@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Inter:wght@300;400;500;600&family=Playfair+Display:ital,wght@0,400;0,600;1,400&display=swap');

:root {
    --bg-base: #050505;
    --bg-card: rgba(20, 20, 20, 0.7);
    --primary: #D4AF37; /* Pure Gold */
    --primary-hover: #F3E5AB;
    --accent: #B22222; /* Deep Crimson */
    --text-main: #F5F5F5;
    --text-muted: #A3A3A3;
    --glass-bg: rgba(15, 15, 15, 0.85);
    --glass-border: rgba(212, 175, 55, 0.15); /* Gold tinted border */
    --success: #10b981;
    --warning: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    overflow-x: hidden;
    background-image: radial-gradient(circle at 50% -20%, #1a1a1a, #050505);
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    background: transparent;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 20px;
    background: linear-gradient(180deg, rgba(5,5,5,0.95) 0%, rgba(5,5,5,0) 100%);
    position: sticky;
    top: 0;
    z-index: 50;
}

.logo {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--primary);
    text-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

.cart-pill {
    background: rgba(0,0,0,0.5);
    padding: 8px 18px;
    border-radius: 30px;
    font-weight: 500;
    font-size: 0.95rem;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    color: var(--text-main);
}

.cart-pill i {
    color: var(--primary);
}

.cart-pill.bump {
    transform: scale(1.15);
    background: rgba(212, 175, 55, 0.1);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

#cart-count {
    color: var(--primary);
    font-weight: 700;
}

/* Main Content */
main {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 120px 20px;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 40px;
    animation: fadeInDown 0.8s ease-out forwards;
}

.hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.8rem;
    font-weight: 400;
    margin-bottom: 10px;
    color: #fff;
}

.hero p {
    color: var(--text-muted);
    font-weight: 300;
    font-size: 1.05rem;
    letter-spacing: 1px;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Views */
.view {
    display: none;
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.view.active {
    display: block;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Section titles */
.section-title {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 25px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--glass-border), transparent);
}

/* Product Card */
.product-card {
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 35px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.6);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 45px rgba(0,0,0,0.8), 0 0 20px rgba(212, 175, 55, 0.1);
    border-color: rgba(212, 175, 55, 0.4);
}

.product-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    margin-bottom: -5px; 
    transition: transform 0.8s;
}

.product-card:hover .product-image {
    transform: scale(1.03);
}

.img-overlay {
    position: relative;
    overflow: hidden;
}

.img-overlay::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(0deg, rgba(20,20,20,1) 0%, rgba(20,20,20,0) 100%);
    pointer-events: none;
}

.product-info {
    padding: 25px;
    position: relative;
    z-index: 2;
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 12px;
}

.product-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    font-weight: 600;
    color: #fff;
}

.product-price {
    font-size: 1.4rem;
    font-weight: 300;
    color: var(--primary);
    font-family: 'Inter', sans-serif;
}

.product-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 25px;
    font-weight: 300;
}

.btn-add {
    width: 100%;
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 16px;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    letter-spacing: 1px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    text-transform: uppercase;
}

.btn-add:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

/* Orders Dashboard */
.order-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 20px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.order-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 15px;
}

.order-id {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-main);
}

.order-time {
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 500;
}

.order-items {
    margin-bottom: 25px;
}

.order-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 1rem;
    font-weight: 300;
    color: var(--text-muted);
}

.btn-dispatch {
    width: 100%;
    background: rgba(16, 185, 129, 0.05);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.4);
    padding: 16px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
}

.btn-dispatch:not(:disabled):hover {
    background: var(--success);
    color: white;
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.2);
}

/* Promo Dashboard */
.promo-container {
    text-align: center;
    padding: 50px 30px;
    background: rgba(20,20,20,0.5);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.promo-icon {
    font-size: 3.5rem;
    color: var(--primary);
    margin-bottom: 25px;
    filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.5));
}

.promo-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 15px;
}

.promo-desc {
    color: var(--text-muted);
    margin-bottom: 35px;
    line-height: 1.6;
    font-weight: 300;
}

.btn-whatsapp {
    width: 100%;
    background: rgba(0,0,0,0.8);
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 18px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
}

.btn-whatsapp:hover {
    background: var(--primary);
    color: #000;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 460px;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 25px;
    display: flex;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 10px;
    border: 1px solid rgba(255,255,255,0.05);
    box-shadow: 0 20px 40px rgba(0,0,0,0.9);
    z-index: 100;
}

/* Ocultar scrollbar visual para que luzca limpio */
.bottom-nav::-webkit-scrollbar {
    display: none;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    flex-shrink: 0;
    min-width: 70px;
}

.nav-item i {
    font-size: 1.3rem;
    transition: all 0.3s;
}

.nav-item.active {
    color: var(--primary);
    background: rgba(212, 175, 55, 0.08);
}

.staff-only {
    display: none !important;
}

body.logged-in .staff-only {
    display: flex !important;
}

.super-only {
    display: none !important;
}

body.super-logged-in .super-only {
    display: flex !important;
}

body.logged-in .login-only {
    display: none !important;
}

/* FINANZAS E IMPUTS PROMOCIÓN */
.finances-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.finance-card {
    background: rgba(20,20,20,0.6);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 30px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.finance-card:hover {
    background: rgba(40,40,40,0.8);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(212, 175, 55, 0.1);
    border-color: var(--primary);
}

.finance-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 2px;
    background: var(--primary);
}

