/* ==========================================================================
   S.Rest Restaurant Management System - Modern Purple Theme CSS
   Matching Reference Design Aesthetic
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    /* Color Palette derived from reference image */
    --purple-primary: #6C38FF;
    --purple-secondary: #8E44AD;
    --purple-gradient: linear-gradient(135deg, #6C38FF 0%, #9D4EDD 100%);
    --purple-gradient-subtle: linear-gradient(135deg, rgba(108, 56, 255, 0.08) 0%, rgba(157, 78, 221, 0.05) 100%);
    
    --orange-primary: #FF6B4A;
    --orange-gradient: linear-gradient(135deg, #FF6B4A 0%, #FF8E53 100%);
    --orange-light: #FFF0ED;

    --bg-main: #F4F6FC;
    --bg-card: #FFFFFF;
    --text-dark: #1E1B2E;
    --text-muted: #828098;
    --border-color: #E9ECF5;
    
    --status-success: #10B981;
    --status-success-bg: #E6F4EA;
    --status-warning: #F59E0B;
    --status-warning-bg: #FEF3C7;
    --status-danger: #EF4444;
    --status-danger-bg: #FEE2E2;
    --status-info: #3B82F6;
    --status-info-bg: #DBEAFE;
    --status-purple: #8B5CF6;
    --status-purple-bg: #EDE9FE;

    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 8px;
    --shadow-soft: 0 10px 30px rgba(108, 56, 255, 0.05);
    --shadow-hover: 0 15px 35px rgba(108, 56, 255, 0.12);
    --transition-fast: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 13px; /* Reduce from browser default 16px — all rem values scale down */
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.875rem; /* ~13px base */
    background-color: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.5;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100vw;
}

/* SIDEBAR STYLING */
.app-sidebar {
    width: 250px;
    background: #221e2a;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition-fast);
    z-index: 100;
    color: #FFFFFF;
    flex-shrink: 0;
}

.app-sidebar.collapsed {
    width: 80px;
    padding: 30px 12px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 8px;
    margin-bottom: 40px;
}

.sidebar-brand .brand-logo {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #FFF;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-brand .brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 3px;
    border-radius: 10px;
}

.sidebar-brand .brand-name {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #FFFFFF;
    white-space: nowrap;
}

.app-sidebar.collapsed .brand-name,
.app-sidebar.collapsed .nav-text {
    display: none;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    list-style: none;
    flex-grow: 1;
}

.sidebar-nav .nav-item {
    width: 100%;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 18px;
    border-radius: 50px; /* Pill shape like image */
    color: rgba(255, 255, 255, 0.75);
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.sidebar-nav .nav-link i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.12);
}

/* Active Nav Item - Vibrant Orange Gradient Pill */
.sidebar-nav .nav-item.active .nav-link {
    background: var(--orange-gradient);
    color: #FFFFFF;
    box-shadow: 0 8px 20px rgba(255, 107, 74, 0.4);
    font-weight: 700;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* MAIN CONTENT CONTAINER */
.main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    overflow-y: auto;
}

/* TOP NAVBAR */
.top-header {
    height: 75px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    flex-shrink: 0;
}

.header-search {
    position: relative;
    width: 340px;
}

.header-search input {
    width: 100%;
    height: 44px;
    padding: 10px 18px 10px 42px;
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    font-size: 0.9rem;
    color: var(--text-dark);
    outline: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    transition: var(--transition-fast);
}

.header-search input:focus {
    border-color: var(--purple-primary);
    box-shadow: 0 0 0 3px rgba(108, 56, 255, 0.15);
}

.header-search i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    cursor: pointer;
    position: relative;
    transition: var(--transition-fast);
}

.icon-btn:hover {
    background: var(--purple-gradient-subtle);
    color: var(--purple-primary);
    border-color: var(--purple-primary);
}

.icon-btn .badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 9px;
    height: 9px;
    background: var(--orange-primary);
    border-radius: 50%;
    border: 2px solid #FFFFFF;
}

