/**
 * Catalog Filter Bar — BulinaStudio
 * Inline size + category chip rows on shop/archive pages.
 *
 * Follows the same CSS token conventions as variation-swatches.css.
 * Do NOT paste these rules into BulinaCustom.css — they belong here.
 */

:root {
    --bulina-accent-soft:     #E8A1B0;
    --bulina-accent-soft-rgb: 232, 161, 176;
}

/* ── Container ───────────────────────────────────────────────────────────────── */

.bulina-filter-bar {
    background:    rgba(var(--bulina-accent-soft-rgb), 0.04);
    border-top:    1px solid rgba(var(--bulina-accent-soft-rgb), 0.08);
    border-bottom: 1px solid rgba(var(--bulina-accent-soft-rgb), 0.08);
    width: 100%;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
}

/* ── Row (one per filter group) ──────────────────────────────────────────────── */

.bulina-filter-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 4px 24px;
    flex: 1;
    min-width: 0;
}

.bulina-filter-row + .bulina-filter-row {
    border-left: 1px solid rgba(var(--bulina-accent-soft-rgb), 0.1);
}

/* Sort row: desktop-only 3rd column; auto-width, no flex-grow */
.bulina-filter-row--sort {
    flex: 0 0 auto;
}

/* Sizes row: take natural content width — leaves more room for CATEGORIE */
.bulina-filter-row--sizes {
    flex: 0 0 auto;
}

/* ── Label (e.g. "Mărime", "Categorie", "Preț") ──────────────────────────────── */

.bulina-filter-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(var(--bulina-accent-soft-rgb), 0.75);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Desktop: icon hidden, text visible */
.bulina-filter-icon {
    display: none;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ── Scrollable chip strip ───────────────────────────────────────────────────── */

.bulina-chips-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;       /* Firefox */
    -ms-overflow-style: none;    /* IE/Edge */
    padding: 6px 4px;            /* Room for box-shadow glow — overflow-x:auto clips shadows at boundary (6px vertical, 4px horizontal) */
}

/* Sizes row: chips at natural content width — no growth needed (fixed set: XS/S/M/L…) */
.bulina-filter-row--sizes .bulina-chips-scroll {
    flex: 0 0 auto;
}

/* Categories chips fill available row space and scroll if content overflows */
.bulina-filter-row--cats .bulina-chips-scroll {
    flex: 1;
}

.bulina-chips-scroll::-webkit-scrollbar {
    display: none;               /* Chrome/Safari */
}

.bulina-chips-scroll.is-overflowing {
    -webkit-mask-image: linear-gradient(to right, black 88%, transparent 100%);
    mask-image:         linear-gradient(to right, black 88%, transparent 100%);
}

/* ── Individual chip ─────────────────────────────────────────────────────────── */

.bulina-chip {
    display: inline-block;
    border: 1px solid #555;
    color: #ccc;
    font-size: 13px;
    letter-spacing: 0.5px;
    padding: 6px 18px;
    border-radius: 999px;        /* Pill style — matches variation-swatches.css */
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: border-color 0.15s, color 0.15s, box-shadow 0.25s ease;
}

.bulina-chip:hover {
    border-color: var(--bulina-accent-soft);
    color: #ffffff;
    text-decoration: none;
}

.bulina-chip--active {
    border-color: var(--bulina-accent-soft);
    color: var(--bulina-accent-soft) !important;  /* !important: overrides Flatsome link colour */
    font-weight: 600;
    box-shadow: 0 0 0 1px var(--bulina-accent-soft), 0 0 18px rgba(var(--bulina-accent-soft-rgb), 0.35);
}

.bulina-chip--active:hover {
    border-color: rgba(var(--bulina-accent-soft-rgb), 0.8);
    color: #ffffff;
}

/* ── Sort group — mobile version (inside sizes row, hidden on desktop) ────────── */

.bulina-sort-group--mobile {
    display: none;            /* desktop: hidden */
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    padding-left: 8px;
    border-left: 1px solid rgba(var(--bulina-accent-soft-rgb), 0.1);
}

