/*
Theme Name: Koop06
Theme URI: https://example.com/koop06
Author: GitHub Copilot
Description: Modern, clean, premium cooperative theme.
Version: 1.3.0
Text Domain: koop06
*/

:root {
    /* Base Colors (overridden by Customizer) */
    --primary-color: #0f172a;
    --secondary-color: #2563eb;
    --header-bg: #ffffff;

    /* System Colors */
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;

    /* Layout */
    --container-width: 1280px;
    --header-height: 80px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    /* Typography */
    --font-heading: 'Inter', system-ui, -apple-system, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.15);
}

/* Base Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--primary-color);
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 1rem;
    letter-spacing: -0.025em;
}

h1 {
    font-size: 2.75rem;
}

h2 {
    font-size: 2.25rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1.5rem;
}

a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--primary-color);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
}

ul {
    list-style: none;
}

.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ================== Header ================== */
.site-header {
    background-color: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    position: relative;
    z-index: 1000;
    transition: all 0.3s ease;
}

.site-header.is-sticky {
    position: sticky;
    top: 0;
}

.site-header,
.site-header .container {
    overflow: visible !important;
}

.site-header .container {
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 2rem;
    position: relative;
}

/* Logo */
.site-branding {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 0 0 auto;
}

.site-branding img {
    max-height: var(--logo-height, 60px);
    width: auto;
    height: auto;
}

.site-branding .custom-logo-link {
    display: inline-block;
    line-height: 0;
}

.site-branding h1 {
    font-size: 1.75rem;
    margin: 0;
    letter-spacing: -0.04em;
}

.site-branding p {
    font-size: 0.875rem;
    color: var(--header-text-color);
    opacity: 0.8;
    margin: 0;
}

/* Position secondary logo on far right */
.site-header .secondary-logo-link {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0 !important;
    line-height: 0;
    display: inline-flex;
    align-items: center;
}

.site-header .secondary-logo {
    max-height: calc(var(--logo-height, 60px) * 1);
    width: auto;
    height: auto;
    display: block;
}

/* Navigation (desktop) */
.desktop-navigation {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.desktop-navigation ul {
    display: flex;
    gap: 2.5rem;
    margin: 0;
}

.desktop-navigation ul li {
    position: relative;
}

.desktop-navigation ul li a {
    color: var(--header-text-color);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0;
    position: relative;
}

.desktop-navigation ul li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--header-text-color);
    transition: width 0.3s;
}

.desktop-navigation ul li:hover>a::after,
.desktop-navigation ul li.current-menu-item>a::after {
    width: 100%;
}

/* Dropdowns */
.desktop-navigation ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    box-shadow: var(--shadow-xl);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    min-width: 200px;
    flex-direction: column;
    gap: 0;
    z-index: 9999;
}

.desktop-navigation ul li:hover>ul {
    display: flex;
    animation: slideUp 0.2s ease-out;
}

.desktop-navigation ul ul li a {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    display: block;
}

.desktop-navigation ul ul li a:hover {
    background: var(--bg-body);
    color: var(--secondary-color);
}