.user-profile-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--purple-gradient);
    color: #FFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(108, 56, 255, 0.25);
}

/* CONTENT BODY WRAPPER (Split with Right Panel) */
.page-body-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    padding: 0 30px 30px 30px;
}

.page-body-grid.full-width {
    grid-template-columns: 1fr;
}

.page-main-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
}

/* RIGHT PROFILE / NOTIFICATIONS SIDEBAR (Derived from image) */
.page-right-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ==========================================================================
   CARD COMPONENTS & STATS WIDGETS
   ========================================================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(233, 236, 245, 0.8);
    transition: var(--transition-fast);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

/* Dashboard Metric Cards Grid */
.stats-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.stat-card .stat-info h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.1;
    margin-bottom: 6px;
}

.stat-card .stat-trend {
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
}

.stat-trend.up {
    color: var(--status-success);
    background: var(--status-success-bg);
}

.stat-trend.down {
    color: var(--orange-primary);
    background: var(--orange-light);
}

.stat-card .stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.purple {
    background: var(--purple-gradient-subtle);
    color: var(--purple-primary);
}

.stat-icon.orange {
    background: var(--orange-light);
    color: var(--orange-primary);
}

.stat-icon.green {
    background: var(--status-success-bg);
    color: var(--status-success);
}

.stat-icon.blue {
    background: var(--status-info-bg);
    color: var(--status-info);
}

/* ==========================================================================
   CHARTS & TABLES
   ========================================================================== */
.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.chart-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.chart-tabs {
    display: flex;
    gap: 6px;
    background: var(--bg-main);
    padding: 4px;
    border-radius: 12px;
}

.chart-tab {
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.chart-tab.active {
    background: #FFFFFF;
    color: var(--purple-primary);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* MODERN TABLES */
.custom-table-container, .table-responsive {
    width: 100%;
    overflow-x: auto;
}

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

.custom-table th, .data-table th {
    padding: 16px 18px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-color);
}

.custom-table td, .data-table td {
    padding: 18px;
    font-size: 0.9rem;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.custom-table tr:last-child td, .data-table tr:last-child td {
    border-bottom: none;
}

.custom-table tr:hover td, .data-table tr:hover td {
    background: rgba(108, 56, 255, 0.03);
}

.table-img {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--bg-main);
}

/* BADGES & STATUS INDICATORS */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: capitalize;
}

.badge-success { background: var(--status-success-bg); color: var(--status-success); }
.badge-warning { background: var(--status-warning-bg); color: var(--status-warning); }
.badge-danger  { background: var(--status-danger-bg);  color: var(--status-danger); }
.badge-info    { background: var(--status-info-bg);    color: var(--status-info); }
.badge-purple  { background: var(--status-purple-bg);  color: var(--status-purple); }

/* ==========================================================================
   BUTTONS & FORM CONTROLS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: var(--purple-gradient);
    color: #FFFFFF;
    box-shadow: 0 6px 18px rgba(108, 56, 255, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(108, 56, 255, 0.35);
}

.btn-accent {
    background: var(--orange-gradient);
    color: #FFFFFF;
    box-shadow: 0 6px 18px rgba(255, 107, 74, 0.25);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(255, 107, 74, 0.35);
}

.btn-secondary {
    background: var(--bg-main);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #EAEFFC;
}

.btn-danger {
    background: var(--status-danger-bg);
    color: var(--status-danger);
}

.btn-danger:hover {
    background: var(--status-danger);
    color: #FFFFFF;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 8px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    height: 44px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-dark);
    outline: none;
    background: #FFFFFF;
    transition: var(--transition-fast);
}

.form-control:focus {
    border-color: var(--purple-primary);
    box-shadow: 0 0 0 3px rgba(108, 56, 255, 0.12);
}

textarea.form-control {
    height: auto;
    min-height: 90px;
}

/* ==========================================================================
   RIGHT SIDEBAR SPECIFIC CARDS (From Reference Image)
   ========================================================================== */
