:root {
    --bg-dark: #0f0f0f;
    --bg-sidebar: #1a1a1a;
    --card-bg: #252525;
    --accent: #d4af37;
    /* Yellow/Gold as primary */
    --accent-dark: #b8860b;
    --text-main: #ffffff;
    --text-muted: #abb1c1;
    --border-color: #333333;
    --input-bg: #2d303e;
    --red: #ea7c69;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
}

/* Global Select Options Styling */
select option {
    background-color: var(--input-bg);
    color: #fff;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Styling */
.sidebar {
    width: 90px;
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 0;
    border-right: 1px solid var(--border-color);
    height: 100vh;
    flex-shrink: 0;
    overflow: hidden;
}

.logo {
    width: 50px;
    height: 50px;
    background: rgba(212, 175, 55, 0.1);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 24px;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    align-items: center;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nav-menu::-webkit-scrollbar {
    display: none;
}

.nav-item {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: var(--accent);
    text-decoration: none;
    font-size: 20px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.nav-item.active {
    background-color: var(--accent);
    color: #000 !important;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

.nav-item:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.logout {
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    width: 100%;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.logout a {
    color: var(--red);
    font-size: 22px;
    transition: 0.3s;
}

/* Main Content Styling */
.main-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.date-info {
    color: var(--text-muted);
    font-size: 14px;
}

.search-bar {
    position: relative;
    width: 300px;
}

.search-bar i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    z-index: 1;
}

.search-bar input {
    width: 100%;
    padding: 14px 15px 14px 45px;
    background: rgba(45, 48, 62, 0.6);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    outline: none;
    transition: all 0.3s ease;
}

.search-bar input:focus {
    border-color: var(--accent);
    background: rgba(45, 48, 62, 0.9);
}

/* Categories */
.categories-section h2,
.products-section h2 {
    font-size: 20px;
    margin-bottom: 20px;
    font-weight: 600;
}

.categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 15px;
}

.category-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 14px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
}


.category-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.category-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}



/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.product-card {
    background: rgba(37, 40, 54, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.product-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: var(--accent);
    background: rgba(37, 40, 54, 0.9);
}

.product-img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.product-name {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
}

.product-price {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.product-stock {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.variant-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 15px;
}

.variant-item {
    position: relative;
}

.variant-item input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.variant-label {
    display: block;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
}

.variant-item input:checked+.variant-label {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.variant-label:hover {
    border-color: var(--accent);
}


.add-cart-btn {
    width: 100%;
    padding: 10px;
    background: var(--accent);
    border: none;
    color: #000;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.add-cart-btn:hover {
    background: var(--accent-dark);
    color: #000;
}

/* Order Summary (Right Sidebar) */
.order-summary {
    width: 400px;
    background-color: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.summary-header h3 {
    font-size: 24px;
    margin-bottom: 5px;
}

.summary-header p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.table-selector {
    margin-bottom: 20px;
}

.form-select {
    width: 100%;
    padding: 12px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: #fff;
    outline: none;
    margin-top: 5px;
}

.order-type-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-muted);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn.active {
    background: var(--accent);
    color: #000;
}

.order-details-wrapper {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}

.order-details-wrapper h4 {
    font-size: 18px;
    margin-bottom: 15px;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 12px;
}

.cart-item-info {
    display: flex;
    gap: 10px;
}

.cart-item-img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

.cart-item-text {
    display: flex;
    flex-direction: column;
}

.cart-item-name {
    font-size: 14px;
    font-weight: 500;
}

.cart-item-price {
    font-size: 12px;
    color: var(--text-muted);
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--input-bg);
    padding: 5px 12px;
    border-radius: 8px;
}

.qty-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
}

.summary-footer {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: var(--bg-sidebar);
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.method-options {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.method-btn {
    flex: 1;
    padding: 15px 5px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 12px;
}

.method-btn.active {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(212, 175, 55, 0.1);
}

.totals {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text-muted);
}

.grand-total {
    font-size: 20px;
    color: #fff;
    font-weight: 700;
    margin-top: 5px;
}

.pay-btn {
    width: 100%;
    padding: 18px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(212, 175, 55, 0.3);
    transition: all 0.3s;
}

.pay-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(212, 175, 55, 0.4);
}

.add-cart-btn:hover {
    background: var(--accent-dark);
    color: #000;
    box-shadow: 0 8px 15px rgba(212, 175, 55, 0.3);
}


/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.empty-cart {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 0;
}

.loader,
.no-items,
.error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px;
    color: var(--text-muted);
    font-size: 18px;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    position: relative;
    width: 450px;
    max-width: 95%;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

#receipt-preview-content {
    background: #fff;
    border-radius: 12px;
    overflow-y: auto;
    flex: 1;
    padding: 20px 10px;
}

#receipt-preview-content .receipt-body {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

/* Floating Orders Button */
.floating-orders-btn {
    position: fixed;
    right: 30px;
    bottom: 30px;
    width: 70px;
    height: 70px;
    background: var(--accent);
    color: var(--dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 15px 35px rgba(212, 175, 55, 0.4);
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 5px solid var(--dark-secondary);
    text-decoration: none;
}

.floating-orders-btn:hover {
    transform: scale(1.1) rotate(5deg);
    background: #fff;
    color: var(--accent);
    box-shadow: 0 20px 45px rgba(212, 175, 55, 0.6);
}


.order-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--red);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    min-width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--dark-secondary);
    padding: 0 4px;
}