.desktop-navigation ul ul li a::after {
    display: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.menu-toggle .menu-toggle-icon {
    display: block;
    width: 24px;
    height: 24px;
}

/* always keep toggle above other header elements */
.menu-toggle {
    z-index: 100002;
}

/* Hide mobile close button on desktop */
.mobile-menu-close {
    display: none;
}

/* Top Bar */
.top-bar {
    background: var(--primary-color);
    color: #fff;
    padding: 0.5rem 0;
    font-size: 0.875rem;
}

.top-bar .container {
    display: flex;
    justify-content: flex-end;
    gap: 2rem;
}

.top-bar a {
    color: #e2e8f0;
}

.top-bar a:hover {
    color: #fff;
}

/* ================== Hero Section (Front Page) ================== */
.hero-section {
    padding: 5rem 0;
    background: linear-gradient(to bottom, #fff 0%, var(--bg-body) 100%);
    position: relative;
    overflow: hidden;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-content {
    order: 1;
}

.hero-visual {
    order: 2;
    position: relative;
}

.hero-visual img {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: perspective(1000px) rotateY(-5deg);
    transition: transform 0.5s ease;
}

.hero-visual:hover img {
    transform: perspective(1000px) rotateY(0deg);
}

.hero-placeholder {
    width: 100%;
    height: 400px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    font-size: 1.5rem;
    border: 2px dashed #cbd5e1;
}

.hero-title {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    max-width: 500px;
}

/* Project Slider Styles */
.project-slider {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
    margin: 2rem 0;
    /* establish stacking context so dots can sit above slides */
    z-index: 0;
}

.project-slider .slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    z-index: 1;
}

.project-slider .slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Slider dots */
.project-slider .slider-dots {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 14px;
    display: flex;
    gap: 8px;
    z-index: 9999;
    /* make sure they're on top of any slide */
    pointer-events: auto;
}

.project-slider .slider-dots button {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 0;
}

.project-slider .slider-dots button.active {
    background: var(--secondary-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* make slides visible when active */
.project-slider .slide.active {
    opacity: 1;
    z-index: 1;
}

.project-slider .slide img {
    display: block;
}

/* enable dragging behavior */
.project-slider {
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

/* simple fade animation handled by JS */

/* ================== Search Section ================== */
.search-section {
    padding: 4rem 2rem;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 4rem;
    text-align: center;
    position: relative;
    top: -40px;
    margin-top: 0;
    z-index: 10;
}

.search-container {
    max-width: 700px;
    margin: 0 auto;
}

.search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 2rem;
}

.search-field {
    flex: 1;
    padding: 1rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: 0.2s;
}

.search-field:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.district-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.tag {
    background: var(--bg-body);
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    color: var(--text-main);
    border: 1px solid transparent;
    transition: 0.2s;
}

.tag:hover {
    background: #fff;
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* ================== Cards & Grid ================== */
.grid {
    display: grid;
    gap: 2rem;
    /* enforce equal-height rows so cards stretch uniformly */
    grid-auto-rows: 1fr;
}

.grid-2 {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.grid.is-ajax-loading {
    transition: opacity 0.2s ease;
}

.ajax-grid-loader {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    margin-top: 0.5rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 600;
    backdrop-filter: blur(4px);
}

.ajax-grid-loader__spinner {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, 0.2);
    border-top-color: var(--secondary-color);
    animation: ajaxSpin 0.8s linear infinite;
}

@keyframes ajaxSpin {
    to {
        transform: rotate(360deg);
    }
}

.card {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(226, 232, 240, 0.8);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--secondary-color);
    background-color: var(--primary-color);
}

.card:hover .card-title,
.card:hover .card-title a,
.card:hover .card-excerpt,
.card:hover p,
.card:hover a:not(.btn) {
    color: #ffffff !important;
}

/* make buttons stick to bottom of card body */
.card-body {
    display: flex;
    flex-direction: column;
}

.card-body a.btn {
    margin-top: auto;
}

/* also make sure any direct link acting as button aligns */
.card-body>a {
    margin-top: auto;
}

/* product-specific tweaks */
.product-item .price {
    color: var(--secondary-color);
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

/* mini product title inside single cooperative list */
.product-mini-title {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-item .product-link {
    display: inline-block;
    padding: 8px 20px;
    background: var(--secondary-color);
    color: #fff;
    border-radius: var(--radius-sm);
    text-align: center;
}

/* Supplier Card Hover Styles */
.supplier-card:hover h3,
.supplier-card:hover h3 a,
.supplier-card:hover div,
.supplier-card:hover strong,
.supplier-card:hover a {
    color: #ffffff !important;
}

.card-image {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    display: block;
    background-color: #f1f5f9;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.5s;
}

.card:hover .card-image img {
    transform: scale(1.05);
}

.card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    /* single line ellipsis */
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-excerpt {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    flex-grow: 1;
    /* allow up to three lines before ellipsis */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.2);
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ================== Footer ================== */
.site-footer {
    background: url('https://images.unsplash.com/photo-1454165804606-c3d57bc86b40?auto=format&fit=crop&q=80') center/cover no-repeat;
    color: white;
    padding-top: 5rem;
    padding-bottom: 2rem;
    margin-top: 5rem;
    position: relative;
}

.site-footer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.95);
}

.site-footer .container {
    position: relative;
    z-index: 1;
}

.footer-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 4rem;
}

.footer-title {
    color: #fff;
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: #94a3b8;
}

.footer-links a:hover {
    color: #fff;
    text-decoration: underline;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 2rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
}

/* Mobile navigation hidden by default; only used on small screens */
#mobile-navigation {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-btns {
        justify-content: center;
    }

    /* allow mobile nav container on small screens */
    #mobile-navigation {
        display: block;
    }

    /* Change header to relative on mobile so fixed nav escapes */
    .site-header:not(.is-sticky) {
        position: relative !important;
        z-index: 100;
    }

    .site-header.is-sticky {
        position: sticky !important;
        top: 0;
        z-index: 1000;
    }

    .menu-toggle {
        display: block;
        color: var(--header-text-color);
    }

    /* pin toggle to top-right so it can't be covered */
    .menu-toggle {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1100;
        color: var(--header-text-color);
        background: transparent;
        border: none;
        font-size: 1.6rem;
        width: 44px;
        height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Reposition secondary logo on mobile */
    .site-header .secondary-logo-link,
    .site-header .secondary-logo {
        width: 65% !important;
        /* display: none !important; */
    }

    /* hide desktop nav entirely on mobile so only mobile menu appears */
    .desktop-navigation {
        display: none !important;
    }


    #mobile-navigation .menu-wrap {
        display: none;
    }

    /* Stronger, more specific fullscreen nav to override other rules */
    header.site-header .main-navigation,
    .site-header .main-navigation,
    .main-navigation {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        inset: 0 !important;
        background: var(--header-bg) !important;
        color: var(--header-text-color) !important;
        z-index: 99999 !important;
        padding: 2.5rem 1.5rem !important;
        /* use viewport-based offset to ensure it's completely offscreen regardless of computed height */
        transform: translateY(-110vh) !important;
        transition: transform 0.38s cubic-bezier(0.2, 0.9, 0.2, 1) !important;
        overflow-y: auto !important;
    }

    .main-navigation.toggled,
    .main-navigation.open {
        transform: translateY(0) !important;
        display: block !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .main-navigation ul {
        flex-direction: column;
        gap: 0.25rem;
        list-style: none;
        padding: 1rem 0;
        margin: 0;
        width: 100% !important;
    }

    .main-navigation ul li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .main-navigation ul li a {
        padding: 1rem 0;
        display: block;
        color: var(--header-text-color);
        font-size: 1.125rem;
    }

    /* Ensure any inner menu containers expand full width (but not the close button) */
    .main-navigation>*:not(.mobile-menu-close),
    .main-navigation *:not(.mobile-menu-close) {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .main-navigation .menu,
    .main-navigation .menu>ul,
    .main-navigation #primary-menu {
        max-width: none !important;
        width: 100% !important;
    }

    .mobile-menu-close {
        display: block;
        position: absolute;
        top: 14px;
        right: 18px;
        background: transparent;
        border: none;
        font-size: 2.25rem;
        color: var(--header-text-color);
        cursor: pointer;
        z-index: 100001;
    }

    .hero-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .hero-content {
        order: 2;
    }

    .hero-visual {
        order: 1;
    }

    h1 {
        font-size: 2rem;
    }

    .search-section {
        padding: 2rem 1rem;
    }

    /* Logo mobile fixes */
    .site-branding {
        flex-wrap: wrap;
        gap: 10px;
        flex: 0 0 auto;
        padding-right: 50px;
        /* Space for menu button and secondary logo */
    }

    .site-branding img {
        max-height: 48px !important;
        height: auto !important;
        width: auto !important;
    }

    .site-header .secondary-logo-link,
    .site-header .secondary-logo {
        width: 65% !important;
    }
}

/* Prevent background scroll when mobile menu open */
body.mobile-menu-open {
    overflow: hidden;
}

/* Secondary logo adjustments to prevent overflow */
.site-header .secondary-logo-link {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
}

.site-header .secondary-logo {
    max-height: calc(var(--logo-height, 60px) * 1);
    width: auto;
    height: auto;
    display: block;
}

@media (max-width: 768px) {
    .site-branding {
        gap: 8px;
        flex-wrap: wrap;
    }

    .site-header .secondary-logo-link,
    .site-header .secondary-logo {
        width: 65% !important;
        /* display: none !important; */
    }

    .site-branding img {
        max-height: calc(var(--logo-height, 60px) * 0.8);
    }
}

/* If there are two logos, reduce size further on very small screens */
@media (max-width: 420px) {
    .site-branding img {
        max-height: calc(var(--logo-height, 60px) * 0.6) !important;
    }

    .site-header .secondary-logo,
    .site-header .secondary-logo-link {
        width: 65% !important;
    }
}

/* Added for Search Results & Missing Classes */
.btn-outline {
    background: var(--primary-color);
    border: 1px solid var(--primary-color);
    color: #ffffff;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: #ffffff;
}

.card:hover .btn-outline {
    background: #ffffff;
    color: var(--primary-color) !important;
}

/* ================== CRITICAL IMAGE & LAYOUT FIXES ================== */

/* 1. PRODUCT DETAIL PAGE */
.product_layout_custom {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 4rem !important;
    align-items: start !important;
    margin-bottom: 3rem !important;
}

@media (max-width: 768px) {
    .product_layout_custom {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
}

.product-gallery-wrapper {
    position: relative !important;
    overflow: hidden !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-md) !important;
}

.product-gallery-wrapper img {
    width: 100% !important;
    height: auto !important;
    max-height: 500px !important;
    /* Height Limit */
    object-fit: cover !important;
    display: block !important;
}

/* 2. COOPERATIVE DETAIL - GALLERY */
.gallery-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
    gap: 1.5rem !important;
    margin-top: 2rem !important;
}

