/* ==========================================================================
   Responsive Enhancements — Acdivet
   State-of-the-art adaptive UI without changing visual design language.
   Loaded after override.css so cascades win.
   ========================================================================== */

:root {
    /* Fluid type scale: floor → preferred → ceiling. Uses clamp(min, vw-based, max). */
    --fs-xs:  clamp(0.75rem, 0.70rem + 0.20vw, 0.875rem);
    --fs-sm:  clamp(0.8125rem, 0.75rem + 0.30vw, 0.9375rem);
    --fs-base: clamp(0.9375rem, 0.875rem + 0.30vw, 1.0625rem);
    --fs-md:  clamp(1rem, 0.92rem + 0.40vw, 1.125rem);
    --fs-lg:  clamp(1.125rem, 1rem + 0.60vw, 1.375rem);
    --fs-xl:  clamp(1.25rem, 1.05rem + 0.95vw, 1.625rem);
    --fs-h6:  clamp(1rem, 0.92rem + 0.40vw, 1.125rem);
    --fs-h5:  clamp(1.125rem, 1rem + 0.625vw, 1.375rem);
    --fs-h4:  clamp(1.25rem, 1.05rem + 1vw, 1.625rem);
    --fs-h3:  clamp(1.375rem, 1.15rem + 1.15vw, 1.875rem);
    --fs-h2:  clamp(1.5rem, 1.2rem + 1.5vw, 2.25rem);
    --fs-h1:  clamp(1.75rem, 1.3rem + 2.25vw, 3rem);

    /* Spacing scale (fluid where it makes sense) */
    --space-2xs: clamp(0.25rem, 0.2rem + 0.25vw, 0.375rem);
    --space-xs:  clamp(0.5rem, 0.45rem + 0.25vw, 0.625rem);
    --space-sm:  clamp(0.75rem, 0.65rem + 0.5vw, 1rem);
    --space-md:  clamp(1rem, 0.85rem + 0.75vw, 1.5rem);
    --space-lg:  clamp(1.5rem, 1.2rem + 1.5vw, 2.5rem);
    --space-xl:  clamp(2rem, 1.5rem + 2.5vw, 4rem);
    --space-2xl: clamp(2.5rem, 1.8rem + 3.5vw, 5.5rem);

    /* Container + gutter (adaptive). Used by .container helpers. */
    --container-max: 1264px;
    --container-pad: clamp(0.75rem, 0.5rem + 1vw, 1.5rem);
    --gutter:        clamp(0.75rem, 0.5rem + 1vw, 1.5rem);

    /* Line lengths for readable prose */
    --read-w: 70ch;
    --read-w-narrow: 55ch;

    /* Easing + timing */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --dur-fast: 150ms;
    --dur-base: 220ms;

    /* Brand color tokens (single source of truth). WCAG AA compliant. */
    --brand-green:        #8bc53f; /* decorative — borders, icons, accents */
    --brand-green-cta:    #5b7a37; /* CTA / text-bearing surface (≥5.13:1 vs white) */
    --brand-green-hover:  #4a6b29; /* hover state (≥7:1) */
    --brand-green-text:   #4a6b29; /* green text on white bg */
    --text-muted-aa:      #595959; /* muted text on white (≥5.93:1, replaces #888) */
    --text-strong:        #2a3a1a; /* dropdown / dark-on-light contrast */
}

@media (min-width: 1920px) {
    :root { --container-max: 1600px; }
}
@media (min-width: 2560px) {
    :root { --container-max: 2200px; }
}

/* --------------------------------------------------------------------------
   Fluid typography (global) — uses :root --fs-* tokens
   Single source of truth; replaces previous mobile-only clamp rules.
   -------------------------------------------------------------------------- */
