:root {
    --sidebar-bg: #111827; /* Near black */
    --sidebar-hover: #1f2937;
    --sidebar-text: #9ca3af;
    --sidebar-text-active: #ffffff;
    
    --brand-orange: #f97316;
    --brand-orange-hover: #ea580c;
    
    --main-bg: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--main-bg);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
}

/* LOGIN SCREEN */
.login-page {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--main-bg);
}
.login-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.login-logo {
    color: var(--brand-orange);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
}
.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 30px;
}
.login-form .form-group {
    text-align: left;
    margin-bottom: 20px;
}
.login-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}
.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
}
.login-form input:focus {
    outline: none;
    border-color: var(--brand-orange);
}
.login-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    font-size: 0.9rem;
}
.btn-primary {
    width: 100%;
    background-color: var(--brand-orange);
    color: white;
    border: none;
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
    background-color: var(--brand-orange-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.flash-message {
    color: #ef4444;
    background: #fef2f2;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* LAYOUT: SIDEBAR */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
}
.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sidebar-header h2 {
    color: white;
    font-size: 1.1rem;
    letter-spacing: 1px;
}
.sidebar-header .dot {
    width: 10px;
    height: 10px;
    background: var(--brand-orange);
    border-radius: 50%;
}
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}
.nav-section {
    margin-bottom: 24px;
}
.nav-section-title {
    padding: 0 24px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    font-weight: 600;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.95rem;
    transition: var(--transition);
}
.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}
.nav-link:hover {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}
.nav-link.active {
    background-color: rgba(249, 115, 22, 0.1);
    color: var(--brand-orange);
    border-right: 3px solid var(--brand-orange);
}

/* LAYOUT: MAIN AREA */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* allows children to truncate text */
}
.topbar {
    height: 70px;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-left {
    font-weight: 600;
    font-size: 1.2rem;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}
.notification-bell {
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-secondary);
}
.profile-menu {
    position: relative;
}
.profile-circle {
    width: 36px;
    height: 36px;
    background-color: var(--brand-orange);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
}
.dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 50px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    width: 200px;
    overflow: hidden;
}
.dropdown.active {
    display: block;
}
.dropdown-item {
    display: block;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}
.dropdown-item:hover {
    background-color: var(--main-bg);
}

/* PAGE CONTENT */
.content-wrapper {
    padding: 30px;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}
.stat-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.stat-card::after {
    content: '';
    position: absolute;
    right: -20px;
    bottom: -20px;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, rgba(249,115,22,0.1) 0%, rgba(255,255,255,0) 100%);
    border-radius: 50%;
}
.stat-title {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 12px;
}
.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* KANBAN BOARD */
.filters-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    background: var(--card-bg);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.filters-left, .filters-right {
    display: flex;
    gap: 12px;
    align-items: center;
}
.filters-bar select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
}
.btn-clear {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
}
.sound-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}

