/* =============================================================================
   hc-filterdrawer.css — mobile off-canvas filter panel.

   On desktop the filter <aside> is a normal grid column. Below 991px the same
   aside becomes a slide-in drawer with a backdrop, so results are visible
   without scrolling past a full screen of checkboxes.

   Markup contract (each page supplies its own ids):
     <button data-fd-open="<aside-id>">            trigger
     <aside id="<aside-id>" data-fd-drawer>        the panel
   The drawer script in frontend/partials/hc-filter-drawer.blade.php wires them.
   ========================================================================== */

.fd-trigger {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 44px;
    margin-bottom: 12px;
    background: #fff;
    border: 1px solid var(--fd-line, #dfeaf0);
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    color: var(--fd-navy, #0d1c51);
    cursor: pointer;
    transition: border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.fd-trigger svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
}

.fd-trigger:hover,
.fd-trigger:focus-visible {
    border-color: var(--fd-teal, #09a9b7);
    color: var(--fd-teal-dark, #087e8b);
    outline: 0;
}

/* how many filters are active — shown as a pill on the trigger */
.fd-trigger__n {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--fd-teal, #09a9b7);
    color: #fff;
    font-size: 11.5px;
    font-weight: 800;
    line-height: 1;
}

.fd-trigger__n[hidden] { display: none; }

/* ------------------------------------------------------------- backdrop */
.fd-backdrop {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(11, 28, 51, .48);
    opacity: 0;
    visibility: hidden;
    transition: opacity .28s ease, visibility .28s ease;
}

.fd-backdrop.is-on {
    opacity: 1;
    visibility: visible;
}

/* --------------------------------------------------------- drawer header */
.fd-drawer__head {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--fd-line, #dfeaf0);
}

/* The panel already prints its own title + Clear All on desktop, so the
   drawer header stays hidden there; on mobile that panel header is dropped
   instead and this one takes over. */
@media (min-width: 992px) {
    .fd-drawer__head { display: none !important; }
}

.fd-drawer__head h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: var(--fd-navy, #0d1c51);
}

.fd-drawer__close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--fd-line, #dfeaf0);
    border-radius: 10px;
    background: #fff;
    color: var(--fd-muted, #6b7897);
    cursor: pointer;
    transition: border-color .18s ease, color .18s ease;
}

.fd-drawer__close svg {
    width: 15px;
    height: 15px;
}

.fd-drawer__close:hover {
    border-color: var(--fd-teal, #09a9b7);
    color: var(--fd-teal-dark, #087e8b);
}

/* --------------------------------------------------------- sticky footer */
.fd-drawer__foot {
    display: none;
    position: sticky;
    bottom: 0;
    z-index: 2;
    gap: 10px;
    padding: 12px 0 4px;
    margin-top: 14px;
    border-top: 1px solid var(--fd-line, #dfeaf0);
    background: #fff;
}

.fd-drawer__foot > * { flex: 1 1 0; }

/* =============================================================== mobile */
@media (max-width: 991px) {
    .fd-trigger {
        display: flex;
    }

    .fd-drawer__head,
    .fd-drawer__foot {
        display: flex;
    }

    /* the panel's own submit is redundant once the sticky footer has one;
       desktop keeps it because the footer is hidden there */
    .fd-panel-submit {
        display: none;
    }

    /* the aside becomes the sliding panel */
    aside[data-fd-drawer] {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1000;
        width: min(360px, 88vw);
        /* block, not flex: flex children shrank and overlapped each other */
        display: block;
        padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        background: #fff;
        box-shadow: 12px 0 40px rgba(11, 28, 51, .2);
        transform: translateX(-102%);
        visibility: hidden;
        transition: transform .3s cubic-bezier(.4, 0, .2, 1), visibility .3s;
    }

    aside[data-fd-drawer].is-open {
        transform: translateX(0);
        visibility: visible;
    }

    /* while open, the page behind must not scroll */
    body.fd-locked {
        overflow: hidden;
    }
}

/* wider phones get the full-width sheet, which reads better than a sliver */
@media (max-width: 991px) and (min-width: 561px) {
    aside[data-fd-drawer] {
        width: min(420px, 92vw);
    }
}