body, p, li, span, td, th, a, label {
    font-size: var(--fs-base);
}
small, .small, .text-muted-small { font-size: var(--fs-sm); }
.lead { font-size: var(--fs-lg); line-height: 1.55; }
h1, .h1 { font-size: var(--fs-h1); line-height: 1.15; text-wrap: balance; }
h2, .h2 { font-size: var(--fs-h2); line-height: 1.2; text-wrap: balance; }
h3, .h3 { font-size: var(--fs-h3); line-height: 1.25; text-wrap: balance; }
h4, .h4 { font-size: var(--fs-h4); line-height: 1.3; }
h5, .h5 { font-size: var(--fs-h5); line-height: 1.35; }
h6, .h6 { font-size: var(--fs-h6); line-height: 1.4; }

/* Don't over-scale on tiny widgets that already opted into a fixed size */
.btn, .button, .badge, .nav-link { font-size: inherit; }

/* Prose content gets a comfortable reading max-width */
.content-page p, .content-page li, .editor-content p, .editor-content li,
article p, article li {
    max-width: var(--read-w);
}

/* --------------------------------------------------------------------------
   1. Universal box sizing & overflow guards
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    max-width: 100vw;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

img, svg, video, canvas, picture {
    max-width: 100%;
    height: auto;
}

iframe, embed, object {
    max-width: 100%;
}

/* Fluid by default; .ratio wrappers still get strict positioning from BS */
iframe { display: block; }

/* Force iframe inside .ratio to fill responsively even when width="600" attr present */
.ratio > iframe,
.ratio > img,
.ratio > video {
    width: 100% !important;
    height: 100% !important;
}

/* Fallback when no .ratio wrapper used */
iframe[src*="google.com/maps"],
iframe[src*="maps.google"],
iframe[src*="youtube.com"],
iframe[src*="vimeo"] {
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
}

/* Prevent long unbroken strings (URLs, product codes) blowing layouts */
p, li, a, span, h1, h2, h3, h4, h5, h6, td, th {
    overflow-wrap: anywhere;
    word-wrap: break-word;
}

/* Tables responsive on narrow screens */
table { max-width: 100%; }

/* --------------------------------------------------------------------------
   2. Boxed-mode breakout below desktop
   styles.css forces .boxed body to render at 1264px+ via .template-container
   On screens <1200px we let it fluid.
   -------------------------------------------------------------------------- */
@media (max-width: 1199.98px) {
    .boxed .template-container,
    .framed .template-container,
    .boxed .header-wrapper,
    .framed .header-wrapper,
    .boxed #header.sticky-on:not([data-type="sticky"]) > [class*=header-wrapper],
    .boxed #header > [class*=header-wrapper] .sticky-on > div,
    .framed #header.sticky-on:not([data-type="sticky"]) > [class*=header-wrapper],
    .framed #header > [class*=header-wrapper] .sticky-on > div {
        width: 100% !important;
        max-width: 100% !important;
    }

    .container,
    div.container,
    .et-container,
    .breadcrumb-trail .page-heading {
        max-width: 100% !important;
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* --------------------------------------------------------------------------
   3. Mobile-first layout safety (≤575px)
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    /* Sections respect viewport edges */
    section,
    .elementor-section,
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Sticky page-heading padding tuned for small screens */
    .page-heading { padding-top: 1em; padding-bottom: .8em; }

    /* Force grids to flow on tiny screens regardless of inline col- classes */
    .row > [class*="col-md-"],
    .row > [class*="col-lg-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Common over-aggressive button widths -> full-width on phones */
    .btn.w-25, .btn.w-50 { width: 100% !important; }

    /* Hero slider title scaling */
    .slide-title { font-size: 1.1rem !important; letter-spacing: 1px; padding: 8px; margin-bottom: 1rem; }
    .slide-category { font-size: .9rem; }
    .read-more-btn { padding: 8px 14px; font-size: .9rem; }

    /* Footer logo sized for phones */
    .footer-logo { max-width: 140px; margin-inline: auto; }

    footer .col-lg-3 { text-align: center; }
    footer .col-lg-3 .list-unstyled { padding-left: 0; }

    /* Whatsapp / back-to-top floaters do not eat content area */
    .whatsapp-button, .back-to-top, #backToTop {
        width: 44px;
        height: 44px;
    }
}

/* --------------------------------------------------------------------------
   4. Tablet portrait (576-767)
   -------------------------------------------------------------------------- */
