:root {
    --primary: #6C63FF;
    --secondary: #4D44DB;
    --accent: #F7567C;
    --background: #0F1624;
    --text: #E9E9E9;
    --card-bg: rgba(25, 32, 54, 0.8);
    --input-bg: rgba(15,22,36,0.8);
}

[data-theme="light"] {
    --primary: #5B54E0;
    --secondary: #4A43C0;
    --accent: #F7567C;
    --background: #F5F7FA;
    --text: #2D3748;
    --card-bg: rgba(255, 255, 255, 0.9);
    --input-bg: rgba(255,255,255,0.8);
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Segoe UI', sans-serif; 
    transition: background-color 0.4s, color 0.4s, border-color 0.4s; 
}
body { background: var(--background); color: var(--text); min-height: 100vh; }

.container { max-width: 1200px; margin: 0 auto; padding: 1rem; padding-bottom: 80px; }

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(150,150,150,0.1);
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
}
.logo:hover { color: var(--accent); }

.search-bar {
    flex: 1;
    max-width: 500px;
    min-width: 200px;
    position: relative;
}
.search-bar input {
    width: 100%;
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    border-radius: 20px;
    border: none;
    background: var(--input-bg);
    color: var(--text);
}
.search-bar input:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary);
}
.search-bar button {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
}

.nav-icons { 
    display: flex; 
    gap: 1rem; 
    align-items: center;
}
.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
}
.icon-btn:hover { background: var(--primary); }
.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle { font-size: 1.2rem; }
.filter-toggle { display: none; font-size: 1.1rem; }

.main { 
    display: grid; 
    grid-template-columns: 280px 1fr; 
    gap: 1.5rem; 
    margin-top: 1.5rem; 
}

.filters {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 20px;
}
.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.filter-title { font-size: 1.2rem; color: var(--primary); }
.close-filters {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
}
.close-filters:hover { opacity: 1; }

.filter-group { margin-bottom: 1.5rem; }
.filter-label { margin-bottom: 0.5rem; opacity: 0.8; font-size: 0.95rem; }
.price-inputs { display: flex; gap: 0.5rem; }
.price-inputs input, .sort-select {
    width: 100%;
    padding: 0.5rem;
    background: var(--input-bg);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 5px;
    color: var(--text);
}
.checkbox-item { margin-bottom: 0.8rem; display: flex; align-items: center; }
.checkbox-item input { margin-right: 0.5rem; }

.checkbox-group.mini-list {
    max-height: 220px;
    overflow-y: auto;
    padding-right: 5px;
}
.checkbox-group.mini-list::-webkit-scrollbar {
    width: 6px;
}
.checkbox-group.mini-list::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
}
.checkbox-group.mini-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}
.checkbox-group.mini-list label {
    font-size: 0.95rem;
    opacity: 0.9;
}

.rating-slider {
    margin-top: 0.5rem;
}
.rating-slider input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: rgba(255,255,255,0.1);
    outline: none;
    -webkit-appearance: none;
}
.rating-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}
.rating-display {
    margin-top: 0.5rem;
    font-weight: 600;
    color: var(--primary);
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    font-weight: 600;
}
.btn:hover { background: var(--secondary); transform: translateY(-2px); }

.products-container { width: 100%; }
.sort-options { display: flex; justify-content: flex-end; margin-bottom: 1rem; }

.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}
.product-card {
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
}
.product-card:hover { box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.product-img {
    height: 180px;
    background: #1c2438;
    overflow: hidden;
}
.product-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-info { padding: 1rem; }
.product-title { margin-bottom: 0.5rem; font-size: 1rem; }
.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}
.product-rating { color: #FFD700; margin-bottom: 0.5rem; }
.product-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
}
.add-to-cart {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    flex: 1;
}
.favorite {
    width: 36px;
    height: 36px;
    border-radius: 5px;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
    cursor: pointer;
}
.favorite.active, .favorite:hover { background: var(--accent); color: white; }

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
}
.pagination button {
    padding: 0.5rem 1rem;
    background: var(--card-bg);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text);
    border-radius: 5px;
    cursor: pointer;
}
.pagination button.active, .pagination button:hover { background: var(--primary); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--card-bg);
    color: var(--text);
    padding: 1rem;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateY(100px);
    opacity: 0;
    transition: 0.3s;
    z-index: 1000;
}
.toast.show { transform: translateY(0); opacity: 1; }