.profile-card-widget {
    background: var(--orange-gradient);
    border-radius: var(--radius-lg);
    padding: 24px;
    color: #FFFFFF;
    text-align: center;
    position: relative;
    box-shadow: 0 10px 25px rgba(255, 107, 74, 0.3);
}

.profile-card-widget .widget-avatar {
    width: 70px;
    height: 70px;
    border-radius: 20px;
    background: #FFFFFF;
    color: var(--orange-primary);
    font-size: 2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px auto;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.profile-card-widget h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.profile-card-widget p {
    font-size: 0.82rem;
    opacity: 0.85;
}

.notification-widget-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--bg-main);
    transition: var(--transition-fast);
}

.notification-item:hover {
    background: #EBF0FF;
}

.notif-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.notif-details h5 {
    font-size: 0.85rem;
    font-weight: 700;
}

.notif-details span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==========================================================================
   POS SCREEN SPECIFIC STYLES
   ========================================================================== */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    height: calc(100vh - 75px);
    gap: 0;
    overflow: hidden;
}

.pos-menu-section {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pos-categories-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 2px 10px 2px;
    flex-shrink: 0;
    scrollbar-width: thin;
}

.pos-categories-tabs::-webkit-scrollbar {
    height: 4px;
}

.pos-categories-tabs::-webkit-scrollbar-thumb {
    background: rgba(108, 56, 255, 0.2);
    border-radius: 4px;
}

.cat-tab-btn {
    padding: 10px 20px;
    height: 42px;
    border-radius: 50px;
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-dark);
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    transition: var(--transition-fast);
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.cat-tab-btn:hover {
    background: var(--bg-main);
    color: var(--purple-primary);
    border-color: var(--purple-primary);
}

.cat-tab-btn.active {
    background: var(--purple-gradient);
    color: #FFFFFF;
    border-color: transparent;
    box-shadow: 0 6px 18px rgba(108, 56, 255, 0.3);
}

.pos-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 18px;
}

.pos-item-card {
    background: #FFFFFF;
    border-radius: var(--radius-md);
    padding: 14px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pos-item-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--purple-primary);
}

.pos-item-thumb {
    width: 100%;
    height: 120px;
    border-radius: 10px;
    object-fit: cover;
    margin-bottom: 10px;
    background: var(--bg-main);
}

.pos-item-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 6px;
    line-height: 1.3;
}

.pos-item-price {
    font-size: 1rem;
    font-weight: 800;
    color: var(--purple-primary);
}

/* POS CART PANEL */
.pos-cart-panel {
    background: #FFFFFF;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    position: relative;
}

.cart-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.cart-order-types {
    display: flex;
    background: var(--bg-main);
    padding: 4px;
    border-radius: 12px;
    margin: 15px 20px 10px 20px;
    flex-shrink: 0;
}

#table-select-group,
#waiter-select-group {
    flex-shrink: 0;
}

.type-btn {
    flex: 1;
    text-align: center;
    padding: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
}

