/* --- NEW: Brand Color Palette & Font --- */
:root {
    --brand-green: #7fa87a;
    /* Primary green used for buttons/links */
    --brand-green-dark: #2d4a3e;
    /* Deeper, richer green */
    --brand-green-light: #8fbc8f;
    /* Softer sage green */
    --brand-orange: #e07a5f;
    /* Terracotta orange */
    --brand-background: #faf9f6;
    /* Off-white/Paper white */
    --brand-text: #2c3e50;
    /* Dark blue-gray for text */
    --brand-accent: #f4a261;
    /* Sandy orange for accents */
    --font-family-brand: 'Nunito', system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 12px;
    --radius-lg: 24px;
}

/* --- Universal Box Sizing --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    max-width: 100%;
    overflow-x: hidden;
    margin: 0 auto;
    padding: 0;
    font-family: var(--font-family-brand);
    background-color: var(--brand-background);
    color: var(--brand-text);
}

/* --- NEW: Container for Header Image and Benefits Bar --- */
.header-group {
    max-width: 1200px;
    margin: 0 auto 2rem;
    /* Center the group and add space below */
}

/* --- NEW: Mobile Category Navigation --- */
.mobile-category-nav {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid #e0e0d1;
    position: fixed;
    /* Changed from sticky to fixed */
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    /* Fixed height for consistency */
    z-index: 100;
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
    align-items: center;
    /* Center items vertically */
}

.mobile-category-nav::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar Chrome/Safari */
}

.category-pill {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #f0f2f5;
    border-radius: 999px;
    text-decoration: none;
    color: var(--brand-text);
    font-weight: 600;
    font-size: 0.9rem;
    transition: background-color 0.2s ease, color 0.2s ease;
    border: 1px solid transparent;
}

.category-pill:hover {
    background: var(--brand-green-light);
    color: #fff;
}

.category-pill:active {
    background: var(--brand-green-dark);
    color: #fff;
}

/* --- Full-width Header Image (within its container) --- */
.header-banner img {
    width: 100%;
    height: auto;
    display: block;
}

/* --- Benefits Bar (aligned under image) --- */
.site-header-benefits {
    background-color: var(--brand-green-dark);
    color: #fff;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}

.benefit-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    /* Add some space between check and text */
}

.main-container {
    padding: 0 1.5rem 2rem;
    /* Adjusted top padding */
    max-width: 1200px;
    margin: 0 auto;
}

.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
}

.panel {
    margin-bottom: 1.5rem;
}

h3 {
    margin: 0 0 .5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand-green-dark);
}

/* <!-- MODIFIED: Removed old hit styles, new styles are below --> */

.topbar {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.topbar>* {
    flex: 1 1 auto;
}

/* --- UPDATED: Styles for collapsible filter panel --- */
.filter-panel details {
    border: 1px solid #e0e0d1;
    border-radius: 8px;
    margin-bottom: 1rem;
    background-color: #fff;
}

.filter-panel summary {
    font-weight: 600;
    padding: 0.75rem 1rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f7f5e9;
    border-radius: 8px 8px 0 0;
}

.filter-panel details[open] summary {
    border-bottom: 1px solid #e0e0d1;
}

.filter-panel summary::-webkit-details-marker {
    display: none;
}

.filter-panel summary::after {
    content: '▾';
}

.filter-panel details[open] summary::after {
    content: '▴';
}

.filter-panel-body {
    padding: 1rem;
}

.facet-search-container {
    margin-bottom: 0.5rem;
}

/* --- NEW: Clear Filters button styles --- */
.clear-filters-container {
    margin-bottom: 1rem;
}

/* Simplified, no gradients/shadows. Match filter panel look. */

/* Match the "Show more" pill look */
.clear-filters-button,
.ais-ClearRefinements-button {
    appearance: none;
    display: block;
    width: 100%;
    padding: 0.55rem 1rem;
    border: 1px solid #cfd2e5;
    /* soft bluish like show more */
    border-radius: 10px;
    background: #fff;
    color: #1f2432;
    /* dark text similar to theme */
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 0 0 2px rgba(207, 210, 229, 0.35) inset;
    /* subtle inner ring */
    background-image: none !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.clear-filters-button:hover,
.ais-ClearRefinements-button:hover {
    border-color: #b9bedb;
    box-shadow: 0 0 0 2px rgba(185, 190, 219, 0.5) inset;
}

/* Disabled state - clearly muted, no fades */
.ais-ClearRefinements-button--disabled,
.clear-filters-button:disabled {
    background: #fff;
    border-color: #e6e8f2;
    color: #9aa0b2;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.7;
}

/* --- NEW: Homepage Action Buttons Styles --- */
.homepage-action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0 3rem 0;
    flex-wrap: wrap;
}

.action-button {
    display: inline-block;
    text-decoration: none;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    min-width: 140px;
}

.facebook-button {
    background-color: #3b5998;
    /* Facebook blue */
    color: #fff;
}

.facebook-button:hover {
    background-color: #2d4373;
    /* Darker blue */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 89, 152, 0.3);
}

