/* ==========================================================================
   B2B Supply Pro — Complete 4-Tier Responsive System (v2.3.0)
   Breakpoints:
     - Wide Desktop : >= 1280px
     - Laptop       : 1025px – 1279px
     - Tablet       : 768px  – 1024px
     - Mobile       : <= 767px
     - Small Mobile : <= 480px
   ========================================================================== */

/* Global Horizontal Overflow Protection & Fluid Media */
html,
body {
    overflow-x: clip;
    max-width: 100%;
}

img,
svg,
iframe,
video {
    max-width: 100%;
}

/* Touch-friendly minimum target sizes */
.b2b-btn,
.b2b-sp-tab-btn,
.b2b-cat-filter-pill,
.b2b-map-pill,
.b2b-auth-tab,
.b2b-finder-reset,
.b2b-pc-btn-primary,
.b2b-pc-btn-ghost {
    min-height: 40px;
}

/* ==========================================================================
   1. LAPTOP BREAKPOINT (1025px – 1279px)
   ========================================================================== */
@media (max-width: 1279px) {
    .b2b-container {
        padding: 0 20px;
    }

    .b2b-nav-list {
        gap: 18px;
    }

    .b2b-nav-link {
        font-size: 13.5px;
    }

    .b2b-mega-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 20px;
    }

    /* Product Finder Bar: clean 3-column wrap on laptop so inputs never squeeze */
    .b2b-finder-bar {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px;
        padding: 20px;
    }

    .b2b-finder-search {
        grid-column: span 2;
    }

    .b2b-finder-meta {
        justify-content: flex-end;
    }

    /* Product Grids */
    .b2b-product-grid-pro.b2b-cols-4 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* Single Product */
    .b2b-sp-hero-grid {
        gap: 32px;
    }

    .b2b-sp-details-grid {
        grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.9fr);
        gap: 28px;
    }

    /* Footer */
    .b2b-footer-grid {
        grid-template-columns: 1.4fr repeat(2, minmax(0, 1fr));
        gap: 28px;
    }
}

/* ==========================================================================
   2. TABLET BREAKPOINT (768px – 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
    .b2b-section {
        padding: 60px 0;
    }

    /* Header switches cleanly to Mobile Drawer on Tablet & below */
    .b2b-utility-bar,
    .b2b-primary-nav,
    .b2b-nav-actions .b2b-btn {
        display: none;
    }

    .b2b-mobile-toggle {
        display: flex !important;
    }

    .b2b-header:has(.b2b-noscript-nav) .b2b-mobile-toggle,
    .b2b-elementor-mobile-toggle:has(+ noscript .b2b-noscript-nav) {
        display: none !important;
    }

    .b2b-noscript-nav {
        display: block;
        padding: 0 24px 12px;
        background: var(--b2b-white);
    }

    .b2b-noscript-menu {
        display: flex;
        flex-wrap: wrap;
        gap: 4px 16px;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .b2b-noscript-menu a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }

    .b2b-nav-inner {
        min-height: 64px;
    }

    .b2b-brand img {
        max-height: 38px;
    }

    /* Catalog Hero */
    .b2b-catalog-hero-pro {
        padding: 52px 0 44px;
    }

    .b2b-catalog-hero-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 24px;
    }

    .b2b-catalog-hero-stats {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* Product Finder Filter Bar */
    .b2b-finder-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 18px;
    }

    .b2b-finder-search {
        grid-column: 1 / -1;
    }

    .b2b-finder-meta {
        grid-column: 1 / -1;
        justify-content: space-between;
        border-top: 1px solid rgba(255, 255, 255, 0.14);
        padding-top: 12px;
        height: auto;
    }

    /* Product Grids: 2-Column balanced tablet cards */
    .b2b-product-grid-pro.b2b-cols-4,
    .b2b-product-grid-pro.b2b-cols-3,
    .b2b-product-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    /* Quick View Modal */
    .b2b-modal-dialog {
        padding: 24px;
        width: min(680px, 100%);
    }

    .b2b-modal-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }

    /* Single Product Page */
    .b2b-sp-hero {
        padding: 36px 0 44px;
    }

    .b2b-sp-hero-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
    }

    .b2b-sp-trust-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
        margin-top: 32px;
    }

    .b2b-sp-details-section {
        padding: 48px 0;
    }

    .b2b-sp-details-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
    }

    .b2b-sp-sidebar {
        position: static;
        scroll-margin-block-start: 5rem;
    }

    body:has(.b2b-noscript-nav) .b2b-sp-sidebar {
        scroll-margin-block-start: 11rem;
    }

    /* Interactive Modules (Maps, Blend, Forms, Auth, Post Grids) */
    .b2b-warehouse-layout,
    .b2b-blend-layout,
    .b2b-post-grid,
    .b2b-product-single-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .b2b-expo-track {
        --b2b-expo-columns: 2;
    }

    /* Footer */
    .b2b-footer {
        padding: 56px 0 28px;
    }

    .b2b-footer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px;
    }

    .b2b-footer-brand-col {
        grid-column: 1 / -1;
    }
}

/* ==========================================================================
   3. MOBILE BREAKPOINT (<= 767px)
   ========================================================================== */
