/* --- Global Variables and Resets --- */
:root {
    --primary-green: #2a9d8f;
    --primary-orange: #f4a261;
    --dark-blue: #264653;
    --light-grey: #f8f9fa;
    --white: #ffffff;
    --text-color: #333;
    --border-color: #e9ecef;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.07);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--light-grey);
    color: var(--text-color);
    line-height: 1.6;
}

/* --- Header Styles --- */
.main-header {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 15px 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: background-color 0.4s ease, box-shadow 0.4s ease;
    border-bottom: 1px solid transparent;
}

.main-header.scrolled {
    background-color: var(--white);
    box-shadow: var(--shadow);
    border-bottom: 1px solid var(--border-color);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 45px;
    margin-right: 10px;
}

.logo h1 {
    font-size: 1.8em;
    color: var(--dark-blue);
    font-weight: 600;
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 30px;
}

.main-nav a {
    text-decoration: none;
    color: var(--dark-blue);
    font-weight: 500;
    position: relative;
    padding-bottom: 5px;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-green);
    transition: width 0.3s ease;
}

.main-nav a:hover::after,
.main-nav a.active::after { /* Make active link underlined */
    width: 100%;
}

/* --- Header Actions (Search, User, Cart) --- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: #f0f2f5;
    border-radius: 50px;
    padding: 5px;
}

.search-bar input {
    border: none;
    background: transparent;
    padding: 8px 15px;
    outline: none;
    width: 200px;
}

.search-bar button {
    border: none;
    background-color: var(--primary-green);
    color: var(--white);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.search-bar button:hover {
    background-color: #248a7f;
}

.user-icon {
    font-size: 1.8em;
    color: var(--dark-blue);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
}

.user-icon:hover {
    background-color: #e9ecef;
}

.user-icon span {
    font-size: 0.5em;
    font-weight: 500;
    margin-left: 8px;
    white-space: nowrap;
}

.user-menu {
    position: relative;
}

.user-dropdown-menu {
    position: absolute;
    top: 120%;
    right: 0;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    list-style: none;
    padding: 10px 0;
    margin: 0;
    width: 180px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease-out;
}

.user-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--dark-blue);
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
}

.user-dropdown-menu li a:hover {
    background-color: var(--light-grey);
    color: var(--primary-green);
}

.user-dropdown-menu li a i {
    margin-right: 12px;
    width: 16px;
    color: var(--primary-orange);
}


.cart-icon {
    font-size: 1.7em;
    color: var(--dark-blue);
    cursor: pointer;
    position: relative;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -10px;
    background-color: var(--primary-orange);
    color: var(--white);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.6em;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
}

/* --- Main Content --- */
main {
    padding-top: 100px; /* Adjust for fixed header height */
    max-width: 1400px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* --- Hero Slider --- */
.hero-slider {
    background-color: var(--white);
    border-radius: 12px;
    padding: 40px;
    margin-bottom: 40px;
    overflow: hidden;
    position: relative; /* Needed for slide positioning */
    height: 400px; /* Set a fixed height for visual stability */
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 40px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out;
}

.slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 10;
}


.slide-content {
    max-width: 50%;
}

.slide-content h2 {
    font-size: 3em;
    color: var(--dark-blue);
    margin-bottom: 15px;
}

.slide-content p {
    font-size: 1.1em;
    margin-bottom: 25px;
    color: #555;
}

.slide-image img {
    max-width: 100%;
    border-radius: 12px;
}

/* --- Category Tiles --- */
.category-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* This is a clickable link now */
.category-tile, a.category-tile {
    background: linear-gradient(135deg, var(--primary-green), #248a7f);
    color: var(--white);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    text-decoration: none; /* Add this */
    position: relative; /* Add this */
    overflow: hidden;  /* Add this */
    
    /* --- CHANGE 1: Added background-color to the transition --- */
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.category-tile:hover, a.category-tile:hover {
    transform: translateY(-5px);
    
    /* --- CHANGE 2: Set background to orange on hover --- */
    background: var(--primary-orange); 
    box-shadow: 0 8px 25px rgba(244, 162, 97, 0.3); /* Updated shadow to match orange */
}

.category-tile h3 {
    font-weight: 500;
    position: relative; /* Keep text on top */
    z-index: 2;
}

/* Style for category tile background images */
.category-tile {
    background-size: cover;
    background-position: center;
}
.category-tile::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.4); /* Dark overlay */
    z-index: 1;
    transition: background-color 0.3s ease;
}
.category-tile:hover::before {
    background-color: rgba(0,0,0,0.2); /* Lighten overlay on hover */
}