@media (min-width: 576px) and (max-width: 767.98px) {
    .row > [class*="col-md-"]:not(.col-sm-12):not(.col-6):not(.col-sm-6) {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* --------------------------------------------------------------------------
   5. Tablet landscape / iPad (768-1023)
   -------------------------------------------------------------------------- */
@media (min-width: 768px) and (max-width: 1023.98px) {
    /* Product grid on tablets: 3 cols feels right vs hard-coded 6 on home */
    .index-products .row.row-cols-md-6 > * {
        flex: 0 0 33.333%;
        max-width: 33.333%;
    }
    .pt-3.row.row-cols-md-6 > * {
        flex: 0 0 33.333%;
        max-width: 33.333%;
    }
}

/* --------------------------------------------------------------------------
   6. Tap targets — WCAG 2.5.5 (44x44 css px minimum on touch)
   Apply both on coarse pointer AND on small viewports (audit/desktop preview).
   -------------------------------------------------------------------------- */
@media (hover: none) and (pointer: coarse), (max-width: 767.98px) {
    .btn,
    .button,
    .form-control,
    .form-select,
    .page-link,
    .nav-link,
    .dropdown-item {
        min-height: 40px;
    }

    /* Buttons need full target including padding */
    button:not([class*=icon]):not(.swiper-button-prev):not(.swiper-button-next),
    input[type=submit],
    input[type=button],
    [role=button] {
        min-height: 40px;
    }

    /* Form inputs: 16px font prevents iOS zoom-on-focus */
    input[type=text],
    input[type=email],
    input[type=password],
    input[type=tel],
    input[type=number],
    input[type=search],
    input[type=url],
    select,
    textarea,
    .form-control,
    .form-select {
        font-size: 16px;
        min-height: 44px;
    }
    textarea, .form-control[rows] { min-height: auto; }

    /* Spread inline icon links so fingers can hit them */
    .list-inline-item, .social-links li { padding: 4px; }
}

/* --------------------------------------------------------------------------
   7. Suppliers / product / blog cards adaptive
   -------------------------------------------------------------------------- */
.supplier-img,
.swiper-slide img,
.content-product img,
.product-content-image img,
.banner img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Suppliers swiper pre-hydration safety: contain widths until JS init */
.container-swiper:not(.swiper-initialized) {
    overflow: hidden;
}
.container-swiper:not(.swiper-initialized) .swiper-wrapper {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
}
.container-swiper:not(.swiper-initialized) .swiper-slide {
    width: 100% !important;
    max-width: 100%;
    flex: 0 0 100%;
    margin-bottom: 16px;
}
.container-swiper:not(.swiper-initialized) .swiper-slide img {
    width: 100% !important;
    max-width: 100%;
    height: auto;
}
@media (min-width: 768px) {
    .container-swiper:not(.swiper-initialized) .swiper-slide {
        width: calc(50% - 12px) !important;
        flex: 0 0 calc(50% - 12px);
        margin-right: 12px;
    }
}
@media (min-width: 1200px) {
    .container-swiper:not(.swiper-initialized) .swiper-slide {
        width: calc(33.333% - 16px) !important;
        flex: 0 0 calc(33.333% - 16px);
    }
}

/* Universal img-fluid behaviour reinforcement */
.img-fluid, img.supplier-img, .swiper-slide img, .product-content-image img {
    max-width: 100% !important;
    height: auto;
}

/* --------------------------------------------------------------------------
   8. Header / mobile menu adaptive
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .header-bottom-wrapper { position: relative !important; }
    #header .top-wrapper, #header .desktop-menu { display: none; }
}

/* --------------------------------------------------------------------------
   9. Sidebar filter responsive on /products
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
    .sidebar-position-right .col-md-3,
    .sidebar-position-right .col-md-9 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .sidebar-position-right .col-md-9 { margin-top: 16px; }

    /* Filters as collapsible already; ensure full-width applied */
    #sidebarCollapse .form-check-label { font-size: 14px; }
}

/* Force Bootstrap collapse semantics — etheme override breaks them */
.collapse:not(.show) { display: none !important; }
.collapse.show { display: block !important; }
.collapsing { overflow: hidden; }

/* Sidebar product categories tree: contain nested deep indents on mobile */
.sidebar-widget .list-group {
    max-width: 100%;
    overflow-wrap: anywhere;
}
.sidebar-widget .list-group .list-group-item .list-group {
    padding-inline-start: 12px;
    border-left: 1px solid rgba(0,0,0,.05);
}
@media (max-width: 575.98px) {
    .sidebar-widget .list-group .list-group-item .list-group {
        padding-inline-start: 8px;
    }
    .sidebar-widget .list-group-item a {
        font-size: 14px;
        line-height: 1.4;
    }
}

/* Pagination wraps on small screens */
.pagination {
    flex-wrap: wrap;
    row-gap: 6px;
}
@media (max-width: 575.98px) {
    .pagination .page-item .page-link {
        padding: 6px 10px;
        font-size: 13px;
    }
}

/* --------------------------------------------------------------------------
   10. Contact form layout breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
    .row .col-md-4 + .col-md-8 { margin-top: 24px; }
    .g-recaptcha { transform: scale(0.85); transform-origin: 0 0; }
}

/* --------------------------------------------------------------------------
   11. Counters block (home `numbers` section) adaptive scale
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .counter-item h2 { font-size: 3rem; }
    .counter-item { min-width: 110px; }
    .counter-label { font-size: 1rem; }
}
@media (max-width: 575.98px) {
    .counter-item h2 { font-size: 2.25rem; }
    .counter-container { min-width: 100%; }
}

/* --------------------------------------------------------------------------
   12. Page heading / breadcrumbs phone fixes
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    .page-heading h1, .page-heading .title { font-size: 1.4rem; line-height: 1.3; }
    .breadcrumbs { font-size: 12px; }
}

/* --------------------------------------------------------------------------
   13. Print friendly basics
   -------------------------------------------------------------------------- */
@media print {
    .whatsapp-button, .back-to-top, #backToTop, header.sticky, footer iframe { display: none !important; }
    a[href]::after { content: " (" attr(href) ")"; font-size: 80%; color: #444; }
    body { background: #fff !important; color: #000 !important; }
}

/* --------------------------------------------------------------------------
   14. Reduce motion preference
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    .animated, .fadeInDown, .fadeInUp, .fadeInLeft, .fadeIn { animation: none !important; opacity: 1 !important; }
}

/* --------------------------------------------------------------------------
   15. Dark scheme respect (kept neutral — does not change palette)
   -------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
    /* Keep existing palette; just ensure form contrast */
    .form-control { background-clip: padding-box; }
}

/* --------------------------------------------------------------------------
   16. Container + gutter — adaptive via tokens (replaces fixed 16px padding)
   -------------------------------------------------------------------------- */
.container, .container-fluid, div.container {
    padding-left: var(--container-pad);
    padding-right: var(--container-pad);
}
.container { max-width: var(--container-max); margin-inline: auto; }
.row { --bs-gutter-x: var(--gutter); }
@media (max-width: 575.98px) {
    .row { --bs-gutter-x: calc(var(--gutter) * 0.75); }
}

/* Smooth transition zone — kill abrupt jumps at standard breakpoints by
   stretching minor breakpoints into the gaps */
@media (min-width: 600px) and (max-width: 767.98px) {
    .container { max-width: 95%; }
}
@media (min-width: 768px) and (max-width: 991.98px) {
    .container { max-width: 92%; }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
    .container { max-width: 90%; }
}
@media (min-width: 1700px) and (max-width: 2559.98px) {
    .container { max-width: min(1600px, 85vw); }
}

/* --------------------------------------------------------------------------
   17. RTL adaptive helpers (Arabic locale)
   -------------------------------------------------------------------------- */
[dir="rtl"] .me-auto { margin-right: 0 !important; margin-left: auto !important; }
[dir="rtl"] .ms-auto { margin-left: 0 !important; margin-right: auto !important; }
[dir="rtl"] .text-start { text-align: right !important; }
[dir="rtl"] .text-end { text-align: left !important; }

/* --------------------------------------------------------------------------
   18. Skip-link / focus visibility (a11y boost — same colors as theme)
   -------------------------------------------------------------------------- */
:focus-visible {
    outline: 2px solid #46498f;
    outline-offset: 2px;
}
a.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px; height: 1px; overflow: hidden;
}
a.skip-link:focus {
    left: 8px; top: 8px; width: auto; height: auto;
    background: #fff; color: #46498f; padding: 8px 12px; z-index: 9999;
    border: 2px solid #46498f;
}

/* Visually hidden but available to screen readers (WCAG SC 1.3.1) */
.visually-hidden,
.sr-only,
.screen-reader-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Hit-area expansion for icon-only buttons (wishlist heart, social, close)
   Visual icon size unchanged; ::before pseudo extends clickable area to >=44px.
   Applied only on touch / small viewport — desktop appearance untouched. */
@media (hover: none) and (pointer: coarse), (max-width: 767.98px) {
    .wishlist-icon,
    .et-close-popup,
    .et-socials a,
    .back-to-top,
    .whatsapp-button {
        position: relative;
    }
    .wishlist-icon::before,
    .et-close-popup::before,
    .et-socials a::before,
    .back-to-top::before,
    .whatsapp-button::before {
        content: "";
        position: absolute;
        inset: -8px;
        min-width: 44px;
        min-height: 44px;
    }
}

/* --------------------------------------------------------------------------
   19. Safe-area insets — notched/foldable devices (iPhone X+, Pixel Fold)
   Padding only; never margin (so backgrounds extend edge-to-edge).
   -------------------------------------------------------------------------- */
@supports (padding: max(0px)) {
    body {
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
    }
    .header-wrapper, footer, .footer {
        padding-left: max(0px, env(safe-area-inset-left, 0px));
        padding-right: max(0px, env(safe-area-inset-right, 0px));
    }
    /* Sticky bottom bars / floating buttons honour bottom inset */
    .fixed-bottom, .navbar-fixed-bottom, .sticky-bottom {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}

/* --------------------------------------------------------------------------
   20. Dynamic viewport units — solve mobile browser-chrome jitter
   Hero/full-height blocks should use 100dvh (dynamic) where supported,
   falling back to 100vh. Apply only to opt-in classes so existing layout
   is untouched.
   -------------------------------------------------------------------------- */
.h-screen, .full-height {
    height: 100vh;
    height: 100dvh;
}
.min-h-screen, .full-height-min {
    min-height: 100vh;
    min-height: 100dvh;
}

/* --------------------------------------------------------------------------
   21. Smooth scroll + stable scrollbar gutter
   Prevents content reflow when scrollbar toggles between pages.
   -------------------------------------------------------------------------- */
html {
    scrollbar-gutter: stable;
    scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* --------------------------------------------------------------------------
   22. Touch optimisations — instant taps, no double-tap zoom on actionables
   -------------------------------------------------------------------------- */
button, a, .btn, [role="button"], input[type="submit"], input[type="button"] {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(70, 73, 143, 0.18);
}

/* --------------------------------------------------------------------------
   23. Modern text rendering — pretty wrap for headings, balance on hero
   Falls back gracefully where unsupported.
   -------------------------------------------------------------------------- */
h1, h2, h3, .page-title, .heading {
    text-wrap: balance;
}
p, li, .lead {
    text-wrap: pretty;
}

/* --------------------------------------------------------------------------
   24. Ultra-narrow guard (<280px) — prevent total layout collapse on
   smartwatches / very small foldable cover displays.
   -------------------------------------------------------------------------- */
@media (max-width: 279.98px) {
    html, body { font-size: 14px; }
    .container, .container-fluid { padding-left: 8px; padding-right: 8px; }
    h1, .h1 { font-size: 1.25rem; }
    h2, .h2 { font-size: 1.125rem; }
    .btn { padding: 6px 10px; font-size: 0.875rem; }
    .row > [class*="col-"] { flex: 0 0 100%; max-width: 100%; padding-left: 4px; padding-right: 4px; }
    .form-control, .form-select { font-size: 14px; }
}

/* --------------------------------------------------------------------------
   25. Ultra-wide guard (>=2560px) — prevent text from sprawling across
   ultrawide / 4K / 5K monitors. Caps reading width without changing
   the standard desktop appearance (<= 1920px).
   -------------------------------------------------------------------------- */
@media (min-width: 2560px) {
    .template-container, .container-fluid, body {
        max-width: 2400px;
        margin-left: auto;
        margin-right: auto;
    }
}
@media (min-width: 3200px) {
    .template-container, .container-fluid, body {
        max-width: 2880px;
    }
}

/* --------------------------------------------------------------------------
   26. Container queries — opt-in adaptive components (modern browsers).
   Applied only to product cards & supplier cards so they self-adapt
   regardless of which column they sit in. No effect on browsers without
   container-query support — cascade is fully additive.
   -------------------------------------------------------------------------- */
.product-item, .supplier-item, .blog-item, .card {
    container-type: inline-size;
    container-name: card;
}
@container card (max-width: 220px) {
    .card-body, .product-info { padding: 8px; }
    .card-title, .product-name { font-size: 0.9rem; line-height: 1.25; }
    .price, .product-price { font-size: 0.95rem; }
    .btn { padding: 6px 10px; font-size: 0.8125rem; }
}
@container card (max-width: 160px) {
    .card-body, .product-info { padding: 6px; }
    .card-title, .product-name { font-size: 0.8125rem; }
    .product-actions, .card-actions { gap: 4px; }
}

/* --------------------------------------------------------------------------
   27. High-DPI image crispness (already handled by srcset where present)
   -------------------------------------------------------------------------- */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    img { image-rendering: -webkit-optimize-contrast; }
}

/* --------------------------------------------------------------------------
   28. Forced-colors mode (Windows High Contrast) — keep buttons visible
   -------------------------------------------------------------------------- */
@media (forced-colors: active) {
    .btn, button, a {
        forced-color-adjust: auto;
        border: 1px solid CanvasText;
    }
}

/* --------------------------------------------------------------------------
   29. Forms — global adaptive sizing
   -------------------------------------------------------------------------- */
.form-control, .form-select, input[type="text"], input[type="email"],
input[type="tel"], input[type="number"], input[type="search"],
input[type="password"], select, textarea {
    width: 100%;
    max-width: 100%;
    font-size: max(16px, var(--fs-base)); /* 16px min — prevents iOS zoom */
    padding: var(--space-xs) var(--space-sm);
    line-height: 1.4;
}
textarea { min-height: clamp(100px, 20vh, 220px); }

label { font-weight: 500; margin-bottom: var(--space-2xs); display: inline-block; }
.form-group, .mb-3, .form-row { margin-bottom: var(--space-md); }

/* Multi-input rows reflow — input groups stack <480, side-by-side >=576 */
.form-row, .input-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}
@media (max-width: 479.98px) {
    .form-row > *, .input-group > .form-control { flex: 1 1 100%; }
}

/* Buttons in form actions */
.form-actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.form-actions .btn { flex: 1 1 auto; min-width: 140px; }

/* --------------------------------------------------------------------------
   30. Tables — overflow + mobile card mode
   -------------------------------------------------------------------------- */
.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}
table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
}
table th, table td {
    padding: var(--space-xs) var(--space-sm);
    text-align: start;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

/* Mobile card mode for explicitly opted-in tables */
@media (max-width: 599.98px) {
    table.table-stack-mobile thead { display: none; }
    table.table-stack-mobile, table.table-stack-mobile tbody, table.table-stack-mobile tr, table.table-stack-mobile td {
        display: block;
        width: 100%;
    }
    table.table-stack-mobile tr {
        margin-bottom: var(--space-md);
        border: 1px solid rgba(0,0,0,.1);
        padding: var(--space-sm);
        border-radius: 6px;
    }
    table.table-stack-mobile td {
        padding: var(--space-2xs) 0;
        text-align: end;
        position: relative;
        padding-inline-start: 50%;
    }
    table.table-stack-mobile td::before {
        content: attr(data-label);
        position: absolute;
        inset-inline-start: 0;
        font-weight: 600;
        text-align: start;
    }
}

/* Definition lists adaptive */
dl { display: grid; grid-template-columns: max-content 1fr; column-gap: var(--space-md); row-gap: var(--space-2xs); }
dl dt { font-weight: 600; }
@media (max-width: 479.98px) {
    dl { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   31. Sidebar widgets — adaptive collapse + sticky
   -------------------------------------------------------------------------- */
.sidebar-widget {
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 8px;
    background: #fff;
}
.sidebar-widget .widget-title {
    font-size: var(--fs-md);
    margin-bottom: var(--space-sm);
    line-height: 1.3;
}
.sidebar-widget ul { padding-inline-start: 0; list-style: none; margin: 0; }
.sidebar-widget .list-group-item {
    border: 0;
    padding: var(--space-2xs) 0;
    background: transparent;
}

/* Nested categories indent */
.sidebar-widget .list-group .list-group .list-group-item { padding-inline-start: var(--space-md); }

/* Price filter slider track wraps cleanly */
.widget_price_filter .price_slider_wrapper { padding-block: var(--space-xs); }
.widget_price_filter .price_label { font-size: var(--fs-sm); }

/* Sticky sidebar at desktop */
@media (min-width: 1200px) {
    .products-sidebar, .blog-sidebar {
        position: sticky;
        top: var(--space-lg);
        max-height: calc(100vh - var(--space-2xl));
        overflow-y: auto;
        scrollbar-gutter: stable;
    }
}

/* --------------------------------------------------------------------------
   31b. Shared adaptive-grid + image-fit utilities (DRY for cards/grids)
   Used by: home-categories-grid, suppliers-page-grid, blog-list-grid,
            products-grid, home-top-products .row, search-results-list.
   Override per consumer via custom properties:
       --grid-min / --grid-vw / --grid-max / --grid-fn
   -------------------------------------------------------------------------- */
.home-categories-grid,
.suppliers-page-grid,
.blog-list-grid,
.products-grid,
.home-top-products .row,
.search-results-list {
    display: grid;
    grid-template-columns: repeat(
        var(--grid-fn, auto-fill),
        minmax(clamp(var(--grid-min, 240px), var(--grid-vw, 30vw), var(--grid-max, 360px)), 1fr)
    );
    gap: var(--gutter);
}
/* Per-grid sizing only — DRY: one rule above does the layout */
.home-categories-grid    { --grid-fn: auto-fit; --grid-min: 120px; --grid-vw: 25vw; --grid-max: 200px; }
.home-top-products .row  { --grid-fn: auto-fit; --grid-min: 140px; --grid-vw: 22vw; --grid-max: 240px; }
.suppliers-page-grid     {                       --grid-min: 260px; --grid-vw: 30vw; --grid-max: 400px; }
.blog-list-grid          {                       --grid-min: 240px; --grid-vw: 32vw; --grid-max: 360px; }
.products-grid           {                       --grid-min: 150px; --grid-vw: 24vw; --grid-max: 260px; }
.search-results-list     {                       --grid-min: 260px; --grid-vw: 28vw; --grid-max: 360px; }

/* Reset Bootstrap col-* width on cards inside grids that took over from rows */
.home-top-products .row > *,
.products-grid > * {
    width: auto !important;
    max-width: 100% !important;
    flex: unset !important;
}

/* Shared image aspect-ratio helpers */
.img-fit-square,
.home-categories-grid .banner img,
.products-grid .product-content-image img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}
.img-fit-16x9,
.blog-list-grid .post-card img,
#blog-slider .slide-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* --------------------------------------------------------------------------
   32. Floating actions — adaptive position with safe-area
   -------------------------------------------------------------------------- */
.floating-actions {
    position: fixed;
    z-index: 1040;
    inset-block-end: max(var(--space-md), env(safe-area-inset-bottom, 0px) + var(--space-sm));
    inset-inline-end: max(var(--space-md), env(safe-area-inset-right, 0px) + var(--space-sm));
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    pointer-events: none;
}
.floating-actions > * { pointer-events: auto; }

.whatsapp-button,
.back-to-top,
#backToTop {
    width: clamp(44px, 5vw, 56px);
    height: clamp(44px, 5vw, 56px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #46498f;
    color: #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
    transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.whatsapp-button:hover,
.back-to-top:hover,
#backToTop:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0,0,0,.22);
}
.whatsapp-button img,
.back-to-top img,
#backToTop img {
    width: 60%;
    height: 60%;
    object-fit: contain;
}
.whatsapp-button { background: #25D366; }

/* Ultra-narrow viewports — shrink + closer to edge */
@media (max-width: 359.98px) {
    .whatsapp-button,
    .back-to-top,
    #backToTop { width: 40px; height: 40px; }
    .floating-actions {
        inset-block-end: max(var(--space-sm), env(safe-area-inset-bottom, 0px));
        inset-inline-end: max(var(--space-sm), env(safe-area-inset-right, 0px));
    }
}

/* Cookie consent banner — safe-area bottom padding */
.acdivet-cookie-consent,
[id*="cookie"][id*="consent"] {
    padding-bottom: max(var(--space-md), env(safe-area-inset-bottom, 0px) + var(--space-sm));
}

/* --------------------------------------------------------------------------
   33. Ultra-wide / large desktop container scaling
   Bootstrap .container caps at 1320px. We scale up beyond that for big screens.
   -------------------------------------------------------------------------- */
@media (min-width: 1920px) {
    .container,
    main.body-content.container { max-width: var(--container-max) !important; }
}

/* --------------------------------------------------------------------------
   34. Print stylesheet — hide chrome, ensure black text on white
   -------------------------------------------------------------------------- */
@media print {
    /* Hide non-content chrome */
    .floating-actions,
    .acdivet-cookie-consent,
    .header-top-wrapper,
    .mobile-header-wrapper,
    #mobile-menu-popup,
    .et-popup-wrapper,
    .skip-link,
    nav.menu-secondary-menu,
    .post-navigation,
    .share-post,
    .comment-respond,
    #respond { display: none !important; }

    /* Solid contrast for ink savings + legibility */
    body { background: #fff !important; color: #000 !important; }
    a { color: #000 !important; text-decoration: underline; }

    /* Prevent multi-column wraps from breaking content */
    .container, main { max-width: 100% !important; padding: 0 !important; }

    /* Avoid orphaned headings */
    h1, h2, h3, h4 { page-break-after: avoid; }
    img { max-width: 100% !important; page-break-inside: avoid; }
}

/* --------------------------------------------------------------------------
   35. Tap-target size guarantee (WCAG 2.5.8 AA — 24px; 44px for touch UX)
   Always-on for primary header controls so headless browsers + screen readers
   alike see actionable hit areas. Visual size unchanged via padding-only growth.
   -------------------------------------------------------------------------- */
#btn-mobile_menu,
.et-popup_toggle,
.navbar-toggler,
.et_b_header-mobile-menu button {
    min-width: 44px;
    min-height: 44px;
    padding: var(--space-xs);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
@media (pointer: coarse), (hover: none) {
    .et-cart-button,
    .et_b_header-account a {
        min-width: 44px;
        min-height: 44px;
    }
}

/* WCAG 2.5.8 AA: text links inside nav, footer, contact info ≥24px tap area.
   Catches: footer site-nav, contact-info phone/email, header secondary menu,
   social link lists, slider titles, logo. inline-block + line-height = no
   visual change. */
nav a,
nav.nav a,
footer a,
footer nav a,
footer ul a,
aside.contact-info ul a,
.contact-info ul a,
.menu li a,
.et_b_header-socials a,
.menu-social-icons a,
.list-inline-item > a,
h2.slide-title a,
.slide-title a,
.et_b_header-logo > a {
    display: inline-block;
    min-height: 24px;
    line-height: 24px;
    padding-block: 2px;
}