.email-button {
    background-color: var(--brand-orange);
    color: #fff;
}

.email-button:hover {
    background-color: #d66043;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 111, 81, 0.3);
}

/* --- NEW: Static Homepage Styles --- */
.static-homepage {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: linear-gradient(180deg, var(--brand-background) 0%, #fff 100%);
}

.homepage-hero {
    padding: 4rem 1.5rem 6rem;
    text-align: center;
    background-image: radial-gradient(circle at 20% 20%, rgba(143, 188, 143, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(224, 122, 95, 0.08) 0%, transparent 40%);
    border-bottom-left-radius: 50% 20px;
    border-bottom-right-radius: 50% 20px;
    margin-bottom: 3rem;
}

.homepage-content {
    max-width: 900px;
    margin: 0 auto;
}

.homepage-content h1 {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--brand-green-dark);
    margin-bottom: 1rem;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.homepage-description {
    font-size: 1.35rem;
    color: #556b63;
    margin-bottom: 3rem;
    line-height: 1.6;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Container for the Search Bar and Button --- */
.search-container {
    position: relative;
    display: flex;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
    border-radius: 50px;
    background: white;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.search-container:hover,
.search-container:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* --- Style the Search Input Field --- */
.search-input {
    width: 100%;
    padding: 1.2rem 80px 1.2rem 2rem;
    /* More padding */
    font-size: 1.1rem;
    border: 2px solid transparent;
    /* Transparent border initially */
    border-radius: 50px;
    outline: none;
    background: transparent;
    color: var(--brand-text);
}

.search-input::placeholder {
    color: #9ca3af;
}

.search-input:focus {
    border-color: var(--brand-green-light);
    box-shadow: none;
    /* Handled by container */
}

/* --- Amazon-style Search Button --- */
.search-button {
    position: absolute;
    right: 6px;
    top: 6px;
    bottom: 6px;
    width: 60px;
    border-radius: 50%;
    /* Circle button */
    border: none;
    cursor: pointer;
    background-color: var(--brand-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.search-button:hover {
    background-color: #d66043;
    transform: scale(1.05);
}

.search-button svg {
    color: #fff;
    width: 24px;
    height: 24px;
}

.search-subtext {
    margin-top: 1rem;
    font-size: 1rem;
    color: #5f7068;
    text-align: center;
}

/* --- Removed old search button styles as they are now integrated above --- */

.homepage-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 4rem auto;
    max-width: 1100px;
    padding: 0 1.5rem;
}

.feature-card {
    background: #fff;
    padding: 2.5rem 2rem;
    border-radius: var(--radius-lg);
    border: none;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: var(--brand-green-light);
    transition: height 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.feature-card:hover::before {
    height: 100%;
    opacity: 0.05;
}

.feature-card h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--brand-green-dark);
    margin-bottom: 1rem;
    position: relative;
}

.feature-card p {
    color: #666;
    line-height: 1.6;
    margin: 0;
    font-size: 1.05rem;
    position: relative;
}


/* --- Social Proof Section (Marquee in Hero) --- */
.social-proof-section {
    margin: 2rem 0 0 0;
    /* Top margin only */
    padding: 1rem 0;
    background: transparent;
    /* Transparent background for hero integration */
    overflow: hidden;
    width: 100%;
}

.social-proof-heading {
    text-align: center;
    font-size: 1.2rem;
    /* Smaller heading for hero context */
    font-weight: 700;
    color: var(--brand-text);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    opacity: 0.8;
}

.testimonial-marquee {
    width: 100%;
    position: relative;
    overflow: hidden;
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.testimonial-track {
    display: flex;
    gap: 1.5rem;
    width: max-content;
    animation: scroll 90s linear infinite;
    padding: 0.5rem 0;
    /* Minimal padding */
    align-items: center;
}

.testimonial-track:hover {
    animation-play-state: paused;
}

@keyframes scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
        /* Move half the width */
    }
}

.testimonial-image {
    height: 120px;
    /* Fixed height for consistent marquee */
    width: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    flex-shrink: 0;
    display: block;
}

.testimonial-image:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
    z-index: 10;
}

/* --- NEW: Homepage Products Section Styles --- */
.homepage-products-section {
    margin: 4rem auto;
    max-width: 1200px;
    padding: 0 1.5rem;
}

.homepage-products-section .homepage-products-heading {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--brand-green-dark);
    margin: 0 0 0.5rem;
    line-height: 1.2;
    text-align: left;
}

.homepage-products-last-updated {
    font-size: 0.95rem;
    font-family: var(--font-family-brand);
    color: var(--brand-green-light);
    margin: 0 0 2rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
}

.homepage-category-sections {
    display: flex;
    flex-direction: column;
    gap: 4rem;
    margin-top: 2rem;
}

.homepage-category-section {
    background: transparent;
    border: none;
    padding: 0;
}

.homepage-category-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.homepage-category-copy h3 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--brand-green-dark);
}