/* --- Product Sections --- */
.product-section {
    margin-bottom: 50px;
}

.product-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.product-section h2 {
    color: var(--dark-blue);
    font-size: 1.8em;
}

.see-all-link {
    text-decoration: none;
    color: var(--primary-green);
    font-weight: 500;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
}

.product-card {
    background-color: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    /* --- ADDED: Flex properties for attribute display --- */
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.product-image {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 Aspect Ratio */
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wishlist-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2em;
    color: var(--primary-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.wishlist-btn:hover {
    background-color: var(--white);
}

.product-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-name {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 10px;
}

.product-name a {
    text-decoration: none;
    color: var(--dark-blue);
}

.product-price {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--primary-green);
    margin-bottom: 15px;
}

/* --- NEW: Attribute Display Styles --- */
.product-attributes {
    font-size: 0.8em;
    color: #555;
    margin-bottom: 15px;
    flex-grow: 1; /* This pushes the button to the bottom */
    min-height: 30px; 
}

.attr-group {
    margin-bottom: 4px;
}

.attr-group strong {
    color: #333;
}


/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 10px 25px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary-green);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--dark-blue);
    transform: translateY(-2px);
}

.add-to-cart-btn {
    width: 100%;
    background-color: var(--primary-orange);
    color: var(--white);
    margin-top: auto; /* Sticks button to the bottom of the flex container */
}

.add-to-cart-btn:hover {
    background-color: #e8924b;
    transform: translateY(-2px);
}

/* --- Shopping Cart Modal --- */
.cart-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.cart-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cart-modal {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background-color: var(--white);
    z-index: 1002;
    transition: right 0.4s ease-in-out;
    display: flex;
    flex-direction: column;
}

.cart-modal.active {
    right: 0;
}

.cart-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.cart-modal-header h2 {
    color: var(--dark-blue);
}

.close-cart-btn {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: #aaa;
}

.cart-modal-body {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.cart-item-image {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.cart-item-details {
    flex-grow: 1;
}

.cart-item-name {
    font-size: 1em;
    font-weight: 500;
    color: var(--dark-blue);
    margin-bottom: 5px;
}

.cart-item-price {
    font-size: 0.9em;
    color: #777;
}

.cart-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    width: 100px;
}

.item-quantity {
    width: 60px;
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    text-align: center;
    font-size: 0.9em;
}

.remove-item-btn {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 1.2em;
    cursor: pointer;
    transition: color 0.2s;
}

.remove-item-btn:hover {
    color: #c0392b;
}

.item-total {
    font-weight: 600;
    font-size: 0.95em;
    color: var(--primary-green);
}

.cart-modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 20px;
}

.checkout-btn {
    width: 100%;
}


/* --- NEW FOOTER STYLES --- */
.main-footer {
    background-color: var(--dark-blue);
    color: var(--light-grey);
    padding: 40px 0;
    margin-top: 50px;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 30px;
}

.footer-section {
    flex-basis: 200px;
    flex-grow: 1;
}

.footer-section h4 {
    color: var(--primary-green);
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 600;
}

