:root {
    /* Light theme variables */
    --bg-color: #f8f9fa;
    --text-color: #2d3436;
    --primary-color: #00b894;
    --secondary-color: #ffffff;
    --border-color: #e9ecef;
    --card-bg: #ffffff;
    --shadow-color: rgba(45, 52, 54, 0.1);
    --accent-color: #fd79a8;
    --success-color: #00cec9;
    --header-bg: #ffffff;
    --header-height: 72px;
}

[data-theme="dark"] {
    /* Dark theme variables */
    --bg-color: #2d3436;
    --text-color: #dfe6e9;
    --primary-color: #00b894;
    --secondary-color: #2d3436;
    --border-color: #636e72;
    --card-bg: #353b48;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --accent-color: #fd79a8;
    --success-color: #00cec9;
    --header-bg: #353b48;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

/* Make room for fixed header so content doesn't sit under it */
body {
    padding-top: var(--header-height);
}

/* Navbar Styles */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    height: var(--header-height);
    background-color: var(--header-bg);
    box-shadow: 0 4px 6px var(--shadow-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
}

.mobile-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 300px;
    height: 100vh;
    background-color: var(--card-bg);
    z-index: 1002;
    transition: left 0.3s ease-in-out;
    box-shadow: 0 0 15px var(--shadow-color);
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.close-menu {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
}

.mobile-menu-content {
    padding: 1.5rem;
}

.mobile-menu-content a {
    display: block;
    padding: 1rem 0;
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border-color);
}

.mobile-controls {
    margin-top: 2rem;
}

.control-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.control-item button {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-icon {
    position: relative;
    cursor: pointer;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--primary-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 50%;
    font-size: 0.8rem;
}

/* Product Details Page Styles */
.product-details {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.product-images {
    border-radius: 15px;
    overflow: hidden;
}

.product-images img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.product-info h1 {
    font-size: 2.5rem;
    color: var(--text-color);
}

.product-price {
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: bold;
}

.product-description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-color);
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.nav-controls {
    display: flex;
    gap: 1rem;
}

.nav-controls button {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    position: relative;
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Contact link in header / mobile */
.contact-link {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: background-color 0.2s, color 0.2s;
    font-size: 0.95rem;
}
.contact-link:hover {
    color: var(--primary-color);
}

/* Small support text shown in overlays and product pages */
.support-contact {
    margin: 1rem 0;
    font-size: 0.95rem;
    color: var(--text-color);
}
.support-contact a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}
.support-contact a:hover { text-decoration: underline; }

/* Payment / Checkout form styles */
.checkout-form {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: 12px;
    box-shadow: 0 8px 20px var(--shadow-color);
}
.checkout-form .form-field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-bottom: .75rem;
}
.checkout-form label {
    font-weight: 600;
    font-size: .95rem;
}
.checkout-form input[type="text"],
.checkout-form input[type="number"],
.checkout-form input[type="email"],
.checkout-form textarea,
.checkout-form select {
    padding: .6rem .75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--secondary-color);
    font-size: 1rem;
    color: var(--text-color);
}
.checkout-form input:focus, .checkout-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.checkout-form input[disabled], .checkout-form input[readonly] {
    background: #f0f0f0;
    color: #666;
    cursor: not-allowed;
}
.checkout-form .small-note {
    font-size: .9rem;
    color: #666;
}
.checkout-summary-item {
    display:flex;justify-content:space-between;gap:.5rem;padding:.4rem 0;border-bottom:1px solid var(--border-color);
}