/* Mobile Navigation Styles */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {

    /* Prevent screen movement/scroll */
    html,
    body {
        overflow: hidden;
        width: 100%;
        height: 100%;
        position: fixed;
    }

    .sidebar {
        display: none;
    }

    .app-container {
        flex-direction: column;
        height: 100%;
        width: 100%;
        overflow: hidden;
    }

    .main-content {
        width: 100%;
        padding: 10px;
        padding-bottom: 80px;
        /* Space for bottom nav */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        height: 100%;
    }

    /* Mobile Bottom Nav */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: #151515;
        height: 60px;
        align-items: center;
        justify-content: space-around;
        z-index: 2000;
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
    }

    .mobile-nav-item {
        color: #666;
        font-size: 18px;
        padding: 10px;
    }

    .mobile-nav-item.active {
        color: var(--accent);
    }

    .mobile-nav-center {
        position: relative;
        top: -20px;
    }

    .center-btn {
        width: 50px;
        height: 50px;
        background: var(--accent);
        color: #000;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        box-shadow: 0 5px 15px rgba(212, 175, 55, 0.3);
        border: 4px solid var(--bg-dark);
    }

    /* Cart Overlay - Full Screen */
    .order-summary {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100%;
        /* Cover full screen */
        z-index: 3000;
        /* High z-index */
        background: var(--bg-dark);
        transition: right 0.3s ease;
        padding: 15px;
        padding-bottom: 80px;
        /* Space for totals */
        display: flex;
        flex-direction: column;
    }

    body.show-mobile-cart .order-summary {
        right: 0;
    }

    .mobile-close-cart {
        display: block !important;
    }

    /* Compact Product Grid */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .product-card {
        padding: 10px;
        border-radius: 12px;
    }

    .product-img {
        width: 70px;
        height: 70px;
        margin-bottom: 5px;
    }

    .product-name {
        font-size: 12px;
        height: 2.4em;
        margin-bottom: 3px;
        font-weight: 600;
    }

    .product-price {
        font-size: 12px;
    }

    /* Compact Variant Selector */
    .variant-selector {
        gap: 4px;
        margin-bottom: 5px;
    }

    .variant-label {
        font-size: 9px;
        padding: 2px 6px;
    }

    /* Compact Buttons */
    .add-cart-btn {
        padding: 6px;
        font-size: 11px;
    }

    /* Compact Cart Items */
    .cart-item {
        padding: 8px;
        gap: 5px;
    }

    .cart-item-img {
        width: 30px;
        height: 30px;
    }

    .cart-item-name {
        font-size: 12px;
    }

    .cart-item-price {
        font-size: 10px;
    }

    .qty-btn {
        font-size: 14px;
        padding: 0 5px;
    }

    .quantity-controls {
        padding: 2px 8px;
    }

    /* Headers */
    .search-bar {
        width: 100%;
    }

    .categories-list {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 5px;
    }

    .category-btn {
        padding: 5px 12px;
        font-size: 10px;
        flex-shrink: 0;
    }

    /* Header Adjustments */
    .top-bar {
        padding-bottom: 10px;
        flex-direction: row;
        /* Keep row but wrap if needed */
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .top-bar h1 {
        font-size: 18px;
        /* Smaller Title */
        margin: 0;
    }

    .top-bar p {
        display: none;
        /* Hide description text */
    }

    .top-bar .stat-box {
        margin-top: 10px;
        width: 100%;
        /* Full width total box */
        padding: 10px;
    }

    /* Filter Section Compact */
    .filter-section form {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-section .form-group,
    .filter-input-group {
        width: 100%;
        margin-bottom: 5px;
    }

    .filter-input-group {
        flex-direction: column;
    }

    .filter-section .pay-btn {
        width: 100% !important;
        margin-top: 5px;
    }

    /* Admin Sales Mobile Adjustments */
    .stat-banner {
        grid-template-columns: 1fr !important;
        /* Stack cards vertically */
        gap: 10px;
    }

    .stat-box {
        padding: 15px;
    }

    .admin-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
    }

    /* Cart Spacing Reduction */
    .summary-footer {
        padding-top: 10px;
        gap: 8px;
    }

    .method-btn {
        padding: 5px;
        font-size: 10px;
    }

    .totals {
        gap: 4px;
    }

    .total-row {
        font-size: 11px;
    }

    .grand-total {
        font-size: 16px;
        margin-top: 5px;
    }

    .pay-btn {
        padding: 12px;
        font-size: 20px;
        margin-bottom: 0px;
        /* Space for scroll */
    }

    /* Hide floating button on mobile */
    .floating-orders-btn {
        display: none;
    }
}
@media (max-width: 768px) {
    .finance-btn span { display: none !important; }
    .finance-btn {
        width: 50px !important;
        height: 50px !important; 
        padding: 0 !important;
        justify-content: center !important;
        margin-top: 0 !important;
    }
    .top-bar > div:last-child {
        display: flex;
        justify-content: space-between;
        width: 100%;
        align-items: center;
    }
    .search-bar { width: calc(100% - 60px) !important; margin: 0 !important; }
}