.type-btn.active {
    background: #FFFFFF;
    color: var(--purple-primary);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.cart-items-scroll {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-radius: 12px;
    background: var(--bg-main);
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: none;
    background: #FFFFFF;
    color: var(--text-dark);
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.cart-summary-section {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: #FAFBFD;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    margin-top: auto;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.summary-row.total {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-dark);
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
}

/* ==========================================================================
   FLOOR PLAN TABLES LAYOUT
   ========================================================================== */
.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.table-card {
    background: #FFFFFF;
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 2px solid var(--border-color);
    position: relative;
    transition: var(--transition-fast);
    text-align: center;
}

.table-card.available { border-color: var(--status-success); }
.table-card.occupied  { border-color: var(--purple-primary); background: var(--purple-gradient-subtle); }
.table-card.reserved  { border-color: var(--status-warning); }
.table-card.cleaning  { border-color: var(--status-info); }

.table-num {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 4px;
}

/* ==========================================================================
   MODAL & TOAST NOTIFICATIONS
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(30, 27, 46, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-fast);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: #FFFFFF;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 550px;
    padding: 26px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: var(--transition-fast);
}

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

/* TOAST NOTIFICATION (Top Right) */
#toast-container {
    position: fixed !important;
    top: 20px !important;
    bottom: auto !important;
    right: 24px !important;
    z-index: 99999 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    pointer-events: none !important;
}

.toast {
    pointer-events: auto;
    padding: 14px 20px;
    border-radius: 12px;
    background: var(--text-dark);
    color: #FFFFFF;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    animation: slideInDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInDown {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* MOBILE SIDEBAR BACKDROP OVERLAY */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(30, 27, 46, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-fast);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES (TABLET & MOBILE READY)
   ========================================================================== */

/* RESPONSIVE UTILITY CLASSES (DESKTOP & MOBILE) */
.hide-mobile {
    display: inline;
}
.show-mobile {
    display: none !important;
}
.show-mobile-inline {
    display: none !important;
}
.mobile-sidebar-close {
    display: none;
}
.mobile-bottom-nav {
    display: none;
}
.pos-mobile-nav {
    display: none;
}
.pos-mobile-sticky-cart {
    display: none;
}
.pos-mobile-back-btn {
    display: none;
}

/* 1. LARGE TABLETS & LAPTOPS (<= 1200px) */
@media (max-width: 1200px) {
    .page-body-grid {
        grid-template-columns: 1fr;
    }

    .pos-layout {
        grid-template-columns: 1fr 340px;
    }
}

/* 2. TABLETS & SMALL DESKTOPS (<= 992px) */
@media (max-width: 992px) {
    /* Transform Sidebar into Off-Canvas Slide Drawer */
    .app-sidebar {
        position: fixed;
        top: 0;
        left: -290px;
        width: 275px;
        max-width: 85vw;
        height: 100vh;
        height: 100dvh;
        z-index: 1050;
        box-shadow: 0 0 45px rgba(0, 0, 0, 0.5);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .app-sidebar.mobile-open {
        left: 0;
    }

    .app-sidebar.collapsed {
        width: 275px;
        padding: 24px 18px;
    }

    .app-sidebar.collapsed .brand-name,
    .app-sidebar.collapsed .nav-text {
        display: inline !important;
    }

    /* Mobile Close Drawer Button inside Brand */
    .mobile-sidebar-close {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.18);
        color: #FFFFFF;
        cursor: pointer;
        margin-left: auto;
        transition: var(--transition-fast);
        font-size: 1.1rem;
    }

    .mobile-sidebar-close:hover,
    .mobile-sidebar-close:active {
        background: rgba(255, 107, 74, 0.35);
        color: var(--orange-primary);
    }

    /* Prevent body scroll when mobile sidebar drawer is open */
    body.sidebar-open {
        overflow: hidden !important;
        touch-action: none;
    }

    .main-wrapper {
        width: 100vw;
        max-width: 100vw;
        min-height: 100vh;
        min-height: 100dvh;
        overflow-x: hidden;
    }

    .top-header {
        padding: 0 16px;
        height: 64px;
    }

    .page-body-grid {
        padding: 0 16px 20px 16px;
        gap: 16px;
    }

    /* Dashboard Charts Grid Stack */
    .dashboard-charts-grid,
    div[style*="grid-template-columns: 2fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* POS Mobile Segmented Tab Switcher & Full Screen Panels */
    .pos-mobile-nav {
        display: flex;
        gap: 8px;
        padding: 6px;
        background: var(--bg-card);
        border-radius: var(--radius-md);
        border: 1px solid var(--border-color);
        margin: 0 0 16px 0;
        box-shadow: var(--shadow-soft);
    }

    .pos-mobile-nav-btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 10px 14px;
        border-radius: 10px;
        font-weight: 700;
        font-size: 0.88rem;
        border: none;
        cursor: pointer;
        background: var(--bg-main);
        color: var(--text-muted);
        transition: var(--transition-fast);
    }

    .pos-mobile-nav-btn.active {
        background: var(--purple-gradient);
        color: #FFFFFF;
        box-shadow: 0 4px 14px rgba(108, 56, 255, 0.35);
    }

    .pos-layout {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
        padding-bottom: 90px;
    }

    .pos-menu-section {
        overflow: visible;
        padding: 0 0 20px 0;
    }

    .pos-cart-panel {
        border-left: none;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-soft);
        height: auto;
        max-height: none;
        overflow: visible;
        margin-bottom: 24px;
    }

    .pos-cart-panel .cart-items-scroll {
        max-height: 380px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .pos-menu-section.mobile-hidden {
        display: none !important;
    }

    .pos-cart-panel.mobile-hidden {
        display: none !important;
    }

    .pos-mobile-back-btn {
        display: inline-flex !important;
        align-items: center;
        gap: 6px;
        margin: 12px 20px 0 20px;
    }

    /* Mobile Sticky Bottom Floating Cart Bar */
    .pos-mobile-sticky-cart {
        position: fixed;
        bottom: 72px; /* Just above mobile bottom bar */
        left: 14px;
        right: 14px;
        height: 58px;
        background: linear-gradient(135deg, #1f1b27, #2d233c);
        border: 1.5px solid rgba(108, 56, 255, 0.55);
        border-radius: 50px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 20px rgba(108, 56, 255, 0.3);
        z-index: 994;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 14px 0 18px;
        cursor: pointer;
        animation: slideUpQuickCart 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    }

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

    .sticky-cart-summary {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .sticky-cart-icon-wrap {
        position: relative;
        width: 38px;
        height: 38px;
        border-radius: 50%;
        background: var(--purple-gradient);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1rem;
        flex-shrink: 0;
    }

    .sticky-cart-badge {
        position: absolute;
        top: -4px;
        right: -4px;
        background: var(--orange-primary);
        color: #fff;
        font-size: 0.68rem;
        font-weight: 800;
        padding: 1px 6px;
        border-radius: 10px;
        border: 2px solid #221e2a;
    }

    .sticky-cart-info {
        display: flex;
        flex-direction: column;
    }

    .sticky-cart-total {
        font-weight: 800;
        font-size: 1.05rem;
        color: #FFFFFF;
        line-height: 1.2;
    }

    .sticky-cart-label {
        font-size: 0.72rem;
        color: rgba(255, 255, 255, 0.65);
    }

    .sticky-cart-action-btn {
        background: var(--purple-gradient);
        color: #FFFFFF;
        border-radius: 50px;
        padding: 9px 18px;
        font-size: 0.85rem;
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: 6px;
        box-shadow: 0 4px 12px rgba(108, 56, 255, 0.45);
        border: none;
    }

    .stats-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

/* 3. MOBILE PHONES (<= 768px) */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    .show-mobile {
        display: block !important;
    }
    .show-mobile-inline {
        display: inline !important;
    }

    /* Prevent iOS Safari unwanted auto-zoom when tapping inputs */
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="tel"],
    input[type="date"],
    input[type="search"],
    select.form-control,
    textarea.form-control,
    .form-control {
        font-size: 16px !important;
    }

    /* Top Header Mobile Layout */
    .top-header {
        padding: 0 12px;
        height: 58px;
    }

    .header-search {
        display: none !important;
    }

    .user-profile-widget div:nth-child(2) {
        display: none !important;
    }

    .header-actions {
        gap: 8px;
    }

    .header-actions .btn-accent {
        padding: 6px 12px;
        font-size: 0.8rem;
        border-radius: 10px;
    }

    .page-body-grid {
        padding: 0 10px 18px 10px;
        gap: 12px;
    }

    .page-main-content {
        padding-bottom: 78px !important;
        gap: 16px;
    }

    .card {
        padding: 16px 14px;
        border-radius: var(--radius-md);
    }

    /* Mobile Bottom Navigation Bar */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: #221e2a;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.35);
        z-index: 995;
        justify-content: space-around;
        align-items: center;
        padding: 0 4px;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        color: rgba(255, 255, 255, 0.62);
        text-decoration: none;
        font-size: 0.68rem;
        font-weight: 600;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 6px 6px;
        border-radius: 10px;
        transition: var(--transition-fast);
        flex: 1;
        text-align: center;
    }

    .mobile-nav-item i {
        font-size: 1.15rem;
    }

    .mobile-nav-item.active {
        color: var(--orange-primary);
        font-weight: 700;
    }

    .mobile-nav-item.active i {
        transform: scale(1.1);
    }

    /* Stats Grid on Mobile Phones */
    .stats-cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .stat-card {
        padding: 12px 10px;
        border-radius: var(--radius-md);
    }

    .stat-card .stat-info h4 {
        font-size: 0.72rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .stat-card .stat-value {
        font-size: 1.22rem;
        margin: 2px 0;
    }

    .stat-card .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 1.05rem;
        border-radius: 12px;
    }

    /* Horizontal Touch Scroll for Subnav Tabs & View Toggles */
    .subnav-tabs-container,
    .order-view-tabs,
    div[style*="width: fit-content"] {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap !important;
        scrollbar-width: none;
        padding: 6px 8px !important;
    }

    .subnav-tabs-container::-webkit-scrollbar,
    div[style*="width: fit-content"]::-webkit-scrollbar {
        display: none;
    }

    .subnav-tab-item,
    .order-view-tabs > a > div,
    div[style*="width: fit-content"] > a > div {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        font-size: 0.82rem !important;
        padding: 8px 14px !important;
    }

    /* Inline Grid Collapses for Forms & Modals */
    [style*="grid-template-columns: 2fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr 1fr"],
    [style*="grid-template-columns:repeat(auto-fit, minmax(420px, 1fr))"],
    [style*="grid-template-columns: repeat(auto-fit, minmax(420px, 1fr))"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    [style*="grid-column: span 2"] {
        grid-column: span 1 !important;
    }

    /* Form Fields & Search Row Stacking */
    form[method="GET"] > div {
        min-width: 0 !important;
    }

    /* Responsive Tables */
    .custom-table-container, .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--radius-sm);
    }

    .custom-table th, .custom-table td,
    .data-table th, .data-table td {
        padding: 10px 12px;
        font-size: 0.82rem;
        white-space: nowrap;
    }

    .custom-table td strong, .data-table td strong {
        white-space: normal;
    }

    /* Modals on Mobile Phones */
    .modal-box {
        width: 95% !important;
        max-width: 95% !important;
        padding: 18px 14px !important;
        border-radius: var(--radius-md) !important;
        max-height: 90vh !important;
        max-height: 90dvh !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-box h3 {
        font-size: 1.05rem;
    }

    /* Floor Plan Grid */
    .tables-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }

    .table-card {
        padding: 12px 10px;
    }

    .table-num {
        font-size: 1.05rem;
    }

    /* POS Item Grid on Mobile */
    .pos-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }

    .pos-item-card {
        padding: 10px 8px;
    }

    .pos-item-title {
        font-size: 0.82rem;
    }

    .pos-item-price {
        font-size: 0.88rem;
    }
}

