@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

:root {
    --primary-green: #2e7d32;
    --secondary-green: #66bb6a;
    --light-green: #c8e6c9;
    --background-light: #f4f9f4;
    --text-dark: #333;
    --footer-text: #fff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--background-light);
    color: var(--text-dark);
    line-height: 1.6;
}

/* --- Header --- */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5%;
    background-color: var(--primary-green);
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.logo {
    max-height: 60px;
    border-radius: 50px;
}

.menu-toggle {
    display: none;
    font-size: 1.8rem;
    color: var(--footer-text);
    cursor: pointer;
    background: none;
    border: none;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 25px;
}

.nav-links li a {
    color: var(--footer-text);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links li a:hover {
    color: var(--light-green);
}

.login-btn button {
    padding: 0.6em 1.6em;
    background: linear-gradient(135deg, var(--secondary-green), #43a047);
    border: none;
    border-radius: 50px;
    color: var(--footer-text);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 187, 106, 0.4);
    transition: all 0.3s ease;
}

.login-btn button:hover {
    background: linear-gradient(135deg, #43a047, var(--primary-green));
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 187, 106, 0.6);
}

/* --- Slider --- */
.slider {
    position: relative;
    width: 100%;
    height: 50vh;
    overflow: hidden; /* This hides images outside the viewport */
    background: #000;
    /*background-color: red;*/
}

.slides-container {
    display: flex; /* This makes the images line up horizontally */
    width: 500%; /* Total width for 5 slides (100% per slide) */
    height: 100%;
    animation: slide-show 25s linear infinite; /* Adjust duration for speed */
}

@keyframes slide-show {
    0% { transform: translateX(0%); }
    20% { transform: translateX(-20%); } /* Slides to the second image */
    40% { transform: translateX(-40%); } /* Slides to the third image */
    60% { transform: translateX(-60%); } /* Slides to the fourth image */
    80% { transform: translateX(-80%); } /* Slides to the fifth image */
    100% { transform: translateX(-100%); } /* Loops back to the start */
}

.slide {
    width: 20%;
    height: 100%;
    object-fit: contain;
    flex-shrink: 0;
}

/* Increase visible image width while keeping height unchanged */
.slide {
    display: block;
    transform-origin: center center; /* scale from center */
    transform: scaleX(1.15); /* increase width by 15% without changing height */
}

/* --- Products Section --- */
.product-comparison {
    text-align: center;
    padding: 40px 5%;
}

.product-comparison h2 {
    color: var(--primary-green);
    margin-bottom: 25px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.product-card {
    background-color: var(--footer-text);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: left;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

.product-card h3 {
    color: var(--primary-green);
    margin-bottom: 10px;
}

.product-card button {
    margin-top: 8px;
    padding: 8px 16px;
    background-color: var(--primary-green);
    color: var(--footer-text);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
}

.product-card button:hover {
    background-color: #1b5e20;
    transform: scale(1.05);
}

.product-img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 10px;
}

/* --- Footer --- */
.footer {
    background-color: var(--primary-green);
    color: var(--footer-text);
    padding: 3em 5%;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2em;
    flex-wrap: wrap;
}

.footer-section {
    flex: 1;
    min-width: 250px;
}

.footer-section h4 {
    margin-bottom: 1em;
    font-size: 1.2rem;
    border-bottom: 2px solid var(--light-green);
    display: inline-block;
    padding-bottom: 0.3em;
}

.footer-section p,
.footer-section a {
    font-size: 0.9rem;
    color: var(--footer-text);
    line-height: 1.6;
    text-decoration: none;
}

.footer-section a:hover {
    color: var(--light-green);
}

.footer-bottom {
    text-align: center;
    margin-top: 2em;
    border-top: 1px solid var(--light-green);
    padding-top: 1em;
    font-size: 0.85rem;
}

.social-icons {
    margin-top: 1em;
    display: flex;
    gap: 15px;
}

.social {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--footer-text);
    color: var(--primary-green);
    font-size: 1.2rem;
    transition: all 0.3s ease;
    text-decoration: none;
}

.social:hover {
    background: var(--light-green);
    color: #1b5e20;
    transform: scale(1.1);
}

/* Image icon inside social link. Hidden by default until it successfully loads. */
.social .social-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: none; /* keep icon visible until image loads */
}

.social i {
    display: inline-block; /* visible fallback */
}

/* --- Popup --- */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.popup-overlay.active {
    display: flex;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.popup-content {
    background-color: var(--footer-text);
    padding: 1.5em;
    border-radius: 1em;
    width: 90%;
    max-width: 400px;
    text-align: center;
    position: relative;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Product popup specific responsive layout (scoped to avoid changing login popup) */
#productPopup .popup-content {
    width: min(95%, 900px);
    max-width: 900px;
    max-height: 90vh; /* keep popup within viewport height */
    padding: 1rem;
    display: flex;
    gap: 1rem;
    align-items: stretch;
    overflow: hidden; /* inner area handles scrolling */
}

/* Hide the previous ingredients/quantity text grid inside the product popup
   — we want the table-only view, so keep the markup but hide the grid and inline
   paragraph placeholders. The table below will always be visible. */
#productPopup .product-details-grid,
#productPopup #popupIngredients,
#productPopup #popupQuantity {
    display: none !important;
}