.gallery-grid .gallery-item {
    display: block !important;
    overflow: hidden !important;
    border-radius: var(--radius-md) !important;
    height: 200px !important;
    /* Fixed Height */
}

.gallery-grid img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.3s ease !important;
}

.gallery-grid .gallery-item:hover img {
    transform: scale(1.1) !important;
}

/* 3. COOPERATIVE DETAIL - PRODUCT MINI CARDS */
.product-card-mini .product-thumb-link {
    display: block !important;
    position: relative !important;
    aspect-ratio: 4/3 !important;
    overflow: hidden !important;
    background: #f8fafc !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.product-card-mini .product-thumb-link img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.5s ease;
}

.product-card-mini:hover .product-thumb-link img {
    transform: scale(1.05) !important;
}

.product-card-mini .product-mini-title {
    padding: 1rem 1rem 0.5rem 1rem;
    margin: 0;
    font-size: 1.1rem;
}

.product-card-mini .btn {
    margin: 0 1rem 1rem 1rem;
}

/* 4. HOMEPAGE HERO & GENERAL GRID FIXES */
.hero-visual img {
    width: 100% !important;
    max-height: 500px !important;
    object-fit: cover !important;
    object-position: center !important;
}

/* Force Card Images everywhere to respect aspect ratio */
.card-image,
.cooperative-item .card-image,
.product-item .card-image {
    aspect-ratio: 4/3 !important;
    max-height: 300px !important;
    width: 100% !important;
    display: block !important;
}