.modal-backdrop {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
    z-index: 2000;
}
.modal-backdrop.show { opacity: 1; visibility: visible; }

.modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
    z-index: 2100;
}
.modal.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    width: 90vw;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}
.modal-content.large { max-width: 900px; }
.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.8rem;
    cursor: pointer;
    opacity: 0.7;
}
.close-btn:hover { opacity: 1; }

.modal-product {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}
.modal-product-img {
    height: 400px;
    background: #1c2438;
    border-radius: 8px;
    overflow: hidden;
}
.modal-product-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.modal-product-info h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--primary);
}
.modal-product-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin: 1rem 0;
}

.reviews-section { margin-top: 2rem; }
.reviews-section h3 { color: var(--primary); margin-bottom: 1rem; }
.review-item {
    background: rgba(255,255,255,0.05);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.review-header { display: flex; justify-content: space-between; margin-bottom: 0.5rem; }
.review-rating { color: #FFD700; }
.review-date { opacity: 0.7; font-size: 0.9rem; }

.cart-item, .wishlist-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    align-items: center;
}
.cart-item img, .wishlist-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}
.item-actions button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 5px;
    cursor: pointer;
}
.cart-total {
    font-size: 1.4rem;
    font-weight: 700;
    text-align: right;
    margin-top: 1rem;
    color: var(--primary);
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.quantity-selector button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
}
.quantity-selector span { min-width: 40px; text-align: center; font-weight: 600; }

.checkout-step { display: none; }
.checkout-step.active { display: block; }
.checkout-step h3 { margin-bottom: 1rem; color: var(--primary); }
#paymentForm label { display: block; margin: 0.5rem 0 0.3rem; }
#paymentForm input {
    width: 100%;
    padding: 0.6rem;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.2);
    background: var(--input-bg);
    color: var(--text);
    margin-bottom: 1rem;
}

.auth-tabs, .admin-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.tab-btn {
    flex: 1;
    padding: 0.8rem;
    background: none;
    border: none;
    color: var(--text);
    opacity: 0.6;
    cursor: pointer;
    font-size: 1rem;
}
.tab-btn.active, .tab-btn:hover {
    opacity: 1;
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}
.auth-tab, .admin-tab {
    animation: fadeIn 0.3s;
}
.auth-tab input, .admin-form input {
    width: 100%;
    padding: 0.7rem;
    margin-bottom: 1rem;
    background: var(--input-bg);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 5px;
    color: var(--text);
}
.auth-note {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 1rem;
    text-align: center;
}

.order-item {
    background: rgba(255,255,255,0.05);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.order-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: 600;
}
.order-items-list {
    margin-left: 1rem;
    opacity: 0.9;
}
.admin-delete-btn {
    background: #ff4444;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
}

footer {
    width: 100%;
    background: rgba(0,0,0,0.5);
    color: white;
    text-align: center;
    padding: 15px 20px;
    font-size: 14px;
    margin-top: 2rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .main { 
        grid-template-columns: 1fr; 
    }
    .filters {
        position: fixed;
        top: 0;
        left: -100%;
        width: 300px;
        height: 100vh;
        z-index: 3000;
        transition: left 0.3s ease;
        border-radius: 0;
        padding-top: 60px;
    }
    .filters.show {
        left: 0;
    }
    .filters-header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        background: var(--card-bg);
        padding: 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        z-index: 1;
    }
    .close-filters { display: block; }
    .filter-toggle { display: flex !important; }
    .modal-backdrop.filters-active {
        display: block;
        opacity: 0.6;
        visibility: visible;
    }
}