/* Filters bar styling */
.filters {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
    border-radius: 12px;
    box-shadow: 0 8px 20px var(--shadow-color);
}
.filters .filter-row {
    display:flex;
    gap:1rem;
    flex-wrap:wrap;
    align-items:center;
}
.filters .filter-group {
    display:flex;
    flex-direction:column;
    gap:.35rem;
    min-width:120px;
}
.filters label { font-weight:600; font-size:.95rem; }
.filters select, .filters input[type="number"], .filters input[type="search"] {
    padding: .5rem .65rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--secondary-color);
    min-width: 140px;
}
.filters input[type="search"] { min-width: 180px; }
.filters .filter-actions { display:flex; gap:.5rem; align-items:flex-end; }
.filters .btn-filter { background:var(--primary-color); color:#fff; border:none; padding:.55rem .9rem; border-radius:8px; cursor:pointer; }
.filters .btn-clear { background:#777; color:#fff; border:none; padding:.55rem .9rem; border-radius:8px; cursor:pointer; }
.filters .btn-filter:hover { opacity:.95 }

@media (max-width: 768px) {
    .filters { padding:.75rem; }
    .filters .filter-group { min-width: 100%; }
    .filters input[type="search"] { min-width: 100%; }
    .filters .filter-actions { width:100%; justify-content:flex-start; }
    /* hide specific filter groups on mobile when flagged */
    .filters .filter-group.hide-mobile { display: none; }
}

.cart-count {
    background-color: var(--primary-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 50%;
    font-size: 0.8rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    background-color: var(--secondary-color);
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    padding: 2rem;
    margin: 0 auto;
    max-width: 1400px;
    position: relative;
}

.product-card {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 10px 20px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px var(--shadow-color);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 4px;
}

.product-card h3 {
    margin: 1rem 0;
}

.product-card .price {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.2rem;
}

.add-to-cart {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    margin-top: 1rem;
}

/* Cart Section */
.cart-section {
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.cart-items {
    margin: 2rem 0;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: bold;
    margin: 2rem 0;
}

.checkout-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    font-size: 1.1rem;
}

/* Cart Overlay */
.cart-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    width: 400px;
    height: 100vh;
    background-color: var(--card-bg);
    box-shadow: -5px 0 15px var(--shadow-color);
    transition: right 0.3s ease-in-out;
    z-index: 1001;
    overflow-y: auto;
    padding: 2rem;
}

.cart-overlay.active {
    right: 0;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.close-cart {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
}

.cart-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    animation: slideIn 0.3s ease-out;
}

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.cart-item-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.quantity-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-item {
    color: var(--accent-color);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.remove-item:hover {
    background-color: rgba(253, 121, 168, 0.1);
}

.cart-total {
    margin-top: 2rem;
    padding: 1rem;
    background-color: var(--secondary-color);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

.checkout-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    margin-top: 1rem;
    font-size: 1.1rem;
    transition: background-color 0.2s;
}

.checkout-btn:hover {
    background-color: var(--success-color);
}

.overlay-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .cart-overlay {
        width: 100%;
    }
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    background-color: var(--card-bg);
    margin-top: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .desktop-controls,
    .desktop-menu {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .product-details {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        padding: 1rem;
    }

    .cart-item {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card {
    animation: fadeIn 0.3s ease-in-out;
}

/* Extra mobile polish for product-details page */
@media (max-width: 600px) {
    .product-details {
        padding: 1rem;
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .product-images {
        width: 100%;
        border-radius: 12px;
        overflow: hidden;
    }

    .product-images img {
        width: 100%;
        height: auto;
        max-height: 360px;
        object-fit: cover;
    }

    .product-info {
        padding: 0.5rem 0;
    }

    .product-info h1 {
        font-size: 1.6rem;
        line-height: 1.2;
    }

    .product-price {
        font-size: 1.25rem;
        margin-top: 0.35rem;
    }

    .product-description {
        font-size: 0.98rem;
        margin-top: 0.6rem;
    }

    .product-info .add-to-cart {
        width: 100%;
        padding: 0.9rem;
        font-size: 1rem;
        border-radius: 10px;
        margin-top: 0.8rem;
    }

    /* Similar products list: show 2 columns on small devices, 1 column on very small */
    #similarProducts.products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
        padding: 0;
    }

    @media (max-width: 420px) {
        #similarProducts.products-grid {
            grid-template-columns: 1fr;
        }
    }

    /* Reduce cart overlay size for small phones */
    .cart-overlay {
        width: 100%;
        right: -100%;
    }
}