:root {
    /* Brand Theme Colors */
    --primary-brown: #2C1810;
    --accent-gold: #D4AF37;
    --accent-green: #1E4327;
    --cream-bg: #FDFBF7;
    --cream-light: #F7F3EB;
    --text-dark: #1A1A1A;
    --text-muted: #666666;
    --border-color: #E5DFD5;
    --bg-card: #FFFFFF;
    --sidebar-width: 250px;
    
    /* Shadows & Transitions */
    --shadow-sm: 0 2px 8px rgba(44, 24, 16, 0.05);
    --shadow-md: 0 4px 16px rgba(44, 24, 16, 0.08);
    --shadow-lg: 0 8px 24px rgba(44, 24, 16, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Store Theme 1: Kaappi 2.0 (Modern Green & Gold) */
body.theme-kaappi2 {
    --primary-brown: #1E4327;
    --accent-gold: #D4AF37;
    --accent-green: #27AE60;
    --cream-bg: #F4F8F5;
    --cream-light: #EAF2EC;
}

/* Store Theme 2: Skanda Kaappi (Classic Deep Brown & Gold) */
body.theme-skanda {
    --primary-brown: #2C1810;
    --accent-gold: #C5A059;
    --accent-green: #1E4327;
    --cream-bg: #FDFBF7;
    --cream-light: #F7F3EB;
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--cream-bg);
    color: var(--text-dark);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Mobile & Tablet Pill 'Menu' Button - STRICTLY HIDDEN ON DESKTOP */
.mobile-hamburger {
    display: none !important;
    background: #EAF2EC;
    color: #1E4327;
    border: 1.5px solid #1E4327;
    padding: 5px 14px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    align-items: center;
    justify-content: center;
    gap: 6px;
    outline: none;
    box-shadow: 0 2px 8px rgba(30, 67, 39, 0.12);
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.mobile-hamburger i {
    font-size: 0.9rem;
}

.mobile-hamburger:hover, .mobile-hamburger:active {
    background: #1E4327;
    color: #FFFFFF;
    border-color: #1E4327;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 67, 39, 0.2);
}

/* Mobile Drawer Close Button - Hidden on Desktop */
.mobile-drawer-close-btn {
    display: none !important;
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: none;
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.mobile-drawer-close-btn:hover {
    background: #C0392B;
    color: white;
}

/* Sidebar Mobile Overlay Backdrop */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block !important;
    opacity: 1 !important;
}

/* Sidebar Styling - DESKTOP DEFAULT */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary-brown);
    color: #FFFFFF;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.sidebar-header {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    max-width: 90px;
    height: auto;
    margin-bottom: 10px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.brand-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent-gold);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.brand-tagline {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 2px;
    text-transform: capitalize;
}

.brand-location {
    font-size: 0.7rem;
    color: var(--accent-gold);
    margin-top: 4px;
    opacity: 0.9;
}

.sidebar-menu {
    list-style: none;
    padding: 16px 12px;
}

.sidebar-menu li {
    margin-bottom: 4px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: rgba(212, 175, 55, 0.15);
    color: var(--accent-gold);
    transform: translateX(4px);
}

.sidebar-menu a i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Badge count for Credit dues */
.badge-credit {
    background-color: #C0392B;
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
    font-weight: 700;
}

/* Main Content Area - DESKTOP DEFAULT */
.main-content {
    margin-left: 250px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100vw - 250px);
    max-width: calc(100vw - 250px);
    overflow-x: hidden;
    transition: var(--transition);
}

/* Professional Sticky Navbar Header */
.navbar {
    background-color: var(--bg-card);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 90;
    gap: 16px;
}

.nav-title {
    flex: 1;
    min-width: 0;
}

.nav-title h2 {
    font-size: 1.3rem;
    color: var(--primary-brown);
}

.nav-title p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

/* Content Body */
.content-body {
    padding: 18px;
    flex: 1;
}

