/* === THEME 2026: DARK MODE DEFAULT === */
:root {
    /* Base Dark Mode - High Contrast Text, Deep Backgrounds */
    --bg-primary: #020617;
    /* Darker than before */
    --bg-secondary: #0f172a;
    --bg-card: #1e293b;
    --bg-surface: #334155;

    /* Text - Increased Brightness */
    --text-primary: #ffffff;
    /* Pure White */
    --text-secondary: #e2e8f0;
    /* Lighter Grey */

    /* Accents - Retain Vibrancy */
    --accent-primary: #38bdf8;
    /* Sky Blue - Softer */
    --accent-success: #4ade80;
    --accent-warning: #facc15;
    --accent-danger: #f87171;

    --border-color: #334155;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    /* Stronger shadows for dark mode */
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
    --glass-bg: rgba(15, 23, 42, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
}

/* Light Mode - Softer, less harsh */
[data-theme="light"] {
    --bg-primary: #f1f5f9;
    /* Slate 100 - Not pure white */
    --bg-secondary: #e2e8f0;
    --bg-card: #ffffff;
    --bg-surface: #f8fafc;

    /* Text - Strong Dark for readability */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    /* Slate 600 */

    /* Accents - Slightly darker for contrast on light */
    --accent-primary: #0284c7;
    /* Sky 600 */
    --accent-success: #059669;
    --accent-warning: #d97706;
    --accent-danger: #dc2626;

    --border-color: #cbd5e1;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
    /* Softer shadows */
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.05);
}

/* Modern Green 2026 - Fresh, Eco, Clean */
[data-theme="modern-green"] {
    --bg-primary: #f0fdf4;
    /* Green 50 */
    --bg-secondary: #dcfce7;
    /* Green 100 */
    --bg-card: #ffffff;
    --bg-surface: #ecfdf5;
    /* Emerald 50 */

    --text-primary: #064e3b;
    /* Emerald 900 */
    --text-secondary: #065f46;
    /* Emerald 800 */

    --accent-primary: #059669;
    /* Emerald 600 */
    --accent-success: #16a34a;
    /* Green 600 */
    --accent-warning: #d97706;
    --accent-danger: #dc2626;

    --border-color: #bbf7d0;
    /* Green 200 */
    --shadow-sm: 0 1px 2px rgba(22, 163, 74, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(22, 163, 74, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(22, 163, 74, 0.15);
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(22, 163, 74, 0.2);
}

/* === BASE STYLES === */
body {
    font-family: 'Inter', 'Kanit', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    line-height: 1.5;
    letter-spacing: -0.01em;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

.text-numbers {
    font-family: 'Inter', 'Kanit', monospace;
    font-weight: 600;
    letter-spacing: -0.025em;
}

/* === NAVBAR === */
.navbar {
    background-color: var(--bg-secondary);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1050;
}

.navbar .dropdown-menu {
    z-index: 1060;
}

.navbar-brand {
    font-weight: 600;
    color: var(--text-primary);
}

/* === CARDS === */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-primary) !important;
    /* Force text color */
}

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

.card-header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 1.5rem;
    color: var(--text-primary) !important;
    /* Force text color */
}


/* === FORMS === */
.form-control,
.form-select {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bg-surface);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
    color: var(--text-primary);
}

