/* --- Safi Design System --- */
:root {
    /* Color Palette */
    --primary-color: #2D6A4F;
    /* Deep Farm Green */
    --primary-light: #40916C;
    --primary-dark: #1B4332;
    --accent-color: #52B788;
    /* Bright Leaf Green */
    --bg-color: #F8F9FA;
    /* Off-white background */
    --surface-color: #FFFFFF;
    /* Pure white for cards */
    --text-main: #212529;
    --text-muted: #6C757D;

    --bg-positive: #e8f5e9;
    --text-positive: #2e7d32;
    --bg-negative: #ffebee;
    --text-negative: #c62828;
    --bg-surface-tint: #f1f8f5;
    --border-tint: #c8e6c9;
    --heading-color: var(--primary-dark);

    /* Layout & Shadows */
    --radius: 12px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
    --primary-color: #52B788;
    --primary-light: #74C69D;
    --primary-dark: #081C15;
    --heading-color: #80ED99;
    --accent-color: #74C69D;
    --bg-color: #121212;
    --surface-color: #1E1E1E;
    --text-main: #E0E0E0;
    --text-muted: #A0A0A0;
    --bg-surface-tint: #0f291e;
    --border-tint: #1b4332;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.5);
    --border-color: rgba(255, 255, 255, 0.1);

    /* Status Colors (Dark Theme) */
    --bg-positive: rgba(82, 183, 136, 0.15);
    --text-positive: #74C69D;
    --bg-negative: rgba(220, 53, 69, 0.15);
    --text-negative: #FF6B6B;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

html {
    scroll-behavior: smooth;
}

/* --- Container & Typography --- */
.container {
    max-width: 1200px;
    margin: 5rem auto;
    padding: 0 1.5rem;
}

h1,
h2,
h3,
h4 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--heading-color);
}

