/* Digilayn Theme - Website */
:root {
    /* Brand Palette */
    --brand-green: #9ACB3E;
    --brand-green-dark: #6EA12B;
    --brand-green-light: #CDEA89;
    --neutral-dark: #303030;
    --neutral-dark-surface: #121212;
    --neutral-variant-light: #E8E8E8;
    --neutral-light-background: #FFFFFF;

    /* Light Theme (Default) */
    --primary: var(--brand-green);
    --on-primary: var(--neutral-dark);
    --primary-container: var(--brand-green-light);
    --on-primary-container: var(--neutral-dark);

    --secondary: var(--brand-green-dark);
    --on-secondary: #FFFFFF;
    --secondary-container: var(--brand-green-light);
    --on-secondary-container: var(--neutral-dark);

    --background: var(--neutral-light-background);
    --on-background: var(--neutral-dark);

    --surface: #FFFFFF;
    --on-surface: var(--neutral-dark);

    --surface-variant: var(--neutral-variant-light);
    --on-surface-variant: rgba(48, 48, 48, 0.75);

    --outline: #E8E8E8;

    --inverse-surface: var(--neutral-dark-surface);
    --inverse-on-surface: #EDEDED;
    --inverse-primary: var(--brand-green-dark);

    --error: #B3261E;
    --on-error: #FFFFFF;
    --error-container: #F9DEDC;
    --on-error-container: #410E0B;

    /* Legacy support / Mapping */
    --primary-pink: var(--primary);
    --text-dark: var(--on-background);
    --text-muted: #666666;
    --warning-yellow: #ffcc00;
    --success-green: #25D366;
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary: var(--brand-green-dark);
        --on-primary: #FFFFFF;
        --primary-container: #26330D;
        --on-primary-container: var(--brand-green-light);

        --secondary: var(--brand-green);
        --on-secondary: var(--neutral-dark);
        --secondary-container: #34440F;
        --on-secondary-container: var(--brand-green-light);

        --background: var(--neutral-dark-surface);
        --on-background: #EDEDED;

        --surface: var(--neutral-dark-surface);
        --on-surface: #EDEDED;

        --surface-variant: #2C2C2C;
        --on-surface-variant: #CCCCCC;

        --outline: #2C2C2C;

        --inverse-surface: #EDEDED;
        --inverse-on-surface: var(--neutral-dark-surface);
        --inverse-primary: var(--brand-green);
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--background);
    color: var(--on-background);
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
}

/* Global Loader */
#global-loader {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--background);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s, visibility 0.5s;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--surface-variant);
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#global-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Navigation */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5%;
    background: var(--surface);
    border-bottom: 1px solid var(--outline);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo-nav img {
    height: 40px;
}

.menu-toggle {
    display: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--on-surface);
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    margin-left: 20px;
    text-decoration: none;
    color: var(--on-surface);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    position: relative;
    padding: 5px 0;
}

/* Selected Tab Styling */
.nav-links a.active {
    color: var(--primary);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
}

.nav-user-link {
    margin-left: 20px;
    font-weight: 600;
    font-size: 13px;
    color: var(--primary) !important;
    text-decoration: none;
}

.cart-icon {
    position: relative;
    cursor: pointer;
    font-size: 18px;
    margin-left: 20px;
    color: var(--on-surface);
}

.cart-count {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--primary);
    color: var(--on-primary);
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
}

/* Hero */
.hero {
    text-align: center;
    padding: 20px 0;
    background: var(--surface-variant);
}

.hero img {
    width: 90%;
    max-width: 900px;
    border-radius: 10px;
}

/* News Banner */
.news-banner {
    background: var(--neutral-dark);
    color: white;
    padding: 12px 5%;
    text-align: center;
    font-size: 14px;
}

.news-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.news-tag {
    background: var(--primary);
    color: var(--on-primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 10px;
    letter-spacing: 1px;
}

/* Products */
.products-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.product-card {
    border: 1px solid var(--outline);
    border-radius: 12px;
    overflow: hidden;
    transition: 0.3s;
    text-align: center;
    padding-bottom: 20px;
    background: var(--surface);
}

.product-img {
    width: 100%;
    height: 380px;
    object-fit: cover;
}

.product-info h3 { margin: 15px 0 5px; color: var(--on-surface); }
.price { color: var(--primary); font-weight: 700; margin-bottom: 15px; }

.btn-add {
    background: var(--primary);
    color: var(--on-primary);
    border: none;
    padding: 10px 30px;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    transition: background 0.3s;
}

.btn-add:hover { background: var(--secondary); }

/* Cart Sidebar */
.cart-sidebar {
    position: fixed;
    right: -400px;
    top: 0;
    width: 350px;
    height: 100%;
    background: var(--surface);
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
    z-index: 2000;
    transition: 0.4s;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.active { right: 0; }

.cart-header {
    padding: 20px;
    border-bottom: 1px solid var(--outline);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--on-surface);
}

.cart-items { flex: 1; overflow-y: auto; padding: 20px; }

.cart-item {
    display: flex;
    margin-bottom: 20px;
    gap: 15px;
    color: var(--on-surface);
}

.cart-item img { width: 70px; height: 70px; object-fit: cover; border-radius: 5px; }

.cart-footer { padding: 20px; border-top: 1px solid var(--outline); background: var(--surface); }

.total-row {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--on-surface);
}

.btn-checkout {
    width: 100%;
    background: var(--primary);
    color: var(--on-primary);
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-checkout:hover { background: var(--secondary); }

/* Checkout Modal & General Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: var(--surface);
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    color: var(--on-surface);
}

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; color: var(--on-surface); }
.form-group input { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid var(--outline); 
    border-radius: 5px; 
    background: var(--background);
    color: var(--on-background);
}

footer { 
    background: var(--neutral-dark-surface); 
    color: #fff; 
    padding: 40px; 
    text-align: center; 
}

/* Responsive Styles */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
        order: 1;
    }
    
    .logo-nav {
        order: 2;
    }

    .cart-icon {
        order: 3;
        margin-left: 0;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--surface);
        flex-direction: column;
        padding: 20px 0;
        border-bottom: 1px solid var(--outline);
        box-shadow: 0 10px 10px rgba(0,0,0,0.05);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links a, .nav-user-link {
        margin: 10px 0;
        width: 100%;
        text-align: center;
    }

    .news-banner {
        font-size: 12px;
    }

    /* Remove active underline on mobile for cleaner look */
    .nav-links a.active::after {
        display: none;
    }
}

@media (max-width: 600px) {
    .cart-sidebar { width: 100%; right: -100%; }
}