/* 4. EXTRA SMALL PHONES (<= 480px) */
@media (max-width: 480px) {
    .stats-cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .stat-card {
        padding: 10px 8px !important;
    }

    .stat-card .stat-info h4 {
        font-size: 0.68rem !important;
    }

    .stat-card .stat-value {
        font-size: 1.15rem !important;
    }

    .stat-card .stat-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.95rem !important;
        border-radius: 8px;
    }

    .pos-items-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .pos-item-card {
        padding: 8px !important;
    }

    .pos-item-card > div:first-child {
        height: 75px !important;
    }

    .pos-item-title {
        font-size: 0.76rem !important;
    }

    .pos-item-price {
        font-size: 0.82rem !important;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.82rem;
        border-radius: 10px;
    }

    .btn-sm {
        padding: 5px 8px;
        font-size: 0.75rem;
    }

    #toast-container {
        top: 10px;
        bottom: auto;
        right: 10px;
        left: 10px;
    }

    .toast {
        font-size: 0.8rem;
        padding: 10px 14px;
    }

    .top-header {
        padding: 0 10px;
        height: 56px;
    }
}

/* PRINT STYLES FOR THERMAL RECEIPT */
@media print {
    body * {
        visibility: hidden;
    }
    #printable-receipt, #printable-receipt * {
        visibility: visible;
    }
    #printable-receipt {
        position: absolute;
        left: 0;
        top: 0;
    }
}