#productPopup .product-popup-body {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: nowrap;
    flex: 1 1 auto;
    overflow: auto; /* scroll the content if it's taller than max-height */
}

#productPopup .product-popup-image {
    flex: 0 0 320px; /* fixed-ish column for image on wide screens */
    display: flex;
    align-items: center;
    justify-content: center;
}

#productPopup .product-popup-image img {
    width: 100%;
    height: auto;
    max-height: calc(90vh - 120px);
    object-fit: contain;
}

#productPopup .product-popup-info {
    flex: 1 1 auto;
    overflow: auto; /* allow text to scroll inside info column */
    padding-right: 0.25rem;
}

/* On small screens stack vertically and make image full-width */
@media (max-width: 700px) {
    #productPopup .popup-content {
        flex-direction: column;
        padding: 1rem;
    }

    #productPopup .product-popup-body {
        flex-direction: column;
        gap: 0.75rem;
    }

    #productPopup .product-popup-image {
        flex: 0 0 auto;
        width: 100%;
    }

    #productPopup .product-popup-image img {
        max-height: none;
        width: 100%;
    }
}

.popup-content input {
    width: 100%;
    padding: 0.8em;
    margin: 0.6em 0;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
}

.popup-content .btn,
.popup-content .send-otp-btn {
    width: 100%;
    padding: 0.8em;
    font-size: 1rem;
    background-color: var(--primary-green);
    color: var(--footer-text);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 0.5em;
}

.popup-content .btn:hover,
.popup-content .send-otp-btn:hover {
    background-color: #1b5e20;
}

.popup-content .btn:disabled,
.popup-content .send-otp-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.popup-content .small {
    margin-top: 1em;
    font-size: 0.9rem;
    color: #666;
}

.popup-content .small a {
    color: var(--primary-green);
    text-decoration: none;
    cursor: pointer;
}

.popup-content .small a:hover {
    text-decoration: underline;
}

/* Cart button in header */
.cart-btn {
    display: inline-block;
    margin-left: 12px;
}
.cart-btn button {
    padding: 0.5em 1em;
    background: linear-gradient(135deg, var(--secondary-green), #43a047);
    color: var(--footer-text);
    border: none;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
}

/* Cart popup styles */
.cart-popup {
    max-width: 900px;
    width: 95%;
}
#cartTable {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}
#cartTable th, #cartTable td {
    padding: 8px;
    border: 1px solid #eaeaea;
    text-align: left;
}
.cart-summary {
    margin-top: 12px;
    text-align: right;
}
.add-cart-btn, .remove-cart-btn {
    margin-left: 8px;
    padding: 6px 10px;
    background: var(--primary-green);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}
.add-cart-btn:hover, .remove-cart-btn:hover { background: #1b5e20; }

@media (max-width: 700px) {
    #cartTable thead { display: none; }
    #cartTable tr { display: block; margin-bottom: 12px; }
    #cartTable td { display: block; border: none; padding: 6px 0; }
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-dark);
    background: none;
    border: none;
}

/* Product popup specific styles */
.product-popup-body {
    display: flex;
    gap: 1em;
    align-items: flex-start;
    flex-wrap: wrap;
}

.product-popup-image img {
    width: 220px;
    max-width: 45vw;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
    background: #fff;
}

.product-popup-info {
    flex: 1 1 200px;
    text-align: left;
}

.product-popup-info h2 {
    margin-top: 0;
    color: var(--primary-green);
}

.product-popup-info p {
    margin: 6px 0;
}

.product-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.product-details-col h4 {
    margin: 0 0 6px 0;
    font-size: 0.95rem;
    color: var(--primary-green);
}

.product-details-col p {
    margin: 0;
    color: #444;
}

@media (max-width: 600px) {
    .product-details-grid { grid-template-columns: 1fr; }
}

/* Table for popup details */
.product-details-table-wrap {
    margin-top: 12px;
    overflow-x: auto;
}

#popupTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 0.95rem;
}

#popupTable thead th {
    text-align: left;
    padding: 8px;
    background: var(--light-green);
    color: #084010;
    border: 1px solid #e6e6e6;
}

#popupTable td {
    padding: 8px;
    border: 1px solid #eaeaea;
    vertical-align: top;
    color: #333;
}

@media (max-width: 480px) {
    #popupTable thead th, #popupTable td { padding: 6px; font-size: 0.9rem; }
}

@media (max-width: 600px) {
    .product-popup-body {
        flex-direction: column;
        align-items: center;
    }

    .product-popup-image img {
        max-width: 80vw;
    }
}

/* --- Responsive Design (Mobile-First) --- */
@media (max-width: 768px) {
    .site-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav {
        display: none;
        width: 100%;
    }

    .nav.show {
        display: block;
    }

    .nav-links {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .login-btn {
        margin-top: 10px;
    }

    .menu-toggle {
        display: block;
        position: absolute;
        top: 20px;
        right: 20px;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
    }

    .footer-section {
        min-width: unset;
    }

    .footer-section h4 {
        border-bottom: none;
    }

    .social-icons {
        justify-content: center;
    }
}
