/* ============================================================
   ROOT VARIABLES
   ============================================================ */
:root {
    --color-cream: #faf6f0;
    --color-warm-white: #fdfcfa;
    --color-dark: #1e1a16;
    --color-charcoal: #2c241e;
    --color-gold: #c9a87c;
    --color-gold-light: #e8d5b5;
    --color-gold-dark: #a8895e;
    --color-teal: #2d6a6a;
    --color-teal-light: #4a8a8a;
    
    --font-display: 'Playfair Display', serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    
    --shadow-sm: 0 2px 8px rgba(30, 26, 22, 0.06);
    --shadow-md: 0 8px 32px rgba(30, 26, 22, 0.10);
    --shadow-lg: 0 16px 64px rgba(30, 26, 22, 0.14);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background: var(--color-cream);
    color: var(--color-dark);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-gold-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-gold); }

/* ============================================================
   AUTH PAGE
   ============================================================ */
#auth-page {
    display: flex;
    min-height: 100vh;
    background: var(--color-warm-white);
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.auth-container {
    max-width: 460px;
    width: 100%;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px 40px;
}

.auth-brand {
    text-align: center;
    margin-bottom: 32px;
}

.auth-brand .brand-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 4px;
}

.auth-brand h1 {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--color-dark);
    background: linear-gradient(135deg, var(--color-dark), var(--color-teal));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-brand p {
    font-size: 12px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--color-gold-dark);
    opacity: 0.6;
}

.auth-card {
    width: 100%;
}

.auth-toggle {
    display: flex;
    gap: 4px;
    background: #f0ebe5;
    border-radius: 40px;
    padding: 4px;
    margin-bottom: 28px;
}

.toggle-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 16px;
    border-radius: 32px;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 14px;
    color: var(--color-charcoal);
    cursor: pointer;
    transition: var(--transition);
}

.toggle-btn.active {
    background: #fff;
    box-shadow: var(--shadow-sm);
    color: var(--color-dark);
}

.toggle-btn:hover:not(.active) {
    color: var(--color-dark);
}

/* ============================================================
   AUTH FORM SLIDE
   ============================================================ */
.auth-form {
    display: none;
    animation: slideUp 0.4s ease forwards;
}

.auth-form.active {
    display: block;
}

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

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

.register-step {
    display: none;
    animation: slideUp 0.4s ease forwards;
}

.register-step.active {
    display: block;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-charcoal);
    margin-bottom: 4px;
}

.form-group label i {
    color: var(--color-gold-dark);
    margin-right: 6px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e8e0d8;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14px;
    background: #fff;
    transition: var(--transition);
    color: var(--color-dark);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-gold);
    box-shadow: 0 0 0 3px rgba(201, 168, 124, 0.15);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.auth-form h2 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.auth-sub {
    color: #8a7a6a;
    font-size: 14px;
    margin-bottom: 24px;
}

.auth-switch {
    text-align: center;
    font-size: 14px;
    color: #8a7a6a;
    margin-top: 16px;
}

.switch-link {
    color: var(--color-gold-dark);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.switch-link:hover {
    color: var(--color-gold);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 24px;
    background: var(--color-dark);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--color-charcoal);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary.btn-full {
    width: 100%;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: transparent;
    color: var(--color-dark);
    border: 1.5px solid #d4c8bc;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover:not(:disabled) {
    background: #f0ebe5;
    border-color: var(--color-gold-dark);
}

.btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================================
   MESSAGES
   ============================================================ */
.error-message {
    margin-top: 12px;
    padding: 10px 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    color: #b91c1c;
    font-size: 13px;
    display: none;
}

.success-message {
    margin-top: 12px;
    padding: 10px 14px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-sm);
    color: #065f46;
    font-size: 13px;
    display: none;
}

.timer-message {
    font-size: 13px;
    color: #8a7a6a;
    margin-top: 8px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #8a7a6a;
    font-size: 14px;
}

/* ============================================================
   MAIN APP LAYOUT
   ============================================================ */
#main-app {
    display: none;
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR - SLIDE IN
   ============================================================ */
#sidebar {
    width: 240px;
    background: var(--color-dark);
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#sidebar.open {
    transform: translateX(0);
}