.homepage-category-copy p {
    margin: 0.35rem 0 0;
    color: #555;
    font-size: 0.95rem;
}

.homepage-category-cta {
    text-decoration: none;
    font-weight: 700;
    color: #fff;
    background: var(--brand-green-dark);
    padding: 0.65rem 1.5rem;
    border-radius: 999px;
    transition: background-color 0.2s ease, transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.homepage-category-cta:hover {
    background: #2a4430;
    transform: translateY(-1px);
}

.homepage-loading-message,
.homepage-load-error {
    text-align: center;
    padding: 2rem 1rem;
    font-weight: 600;
    color: #555;
}

.homepage-empty-state {
    padding: 2rem;
    margin: 0 auto;
    border: 1px dashed #e0e0d1;
    border-radius: 12px;
    background: #f9f7ef;
    color: #777;
    font-weight: 600;
    width: 100%;
}

.homepage-products-carousel {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.homepage-products-track-wrapper {
    overflow: hidden;
    flex: 1;
    min-width: 0;
    width: 100%;
}

.homepage-products-track {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 1rem 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x;
}

.homepage-products-track::-webkit-scrollbar {
    display: none;
}

.carousel-nav {
    background: #fff;
    border: 1px solid var(--brand-green-light);
    color: var(--brand-green-dark);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.carousel-nav:hover {
    background: var(--brand-green-light);
    color: #fff;
    transform: translateY(-1px);
}

.carousel-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f3f3f3;
    color: #888;
    transform: none;
    box-shadow: none;
}

.homepage-product-card {
    flex: 0 0 280px;
    max-width: 280px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    overflow: hidden;
    text-decoration: none;
    color: var(--brand-text);
    transition: all 0.3s ease;
    scroll-snap-align: start;
    box-shadow: var(--shadow-sm);
}

.homepage-product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(143, 188, 143, 0.3);
}

.homepage-product-card:hover .homepage-product-title {
    color: var(--brand-orange);
}

.homepage-product-image {
    width: 100%;
    padding-top: 80%;
    /* Taller image area */
    position: relative;
    background-color: #f0f2f5;
    overflow: hidden;
}

.homepage-product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Ensure it covers nicely */
    transition: transform 0.5s ease;
}

.homepage-product-card:hover .homepage-product-image img {
    transform: scale(1.05);
}

.homepage-product-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.homepage-product-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--brand-green-dark);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.homepage-product-description {
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #666;
}