/* Coin/price icon shown as mobile sort label */
.bulina-sort-price-icon {
    width: 15px;
    height: 15px;
    color: var(--bulina-accent-soft);
    flex-shrink: 0;
}

/* Desktop sort row label */
.bulina-sort-label {
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(var(--bulina-accent-soft-rgb), 0.75);
    white-space: nowrap;
}

/* ── Sort chip (the cycling link) ────────────────────────────────────────────── */

.bulina-sort-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #555;
    border-radius: 999px;
    padding: 7px 14px;
    text-decoration: none;
    flex-shrink: 0;
    transition: border-color 0.15s, box-shadow 0.25s ease;
}

.bulina-sort-chip:hover {
    border-color: rgba(var(--bulina-accent-soft-rgb), 0.5);
    text-decoration: none;
}

.bulina-sort-chip--asc,
.bulina-sort-chip--desc {
    border-color: var(--bulina-accent-soft);
    box-shadow: 0 0 0 1px var(--bulina-accent-soft), 0 0 18px rgba(var(--bulina-accent-soft-rgb), 0.35);
}

/* Sort icon — SVG fills driven by state class on the chip.
   Icon layout: ↓ (down arrow, left) | ≡ (lines, centre) | ↑ (up arrow, right) */

.sort-lines                      { fill: #555; }
.sort-arrow-up, .sort-arrow-down { fill: #444; }

/* ASC: right up-arrow glows pink, left down-arrow dims */
.bulina-sort-chip--asc .sort-lines      { fill: #ffffff; }
.bulina-sort-chip--asc .sort-arrow-up   { fill: var(--bulina-accent-soft); }
.bulina-sort-chip--asc .sort-arrow-down { fill: #2a2a2a; }

/* DESC: left down-arrow glows pink, right up-arrow dims */
.bulina-sort-chip--desc .sort-lines      { fill: #ffffff; }
.bulina-sort-chip--desc .sort-arrow-up   { fill: #2a2a2a; }
.bulina-sort-chip--desc .sort-arrow-down { fill: var(--bulina-accent-soft); }

/* ── Mobile ──────────────────────────────────────────────────────────────────── */

@media (max-width: 849px) {
    .bulina-filter-bar {
        display: block;             /* Mobile: stack the two rows vertically */
    }

    .bulina-filter-row {
        padding: 2px 12px 2px 8px;   /* Tight left edge on mobile; 6px absorbed by chips-scroll padding */
        gap: 8px;
    }

    .bulina-filter-row + .bulina-filter-row {
        border-left: none;
        border-top: 1px solid rgba(var(--bulina-accent-soft-rgb), 0.1);
    }

    /* Desktop sort row: hide on mobile */
    .bulina-filter-row--sort {
        display: none;
    }

    /* Mobile sort group: show inside sizes row */
    .bulina-sort-group--mobile {
        display: flex;
    }

    /* Icon visible, text hidden */
    .bulina-filter-icon {
        display: block;
        color: var(--bulina-accent-soft);
    }

    .bulina-filter-label-text {
        display: none;
    }

    .bulina-chip {
        font-size: 13px;
        padding: 7px 16px;          /* Slightly taller tap target on mobile */
    }

    .bulina-sort-chip {
        padding: 7px 10px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE FILTER BAR — .bulina-filter-bar--mobile
   Parallel block for ≤849px. Desktop bar (.bulina-filter-bar) is display:none
   at this breakpoint. Class prefix: bulina-fm-
   ═══════════════════════════════════════════════════════════════════════════ */

/* Hidden on desktop by default */
.bulina-filter-bar--mobile {
    display: none;
}

@media (max-width: 849px) {

    /* Hide the desktop bar — mobile bar takes over */
    .bulina-filter-bar { display: none; }

    .bulina-filter-bar--mobile {
        display: block;
        /* position:sticky disabled — JS handles sticky via .is-stuck + position:fixed */
        background: #111;
        border-bottom: 1px solid rgba(var(--bulina-accent-soft-rgb), 0.08);
    }

    /* JS adds .is-stuck when the bar scrolls past its natural position */
    .bulina-filter-bar--mobile.is-stuck {
        position: fixed !important;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 9999;
        /* top is set dynamically by JS to match the Flatsome sticky header height */
    }

    /* ── Row 1: Marime | Categorie | Pret — three equal dropdown buttons ─── */
    .bulina-fm-row1 {
        display: flex;
        align-items: stretch;
    }

    .bulina-fm-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        flex: 1;
        padding: 9px 6px;
        font-size: 12px;
        letter-spacing: 1.6px;
        text-transform: uppercase;
        color: var(--bulina-accent-soft);   /* pink — always, every state    */
        background: none;
        border: none;
        border-right: 1px solid rgba(var(--bulina-accent-soft-rgb), 0.12);
        cursor: pointer;
        text-decoration: none;
        white-space: nowrap;
        overflow: hidden;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        box-sizing: border-box;
    }

    .bulina-fm-btn:last-child { border-right: none; }
    .bulina-fm-btn:hover      { text-decoration: none; }   /* keep pink — no color change */

    /* Marime: left-align so text starts where product photos start */
    .bulina-fm-btn--size {
        justify-content: flex-start;
        padding-left: 14px;
    }

    /* Categorie: slightly wider than Marime */
    .bulina-fm-btn--cat {
        flex: 1.2;
    }

    /* Pret: narrower — pushes the Categorie|Pret separator rightward */
    .bulina-fm-btn--sort {
        flex: 0.7;
    }

    .bulina-fm-btn-label {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Chevron: default points down (rotate 180° the chevron-up path).
       aria-expanded=true → 0deg = points up. Color stays pink via currentColor. */
    .bulina-fm-chevron {
        width: 9px;
        height: 9px;
        flex-shrink: 0;
        transform: rotate(180deg);
        transition: transform 0.2s ease;
    }
    .bulina-fm-btn[aria-expanded="true"] .bulina-fm-chevron { transform: rotate(0deg); }

    /* ── Row 3: active filter pills (below panels, always last) ─────────── */
    .bulina-fm-row2 {
        display: none;   /* .is-visible added by PHP when any filter is active */
        background: rgba(var(--bulina-accent-soft-rgb), 0.04);
        border-top: 1px solid rgba(var(--bulina-accent-soft-rgb), 0.12);
    }

    .bulina-fm-row2.is-visible {
        display: grid;
        grid-template-columns: 1fr 1.2fr 0.7fr;  /* mirrors Row 1 flex proportions */
        padding: 6px 8px 10px 14px;              /* left matches Marime text start */
        gap: 4px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);   /* discrete separator above products */
    }

    .bulina-fm-row2-cell {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        min-height: 30px;
    }

    .bulina-fm-active-pill {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 7px 16px;
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.35);
        color: #fff;
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0.5px;
        text-decoration: none;
        white-space: nowrap;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        transition: opacity 0.15s;
    }
    .bulina-fm-active-pill:hover { opacity: 0.7; text-decoration: none; }

    .bulina-fm-pill-x {
        font-size: 13px;
        line-height: 1;
        font-weight: 400;
        flex-shrink: 0;
    }

    /* ── Dropdown panels (JS sets hidden attr) ───────────────────────────── */
    .bulina-fm-panel {
        border-top: 1px solid rgba(var(--bulina-accent-soft-rgb), 0.08);
        background: #111;
    }

    .bulina-fm-panel-inner {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;       /* Firefox */
        -ms-overflow-style: none;    /* IE/Edge */
        gap: 8px;
        padding: 10px 12px 14px;
    }

    .bulina-fm-panel-inner::-webkit-scrollbar {
        display: none;               /* Chrome/Safari */
    }

    /* Sort panel chips: right-aligned to sit under the Preț column */
    #bulina-fm-panel-sort .bulina-fm-panel-inner {
        justify-content: flex-end;
    }

    /* Chips inside panels reuse .bulina-chip and .bulina-chip--active
       (defined in the desktop section above — cascade applies here too) */

} /* end @media (max-width: 849px) — mobile filter bar */