/* Mobile hamburger menu */
.hamburger {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 101;
    background: var(--color-dark);
    color: #fff;
    border: none;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 20px;
    transition: var(--transition);
}

.hamburger:hover {
    background: var(--color-charcoal);
}

.hamburger .bi {
    display: block;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.sidebar-overlay.open {
    display: block;
    opacity: 1;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 24px;
}

.sidebar-brand .brand-icon {
    font-size: 28px;
}

.sidebar-brand .brand-name {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #fff, var(--color-gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    text-align: left;
}

.nav-btn i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-btn:hover {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
    color: #fff;
    background: rgba(201, 168, 124, 0.15);
    box-shadow: inset 3px 0 0 var(--color-gold);
}

.nav-btn.logout-btn {
    margin-top: auto;
    color: rgba(255, 255, 255, 0.35);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 20px;
    margin-top: 8px;
}

.nav-btn.logout-btn:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.08);
}

/* ============================================================
   MAIN CONTENT - SLIDE
   ============================================================ */
#main-content {
    margin-left: 0;
    padding: 24px 16px 40px;
    min-height: 100vh;
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#main-content.sidebar-open {
    margin-left: 240px;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 20px;
    border-bottom: 1px solid rgba(30, 26, 22, 0.06);
    margin-bottom: 32px;
}

.topbar-left h2 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--color-dark);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-date {
    font-size: 14px;
    color: #8a7a6a;
}

.topbar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-gold);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    text-transform: uppercase;
}

/* ============================================================
   VIEWS - SLIDE TRANSITIONS
   ============================================================ */
.view {
    display: none;
    position: relative;
}

.view.slide-in {
    display: block;
    animation: slideInRight 0.4s ease forwards;
}

.view.slide-out {
    display: block;
    animation: slideOutLeft 0.3s ease forwards;
}

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

@keyframes slideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-30px);
    }
}

/* For content within views - stagger animation */
.view .view-header,
.view .bento-grid,
.view .menu-grid,
.view .tables-grid,
.view .billing-status,
.view .plans-grid,
.view .profile-card,
.view #profile-form {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

.view .view-header { animation-delay: 0.05s; }
.view .bento-grid { animation-delay: 0.1s; }
.view .menu-grid { animation-delay: 0.1s; }
.view .tables-grid { animation-delay: 0.1s; }
.view .billing-status { animation-delay: 0.1s; }
.view .plans-grid { animation-delay: 0.15s; }
.view .profile-card { animation-delay: 0.1s; }
.view #profile-form { animation-delay: 0.1s; }

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

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.view-header h2 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
}

.view-actions {
    display: flex;
    gap: 10px;
}

/* ============================================================
   BENTO GRID (Dashboard)
   ============================================================ */
.bento-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 20px;
}

.bento-card {
    background: #fff;
    padding: 24px 28px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(30, 26, 22, 0.04);
    transition: var(--transition);
}

.bento-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.bento-card h3 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bento-card h3 i {
    color: var(--color-gold);
}

.bento-card.large {
    grid-row: 1 / 3;
}

.bento-card.large p {
    font-size: 14px;
    margin: 4px 0;
}

.bento-card.small p {
    font-size: 32px;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--color-dark);
}

.bento-card.wide {
    grid-column: 2 / 4;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 10px 18px;
    border: 1px solid rgba(30, 26, 22, 0.08);
    background: var(--color-cream);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-btn:hover {
    background: var(--color-gold-light);
    border-color: var(--color-gold);
}

/* ============================================================
   MENU GRID
   ============================================================ */
.menu-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
}

.menu-col h3 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

#categories-list,
#items-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-item,
.item-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #fff;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(30, 26, 22, 0.04);
    transition: var(--transition);
}

.category-item:hover,
.item-item:hover {
    border-color: var(--color-gold-light);
}

.category-item .cat-name {
    font-weight: 500;
}

.item-item .item-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.item-item .item-price {
    font-weight: 600;
    color: var(--color-gold-dark);
}

.item-item .item-category {
    font-size: 12px;
    color: #8a7a6a;
    background: #f0ebe5;
    padding: 2px 10px;
    border-radius: 20px;
}

.item-actions,
.cat-actions {
    display: flex;
    gap: 4px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #8a7a6a;
}