@media (max-width: 768px) {
    .sale-tab span { display: none !important; }
    .sale-tab { 
        padding: 12px !important; 
        justify-content: center !important;
        flex: 1;
    }
    .sale-tab i { margin: 0 !important; font-size: 20px; }
}

@media (max-width: 768px) {
    /* Global Compactness for Mobile */
    .stat-box, .filter-card, .product-card, .order-summary, .modal-content, .filter-section {
        padding: 10px !important;
        border-radius: 12px !important;
    }
    
    .stat-banner, .filter-section, .sales-tabs, .products-section, .filter-grid, .stats-grid {
        margin-bottom: 10px !important;
        gap: 8px !important;
    }
    
    h1, h2, h3, h4 {
        margin-bottom: 5px !important;
        line-height: 1.2;
    }
    
    .form-group, .filter-input-group {
        margin-bottom: 8px !important;
    }
    
    .filter-grid { display: flex; flex-direction: column; }
    
    input, select, textarea {
        padding: 8px !important;
        font-size: 13px !important;
        height: auto;
    }
    
    .admin-table th, .admin-table td {
        padding: 8px 10px !important;
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    /* Fix Search Icon Overlap */
    .search-bar input {
        padding-left: 40px !important; /* Space for icon */
        padding-right: 10px !important;
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }
    .search-bar i {
        left: 12px !important;
        font-size: 14px;
    }
}