.homepage-product-meta {
    font-size: 0.8rem;
    color: #666;
    border-top: 1px solid #eee;
    padding-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    row-gap: 0.25rem;
    column-gap: 1rem;
}

.homepage-product-price {
    font-weight: 700;
    color: var(--brand-green-dark);
    margin-left: auto;
    flex-shrink: 0;
}

.homepage-product-sold-out {
    font-weight: 600;
    color: #c05621;
    flex-basis: 100%;
}

.homepage-product-supplier {
    flex: 1 1 0;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.homepage-product-seen {
    flex-basis: 100%;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    color: #888;
}

@media (max-width: 900px) {
    .homepage-products-carousel {
        gap: 0.75rem;
    }

    .homepage-products-track {
        gap: 0.75rem;
        padding: 0.5rem 0.75rem;
    }

    .homepage-product-card {
        flex: 0 0 85%;
        max-width: 85%;
    }

    .carousel-nav {
        width: 38px;
        height: 38px;
        font-size: 1.2rem;
    }

    .homepage-product-title {
        font-size: 0.95rem;
    }

    .homepage-product-description {
        font-size: 0.8rem;
    }
}

@media (max-width: 640px) {
    .homepage-category-section {
        background: transparent;
        border: none;
        padding: 1rem 0;
        box-shadow: none;
    }

    .homepage-products-carousel {
        gap: 0;
    }

    .homepage-products-track {
        padding: 0;
        gap: 0.5rem;
    }

    .homepage-product-card {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .carousel-nav {
        display: none;
    }
}

/* --- NEW: Style for the "sub-header" info box in the top bar --- */
.sub-header-topbar {
    flex: 1 1 100%;
    /* Allow it to wrap and take full width if needed */
    font-size: 0.95rem;
    color: #444;
    line-height: 1.5;
    background-color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid #e0e0d1;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    min-width: 250px;
}

.sub-header-topbar a {
    color: var(--brand-orange);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.sub-header-topbar a:hover {
    color: var(--brand-green-dark);
}

/* Tooltip Styles */
.tooltip-container {
    position: relative;
    display: inline-block;
    cursor: help;
    color: var(--brand-green-dark);
    margin-left: 4px;
    font-weight: bold;
}

.tooltip-text {
    visibility: hidden;
    width: 260px;
    background-color: #333;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 12px;
    position: absolute;
    z-index: 100;
    bottom: 140%;
    /* Position above */
    left: 50%;
    margin-left: -130px;
    /* Center */
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
    font-size: 0.9rem;
    font-weight: normal;
    line-height: 1.4;
    box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.2);
}

/* Tooltip Arrow */
.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
    bottom: 125%;
    /* Small animation up */
}


/* --- Styling for the Tally button --- */
.tally-button {
    flex-grow: 0;
    display: inline-block;
    text-align: center;
    text-decoration: none;
    font-weight: 700;
    color: #fff;
    padding: 0 1.5rem;
    height: 44px;
    line-height: 44px;
    border: none;
    border-radius: 22px;
    /* Pill shape */
    background: var(--brand-orange);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
}

.tally-button:hover {
    background: #d66043;
    transform: translateY(-2px);
}

/* --- UPDATED: Algolia Widget Overrides --- */

/* Remove white box behind rounded search */
.ais-SearchBox-form {
    background: transparent !important;
    /* Override theme default */
}

/* --- NEW: Specific styles for TOPBAR search/sort --- */
.topbar .ais-SearchBox-input,
.topbar .ais-SortBy-select {
    height: 44px;
    border-radius: 22px;
    border: 1px solid #ccc;
    background-color: #fff;
}

.topbar .ais-SearchBox-input:focus,
.topbar .ais-SortBy-select:focus {
    border-color: var(--brand-green-light);
    box-shadow: 0 0 0 3px rgba(163, 177, 138, 0.3);
    outline: none;
}

.topbar .ais-SearchBox-input {
    padding-left: 2.5rem;
    /* Pushes text past the icon */
}

/* --- NEW: Specific styles for FILTER PANEL search --- */
.filter-panel .ais-SearchBox-input {
    height: 36px;
    /* Reduced height */
    border-radius: 18px;
    /* Adjusted radius */
    border: 1px solid #ccc;
    background-color: #fff;
    background-position: center left 0.75rem;
    padding-left: 2.25rem;
    display: flex;
    /* Vertically align content */
    align-items: center;
    /* Vertically align content */
}

.filter-panel .ais-SearchBox-input:focus {
    border-color: var(--brand-green-light);
    box-shadow: 0 0 0 3px rgba(163, 177, 138, 0.3);
    outline: none;
}

/* <!-- MODIFIED: Removed old ais-Hits-item styles --> */
.ais-CurrentRefinements-item,
.ais-Pagination-item {
    border-radius: 15px;
}

.ais-Pagination-item--selected {
    background-color: var(--brand-green-dark);
    border-color: var(--brand-green-dark);
}

/* --- NEW: Pagination Fix for Mobile --- */
.ais-Pagination-list {
    display: flex;
    /* Use flexbox for alignment */
    flex-wrap: wrap;
    /* Allow items to wrap to the next line */
    justify-content: center;
    /* Center the pagination links */
}

/* --- START: Added styles for rangeInput widget --- */
.ais-RangeInput-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ais-RangeInput-input {
    width: 100%;
    height: 36px;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 0 0.5rem;
}

.ais-RangeInput-submit {
    height: 36px;
    border: none;
    border-radius: 6px;
    background-color: var(--brand-green-dark);
    color: white;
    font-weight: 600;
    cursor: pointer;
    padding: 0 1rem;
}

.ais-RangeInput-submit:hover {
    background-color: #2a4430;
}

/* --- END: Added styles for rangeInput widget --- */


/* <!-- MODIFIED: START: NEW STYLES for Product Grid --> */
.ais-Hits-list {
    display: grid;
    /* Define responsive grid columns */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.ais-Hits-item {
    /* Resetting InstantSearch default styles for the item wrapper */
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    box-shadow: none;
}

.product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Make cards in a row equal height */
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e0e0d1;
    overflow: hidden;
    /* Ensures content respects border-radius */
    text-decoration: none;
    color: var(--brand-text);
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    border-color: var(--brand-green-light);
}

.product-card:hover .product-title {
    color: var(--brand-orange);
}

.product-image {
    width: 100%;
    padding-top: 100%;
    /* Creates a 1:1 aspect ratio square */
    position: relative;
    background-color: #f7f7f7;
    /* Placeholder color */
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Crop image to fit, not stretch */
}

.product-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    /* Allows this container to fill available space */
}