.finance-value {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    color: var(--primary);
    margin: 15px 0;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.finance-label {
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 2px;
    color: var(--text-muted);
}

/* Tablas de Detalles Financieros */
.detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.detail-table th, .detail-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.detail-table th {
    color: var(--primary);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.chart-container {
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    background: rgba(0,0,0,0.4);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid var(--glass-border);
}

.promo-textarea {
    width: 100%;
    min-height: 120px;
    background: rgba(0,0,0,0.6);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 15px;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    margin-bottom: 25px;
    resize: vertical;
    transition: all 0.3s;
}

.promo-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
}

/* Floating Pagar Button */
.floating-pay-btn {
    position: fixed;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%) translateY(150px);
    background: var(--primary);
    color: #000;
    padding: 18px 35px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 1.1rem;
    box-shadow: 0 15px 30px rgba(212, 175, 55, 0.3);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 90;
    border: none;
    cursor: pointer;
    display: flex;
    gap: 12px;
    align-items: center;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.floating-pay-btn.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    z-index: 200;
    align-items: flex-end;
}
.modal.active {
    display: flex;
}
.modal-content {
    background: #0f0f0f;
    width: 100%;
    border-radius: 30px 30px 0 0;
    padding: 35px 25px;
    border-top: 1px solid var(--glass-border);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-header h2 {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-size: 1.8rem;
}
.payment-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
    margin-top: 20px;
}
.pay-option {
    padding: 20px;
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 1.1rem;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(25,25,25,0.5);
}
.pay-option.selected {
    border-color: var(--primary);
    background: rgba(212, 175, 55, 0.05);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.1);
}
#btn-confirm-pay {
    width: 100%;
    padding: 18px;
    border-radius: 16px;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-confirm-disabled {
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
}
.btn-confirm-active {
    background: var(--primary);
    color: #000;
}

/* ADMIN PANEL STYLES */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.btn-add-product {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-add-product:hover {
    background: var(--primary-hover);
}

.table-container {
    overflow-x: auto;
    background: rgba(20,20,20,0.5);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-main);
    font-size: 0.9rem;
}

.admin-table th, .admin-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.admin-table th {
    font-family: 'Cinzel', serif;
    color: var(--primary);
    font-weight: 600;
}

.admin-table tr:hover {
    background: rgba(255,255,255,0.02);
}

.admin-input {
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 8px;
    border-radius: 6px;
    width: 100%;
    font-family: 'Inter', sans-serif;
}

.admin-input[type="number"] {
    width: 70px;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    transition: color 0.3s;
}

.btn-icon:hover {
    color: var(--primary);
}

/* ---------- TRACKING TIMELINE & TOAST ---------- */
.tracking-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
}

.tracking-input {
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 15px;
    border-radius: 10px;
    width: 60%;
    font-size: 1.1rem;
    font-family: 'Inter', sans-serif;
}

.timeline {
    display: flex;
    justify-content: space-between;
    position: relative;
    max-width: 400px;
    margin: 0 auto;
    padding: 20px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 35px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: rgba(255,255,255,0.1);
    z-index: 1;
}

.timeline-step {
    position: relative;
    z-index: 2;
    text-align: center;
    width: 30%;
}

.timeline-point {
    width: 30px;
    height: 30px;
    background: var(--bg-card);
    border: 2px solid var(--glass-border);
    border-radius: 50%;
    margin: 0 auto 10px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.4s;
}

.timeline-step.completed .timeline-point,
.timeline-step.active .timeline-point {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.timeline-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.timeline-step.active .timeline-label {
    color: var(--primary);
    font-weight: 600;
}

/* TOAST */
#toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: rgba(37, 211, 102, 0.9); /* WhatsApp green */
    color: white;
    padding: 15px 25px;
    border-radius: 30px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(37, 211, 102, 0.4);
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
}

#toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ---------- RESPONSIVE MEDIA QUERIES ---------- */
/* Tablets and Desktops */
@media (min-width: 768px) {
    #app {
        flex-direction: row; /* Sidebar structure */
    }

    header {
        position: absolute;
        top: 0;
        right: 0;
        width: calc(100% - 250px);
        padding-left: 20px; 
        background: transparent; 
    }

    /* Transform bottom nav intro a lateral Sidebar */
    .bottom-nav {
        order: -1; /* Fuerza la barra a la izquierda */
        position: relative;
        bottom: 0;
        left: 0;
        transform: none;
        width: 250px;
        min-width: 250px;
        height: 100vh;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        border-radius: 0;
        border-right: 1px solid var(--glass-border);
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
        padding: 40px 20px;
        z-index: 150;
    }

    /* Add Logo to sidebar manually via flex hacks or just leave header */
    .bottom-nav::before {
        content: 'KIBO 鮨';
        font-family: 'Cinzel', serif;
        font-size: 1.8rem;
        font-weight: 700;
        color: var(--primary);
        letter-spacing: 2px;
        text-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
        margin-bottom: 40px;
        text-align: center;
        width: 100%;
    }

    header .logo {
        display: none; /* Hide top logo since sidebar has it */
    }

    .nav-item {
        flex-direction: row;
        width: 100%;
        padding: 18px 20px;
        font-size: 1rem;
    }

    .nav-item i {
        font-size: 1.4rem;
        width: 30px;
        text-align: center;
    }

    main {
        flex: 1; /* Ocupa el resto de la pantalla */
        padding: 100px 40px 40px 40px; 
        height: 100vh;
        overflow-y: auto;
    }

    /* CSS Grid para productos */
    #product-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 30px;
    }

    .product-card {
        margin-bottom: 0;
        display: flex;
        flex-direction: column;
    }
    
    .product-info {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
    }

    .btn-add {
        margin-top: auto;
    }

    /* Floating pay button adjustments */
    .floating-pay-btn {
        bottom: 30px;
        left: auto;
        right: 40px;
        transform: translateY(150px);
    }
    .floating-pay-btn.visible {
        transform: translateY(0);
    }

    /* Grid for Dashboards/Admin */
    #orders-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 20px;
    }
}