.card-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}


/* ================== SINGLE COOPERATIVE PAGE LAYOUT FIXES ================== */

/* 1. Feature Hero Header */
.feature-header {
    position: relative;
    height: 400px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    color: #fff;
    margin-bottom: 3rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: hidden;
}

.feature-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
}

.feature-header .container {
    position: relative;
    z-index: 2;
    padding-bottom: 3rem;
}

.feature-badge {
    background: var(--secondary-color);
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 1rem;
}

.feature-title {
    font-size: 3rem;
    margin: 0 0 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    color: #fff;
}

.feature-meta {
    font-size: 1.1rem;
    opacity: 0.9;
    display: flex;
    gap: 1.5rem;
}

.feature-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 2. Main Layout Grid (Sidebar + Content) */
.content-grid-sidebar {
    display: grid;
    grid-template-columns: 1fr 350px;
    /* Main content | Sidebar width */
    gap: 3rem;
    align-items: start;
}

@media (max-width: 992px) {
    .content-grid-sidebar {
        grid-template-columns: 1fr;
        /* Stack on mobile/tablet */
    }
}

/* 3. Sections Styling */
.section-title {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
    color: var(--primary-color);
}

.content-card,
.products-section,
.gallery-section {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 2rem;
    margin-bottom: 3rem;
    box-shadow: var(--shadow-sm);
}

.entry-content {
    font-size: 1.1rem;
    color: var(--text-main);
    line-height: 1.8;
}

/* 4. Sidebar Styling */
.sticky-sidebar {
    position: sticky;
    top: 100px;
    /* Stick below header */
}