.product-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--brand-green-dark);
    margin-bottom: 0.5rem;
    /* Clamp title to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-description {
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 1rem;
    flex-grow: 1;
    /* Pushes meta-info to the bottom */
    /* Clamp description to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 4em;
    /* <<< ADD THIS LINE */
}

/* MODIFIED RULE */
.product-meta {
    font-size: 0.8rem;
    color: #666;
    border-top: 1px solid #eee;
    padding-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    /* Vertically align supplier and price */
    row-gap: 0.25rem;
    /* Space between the two lines */
    column-gap: 3.0rem;
    /* Space between supplier and price */
}

/* MODIFIED RULE */
.product-price {
    font-weight: 700;
    color: var(--brand-green-dark);
    margin-left: auto;
    /* Magic property to push it to the right */
    flex-shrink: 0;
    /* Prevent it from shrinking */
}

.product-sold-out {
    font-weight: 600;
    color: #c05621;
    flex-basis: 100%;
}

/* MODIFIED RULE for Supplier */
.product-supplier {
    /* This allows the supplier to grow but not exceed the available space */
    flex: 1 1 0;
    min-width: 0;
    /* Crucial for enabling truncation in a flex item */

    /* These properties handle the truncation with "..." */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* MODIFIED RULE for Date */
.product-seen {
    /* Force this element to a new line by taking 100% of the width */
    flex-basis: 100%;
    margin-bottom: 0.25rem;
    /* Adds space below the date */
}

/* <!-- MODIFIED: END: NEW STYLES for Product Grid --> */

/* --- Legal Disclaimer Footer --- */
.legal-disclaimer {
    background-color: #f8f9fa;
    border-top: 1px solid #e0e0d1;
    padding: 2rem 1.5rem;
    margin-top: 4rem;
    text-align: center;
}

.disclaimer-content {
    max-width: 800px;
    margin: 0 auto;
}

.disclaimer-content p {
    font-size: 0.85rem;
    line-height: 1.5;
    color: #666;
    margin-bottom: 1rem;
}

.disclaimer-content p:last-child {
    margin-bottom: 0;
}

/*
============================================
== NEW: MOBILE STYLES (860px and below)   ==
============================================
*/
@media (max-width: 860px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .main-container {
        padding: 0 1rem 1rem;
    }

    #desktop-benefits {
        display: none;
    }

    #mobile-benefits {
        display: flex;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
        padding: 0 1rem;
        /* Add padding to the content inside main */
    }

    .topbar #searchbox,
    .topbar #sort-by,
    .topbar #stats,
    .topbar .tally-button,
    .topbar .sub-header-topbar {
        flex-basis: auto;
        width: 100%;
        text-align: center;
    }

    /* --- NEW FIX: Force main content blocks to screen width --- */
    .filter-panel,
    main {
        width: 100vw;
        margin-left: -1rem;
        /* Counteract parent padding */
    }

    /* Add padding back to the direct children of the constrained containers */
    .filter-panel>details,
    #current-refinements,
    #hits,
    #pagination {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* <!-- MODIFIED: Responsive grid for mobile --> */
    .ais-Hits-list {
        grid-template-columns: 1fr;
        /* 1 column on mobile */
        gap: 1rem;
    }

    /* ▼▼▼ ADD THIS NEW RULE ▼▼▼ */
    .product-card {
        width: 100%;
    }

    /* --- NEW: Mobile styles for static homepage --- */
    .homepage-content h1 {
        font-size: 2rem;
    }

    .homepage-logo {
        display: none;
    }

    .homepage-description {
        font-size: 1.1rem;
        margin-bottom: 2rem;
    }

    .homepage-features {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-bottom: 2rem;
    }

    .feature-card {
        padding: 1.5rem 1rem;
    }

    .homepage-search-input {
        height: 50px;
        font-size: 1rem;
        padding: 0 3rem 0 2.5rem;
        /* Keep room for nested button */
    }

    .homepage-search-icon {
        left: 0.75rem;
        font-size: 1rem;
    }

    /* Mobile sizing for homepage search button */
    .homepage-search-button {
        width: 38px;
        height: 38px;
        right: 0.4rem;
        font-size: 1rem;
    }

    /* --- NEW: Mobile styles for action buttons --- */
    .homepage-action-buttons {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
        margin: 1.5rem 0 2rem 0;
    }

    .action-button {
        width: 100%;
        max-width: 280px;
        padding: 0.6rem 1.5rem;
        font-size: 0.9rem;
    }

    /* --- NEW: Mobile styles for homepage products section --- */
    .homepage-products-section {
        margin: 3rem 0;
    }

    .homepage-products-section .homepage-products-heading {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .homepage-products-carousel {
        gap: 0.5rem;
        width: calc(100% + 2rem);
        margin-left: -1rem;
        margin-right: -1rem;
    }

    .carousel-nav {
        display: none;
    }

    .homepage-products-track {
        width: 100%;
        gap: 0.75rem;
        padding: 0.5rem 1rem;
    }

    .homepage-product-card {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .homepage-product-info {
        padding: 0.85rem;
    }

    .homepage-product-title {
        font-size: 0.95rem;
    }

    .homepage-product-description {
        font-size: 0.85rem;
    }

    /* --- Mobile styles for legal disclaimer --- */
    .legal-disclaimer {
        padding: 1.5rem 1rem;
        margin-top: 3rem;
    }

    .disclaimer-content p {
        font-size: 0.8rem;
    }
}

/*
============================================
== DESKTOP STYLES (861px and above)       ==
============================================
*/
@media (min-width: 861px) {
    #mobile-benefits {
        display: none;
    }
}