/* EXPENSE MODULE NAVIGATION TABS */
.subnav-tabs-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    margin-bottom: 24px;
    flex-wrap: wrap;
    border: 1px solid var(--border-color);
}

.subnav-tab-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    text-decoration: none;
    cursor: pointer;
}

.subnav-tab-item:hover {
    color: var(--purple-primary);
    background: var(--purple-gradient-subtle);
}

.subnav-tab-item.active {
    background: var(--purple-gradient);
    color: #FFFFFF !important;
    box-shadow: 0 4px 14px rgba(108, 56, 255, 0.3);
}

.expense-stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 16px;
}

.expense-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

/* SIDEBAR COLLAPSIBLE SUBMENU (MODERN SLEEK DESIGN) */
.sidebar-nav .nav-item.has-submenu {
    position: relative;
    transition: all 0.3s ease;
}

.sidebar-nav .submenu-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.sidebar-nav .submenu-toggle .submenu-arrow {
    margin-left: auto;
    font-size: 0.72rem;
    padding: 6px 8px;
    border-radius: 8px;
    opacity: 0.85;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s ease, opacity 0.2s ease;
}

.sidebar-nav .submenu-toggle:hover .submenu-arrow {
    opacity: 1;
}

.sidebar-nav .submenu-toggle .submenu-arrow:hover {
    background: rgba(255, 255, 255, 0.18);
}