.kanban-board {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 20px;
    height: calc(100vh - 220px);
}
.kanban-column {
    flex: 1;
    min-width: 280px;
    background: #f8fafc;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}
.column-header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
    font-weight: 600;
}
.new-header { border-top: 4px solid #3b82f6; }
.preparing-header { border-top: 4px solid #f59e0b; }
.served-header { border-top: 4px solid #10b981; }
.completed-header { border-top: 4px solid #6b7280; }

.count-badge {
    background: rgba(0,0,0,0.1);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}
.column-body {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ORDER CARD */
.order-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    cursor: grab;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.order-card.dragging {
    opacity: 0.5;
}
.order-card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-weight: 600;
}
.order-id { color: var(--brand-orange); }
.order-time { color: var(--text-secondary); font-size: 0.85rem; font-weight: normal; }
.order-table { font-weight: 600; margin-bottom: 8px; }
.order-items-summary {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    background: var(--bg-color);
    padding: 8px;
    border-radius: 6px;
}
.order-actions {
    display: flex;
    justify-content: flex-end;
}
.btn-status {
    background: white;
    border: 1px solid var(--brand-orange);
    color: var(--brand-orange);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}
.btn-status:hover {
    background: var(--brand-orange);
    color: white;
}

/* ==========================================================================
   Modals (Settle, Discount, Split)
   ========================================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6); /* Dark navy semi-transparent */
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex !important;
    opacity: 1;
}

.modal-content {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 90vh;
    overflow-y: auto;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-content h3 {
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: 700;
}

/* Modal Scrollbar Styling */
.modal-content::-webkit-scrollbar {
    width: 8px;
}
.modal-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}
.modal-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.modal-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Close button hover */
.modal-content span[onclick^="closeModal"] {
    color: #64748b;
    transition: color 0.2s;
}
.modal-content span[onclick^="closeModal"]:hover {
    color: #ef4444;
}


/* Global Form Group Styling for Modals */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: var(--bg-color);
    box-sizing: border-box;
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--brand-orange);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
    background-color: #fff;
}
.form-group input[type="radio"] {
    accent-color: var(--brand-orange);
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin-right: 5px;
    cursor: pointer;
}
.form-group label:has(input[type="radio"]) {
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

/* ==========================================================================
   Mobile Responsive Styles (Phase 26)
   ========================================================================== */
@media (max-width: 768px) {
    /* Sidebar as Drawer */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 2px 0 10px rgba(0,0,0,0.5);
    }
    .mobile-menu-btn {
        display: block !important;
    }
    .topbar {
        padding: 0 15px;
    }
    
    /* Content wrapper */
    .content-wrapper {
        padding: 15px;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    /* Kanban Board */
    .kanban-board {
        gap: 15px;
    }
    .kanban-column {
        min-width: 85vw; /* peek-hint effect */
        scroll-snap-align: start;
    }
    /* Optional: enable snap scrolling on kanban-board */
    .kanban-board {
        scroll-snap-type: x mandatory;
        padding-right: 15vw;
    }
    
    /* Live Tables */
    .tables-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .table-stats {
        flex-wrap: wrap;
    }
    .table-stat {
        flex: 1 1 45%;
    }
    .table-search input {
        width: 100%;
    }
    .tables-top {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    /* Order Taking (Parcel Layout) Mobile */
    .parcel-layout {
        display: flex !important;
        flex-direction: column;
        gap: 15px;
        padding-bottom: 80px; /* space for toggle */
    }
    .col-cart {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: auto;
        max-height: 85vh;
        z-index: 2000;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -5px 25px rgba(0,0,0,0.3);
        padding: 20px;
        background: var(--main-bg);
    }
    .col-cart.active {
        transform: translateY(0);
    }
    .mobile-cart-toggle {
        display: flex !important;
    }
    .menu-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Touch friendly sizes */
    .stepper button {
        padding: 12px !important;
    }
    .menu-item-card {
        padding: 20px !important;
    }
}

/* Category Tabs for Mobile Order Taking */
.category-tabs-wrapper {
    display: none;
}
@media (max-width: 768px) {
    .category-tabs-wrapper {
        display: flex;
        overflow-x: auto;
        gap: 10px;
        margin-bottom: 20px;
        padding-bottom: 5px;
        white-space: nowrap;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    .category-tabs-wrapper::-webkit-scrollbar {
        display: none;
    }
    .category-tab-btn {
        background: white;
        border: 1px solid var(--border-color);
        padding: 10px 20px;
        border-radius: 20px;
        cursor: pointer;
        font-weight: 500;
        font-size: 0.95rem;
    }
    .category-tab-btn.active {
        background: var(--brand-orange);
        color: white;
        border-color: var(--brand-orange);
    }
    .category-section {
        display: none; /* Hide all by default on mobile, JS will toggle */
    }
    .category-section.active {
        display: block; /* Show only active */
    }
    .category-title {
        display: none; /* Hide category titles on mobile, tabs take over */
    }
}

.mobile-cart-toggle {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    padding: 15px 20px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1500;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
}
.cart-toggle-btn {
    background: var(--brand-orange);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
}