/* --- Sticky Search Header --- */
.sticky-search-header {
    position: fixed;
    /* Changed from sticky to fixed */
    top: 60px;
    /* Matches height of mobile-category-nav */
    left: 0;
    width: 100%;
    z-index: 90;
    background: #fff;
    border-bottom: 1px solid #e0e0d1;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: top 0.2s ease;
    /* Smooth transition if nav height changes */
}

/* Ensure body has padding to account for the fixed category nav */
body {
    padding-top: 60px;
}

/* Ensure search results have padding to account for the fixed search header */
#search-results {
    padding-top: 80px;
    /* Approx height of search header + margin */
}

/* --- NEW: Sticky Header Search Styling --- */

/* 1. Hide Reset/Loading, but KEEP Submit (for the orange button) */
.sticky-search-header .ais-SearchBox-reset,
.sticky-search-header .ais-SearchBox-loadingIndicator {
    display: none !important;
}

.sticky-search-header .ais-SearchBox-submit {
    display: flex !important;
    /* Restore submit button */
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--brand-orange);
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 10;
    /* Ensure it's above input */
}

.sticky-search-header .ais-SearchBox-submit svg {
    width: 18px;
    height: 18px;
    fill: #fff;
    /* Make icon white */
}

/* 2. Adjust Input Padding */
.sticky-search-header .ais-SearchBox-form {
    position: relative;
    /* Ensure absolute positioning works */
    display: block;
    width: 100%;
}