.section-header {
    text-align: center;
    margin-bottom: 3.5rem;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.section-header p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* --- Navigation --- */
.navbar {
    background-color: var(--primary-dark);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: #ffffff;
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a:hover:not(.btn-primary):not(.btn-outline) {
    color: var(--primary-light);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #ffffff;
    cursor: pointer;
}

/* --- Buttons --- */
.btn-primary {
    background-color: var(--primary-color);
    color: #fff !important;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.btn-primary:hover {
    background-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary.large {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    border-radius: 10px;
    margin-top: 1.5rem;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color) !important;
    padding: 0.4rem 1.4rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: #fff !important;
}

.btn-secondary {
    background-color: var(--bg-color);
    color: var(--primary-color);
    border: 1px solid var(--primary-light);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: #fff;
}

/* --- Hero Section --- */
.hero {
    /* Explode background properties to ensure JS only overrides the image safely */
    background-image: linear-gradient(rgba(27, 67, 50, 0.6), rgba(27, 67, 50, 0.8)), url('../images/hero.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    height: 70vh;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #fff;
    padding: 0 1.5rem;
}

.hero-content {
    max-width: 800px;
}

.hero-content h1 {
    font-size: 3.5rem;
    color: #fff;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-content p {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* --- How It Works --- */
.how-it-works {
    background-color: var(--surface-color);
    padding: 1px 0;
    /* Clearfix margin collapse */
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.step-card {
    text-align: center;
    padding: 2rem;
}

.step-icon {
    font-size: 2.5rem;
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    background: var(--bg-color);
    width: 80px;
    height: 80px;
    line-height: 80px;
    border-radius: 50%;
    margin-inline: auto;
}

.step-card h3 {
    margin-bottom: 1rem;
}

/* --- Products Grid --- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
}

.product-card {
    background: var(--surface-color);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.product-img {
    height: 220px;
    background-color: var(--bg-color);
    background-size: cover;
    background-position: center;
    position: relative;
}

.milk-img {
    background-image: url('../images/milk.png');
}

.eggs-img {
    background-image: url('../images/eggs.png');
}

.honey-img {
    background-image: url('../images/honey.png');
}

.product-info {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-tags {
    margin-bottom: 0.5rem;
}

.tag {
    background-color: var(--bg-color);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag.organic {
    background-color: #D8F3DC;
    color: var(--primary-dark);
}

.product-info h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.product-info .description {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.price .unit {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* --- Footer --- */
footer {
    background-color: var(--primary-dark);
    color: #fff;
    padding: 4rem 1.5rem 1.5rem;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-logo h2 {
    color: #fff;
    margin-bottom: 0.5rem;
}

.footer-logo p {
    color: rgba(255, 255, 255, 0.7);
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: #fff;
    text-decoration: none;
    opacity: 0.8;
    transition: var(--transition);
}

.footer-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

/* --- Mobile Responsiveness --- */
.mobile-only {
    display: none !important;
}

@media (max-width: 900px) {
    .hero-content h1 {
        font-size: 2.8rem;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: row;
        justify-content: flex-start;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: flex !important;
        /* So it aligns perfectly within flex containers or nav links */
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.8rem !important;
    }

    .product-img {
        height: 140px;
        /* Compress images to fit nicely on side-by-side view */
    }

    .product-info h3 {
        font-size: 1.1rem;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 260px;
        background-color: var(--surface-color);
        flex-direction: column;
        padding: 1.5rem;
        box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.1);
        border-bottom-right-radius: 12px;
        gap: 1rem;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links a {
        display: flex;
        align-items: center;
        gap: 0.8rem;
        width: 100%;
        text-align: left;
        padding: 0.8rem 1rem;
        border-radius: 8px;
        background: var(--bg-surface-tint);
        color: var(--primary-dark);
        font-weight: 500;
        border: 1px solid var(--border-tint);
    }

    .nav-links a:hover {
        background-color: var(--bg-color);
        color: var(--primary-color) !important;
    }

    .mobile-menu-btn {
        display: block;
    }

    .steps-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .steps-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .hero {
        height: auto;
        min-height: 350px;
        padding-top: 4rem;
        padding-bottom: 4rem;
    }

    .hero-content h1 {
        font-size: 2.2rem;
    }

    .section-header h2 {
        font-size: 2rem;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

/* --- SafiApp Mirror Styles --- */
.pill {
    border-radius: 50px !important;
}

.hero-badge-100 {
    color: #ff3b3b;
    font-family: 'Brush Script MT', cursive;
    font-size: 3rem;
    font-weight: 800;
    transform: rotate(-10deg);
    margin-bottom: -1rem;
    display: inline-block;
}

.hero-micro {
    font-size: 0.95rem !important;
    opacity: 0.9;
    margin-bottom: 1.5rem !important;
}

.hero-btn {
    background: #ffffff !important;
    color: var(--primary-dark) !important;
    font-weight: bold;
}

.hero-btn:hover {
    background: #e8f5e9 !important;
}

.btn-add-to-order {
    background-color: #e8f5e9;
    color: #2e7d32;
    border-radius: 20px;
    padding: 0.6rem 1rem;
    border: none;
    font-weight: 600;

    .footer-content {
        max-width: 1200px;
        margin: 0 auto;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 2rem;
        margin-bottom: 2rem;
    }

    .footer-logo h2 {
        color: #fff;
        margin-bottom: 0.5rem;
    }

    .footer-logo p {
        color: rgba(255, 255, 255, 0.7);
    }

    .footer-links {
        display: flex;
        gap: 1.5rem;
    }

    .footer-links a {
        color: #fff;
        text-decoration: none;
        opacity: 0.8;
        transition: var(--transition);
    }

    .footer-links a:hover {
        opacity: 1;
        text-decoration: underline;
    }

    .footer-bottom {
        text-align: center;
        padding-top: 2rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        color: rgba(255, 255, 255, 0.6);
        font-size: 0.9rem;
    }

    /* --- Mobile Responsiveness --- */
    .mobile-only {
        display: none !important;
    }

    @media (max-width: 900px) {
        .hero-content h1 {
            font-size: 2.8rem;
        }
    }

    @media (max-width: 768px) {
        .nav-container {
            flex-direction: row;
            justify-content: flex-start;
        }

        .desktop-only {
            display: none !important;
        }

        .mobile-only {
            display: flex !important;
            /* So it aligns perfectly within flex containers or nav links */
        }

        .products-grid {
            grid-template-columns: repeat(2, 1fr) !important;
            gap: 0.8rem !important;
        }

        .product-img {
            height: 140px;
            /* Compress images to fit nicely on side-by-side view */
        }

        .product-info h3 {
            font-size: 1.1rem;
        }

        .nav-links {
            display: none;
            position: absolute;
            top: 100%;
            left: 0;
            width: 260px;
            background-color: var(--surface-color);
            flex-direction: column;
            padding: 1.5rem;
            box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.1);
            border-bottom-right-radius: 12px;
            gap: 1rem;
        }

        .nav-links.active {
            display: flex;
        }

        .nav-links a {
            display: flex;
            align-items: center;
            gap: 0.8rem;
            width: 100%;
            text-align: left;
            padding: 0.8rem 1rem;
            border-radius: 8px;
            background: var(--bg-surface-tint);
            color: var(--primary-dark);
            font-weight: 500;
            border: 1px solid var(--border-tint);
        }

        .nav-links a:hover {
            background-color: var(--bg-color);
            color: var(--primary-color) !important;
        }

        .mobile-menu-btn {
            display: block;
        }

        .steps-grid {
            grid-template-columns: 1fr;
            gap: 1rem;
        }

        .steps-grid {
            grid-template-columns: 1fr;
            gap: 1rem;
        }

        .hero {
            height: auto;
            min-height: 350px;
            padding-top: 4rem;
            padding-bottom: 4rem;
        }

        .hero-content h1 {
            font-size: 2.2rem;
        }

        .section-header h2 {
            font-size: 2rem;
        }

        .footer-content {
            flex-direction: column;
            text-align: center;
        }
    }

    /* --- SafiApp Mirror Styles --- */
    .pill {
        border-radius: 50px !important;
    }

    .hero-badge-100 {
        color: #ff3b3b;
        font-family: 'Brush Script MT', cursive;
        font-size: 3rem;
        font-weight: 800;
        transform: rotate(-10deg);
        margin-bottom: -1rem;
        display: inline-block;
    }

    .hero-micro {
        font-size: 0.95rem !important;
        opacity: 0.9;
        margin-bottom: 1.5rem !important;
    }

    .hero-btn {
        background: #ffffff !important;
        color: var(--primary-dark) !important;
        font-weight: bold;
    }

    .hero-btn:hover {
        background: #e8f5e9 !important;
    }

    .btn-add-to-order {
        background-color: #e8f5e9;
        color: #2e7d32;
        border-radius: 20px;
        padding: 0.6rem 1rem;
        border: none;
        font-weight: 600;
        cursor: pointer;
        width: 100%;
        transition: all 0.3s ease;
    }

    .btn-add-to-order:hover {
        background-color: #c8e6c9;
    }

    .bottom-nav-inner {
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        display: flex !important;
        gap: 1.5rem !important;
        padding: 0 1.5rem !important;
    }

    .bottom-nav-inner::-webkit-scrollbar {
        display: none !important;
    }

    .bottom-nav-inner .bn-item {
        min-width: max-content !important;
        flex-shrink: 0 !important;
    }