.sidebar-nav .nav-item.has-submenu.open .submenu-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

.sidebar-submenu {
    list-style: none !important;
    list-style-type: none !important;
    margin: 8px 4px 8px 16px !important;
    padding: 8px 6px 8px 12px !important;
    display: none;
    flex-direction: column;
    gap: 4px;
    border-left: 2px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.22);
    border-radius: 0 16px 16px 0;
    backdrop-filter: blur(10px);
    animation: submenuFadeSlide 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.sidebar-nav .nav-item.has-submenu.open .sidebar-submenu {
    display: flex;
}

.sidebar-submenu .submenu-item {
    list-style: none !important;
    list-style-type: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
}

.sidebar-submenu .submenu-item .submenu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.86rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.sidebar-submenu .submenu-item .submenu-link i {
    width: 18px;
    font-size: 0.92rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.55);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-submenu .submenu-item .submenu-link .nav-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Submenu Hover */
.sidebar-submenu .submenu-item .submenu-link:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.09);
    transform: translateX(3px);
}

.sidebar-submenu .submenu-item .submenu-link:hover i {
    color: #FF8F6B;
    transform: scale(1.1);
}

/* Submenu Active Item */
.sidebar-submenu .submenu-item.active .submenu-link {
    color: #FFFFFF;
    background: linear-gradient(135deg, rgba(255, 107, 74, 0.28) 0%, rgba(255, 87, 51, 0.15) 100%);
    border: 1px solid rgba(255, 107, 74, 0.4);
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(255, 107, 74, 0.18);
}

.sidebar-submenu .submenu-item.active .submenu-link i {
    color: #FF6B4A;
    font-weight: 700;
}

.sidebar-submenu .submenu-item.active .submenu-link::before {
    content: '';
    position: absolute;
    left: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 18px;
    background: #FF6B4A;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255, 107, 74, 0.9);
}

.app-sidebar.collapsed .sidebar-submenu,
.app-sidebar.collapsed .submenu-arrow {
    display: none !important;
}



