/* ═══════════════════════════════════════════════════════════════
   Frozberries Category Banner v1.0.0
   Unified: Header + Banner + Breadcrumbs + Checklist Widget
   ═══════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────
   1.  CATEGORY HEADER — Green Gradient (no banner image)
   ───────────────────────────────────────────────────────────── */
.fb-shop-header {
    background: linear-gradient(135deg, #e8f5e9 0%, #d1f2e5 100%);
    border-radius: 20px;
    padding: 45px 55px;
    margin-bottom: 40px;
    color: #1b5e20;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 20px 40px -15px rgba(209, 242, 229, 0.6),
        inset 0 2px 0 rgba(255, 255, 255, 0.7),
        inset 0 -2px 0 rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Radial light wash */
.fb-shop-header::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, transparent 40%);
    pointer-events: none;
    transform: rotate(30deg);
}

/* Strawberry watermark */
.fb-shop-header::after {
    content: '🍓';
    position: absolute;
    right: 30px; bottom: -40px;
    font-size: 180px;
    opacity: 0.05;
    transform: rotate(-15deg);
    pointer-events: none;
    filter: drop-shadow(0 10px 10px rgba(0,0,0,0.1));
}

.fb-shop-header h1 {
    color: #0d3b23;
    font-weight: 900;
    font-size: 44px;
    margin: 0 0 14px 0;
    text-transform: none;
    letter-spacing: -1.2px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 10px rgba(255,255,255,0.8);
}

/* Hide Porto theme defaults */
.page-top, .porto-u-main-heading, .breadcrumb { display: none !important; }

/* ─────────────────────────────────────────────────────────────
   2.  CATEGORY HEADER — Banner Image Mode (.fb-has-banner)
   ───────────────────────────────────────────────────────────── */
.fb-shop-header.fb-has-banner {
    --fb-banner-h: 280px;
    --fb-banner-mh: 200px;

    background: none;
    padding: 0;
    border: none;
    border-radius: 0;
    margin-bottom: 32px;

    /* ── Full-width breakout from any parent container ── */
    width: 100vw !important;
    max-width: 100vw !important;
    position: relative;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    left: auto !important;
    right: auto !important;

    box-shadow:
        0 4px 20px -4px rgba(0, 0, 0, 0.10),
        0 2px 6px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.4s ease;
    max-height: var(--fb-banner-h);
}

.fb-shop-header.fb-has-banner:hover {
    box-shadow:
        0 6px 28px -4px rgba(0, 0, 0, 0.14),
        0 3px 10px rgba(0, 0, 0, 0.07);
}

/* Remove green pseudo-elements */
.fb-shop-header.fb-has-banner::before,
.fb-shop-header.fb-has-banner::after {
    display: none;
}

/* Banner image */
.fb-banner-picture {
    display: block;
    width: 100%;
    line-height: 0;
}

.fb-banner-img {
    width: 100% !important;
    height: auto !important;
    max-height: var(--fb-banner-h) !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fb-shop-header.fb-has-banner:hover .fb-banner-img {
    transform: scale(1.03);
}

/* Link wrapper */
.fb-header-banner-link {
    display: block;
    text-decoration: none !important;
    color: inherit !important;
    line-height: 0;
}

/* ── Overlay — text on top of banner image ── */
.fb-banner-overlay {
    position: absolute !important;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 28px 40px;
    z-index: 2;
    /* Gradient for text readability */
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.02) 35%,
        rgba(0, 0, 0, 0.3) 70%,
        rgba(0, 0, 0, 0.55) 100%
    );
    transition: background 0.4s ease;
}

.fb-shop-header.fb-has-banner:hover .fb-banner-overlay {
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.04) 35%,
        rgba(0, 0, 0, 0.35) 70%,
        rgba(0, 0, 0, 0.6) 100%
    );
}