@media (max-width: 767px) {
    .b2b-site-main .elementor-widget-text-editor :is(th, td) {
        overflow-wrap: anywhere;
    }

    body {
        font-size: 15px;
    }

    .b2b-container {
        padding: 0 16px;
    }

    .b2b-section {
        padding: 44px 0;
    }

    /* Prevent iOS Safari input auto-zoom (minimum 16px on form controls) */
    input[type="text"],
    input[type="email"],
    input[type="search"],
    input[type="tel"],
    input[type="url"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Swipeable Category Pills Rail on Mobile */
    .b2b-cat-pills-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 6px;
        margin-bottom: 16px;
    }

    .b2b-cat-pills-bar::-webkit-scrollbar {
        display: none;
    }

    .b2b-cat-filter-pill {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 9px 14px;
        font-size: 12.5px;
    }

    /* Catalog Hero & Stats */
    .b2b-catalog-hero-pro {
        padding: 36px 0 32px;
    }

    .b2b-catalog-hero-pro h1 {
        font-size: 28px;
    }

    .b2b-catalog-hero-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .b2b-ch-stat {
        padding: 12px 10px;
        min-width: 0;
    }

    .b2b-ch-stat strong {
        font-size: 20px;
    }

    .b2b-ch-stat span {
        font-size: 11px;
    }

    /* Product Finder Filter Bar: Single Column Stack */
    .b2b-finder-bar {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px;
        margin-bottom: 24px;
    }

    /* Utility Toolbar */
    .b2b-catalog-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
    }

    .b2b-toolbar-right {
        justify-content: space-between;
        width: 100%;
    }

    /* Category Group Header */
    .b2b-cat-header-pro {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .b2b-cat-header h2 {
        font-size: 18px;
    }

    /* Product Cards: Clean 1-Column Mobile Showcase */
    .b2b-product-grid-pro.b2b-cols-4,
    .b2b-product-grid-pro.b2b-cols-3,
    .b2b-product-grid-pro.b2b-cols-2,
    .b2b-product-grid-4 {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .b2b-catalog-groups.is-list-view .b2b-product-card-pro {
        flex-direction: column;
    }

    .b2b-catalog-groups.is-list-view .b2b-pc-media-pro {
        width: 100%;
        aspect-ratio: 4 / 3;
        min-height: 0;
    }

    .b2b-pc-actions-pro {
        grid-template-columns: 1fr 1fr;
    }

    /* Single Product Page Mobile Polish */
    .b2b-sp-breadcrumb {
        font-size: 12px;
        margin-bottom: 18px;
    }

    .b2b-sp-title {
        font-size: 26px;
    }

    .b2b-sp-kpi-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .b2b-sp-cta-row {
        flex-direction: column;
        align-items: stretch;
    }

    .b2b-sp-cta-row .b2b-btn {
        width: 100%;
    }

    .b2b-sp-tab-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }

    .b2b-sp-tab-nav::-webkit-scrollbar {
        display: none;
    }

    .b2b-sp-tab-btn {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 10px 14px;
        font-size: 12.5px;
    }

    .b2b-sp-card,
    .b2b-sp-quote-box {
        padding: 20px 16px;
    }

    .b2b-sp-logistics-grid,
    .b2b-sp-cert-grid {
        grid-template-columns: 1fr;
    }

    .b2b-sp-related-section {
        padding: 44px 0 56px;
    }

    .b2b-sp-related-head h2 {
        font-size: 22px;
    }

    /* Interactive Forms & Auth Portal */
    .b2b-form-grid-2,
    .b2b-auth-grid-2 {
        grid-template-columns: 1fr !important;
    }

    .b2b-expo-track {
        --b2b-expo-columns: 1;
    }

    .b2b-modal {
        padding: 10px;
    }

    .b2b-modal-dialog {
        padding: 20px 16px;
        max-height: 94vh;
    }

    /* Footer Mobile Stack */
    .b2b-footer-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .b2b-footer-bottom {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .b2b-footer-legal {
        justify-content: center;
        flex-wrap: wrap;
        gap: 14px;
    }
}

/* ==========================================================================
   4. SMALL MOBILE BREAKPOINT (<= 480px)
   ========================================================================== */
@media (max-width: 480px) {
    /* Stack Spec Table cleanly on narrow phones so text never wraps awkwardly */
    .b2b-sp-spec-table,
    .b2b-sp-spec-table tbody,
    .b2b-sp-spec-table tr,
    .b2b-sp-spec-table th,
    .b2b-sp-spec-table td {
        display: block;
        width: 100%;
    }

    .b2b-sp-spec-table tr {
        padding: 10px 0;
    }

    .b2b-sp-spec-table th {
        padding: 0 0 3px;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .b2b-sp-spec-table td {
        padding: 0;
        font-size: 14px;
    }

    .b2b-sp-trust-strip {
        grid-template-columns: 1fr;
    }

    .b2b-catalog-hero-stats {
        grid-template-columns: 1fr;
    }

    .b2b-pc-spec-chips {
        grid-template-columns: 1fr;
    }

    .b2b-pc-actions-pro {
        grid-template-columns: 1fr;
    }

    .b2b-catalog-groups.is-list-view .b2b-pc-actions-pro {
        grid-template-columns: minmax(0, 1fr);
        justify-content: stretch;
    }

    .b2b-mobile-drawer-panel {
        width: 100%;
        max-width: 100%;
    }
}