.btn-icon:hover {
    background: rgba(30, 26, 22, 0.06);
    color: var(--color-dark);
}

.btn-icon.danger:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.empty-state {
    padding: 24px;
    text-align: center;
    color: #8a7a6a;
    font-size: 14px;
    background: #fff;
    border-radius: var(--radius-sm);
    border: 1px dashed #d4c8bc;
}

/* ============================================================
   TABLES
   ============================================================ */
#tables-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.table-card {
    background: #fff;
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(30, 26, 22, 0.04);
    transition: var(--transition);
}

.table-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.table-card.available {
    border-left: 4px solid #059669;
}

.table-card.reserved {
    border-left: 4px solid #d97706;
}

.table-card.occupied {
    border-left: 4px solid #dc2626;
}

.table-number {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
}

.table-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0 12px;
}

.status-badge {
    font-size: 12px;
    font-weight: 500;
    padding: 2px 12px;
    border-radius: 20px;
    text-transform: capitalize;
}

.status-badge.available {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.reserved {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.occupied {
    background: #fee2e2;
    color: #991b1b;
}

.table-seats {
    font-size: 13px;
    color: #8a7a6a;
}

.table-seats i {
    margin-right: 4px;
}

.table-qr {
    margin: 8px 0;
}

.qr-preview {
    max-width: 80px;
    max-height: 80px;
    border-radius: var(--radius-sm);
}

.table-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(30, 26, 22, 0.06);
}

/* ============================================================
   BILLING
   ============================================================ */
#billing-status {
    margin-bottom: 32px;
}

.billing-card {
    background: #fff;
    padding: 28px 32px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(30, 26, 22, 0.04);
}

.billing-card h3 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.billing-plan {
    font-size: 20px;
    font-weight: 600;
    font-family: var(--font-display);
}

.billing-price {
    font-size: 14px;
    color: #8a7a6a;
}

.billing-renewal {
    font-size: 13px;
    color: #8a7a6a;
    margin-top: 4px;
}

#billing-plans {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.plan-card {
    background: #fff;
    padding: 28px 32px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(30, 26, 22, 0.04);
    transition: var(--transition);
    position: relative;
}

.plan-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.plan-card.featured {
    border: 2px solid var(--color-gold);
    background: var(--color-warm-white);
}

.plan-badge {
    position: absolute;
    top: -10px;
    right: 20px;
    background: var(--color-gold);
    color: #fff;
    padding: 2px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.plan-card h3 {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
}

.plan-price {
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--color-dark);
    margin: 4px 0 12px;
}

.plan-price span {
    font-size: 14px;
    font-weight: 400;
    color: #8a7a6a;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 16px 0 24px;
}

.plan-features li {
    padding: 6px 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.plan-features li i {
    color: var(--color-gold);
    font-size: 16px;
}

/* ============================================================
   PROFILE
   ============================================================ */
#profile-form {
    background: #fff;
    padding: 28px 32px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(30, 26, 22, 0.04);
    max-width: 600px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }

    .bento-card.large {
        grid-row: auto;
    }

    .bento-card.wide {
        grid-column: 1 / 3;
    }

    #billing-plans {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    #sidebar {
        width: 280px;
        transform: translateX(-100%);
        padding: 20px 16px;
    }

    #sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
    }

    .sidebar-overlay.open {
        display: block;
    }

    #main-content {
        padding: 16px;
        padding-top: 72px;
        margin-left: 0 !important;
    }

    #main-content.sidebar-open {
        margin-left: 0 !important;
    }

    .sidebar-brand .brand-name,
    .nav-btn span {
        display: inline;
    }

    .bento-grid {
        grid-template-columns: 1fr;
    }

    .bento-card.wide {
        grid-column: auto;
    }

    .menu-grid {
        grid-template-columns: 1fr;
    }

    .view-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .view-actions {
        flex-wrap: wrap;
    }

    #tables-container {
        grid-template-columns: 1fr 1fr;
    }

    .auth-container {
        padding: 32px 24px;
    }
}

@media (max-width: 480px) {
    #tables-container {
        grid-template-columns: 1fr;
    }

    #billing-plans {
        grid-template-columns: 1fr;
    }

    .auth-container {
        padding: 24px 16px;
    }

    .auth-brand h1 {
        font-size: 22px;
    }
}