:root {
    --primary: #d4a373;
    --primary-hover: #bc8a5f;
    --bg-dark: #0f1115;
    --bg-card: rgba(255, 255, 255, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8f9fa;
    --text-muted: #adb5bd;
    --accent: #e63946;
    --success: #2a9d8f;
    --radius-lg: 20px;
    --radius-md: 12px;
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    display: flex;
}

/* App Container */
#app {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar / Categories */
aside {
    width: 280px;
    background: var(--glass-bg);
    border-right: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    padding: 2rem 1.5rem;
    overflow-y: auto;
}

aside .logo {
    margin-bottom: 3rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0px;
}

.aside-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3rem;
    transition: all 0.3s ease;
}

.sidebar-toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary);
}

/* Sidebar Collapsed State */
aside.collapsed {
    width: 90px !important;
    padding: 2rem 1rem !important;
}

aside.collapsed .logo-text,
aside.collapsed .nav-label,
aside.collapsed .nav-btn span,
aside.collapsed .logout-text,
aside.collapsed .nav-group:last-child {
    display: none !important;
}

aside.collapsed .nav-btn {
    justify-content: center;
    padding: 12px;
}

aside.collapsed .nav-btn i {
    margin-right: 0;
}

aside.collapsed .aside-header {
    flex-direction: column;
    gap: 1rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-dark);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-group {
    margin-bottom: 2rem;
}

.nav-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 1rem;
    display: block;
}

.nav-links {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-btn {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: var(--glass-bg);
    color: var(--text-main);
}

.nav-btn.active {
    background: var(--primary);
    color: var(--bg-dark);
}

/* Main Content */
main {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.search-bar {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
    width: 350px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    outline: none;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(212, 163, 115, 0.1);
}

.product-img {
    width: 100%;
    height: 160px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    object-fit: cover;
}

.product-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.product-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.2rem;
}

/* Cart Panel */
#cart-panel {
    width: 400px;
    background: var(--glass-bg);
    border-left: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.cart-header {
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
}

.cart-item-info {
    flex: 1;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--glass-border);
    background: transparent;
    color: white;
    cursor: pointer;
}

.cart-footer {
    border-top: 1px solid var(--glass-border);
    padding-top: 1.5rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.total-row {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 1rem 0;
}

.checkout-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-md);
    color: var(--bg-dark);
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.checkout-btn:active {
    transform: scale(0.98);
}

/* Admin Styles */
#admin-view {
    display: none;
    padding: 2rem;
    width: 100%;
    flex: 1;
    overflow-y: auto;
    /* Fix admin scroll */
    height: 100vh;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.btn-add {
    background: var(--success);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-muted);
}

.admin-table td {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: #1a1d23;
    width: 500px;
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade {
    animation: fadeIn 0.4s ease forwards;
}

/* Archives & Stats */
.stats-grid {
    margin-bottom: 2rem;
}

.stat-card {
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

#image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#image-preview {
    border: 2px dashed var(--glass-border);
    transition: all 0.3s ease;
}

#image-preview:hover {
    border-color: var(--primary);
}

/* Responsive Mobile Styles */
@media screen and (max-width: 1024px) {
    #app {
        flex-direction: column;
    }

    aside {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
        padding: 0.75rem 1rem;
        flex-direction: column;
        align-items: stretch;
        position: relative;
        z-index: 100;
        flex-shrink: 0;
        max-height: 100vh;
        overflow-y: auto;
    }

    .aside-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        min-height: 50px;
    }

    .logo {
        margin-bottom: 0;
    }

    .nav-group,
    #category-list-container,
    aside>div:last-child {
        display: none;
        /* Hide standard nav on mobile */
    }

    .mobile-nav-toggle {
        display: flex !important;
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
        padding: 8px;
        border-radius: 8px;
        color: white;
    }

    main {
        width: 100%;
        padding: 1rem;
        flex: 1;
        overflow-y: auto;
    }

    .header-top {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    .product-card {
        padding: 0.5rem !important;
    }

    .product-img {
        height: 110px !important;
        /* Increased height to show more of the image */
        margin-bottom: 0.3rem !important;
        object-fit: contain !important;
        /* Prevent cropping the image */
        background: rgba(255, 255, 255, 0.03);
        /* Subtle background for transparency */
    }

    .product-info h3 {
        font-size: 0.85rem !important;
        margin-bottom: 2px;
        line-height: 1.2;
    }

    .product-price {
        font-size: 0.95rem !important;
    }

    #cart-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 50vh;
        z-index: 200;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        border-left: none;
        border-top: 2px solid var(--primary);
        background: #15171c;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
    }

    /* Improved Side-by-Side View for Tablets */
    @media screen and (min-width: 600px) {
        #app {
            display: flex;
            flex-direction: row;
            flex-wrap: nowrap;
            height: 100vh;
            overflow: hidden;
        }

        aside {
            width: 200px !important;
            flex-direction: column !important;
            height: 100vh !important;
            border-right: 1px solid var(--glass-border) !important;
            border-bottom: none !important;
            position: relative !important;
            max-height: 100vh !important;
            padding: 1.5rem 1rem !important;
        }

        aside .logo {
            margin-bottom: 2rem;
        }

        .aside-header {
            flex-direction: column;
            align-items: flex-start;
            margin-bottom: 2rem;
        }

        main {
            flex: 1 !important;
            height: 100vh !important;
            overflow-y: auto !important;
        }

        .mobile-nav-toggle {
            display: none !important;
        }

        .nav-group,
        #category-list-container,
        aside>div:last-child {
            display: block !important;
        }

        #cart-panel {
            position: static !important;
            width: 300px !important;
            height: 100vh !important;
            transform: none !important;
            display: flex !important;
            border-top: none !important;
            border-left: 1px solid var(--glass-border) !important;
            background: rgba(21, 23, 28, 0.4) !important;
        }

        .cart-float-btn,
        #mobile-cart-btn {
            display: none !important;
        }

        #close-cart-mobile {
            display: none !important;
        }
    }

    #cart-panel.active {
        transform: translateY(0);
    }

    .cart-float-btn {
        display: none !important;
        /* Hide floating btn in favor of the full width summary bar */
    }

    /* Make room for bottom bar in main view */
    main {
        padding-bottom: 2rem !important;
    }

    .cart-badge {
        position: absolute;
        top: -5px;
        right: -5px;
        background: var(--accent);
        color: white;
        border-radius: 50%;
        width: 22px;
        height: 22px;
        font-size: 0.75rem;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .modal {
        width: 95%;
        padding: 1.5rem;
    }
}

/* Base Utility for Buttons */
.mobile-nav-toggle,
.cart-float-btn {
    display: none;
}