.form-label {
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

/* === OVERRIDES FOR BOOTSTRAP UTILITIES === */
.text-secondary,
.text-muted {
    color: var(--text-secondary) !important;
}

.text-primary {
    color: var(--accent-primary) !important;
}

.bg-light {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}

.bg-white {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

/* === BUTTONS === */
.btn {
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    border: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.btn:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }

    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-primary);
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-success {
    background-color: var(--accent-success);
    color: white;
}

.btn-danger {
    background-color: var(--accent-danger);
    color: white;
}

.btn-outline-primary {
    background-color: transparent;
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
}

.btn-outline-primary:hover {
    background-color: var(--accent-primary);
    color: white;
}

/* === TABLES === */
.table {
    color: var(--text-primary);
    border-color: var(--border-color);
}

.table thead th {
    background-color: var(--bg-surface);
    border-color: var(--border-color);
    font-weight: 600;
    color: var(--text-secondary);
    padding: 1rem;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-color: var(--border-color);
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: var(--bg-surface);
}

/* === STATUS BADGES === */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.status-success {
    background-color: rgba(74, 222, 128, 0.15);
    color: var(--accent-success);
}

.status-danger {
    background-color: rgba(248, 113, 113, 0.15);
    color: var(--accent-danger);
}

.status-warning {
    background-color: rgba(251, 191, 36, 0.15);
    color: var(--accent-warning);
}

.status-info {
    background-color: rgba(34, 211, 238, 0.15);
    color: var(--accent-primary);
}

/* === STATS CARDS === */
.stat-card {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-surface));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

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

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0.5rem 0;
    font-family: 'Inter', 'Kanit', monospace;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* === IMPROVED PRODUCT GRID === */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem 1rem 1rem 1rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: none !important;
}

.product-card:hover {
    transform: translateY(-6px);
    border-color: var(--accent-primary);
    background: linear-gradient(145deg, var(--bg-card), var(--bg-surface));
}

.product-card.selected {
    border: 2px solid var(--accent-primary);
    background: linear-gradient(145deg, var(--bg-surface), var(--bg-card));
}

.product-image {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f0f4f8, #d9e2ec);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    transition: transform 0.3s ease;
}

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

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(1.02) contrast(1.05);
}

.product-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0.25rem 0 0.5rem 0;
    font-family: 'Inter', 'Kanit', monospace;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.product-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
    height: 2.8em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-stock {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    width: fit-content;
}

.product-stock.normal {
    background-color: rgba(74, 222, 128, 0.15);
    color: var(--accent-success);
}

.product-stock.low {
    background-color: rgba(251, 191, 36, 0.15);
    color: var(--accent-warning);
}

.product-stock.out {
    background-color: rgba(248, 113, 113, 0.15);
    color: var(--accent-danger);
}

.product-category {
    position: absolute;
    top: 12px;
    left: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    background-color: var(--bg-surface);
    color: var(--text-secondary);
    z-index: 2;
}

.product-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 2;
}

.product-card:hover .product-actions {
    opacity: 1;
}

.product-actions button {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.product-actions button:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.product-code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: var(--bg-surface);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-top: 0.25rem;
}