/* Cards & Containers */
.card-metric {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.metric-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.metric-info h3 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-brown);
    font-family: 'Outfit', sans-serif;
    margin: 4px 0;
}

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.icon-sales { background: #EAFAF1; color: #27AE60; }
.icon-profit { background: #FEF9E7; color: #F39C12; }
.icon-cost { background: #FDEDEC; color: #E74C3C; }

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.card-chart {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: 1.05rem;
    color: var(--primary-brown);
    font-weight: 700;
}

/* POS Full-Screen High Efficiency View - 100% Scrollable Receipt Container */
.pos-grid-container {
    display: flex;
    gap: 16px;
    width: 100%;
    height: calc(100vh - 110px);
    overflow: hidden;
}

.pos-menu-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.pos-items-scrollable {
    flex: 1;
    overflow-y: auto;
    padding-right: 6px;
}

.pos-cart-panel {
    width: 360px;
    min-width: 360px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: var(--shadow-md);
    overflow-y: auto !important;
}

.pos-cart-items-box {
    flex: 1;
    min-height: 100px;
    max-height: 160px;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #ffffff;
    margin-bottom: 8px;
    width: 100%;
}

/* Clean Custom Scrollbar */
.pos-cart-items-box::-webkit-scrollbar,
.pos-cart-panel::-webkit-scrollbar {
    width: 4px;
    height: 0px;
}

.pos-cart-items-box::-webkit-scrollbar-thumb,
.pos-cart-panel::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.category-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 12px;
    -webkit-overflow-scrolling: touch;
}

.btn-cat {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--primary-brown);
    padding: 8px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-cat:hover, .btn-cat.active {
    background: var(--primary-brown);
    color: var(--accent-gold);
    border-color: var(--primary-brown);
}

.btn-primary {
    background: var(--primary-brown);
    color: var(--accent-gold);
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
}

.btn-primary:hover {
    background: var(--accent-green);
    color: #FFFFFF;
}

/* POS Menu Cards Grid */
.menu-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.menu-card:hover, .menu-card:active {
    border-color: var(--accent-gold);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.form-control {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    transition: var(--transition);
    min-height: 36px;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(30, 67, 39, 0.1);
}

/* Custom Table */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    background: var(--cream-light);
    color: var(--primary-brown);
    font-weight: 700;
    padding: 10px 12px;
    font-size: 0.82rem;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-color);
}

.custom-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    vertical-align: middle;
}

.custom-table tr:hover {
    background-color: var(--cream-light);
}

/* Badges & Buttons */
.badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-success { background: #EAFAF1; color: #27AE60; }
.badge-warning { background: #FEF9E7; color: #D35400; }
.badge-danger { background: #FDEDEC; color: #C0392B; }
.badge-info { background: #EBF5FB; color: #2980B9; }

/* Floating Voice Chat Z-Index Adjustment */
#floating-chat-btn {
    z-index: 80 !important;
}

#floating-chat-window {
    z-index: 95 !important;
}

/* Modals */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 24px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

/* ========================================================================== */
/* COMPREHENSIVE RESPONSIVE MEDIA QUERIES (TABLETS & MOBILE PHONES)            */
/* ========================================================================== */

@media screen and (max-width: 1024px) {
    .mobile-hamburger {
        display: inline-flex !important;
    }

    .mobile-drawer-close-btn {
        display: inline-flex !important;
    }

    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 270px !important;
        height: 100vh !important;
        z-index: 999 !important;
        box-shadow: 6px 0 24px rgba(0,0,0,0.3) !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    .sidebar.active {
        transform: translateX(0) !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .navbar {
        padding: 10px 14px;
    }

    .pos-grid-container {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .pos-menu-panel {
        height: auto;
        overflow: visible;
    }

    .pos-items-scrollable {
        max-height: 450px;
        overflow-y: auto;
    }

    .pos-cart-panel {
        width: 100%;
        min-width: 100%;
        height: auto;
        max-height: none;
        overflow: visible;
        margin-top: 14px;
    }

    .pos-cart-items-box {
        max-height: 240px;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .content-body {
        padding: 12px;
    }

    .navbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .nav-title {
        width: 100%;
    }

    .nav-user {
        gap: 8px;
        flex-wrap: wrap;
        width: 100%;
        justify-content: space-between;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}