.sticky-search-header .ais-SearchBox-input {
    padding-left: 2.5rem !important;
    /* Space for LEFT icon */
    padding-right: 3.5rem !important;
    /* Space for RIGHT orange button */
    background-color: #fff;
    /* Ensure background icon (left) is visible if it's a background image */
    /* If it's an SVG, the padding handles the overlap */
    box-shadow: none;
    border: 1px solid #ccc;
    border-radius: 22px;
    height: 44px;
    width: 100%;
    -webkit-appearance: none;
}

.sticky-search-header .ais-SearchBox-input:focus {
    border-color: var(--brand-green-light);
    box-shadow: inset 0 0 0 1px var(--brand-green-light) !important;
    /* Inset to keep width constant */
    outline: none;
    background-color: #fff;
}

.search-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.searchbox-container {
    flex-grow: 1;
}

/* --- Hamburger Menu Button --- */
.filter-toggle-btn {
    display: none;
    /* Hidden by default on desktop */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--brand-green-dark);
    border-radius: 50%;
    transition: background-color 0.2s;
}

.filter-toggle-btn:hover {
    background-color: #f0f2f5;
}

/* --- Filter Panel (Desktop Default) --- */
.filter-panel {
    display: block;
}

.filter-header-mobile {
    display: none;
}

/* --- Mobile Responsive Styles --- */
@media (max-width: 860px) {
    .sticky-search-header {
        top: 60px;
        /* Keep consistent with desktop/category nav */
        padding: 0.5rem 1rem;
    }

    .filter-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Filter Drawer */
    .filter-panel {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 100%;
        max-width: 320px;
        background: #fff;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
        padding: 0;
    }

    .filter-panel.open {
        transform: translateX(0);
    }

    .filter-header-mobile {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1rem;
        border-bottom: 1px solid #eee;
        background: #f9f9f9;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .filter-header-mobile h2 {
        margin: 0;
        font-size: 1.2rem;
        color: var(--brand-green-dark);
    }

    .close-filters-btn {
        background: none;
        border: none;
        font-size: 2rem;
        line-height: 1;
        cursor: pointer;
        color: #666;
    }

    .filter-panel-content {
        padding: 1rem;
    }

    /* Overlay when filters are open */
    body.filters-open::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 150;
    }

    /* Adjust layout grid for mobile */
    .layout {
        display: block;
    }
}