.coop-info-card {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.coop-contact-list li {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.coop-contact-list li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.coop-contact-list i {
    color: var(--secondary-color);
    font-size: 1.25rem;
}

.map-embed iframe {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}


/* ================== MOBILE & UI FIXES ================== */

/* 1. Global Overflow Protection */
body {
    overflow-x: hidden;
    width: 100%;
}

img {
    max-width: 100%;
    height: auto;
}

/* 2. Select2 Styling Fixes */
.select2-container .select2-selection--single {
    height: 50px !important;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 48px !important;
    top: 1px !important;
    right: 10px !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: normal !important;
    padding-left: 0 !important;
    color: var(--text-main);
}

/* Fix Search Field in Dropdown */
.select2-search__field {
    height: 40px !important;
    border-radius: 4px !important;
}

/* 3. Grid Responsibility (Force Grid-3 to stack on mobile) */
@media (max-width: 992px) {
    .grid-3 {
        grid-template-columns: 1fr !important;
        /* Stack columns */
        gap: 2rem !important;
        width: 100% !important;
    }

    form.grid-3 {
        gap: 1rem !important;
        display: flex !important;
        flex-direction: column;
    }

    /* Container Padding */
    .container {
        padding-left: 20px;
        padding-right: 20px;
        width: 100%;
        max-width: 100vw;
    }
}

/* 4. Homepage Search Section Mobile Fix */
@media (max-width: 768px) {

    /* Stack the search bar elements */
    .search-container form {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .search-container input,
    .search-container select,
    .search-container button,
    .search-container .btn {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: var(--radius-md) !important;
        margin: 0 !important;
    }

    /* Search button full width */
    #search-area button[type="submit"],
    .search-section button {
        width: 100%;
    }

    /* Filters Bar on Archive Page */
    .archive-header .grid-3,
    .filter-bar .grid-3 {
        display: flex;
        flex-direction: column;
    }

    #filter-btn {
        width: 100% !important;
        margin-top: 10px;
    }
}

/* 5. Card Overflow Prevention */
.card {
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    /* Contains children like images */
}

/* Ensure images don't break layout */
.card img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Featured cooperatives header row */
.coops-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .coops-section-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .coops-section-head .btn {
        margin-top: 0.75rem;
    }
}

/* ================== BREADCRUMBS STYLING ================== */
.breadcrumbs {
    padding: 1rem 0;
    margin-bottom: 2rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.breadcrumbs a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;
}

.breadcrumbs a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.breadcrumbs .sep {
    color: var(--secondary-color);
    font-weight: 600;
    margin: 0 0.5rem;
}

.breadcrumbs span:not(.sep) {
    color: var(--text-main);
}

/* ================== VIDEO PLAYER STYLING ================== */
.video-player-wrapper,
.youtube-video-wrapper {
    position: relative;
    display: block;
}

.video-player-wrapper video {
    display: block;
    width: 100%;
    height: auto;
}

.video-thumbnail-link {
    position: relative;
    display: block;
    text-decoration: none;
}

.video-thumbnail-link img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
}

.video-thumbnail-link:hover img {
    transform: scale(1.02);
}

.video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
}

.video-play-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: auto;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-play-btn:hover {
    transform: scale(1.1);
}

.video-play-btn svg {
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.video-play-btn svg circle {
    transition: fill 0.3s ease;
}

.video-play-btn:hover svg circle {
    fill: rgba(255, 255, 255, 1);
}

/* Hide overlay when video is playing */
.video-player-wrapper.playing .video-play-overlay {
    display: none;
}

/* ================== COOPERATIVE LOGO STYLING ================== */
/* Header Logo (Feature Header) */
.coop-header-logo {
    position: absolute;
    left: -10%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 12px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-width: 120px;
}

.coop-header-logo img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 100px;
    object-fit: contain;
}

/* Supplier Card Logo */
.supplier-card-logo {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    border-radius: var(--radius-md);
    padding: 8px;
    transition: all 0.3s ease;
}

.supplier-card-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.supplier-card:hover .supplier-card-logo {
    background: rgba(255, 255, 255, 0.2);
}

/* Responsive Logo Adjustments */
@media (max-width: 768px) {
    .coop-header-logo {
        position: static;
        transform: none;
        max-width: 80px;
        margin-bottom: 1rem;
        padding: 8px;
    }

    .coop-header-logo img {
        max-height: 60px;
    }

    .supplier-card>div {
        flex-direction: column;
    }

    .supplier-card-logo {
        width: 80px;
        height: 80px;
        margin: 0 auto;
    }
}

/* ================== SMOOTH SCROLL & HERO FIXES ================== */
html {
    scroll-behavior: smooth;
}

/* Fix Hero Grid on Mobile */
@media (max-width: 768px) {
    .hero-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
        text-align: center;
    }

    .hero-content {
        order: 2;
        /* Text below image on mobile usually looks better, or above? */
        /* Design often puts text first, but if image is large... let's keep text first (default order without flex/grid manipulation implies dom order). 
           BUT style.css had .hero-content { order: 1; } and .hero-visual { order: 2; }.
           So on mobile column, they stack 1 then 2.
           However, text alignment center helps.
        */
    }

    .hero-visual {
        order: 1;
        /* Let's put visual on top for mobile impact */
        margin-bottom: 2rem;
    }
}

.site-branding .custom-logo-link img {
    width: auto !important;
}