.footer-section p {
    font-size: 0.9em;
    margin-bottom: 10px;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li a {
    color: var(--light-grey);
    text-decoration: none;
    display: block;
    padding: 5px 0;
    font-size: 0.9em;
    transition: color 0.3s;
}

.footer-section ul li a:hover {
    color: var(--primary-orange);
}

.social-links a {
    color: var(--white);
    font-size: 1.5em;
    margin-right: 15px;
    transition: color 0.3s;
}

.social-links a:hover {
    color: var(--primary-green);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 30px;
    font-size: 0.8em;
}

/* 1. Toast Notification Container */
#toast-container {
    position: fixed;
    top: 90px; /* Below the header */
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

/* 2. Individual Toast Message */
.toast-message {
    padding: 15px 25px;
    border-radius: 8px;
    color: var(--white);
    font-weight: 500;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s ease-in-out;
}

/* 3. Toast Types */
.toast-message.success {
    background-color: var(--primary-green);
}
.toast-message.error {
    background-color: #e74c3c; /* Red color for errors */
}

/* 4. Animation Classes */
.toast-message.show {
    opacity: 1;
    transform: translateX(0);
}
.toast-message.hide {
    opacity: 0;
    transform: translateX(100%);
}

/* =========================================
   COMPREHENSIVE RESPONSIVE STYLES (Front Page)
   ========================================= */

/* --- TABLET VIEW (max-width: 1024px) --- */
@media screen and (max-width: 1024px) {
    
    /* 1. Container Widths */
    .header-container, 
    main, 
    .footer-container {
        padding: 0 30px; /* More breathing room on sides */
    }

    /* 2. Hero Slider (Tablet) */
    .hero-slider {
        height: 350px; /* Slightly shorter than desktop */
    }
    .slide {
        padding: 0 40px;
    }
    .slide-content h2 {
        font-size: 2.2rem;
    }

    /* 3. Product Grid (3 Columns) */
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

/* --- MOBILE VIEW (max-width: 768px) --- */
@media screen and (max-width: 768px) {

    /* 1. Header & Navigation */
    .main-header {
        padding: 10px 0;
    }

    .header-container {
        padding: 0 15px;
        position: relative;
    }

    /* Hide Desktop Menu */
    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--white);
        box-shadow: 0 10px 15px rgba(0,0,0,0.1);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-in-out;
        flex-direction: column;
    }

    /* When active class is added via JS */
    .main-nav.active {
        max-height: 300px; /* Enough height for links */
        border-bottom: 1px solid var(--border-color);
    }

    .main-nav ul {
        flex-direction: column;
        padding: 20px;
        gap: 15px;
        text-align: center;
    }

    /* Search Bar Adjustment */
    .search-bar input {
        width: 140px; /* Shrink search input */
    }

    /* 2. Hero Slider (Mobile Stacked) */
    .hero-slider {
        height: auto;
        min-height: 400px;
        padding: 20px 0;
    }

    .slide {
        flex-direction: column-reverse; /* Text below image */
        text-align: center;
        padding: 20px;
        justify-content: center;
    }

    .slide-image img {
        height: 180px; /* Smaller image */
        margin-bottom: 20px;
    }

    .slide-content {
        max-width: 100%;
    }

    .slide-content h2 {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }

    .slide-content p {
        font-size: 1rem;
        margin-bottom: 15px;
    }

    /* 3. Category Tiles (2 Columns) */
    .category-tiles {
        grid-template-columns: repeat(2, 1fr); 
        gap: 15px;
        margin: 30px 0;
    }

    .category-tile {
        height: 120px; /* Shorter tiles */
        font-size: 1rem;
    }

    /* 4. Product Grid (2 Columns) */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .product-card {
        padding: 10px;
    }

    .product-image img {
        height: 150px;
    }

    .product-info h3 {
        font-size: 0.95rem;
    }

    .product-price {
        font-size: 1.1rem;
    }

    .btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }

    /* 5. Footer (Stacked) */
    .footer-container {
        grid-template-columns: 1fr; /* Single column */
        text-align: center;
        gap: 30px;
    }

    .footer-section {
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding-bottom: 20px;
    }

    .footer-section:last-child {
        border-bottom: none;
    }
}

/* --- SMALL MOBILE VIEW (max-width: 480px) --- */
@media screen and (max-width: 480px) {
    
    /* Hide Logo Text to save space */
    .logo h1 {
        display: none; 
    }
    
    .logo img {
        height: 35px; /* Smaller Logo */
    }

    /* Simplify Header Actions */
    .header-actions {
        gap: 10px;
    }
    
    .search-bar {
        background: transparent; /* Remove grey bg to save space */
    }
    
    .search-bar input {
        width: 100px;
        background: #f0f2f5;
        border-radius: 4px;
    }

    /* 1 Column for Products on very small screens */
    .product-grid {
        grid-template-columns: 1fr; 
    }
    
    .product-image img {
        height: 200px; /* Larger image since it's full width */
    }
}