/* Banner-mode title overrides */
.fb-shop-header.fb-has-banner h1 {
    color: #ffffff;
    font-size: 36px;
    text-shadow:
        0 2px 12px rgba(0, 0, 0, 0.35),
        0 1px 3px rgba(0, 0, 0, 0.2);
    margin: 0 0 8px 0;
}

.fb-banner-subtext {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", Roboto, sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.92);
    margin: 0 0 10px 0;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.2px;
    line-height: 1.5;
}

/* Banner-mode breadcrumbs */
.fb-shop-header.fb-has-banner .fb-crumbs {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.95);
}

.fb-shop-header.fb-has-banner .fb-crumbs a {
    color: rgba(255, 255, 255, 0.9) !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.fb-shop-header.fb-has-banner .fb-crumbs a:hover {
    color: #ffffff !important;
}

/* Shine sweep on hover */
.fb-shop-header.fb-has-banner .fb-banner-picture::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    z-index: 3;
    pointer-events: none;
    transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.fb-shop-header.fb-has-banner:hover .fb-banner-picture::after {
    left: 100%;
}

/* Banner load animation */
@keyframes fbBannerFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fb-shop-header.fb-has-banner {
    animation: fbBannerFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ─────────────────────────────────────────────────────────────
   3.  BREADCRUMBS  (shared for both modes)
   ───────────────────────────────────────────────────────────── */
.fb-crumbs {
    font-size: 15px;
    font-weight: 600;
    color: #2e7d5b;
    position: relative;
    z-index: 1;
    display: inline-flex;
    /* WooCommerce's breadcrumb emits bare text nodes between the links, so the
       delimiters and the final crumb become anonymous flex items. With nowrap +
       align-items:center, a long final crumb ("Search results for ...") wrapped
       inside its own item and was then vertically centred against the
       single-line items, leaving the delimiters floating above the text.
       Wrap properly and align on the baseline instead. */
    flex-wrap: wrap;
    align-items: baseline;
    row-gap: 2px;
    max-width: 100%;
    background: rgba(255, 255, 255, 0.65);
    padding: 8px 20px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03), inset 0 1px 0 #fff;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.4);
}

.fb-crumbs a {
    color: #ce2a37;
    text-decoration: none;
    transition: all 0.3s ease;
}

.fb-crumbs a:hover {
    color: #a41b26;
    transform: translateY(-1px);
}

/* ─────────────────────────────────────────────────────────────
   4.  RESPONSIVE HEADER
   ───────────────────────────────────────────────────────────── */
@media (max-width: 991px) {
    /* Green gradient */
    .fb-shop-header {
        padding: 30px 25px;
        border-radius: 16px;
    }
    .fb-shop-header h1 {
        font-size: 32px;
        letter-spacing: -0.5px;
    }
    .fb-shop-header::after {
        font-size: 100px; right: 0; bottom: -20px;
    }

    /* Banner mode — stays full-width */
    .fb-shop-header.fb-has-banner {
        border-radius: 0;
        max-height: calc(var(--fb-banner-h) * 0.85);
    }
    .fb-banner-img {
        max-height: calc(var(--fb-banner-h) * 0.85) !important;
    }
    .fb-banner-overlay {
        padding: 22px 28px;
    }
    .fb-shop-header.fb-has-banner h1 {
        font-size: 28px;
    }
}

@media (max-width: 767px) {
    .fb-shop-header {
        padding: 24px 20px;
        border-radius: 14px;
        margin-bottom: 24px;
    }
    .fb-shop-header h1 {
        font-size: 26px;
        letter-spacing: -0.3px;
    }

    /* Banner mode — stays full-width */
    .fb-shop-header.fb-has-banner {
        border-radius: 0;
        margin-bottom: 20px;
        max-height: var(--fb-banner-mh);
    }
    .fb-banner-img {
        max-height: var(--fb-banner-mh) !important;
    }
    .fb-banner-overlay {
        padding: 16px 20px;
        justify-content: center;
    }
    .fb-shop-header.fb-has-banner h1 {
        font-size: 22px;
    }
    .fb-banner-subtext {
        font-size: 13px;
    }
    .fb-crumbs {
        font-size: 13px;
        padding: 6px 14px;
    }
    /* Disable hover effects on mobile */
    .fb-shop-header.fb-has-banner:hover .fb-banner-img {
        transform: none;
    }
    .fb-shop-header.fb-has-banner .fb-banner-picture::after {
        display: none;
    }
}

@media (max-width: 480px) {
    .fb-shop-header {
        border-radius: 12px;
        margin-bottom: 20px;
    }
    .fb-shop-header.fb-has-banner h1 {
        font-size: 19px;
    }
    .fb-banner-subtext {
        font-size: 12px;
    }
    .fb-banner-overlay {
        padding: 12px 16px;
    }
}

/* ─────────────────────────────────────────────────────────────
   5.  MOBILE FILTER: toolbar button + bottom sheet (v1.2.0)
   The widget used to sit in the sidebar, which Porto drops below every
   product on phones. script.js now puts a Filter button beside Sort and
   moves the widget into a bottom sheet. Desktop is unaffected.
   ───────────────────────────────────────────────────────────── */
.fb-filter-trigger,
.fb-fsheet,
.fb-fsheet-overlay { display: none; }

@media (max-width: 991px) {
    .shop-loop-before.fb-has-filter { display: flex !important; align-items: stretch !important; gap: 10px !important; }
    .shop-loop-before.fb-has-filter > .woocommerce-ordering { flex: 1 1 0 !important; min-width: 0 !important; margin: 0 !important; }
    /* Filter and Sort as a matched pair. !important because the theme's
       global button/select styles (pink fill, uppercase) otherwise win. */
    .shop-loop-before.fb-has-filter > .woocommerce-ordering select {
        width: 100% !important; height: 46px !important; min-height: 46px !important;
        padding: 0 28px 0 12px !important;
        border: 1px solid #e2e8f0 !important; border-radius: 10px !important;
        background-color: #fff !important; color: #0f172a !important;
        font-size: 14px !important; font-weight: 600 !important; text-transform: none !important; letter-spacing: 0 !important;
        text-overflow: ellipsis; box-shadow: 0 1px 2px rgba(0,0,0,.04) !important;
    }

    .fb-filter-trigger {
        flex: 0 0 auto !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        height: 46px !important;
        min-height: 46px !important;
        margin: 0 !important;
        padding: 0 14px !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 10px !important;
        background: #fff !important;
        color: #0f172a !important;
        font-size: 15px !important;
        font-weight: 700 !important;
        line-height: 1 !important;
        text-transform: none !important;
        letter-spacing: 0 !important;
        cursor: pointer;
        box-shadow: 0 1px 2px rgba(0,0,0,.04) !important;
    }
    .fb-filter-trigger span { color: #0f172a !important; font: inherit !important; }
    .fb-filter-trigger svg { width: 20px !important; height: 20px !important; color: #C40044 !important; stroke: #C40044 !important; flex: none; }
    .fb-filter-trigger b {
        min-width: 20px; height: 20px; padding: 0 6px;
        border-radius: 10px; background: #C40044; color: #fff;
        font-size: 12px; line-height: 20px; text-align: center;
    }
    .fb-filter-trigger:active { background: #fdf0f4 !important; }

    .fb-fsheet-overlay {
        display: block;
        position: fixed; inset: 0;
        background: rgba(17,17,17,.5);
        opacity: 0; visibility: hidden;
        transition: opacity .25s ease, visibility 0s linear .25s;
        z-index: 100010;
    }
    .fb-fsheet-overlay.is-open { opacity: 1; visibility: visible; transition: opacity .25s ease; }

    .fb-fsheet {
        display: flex;
        flex-direction: column;
        position: fixed; left: 0; right: 0; bottom: 0;
        max-height: 82vh; max-height: 82dvh;
        background: #fff;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -10px 40px rgba(0,0,0,.2);
        transform: translateY(105%);
        visibility: hidden;
        transition: transform .3s cubic-bezier(.2,.8,.2,1), visibility 0s linear .3s;
        z-index: 100011;
    }
    .fb-fsheet.is-open { transform: none; visibility: visible; transition: transform .3s cubic-bezier(.2,.8,.2,1); }

    .fb-fsheet-head {
        position: relative;
        flex: none;
        display: flex; align-items: center; justify-content: space-between;
        padding: 20px 12px 12px 20px;
        border-bottom: 1px solid #f1f5f9;
    }
    .fb-fsheet-head strong { font-size: 17px; font-weight: 800; color: #0f172a; }
    .fb-fsheet-grip {
        position: absolute; top: 8px; left: 50%;
        width: 40px; height: 4px; margin-left: -20px;
        border-radius: 2px; background: #e2e8f0;
    }
    .fb-fsheet-close {
        width: 40px; height: 40px;
        display: inline-flex; align-items: center; justify-content: center;
        border: 0 !important; border-radius: 50% !important;
        background: #f1f5f9 !important; color: #334155 !important;
        font-size: 26px; line-height: 1; padding: 0 !important; cursor: pointer; box-shadow: none !important;
    }
    .fb-fsheet-body {
        flex: 1;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding: 8px 12px calc(16px + env(safe-area-inset-bottom));
    }

    /* The widget inside the sheet: plain list, no card chrome, always shown
       (the child theme hides .fb-filter-box on phones for the old toggle). */
    .fb-fsheet .fb-filter-box {
        display: block !important;
        position: static !important;
        border: 0 !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 0 !important;
        animation: none !important;
    }
    .fb-fsheet .fb-filter-box h2,
    .fb-fsheet .fb-filter-box .widget-title { display: none !important; }

    .fb-filter-widget { display: none !important; }

    html.fb-fsheet-lock, html.fb-fsheet-lock body { overflow: hidden !important; }
}
@media (max-width: 991px) and (prefers-reduced-motion: reduce) {
    .fb-fsheet, .fb-fsheet-overlay { transition: none !important; }
}

@keyframes slideDownFade {
    0%   { opacity: 0; transform: translateY(-15px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─────────────────────────────────────────────────────────────
   6.  CHECKBOX CATEGORY WIDGET
   ───────────────────────────────────────────────────────────── */
.fb-filter-box {
    background: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", Roboto, sans-serif;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.05);
    border-radius: 20px;
    padding: 24px 20px;
    position: sticky;
    top: 30px;
}

.widget_fb_cat_checklist h2.widget-title, .fb-filter-box h2 {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f5f9;
    letter-spacing: -0.2px;
}

ul.fb-checklist { list-style: none !important; margin: 0 !important; padding: 0 !important; }
ul.fb-checklist li { list-style: none !important; margin: 0 !important; padding: 0 !important; position: relative; }

/* Link row */
a.fb-chk-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    text-decoration: none !important;
    color: #475569 !important;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 10px;
    margin-bottom: 4px;
    position: relative;
    overflow: hidden;
}

a.fb-chk-link::before {
    content: '';
    position: absolute;
    left: 0; top: 10%; height: 80%; width: 4px;
    background: #ce2a37;
    transform: scaleY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
}

a.fb-chk-link:hover {
    background: #f8fafc;
    color: #0f172a !important;
    transform: translateX(4px);
}

/* Checkbox visual */
.fb-box {
    width: 22px; height: 22px;
    border: 2px solid #cbd5e1;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; background: #fff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

/* Checked state */
li.checked > a .fb-box {
    background: #ce2a37;
    border-color: #ce2a37;
    box-shadow: 0 4px 12px rgba(206, 42, 55, 0.35);
    transform: scale(1.05);
}

li.checked > a .fb-box::after {
    content: ''; width: 6px; height: 12px;
    border: solid white; border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg); margin-top: -2px;
    animation: drawCheck 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes drawCheck {
    0%   { height: 0; width: 0; opacity: 0; }
    100% { height: 11px; width: 5px; opacity: 1; }
}

li.checked > a {
    font-weight: 700;
    color: #0f172a !important;
    background: linear-gradient(90deg, #fff1f2 0%, #ffffff 100%);
}

li.checked > a::before {
    transform: scaleY(1);
}

li.checked > a:hover { transform: translateX(2px); background: #fee2e2; }

/* Text & count pills */
.fb-name { flex-grow: 1; line-height: 1.4; color: inherit; transition: color 0.3s; }
.fb-cnt {
    font-size: 13px; color: #64748b;
    background: #f1f5f9; padding: 3px 10px;
    border-radius: 20px; font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

li.checked > a .fb-cnt { color: #ce2a37; background: #ffe4e6; box-shadow: 0 2px 8px rgba(206,42,55,0.15); }
a.fb-chk-link:hover .fb-cnt { background: #e2e8f0; color: #334155; transform: scale(1.05); }
li.checked > a:hover .fb-cnt { background: #fecdd3; }

/* Sub-categories */
ul.level-child {
    padding-left: 20px !important;
    position: relative;
    border-left: 1px solid #e2e8f0;
    margin-left: 30px !important;
    margin-top: 5px !important;
    margin-bottom: 10px !important;
}

ul.level-child > li::before {
    content: '';
    position: absolute;
    left: -21px; top: 24px;
    width: 16px; height: 1.5px;
    background: #e2e8f0;
    transition: background 0.3s;
}

ul.level-child > li:hover::before { background: #cbd5e1; }
ul.level-child > li:last-child { background: #fff; }

ul.level-child > li:last-child::after {
    content: '';
    position: absolute;
    bottom: -15px; left: -25px;
    width: 10px; height: 100%;
    background: #fff;
    z-index: -1;
}

a.fb-chk-link:hover .fb-box { border-color: #94a3b8; }

/* ─────────────────────────────────────────────────────────────
   7.  ACCESSIBILITY & PRINT
   ───────────────────────────────────────────────────────────── */
.fb-header-banner-link:focus-visible {
    outline: 3px solid #C40044;
    outline-offset: 3px;
}

@media print {
    .fb-shop-header.fb-has-banner { box-shadow: none; }
    .fb-banner-picture::after { display: none !important; }
}

/* ─────────────────────────────────────────────────────────────
   COMPACT CATEGORY HEADER ON PHONES (v1.2.1)
   The title card was 186px tall with a pill-shaped 15px breadcrumb, so on
   a phone it filled a third of the first screen before any product. Now
   ~92px: smaller title, breadcrumb as one plain 13px line (ellipsis if long).
   'body' prefix + !important because the child theme styles .fb-shop-header
   and .fb-crumbs with !important. Google's breadcrumb data is separate
   JSON-LD in the page, so this is purely visual.
   ───────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    body .fb-shop-header {
        padding: 16px 18px !important;
        border-radius: 14px !important;
        margin-bottom: 16px !important;
        box-shadow: 0 6px 16px -10px rgba(16, 94, 56, .35) !important;
    }
    body .fb-shop-header::before { display: none !important; }
    body .fb-shop-header::after { font-size: 72px !important; right: 6px !important; bottom: -14px !important; }
    body .fb-shop-header h1 {
        font-size: 24px !important;
        line-height: 1.2 !important;
        letter-spacing: -.4px !important;
        margin: 0 0 4px !important;
    }
    body .fb-shop-header .fb-crumbs {
        display: block !important;
        background: none !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        font-size: 13px !important;
        font-weight: 500 !important;
        line-height: 1.4 !important;
        color: #2e6b4f !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    body .fb-shop-header .fb-crumbs a { color: #b3122f !important; }
}