/* --- NEW: Mobile Sticky Search Aesthetic Match --- */
@media (max-width: 860px) {
    .sticky-search-header {
        padding: 0.5rem 0.5rem;
        /* Minimal padding for full width feel */
    }

    .search-header-inner {
        gap: 0.5rem;
    }

    /* Match Homepage Aesthetic for the Algolia Widget */
    .sticky-search-header .ais-SearchBox-form {
        background: #fff;
        border-radius: 50px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        /* Shadow like homepage */
        display: flex;
        position: relative;
        width: 100%;
    }

    .sticky-search-header .ais-SearchBox-input {
        border-radius: 50px;
        border: 1px solid transparent;
        padding: 0.6rem 3rem 0.6rem 1.2rem;
        /* Adjust padding */
        height: 48px;
        /* Match homepage height approx */
        font-size: 1rem;
        box-shadow: none;
        /* Remove default input shadow */
        width: 100%;
        background-color: transparent;
        /* Let form bg show */
    }

    .sticky-search-header .ais-SearchBox-input:focus {
        border-color: var(--brand-green-light);
        box-shadow: none;
    }

    /* Style the submit button to look like the orange circle */
    .sticky-search-header .ais-SearchBox-submit {
        position: absolute;
        right: 4px;
        top: 50%;
        transform: translateY(-50%);
        background-color: var(--brand-orange);
        border-radius: 50%;
        width: 40px;
        height: 40px;
        color: #fff;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        cursor: pointer;
    }

    .sticky-search-header .ais-SearchBox-submitIcon {
        width: 18px;
        height: 18px;
        fill: #fff;
    }

    /* Hide the reset button for cleaner look, or style it if needed */
    .sticky-search-header .ais-SearchBox-reset {
        display: none;
    }
}

/* --- NEW: Full Width Layout Fixes --- */
/* Since #search-results is now outside .main-container */
#search-results {
    width: 100%;
}

.layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
}

/* Ensure sticky header is full width */
.sticky-search-header {
    width: 100%;
    box-sizing: border-box;
}

/* Mobile adjustments for layout padding */
@media (max-width: 860px) {
    .layout {
        padding: 0 1rem 1rem;
    }

    /* Reset the negative margins we added earlier since we now have a different structure */
    .filter-panel,
    main {
        width: auto;
        margin-left: 0;
    }

    /* But wait, if we want the filter panel to be a drawer, it needs fixed positioning which ignores this */
    /* The main content should be normal block */

    /* Re-apply padding to children if needed, but now .layout handles the container padding */
    .filter-panel>details,
    #current-refinements,
    #hits,
    #pagination {
        padding-left: 0;
        padding-right: 0;
    }
}

/* --- NEW: Mobile Sort Logic --- */
.mobile-sort-container {
    display: none;
    /* Hidden on desktop */
    margin-bottom: 1.5rem;
}

.mobile-sort-container h3 {
    margin-bottom: 0.5rem;
}

/* Mobile Styles */
@media (max-width: 860px) {

    /* Hide the topbar sort on mobile */
    .topbar #sort-by {
        display: none;
    }

    /* Show the mobile sort in the drawer */
    .mobile-sort-container {
        display: block;
    }

    /* Style the mobile sort select to look good in the drawer */
    .mobile-sort-container .ais-SortBy-select {
        width: 100%;
        height: 44px;
        border-radius: 8px;
        border: 1px solid #ccc;
        padding: 0 1rem;
        font-size: 1rem;
        background-color: #fff;
    }
}

/* --- NEW: Mobile Search Fixes (Icon, Gap, Sticky) --- */
@media (max-width: 860px) {

    /* 1. Remove Search Icon - REMOVED to restore icon and fix padding */
    /* .sticky-search-header .ais-SearchBox-input rule removed */

    /* 2. Fix Header Gap & Movement */
    /* Enforce fixed height and alignment on category nav */
    .mobile-category-nav {
        height: 60px;
        padding: 0 1.5rem;
        /* Horizontal padding only */
        align-items: center;
        /* Vertically center the pills */
        box-sizing: border-box;
    }

    /* Position search header exactly below category nav */
    .sticky-search-header {
        top: 60px;
        /* Matches category nav height */
        margin-top: 0;
        /* Remove any margin causing gaps */
        /* Ensure seamless look */
        border-top: none;
    }
}

/* --- Homepage Icon --- */
.homepage-icon {
    max-width: 100px;
    height: auto;
    margin-bottom: 1.5rem;
    display: inline-block;
}