/* === CART ITEMS === */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.cart-item:hover {
    background-color: var(--bg-surface);
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.cart-item-price {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background: var(--border-color);
}

.qty-input {
    width: 40px;
    text-align: center;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-weight: 600;
}

/* === ANIMATIONS === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-pulse-slow {
    animation: pulse 2s infinite;
}

/* === UTILITY CLASSES === */
.rounded-xl {
    border-radius: 12px;
}

.hover-lift {
    transition: transform 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
}

/* === FOOTER === */
footer {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 1.5rem 0;
    margin-top: auto;
    text-align: center;
    font-size: 0.875rem;
}

/* === SWEETALERT2 CUSTOMIZATION === */
.swal2-popup {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
}

.swal2-input,
.swal2-textarea,
.swal2-select {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }

    .product-image {
        width: 100px;
        height: 100px;
    }

    .product-price {
        font-size: 1.3rem;
    }

    .product-name {
        font-size: 0.8rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .card-body {
        padding: 1rem;
    }

    .table-responsive {
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1025px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
}

/* === RECEIPT STYLES === */
@media print {
    body * {
        visibility: hidden;
    }

    .receipt-container,
    .receipt-container * {
        visibility: visible;
    }

    .receipt-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}

/* === DROPDOWN THEME FIX === */
.dropdown-menu {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.dropdown-item {
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

.dropdown-divider {
    border-top-color: var(--border-color);
}

/* ====================================== */
/* === MOBILE SHOPEE-STYLE UI (<992px) === */
/* ====================================== */

/* --- Bottom Navigation Bar --- */
.mobile-bottom-nav {
    display: none;
}

.mobile-cart-fab {
    display: none !important;
}

.mobile-cart-overlay {
    display: none;
}

@media (max-width: 991px) {

    /* --- Body padding for bottom nav --- */
    html,
    body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    body {
        padding-top: 80px;
        /* Default height for Fixed Navbar */
        padding-bottom: 100px;
    }

    /* Only POS has mobile search sticking to top */
    body.has-mobile-search {
        padding-top: 160px;
        /* Increased from 140px */
    }

    .navbar {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 1060;
    }

    /* --- Mobile Search Bar --- */
    .mobile-search-container {
        display: block !important;
        padding: 0.75rem 1rem !important;
        background: var(--bg-primary) !important;
        position: fixed !important;
        top: 65px;
        /* Locked below fixed navbar */
        left: 0;
        right: 0;
        width: 100%;
        z-index: 1040;
        /* Below navbar and dropdowns */
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 0 !important;
    }

    .mobile-search-wrapper {
        position: relative;
    }

    .mobile-search-wrapper i {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--text-secondary);
        font-size: 0.9rem;
    }

    .mobile-search-input {
        width: 100%;
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
        border-radius: 20px;
        padding: 6px 15px 6px 35px;
        color: var(--text-primary);
        font-size: 0.85rem;
    }

    .mobile-search-input:focus {
        outline: none;
        border-color: var(--accent-success);
    }

    /* --- Compact Navbar on Mobile --- */
    .navbar {
        padding: 0.4rem 0.5rem;
    }

    .navbar .navbar-brand div:last-child .text-xs {
        display: none !important;
    }

    .navbar .navbar-brand div:last-child .fw-bold {
        font-size: 0.95rem !important;
    }

    .navbar .d-flex.align-items-center.gap-2 {
        gap: 0.25rem !important;
    }

    .navbar .d-flex.align-items-center.gap-2 .dropdown .btn {
        font-size: 0.7rem !important;
        padding: 0.25rem 0.5rem !important;
        min-width: 55px;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border-radius: 8px !important;
        color: var(--text-primary) !important;
    }

    #pricingDropdown {
        background: rgba(74, 222, 128, 0.1) !important;
        border-color: var(--accent-success) !important;
        color: var(--accent-success) !important;
    }

    /* Hide login/profile from navbar on mobile — use bottom nav instead */
    #login-btn,
    #user-profile-menu {
        display: none !important;
    }

    #daily-sales-container {
        display: none !important;
    }

    /* --- Hide Stats Bar on Mobile --- */
    #stats-bar {
        display: none !important;
    }

    /* --- Product Grid: 2 columns Shopee-style --- */
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        padding: 0 !important;
    }

    .product-card {
        border-radius: 8px !important;
        padding: 8px !important;
        margin: 0 !important;
    }

    .product-card {
        background: var(--bg-secondary) !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 12px !important;
        overflow: hidden !important;
        transition: transform 0.2s, box-shadow 0.2s !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    }

    .product-card .card-body {
        padding: 8px !important;
        flex-grow: 1 !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .product-card .product-image-container {
        height: 110px !important;
        background: #f8fafc22 !important;
        border-bottom: 1px solid var(--border-color) !important;
    }

    .product-card .product-image-container img {
        height: 80px !important;
        width: 80px !important;
    }

    .product-card .product-price {
        font-size: 1.1rem !important;
        color: var(--accent-success, #4ade80) !important;
        /* Changed from orange to Green to match POS theme */
        font-weight: 700 !important;
        margin-bottom: 2px !important;
    }

    .product-card .product-name {
        font-size: 0.85rem !important;
        color: var(--text-primary) !important;
        font-weight: 500 !important;
        height: 2.4em !important;
        overflow: hidden !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2;
        line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        margin-bottom: 6px !important;
    }

    .product-card .product-stock {
        font-size: 0.72rem !important;
        padding: 2px 8px !important;
        border-radius: 4px !important;
        background: rgba(16, 185, 129, 0.1) !important;
        color: #4ade80 !important;
        display: inline-block !important;
        margin-top: auto !important;
    }

    .product-card .product-stock.out {
        background: rgba(239, 68, 68, 0.1) !important;
        color: #f87171 !important;
    }

    .product-card .product-actions {
        display: none !important;
    }

    .product-card .product-category {
        font-size: 0.6rem !important;
        padding: 1px 5px !important;
    }

    /* --- Category Chips: Horizontal Scroll --- */
    #category-filters {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }

    #category-filters::-webkit-scrollbar {
        display: none;
    }

    #category-filters .btn {
        white-space: nowrap;
        font-size: 0.8rem !important;
        padding: 4px 12px !important;
        flex-shrink: 0;
        border-radius: 16px !important;
    }

    /* --- Card Header: Compact --- */
    .card-header {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.9rem !important;
    }

    .card-body {
        padding: 0.5rem !important;
    }

    /* --- Hide Cart Sidebar on Mobile --- */
    #cart-column {
        display: none;
    }

    /* Show cart when toggled */
    #cart-column.mobile-cart-open {
        display: block !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        z-index: 1065;
        /* Higher than Bottom Nav (1060) */
        max-height: 85vh;
        overflow-y: auto;
        border-radius: 20px 20px 0 0;
        animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.5);
        padding: 0 0 env(safe-area-inset-bottom, 20px) !important;
        /* Extra padding for bottom nav */
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
    }

    #cart-column.mobile-cart-open #cart-card {
        position: static !important;
        border-radius: 16px 16px 0 0;
    }

    #cart-column.mobile-cart-open .card-header {
        border-radius: 16px 16px 0 0;
        padding: 0.5rem 1rem 0.75rem !important;
        cursor: grab;
        font-size: 0.85rem !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        position: relative !important;
    }

    #cart-column.mobile-cart-open .card-header .btn {
        font-size: 0.7rem !important;
        padding: 0.2rem 0.5rem !important;
    }

    #cart-column.mobile-cart-open .card-header::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: rgba(255, 255, 255, 0.4);
        border-radius: 2px;
        margin: 0 auto 8px;
    }

    #cart-column.mobile-cart-open #cart-items {
        max-height: 20vh !important;
    }

    #cart-column.mobile-cart-open .card-header .btn {
        position: absolute !important;
        right: 1rem !important;
        bottom: 0.6rem !important;
    }

    /* Compact empty cart state on mobile */
    #cart-column.mobile-cart-open #cart-items .text-center.py-5 {
        padding: 1rem 0 !important;
    }

    #cart-column.mobile-cart-open #cart-items .text-center.py-5 .fs-1 {
        font-size: 1.5rem !important;
    }

    #cart-column.mobile-cart-open #cart-items .text-center.py-5 p {
        font-size: 0.85rem;
        margin-bottom: 0;
    }

    /* Compact all cart text on mobile */
    #cart-column.mobile-cart-open .border-top {
        padding: 0.5rem 0.75rem !important;
    }

    #cart-column.mobile-cart-open .border-top span,
    #cart-column.mobile-cart-open .border-top label {
        font-size: 0.8rem !important;
    }

    #cart-column.mobile-cart-open .border-top .fw-bold.fs-5 {
        font-size: 0.95rem !important;
    }

    #cart-column.mobile-cart-open .border-top .fw-bold.fs-5 span {
        font-size: 0.95rem !important;
    }

    #cart-column.mobile-cart-open .form-select,
    #cart-column.mobile-cart-open .form-control {
        font-size: 0.8rem !important;
        padding: 0.3rem 0.5rem !important;
    }

    #cart-column.mobile-cart-open .form-label {
        font-size: 0.75rem !important;
        margin-bottom: 0.15rem !important;
    }

    #cart-column.mobile-cart-open .mb-3 {
        margin-bottom: 0.5rem !important;
    }

    #cart-column.mobile-cart-open .mb-4 {
        margin-bottom: 0.5rem !important;
    }

    #cart-column.mobile-cart-open .mb-2 {
        margin-bottom: 0.25rem !important;
    }

    #cart-column.mobile-cart-open #checkout-btn {
        padding: 0.6rem !important;
        font-size: 0.9rem !important;
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%);
            opacity: 0.5;
        }

        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    /* --- Cart Overlay Backdrop --- */
    .mobile-cart-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1054;
        /* Under Cart Column (1055) */
        backdrop-filter: blur(2px);
    }

    .mobile-cart-overlay.active {
        display: block;
    }

    /* --- Floating Cart Button --- */
    .mobile-cart-fab {
        display: flex !important;
        position: fixed;
        bottom: calc(95px + env(safe-area-inset-bottom, 0px));
        right: 12px;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: linear-gradient(135deg, #059669, #10b981);
        color: white;
        border: none;
        box-shadow: 0 4px 15px rgba(5, 150, 105, 0.4);
        z-index: 1070;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        cursor: pointer;
        transition: transform 0.2s, box-shadow 0.2s;
    }

    /* Hide FAB when cart drawer is open to prevent overlap */
    .mobile-cart-overlay.active~.mobile-cart-fab {
        opacity: 0;
        pointer-events: none;
        transform: scale(0.5);
    }

    .mobile-cart-fab:active {
        transform: scale(0.9);
    }

    .mobile-cart-badge {
        position: absolute;
        top: -2px;
        right: -2px;
        background: #ef4444;
        color: white;
        border-radius: 10px;
        font-size: 0.65rem;
        font-weight: 700;
        min-width: 18px;
        height: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 4px;
    }

    .mobile-cart-badge:empty,
    .mobile-cart-badge[data-count="0"] {
        display: none;
    }

    /* --- Bottom Navigation Bar --- */
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(70px + env(safe-area-inset-bottom, 0px));
        background: var(--bg-secondary);
        border-top: 2px solid var(--accent-success, #4ade80);
        box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.3);
        z-index: 1060;
        justify-content: space-around;
        align-items: flex-start;
        padding: 5px 0 env(safe-area-inset-bottom, 12px);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--text-secondary);
        font-size: 0.65rem;
        flex: 1;
        padding: 8px 0;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
    }

    .mobile-nav-item i {
        font-size: 1.35rem;
        margin-bottom: 2px;
        transition: transform 0.3s ease;
    }

    .mobile-nav-item.active {
        color: var(--accent-success, #4ade80);
    }

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

    /* Active Indicator Line (Shopee-style) */
    .mobile-nav-item::after {
        content: '';
        position: absolute;
        top: -8px;
        left: 50%;
        transform: translateX(-50%) scaleX(0);
        width: 25px;
        height: 3px;
        background: var(--accent-success, #4ade80);
        border-radius: 0 0 4px 4px;
        transition: transform 0.3s ease;
    }

    .mobile-nav-item.active::after {
        transform: translateX(-50%) scaleX(1);
    }

    .mobile-nav-badge {
        position: absolute;
        top: 0;
        right: 50%;
        transform: translateX(14px);
        background: #ef4444;
        color: white;
        border-radius: 10px;
        font-size: 0.6rem;
        font-weight: 700;
        min-width: 16px;
        height: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 3px;
    }

    .mobile-nav-badge:empty,
    .mobile-nav-badge[data-count="0"] {
        display: none;
    }

    /* --- Recent Orders: Compact on Mobile --- */
    #recent-orders-section .table th,
    #recent-orders-section .table td {
        font-size: 0.75rem !important;
        padding: 0.4rem !important;
    }

    /* --- Footer: Hidden on Mobile --- */
    footer {
        display: none !important;
    }

    /* --- Main Container: Less Padding --- */
    .container-fluid.my-4 {
        padding-left: 8px !important;
        padding-right: 8px !important;
        margin-top: 0.5rem !important;
        margin-bottom: 0.5rem !important;
    }

    /* --- Sort dropdown compact --- */
    #sortDropdown {
        font-size: 0.75rem !important;
        padding: 2px 6px !important;
    }

    /* --- Admin Tabs Scrolling --- */
    #adminTabs {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Hide scrollbar for Chrome/Safari */
    }

    #adminTabs::-webkit-scrollbar {
        display: none;
        /* Hide scrollbar */
    }

    #adminTabs .nav-link {
        white-space: nowrap;
        padding: 0.5rem 0.75rem !important;
        font-size: 0.85rem !important;
    }
}