/* ════════════════════════════════════════════════════════════
   TCE Archive Filter — Styles
   ════════════════════════════════════════════════════════════ */

.tceaf-wrap {
    --tceaf-teal:   #1a3d47;
    --tceaf-teal2:  #0d7377;
    --tceaf-gold:   #AE9A78;
    --tceaf-beige:  #f0ece4;
    --tceaf-border: #e4e8eb;
    --tceaf-text:   #3d4a52;
    --tceaf-muted:  #6b7a8a;
    --tceaf-card-w: 360px;   /* fixed reference card width — used to size the grid columns */
    font-family: inherit;
    color: var(--tceaf-text);
}
.tceaf-wrap *, .tceaf-wrap *::before, .tceaf-wrap *::after { box-sizing: border-box; }

/* ── TOP BAR ───────────────────────────────────────────────── */
.tceaf-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.tceaf-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--tceaf-teal);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .18s;
    position: relative;
}
.tceaf-toggle-btn:hover { background: var(--tceaf-teal2); }
.tceaf-toggle-btn[aria-expanded="true"] { background: var(--tceaf-teal2); }

.tceaf-active-count {
    background: var(--tceaf-gold);
    color: var(--tceaf-teal);
    font-size: 11px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.tceaf-results-meta { font-size: 13px; color: var(--tceaf-muted); }

/* ── BODY: drawer + results side by side ──────────────────────
   Default: drawer closed → results take full width, grid shows
   the natural N columns set by --tceaf-cols.
   Open state: switch to [sidebar][results] grid; the results
   column keeps using the SAME column track width as before
   (var(--tceaf-card-w)) so cards never resize — columns just
   drop off the right edge instead of stretching.
   ─────────────────────────────────────────────────────────── */
.tceaf-body {
    display: block;
    position: relative;
}

.tceaf-drawer {
    display: none; /* hidden until opened */
}

.tceaf-results { width: 100%; }

.tceaf-grid {
    display: grid;
    grid-template-columns: repeat(var(--tceaf-cols, 3), 1fr);
    gap: 22px;
    align-items: start;
}

/* ── OPEN STATE ────────────────────────────────────────────── */
.tceaf-wrap.tceaf-open .tceaf-body {
    display: grid;
    grid-template-columns: 25% 75%;
    gap: 24px;
    align-items: start;
}

.tceaf-wrap.tceaf-open .tceaf-drawer {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1.5px solid var(--tceaf-border);
    border-radius: 14px;
    overflow: hidden;
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 110px);
}

/* Cards keep their natural width — grid switches from N cols to
   a fixed-width auto-fill so the 3rd column simply disappears
   rather than stretching the remaining 2 cards. */
.tceaf-wrap.tceaf-open .tceaf-grid {
    grid-template-columns: repeat(auto-fill, minmax(0, 1fr));
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 1024px) {
    .tceaf-wrap.tceaf-open .tceaf-body { grid-template-columns: 1fr; }
    .tceaf-wrap.tceaf-open .tceaf-drawer {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 86vw;
        max-width: 380px;
        max-height: 100vh;
        z-index: 99999;
        border-radius: 0;
        box-shadow: 0 0 40px rgba(0,0,0,.25);
    }
    .tceaf-wrap.tceaf-open .tceaf-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .tceaf-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
    .tceaf-wrap.tceaf-open .tceaf-grid { grid-template-columns: 1fr; }
    .tceaf-wrap.tceaf-open .tceaf-drawer { width: 92vw; }
}

/* Backdrop on mobile when drawer is open */
.tceaf-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(10,25,30,.55);
    z-index: 99998;
}
@media (max-width: 1024px) {
    .tceaf-wrap.tceaf-open .tceaf-backdrop { display: block; }
}

/* ── DRAWER INTERNALS ──────────────────────────────────────── */
.tceaf-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: var(--tceaf-teal);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}
.tceaf-drawer-close {
    background: rgba(255,255,255,.15);
    border: none;
    border-radius: 50%;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    cursor: pointer;
}
.tceaf-drawer-close:hover { background: rgba(255,255,255,.28); }

.tceaf-drawer-body {
    padding: 16px 18px;
    overflow-y: auto;
    flex: 1;
}

.tceaf-field { margin-bottom: 20px; }
.tceaf-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--tceaf-teal);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 8px;
}

.tceaf-search-input,
.tceaf-tax-search {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--tceaf-border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    margin-bottom: 8px;
}
.tceaf-search-input:focus, .tceaf-tax-search:focus {
    outline: none;
    border-color: var(--tceaf-teal);
}

.tceaf-checklist { display: flex; flex-direction: column; gap: 2px; }
.tceaf-checklist-scroll { max-height: 220px; overflow-y: auto; padding-right: 4px; }

.tceaf-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}
.tceaf-check-row:hover { background: var(--tceaf-beige); }
.tceaf-check-row input[type=checkbox] { flex-shrink: 0; }
.tceaf-check-row span { flex: 1; }
.tceaf-count { color: var(--tceaf-muted); font-size: 11px; font-style: normal; }

.tceaf-price-inputs { display: flex; gap: 10px; margin-bottom: 10px; }
.tceaf-price-box {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1.5px solid var(--tceaf-border);
    border-radius: 8px;
    padding: 6px 10px;
}
.tceaf-price-box span { font-size: 12px; color: var(--tceaf-muted); white-space: nowrap; }
.tceaf-price-box input {
    width: 100%;
    border: none;
    font-size: 13px;
    font-family: inherit;
    text-align: right;
}
.tceaf-price-box input:focus { outline: none; }

.tceaf-price-slider-wrap { position: relative; height: 30px; }
.tceaf-price-range {
    position: absolute;
    top: 10px; left: 0; right: 0;
    width: 100%;
    margin: 0;
    pointer-events: none;
    -webkit-appearance: none;
    background: transparent;
}
.tceaf-price-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    pointer-events: all;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--tceaf-teal);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--tceaf-border);
}
.tceaf-price-range::-moz-range-thumb {
    pointer-events: all;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--tceaf-teal);
    cursor: pointer;
    border: 2px solid #fff;
}
.tceaf-price-range::-webkit-slider-runnable-track { background: transparent; }

.tceaf-drawer-foot {
    display: flex;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1.5px solid var(--tceaf-border);
    flex-shrink: 0;
}
.tceaf-btn-reset, .tceaf-btn-apply {
    flex: 1;
    padding: 11px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}
.tceaf-btn-reset {
    background: #fff;
    border: 1.5px solid var(--tceaf-border);
    color: var(--tceaf-muted);
}
.tceaf-btn-reset:hover { background: var(--tceaf-beige); }
.tceaf-btn-apply {
    background: var(--tceaf-teal);
    border: none;
    color: #fff;
}
.tceaf-btn-apply:hover { background: var(--tceaf-teal2); }

/* ── RESULTS STATE ─────────────────────────────────────────── */
.tceaf-results[data-state="loading"] .tceaf-grid { opacity: .4; pointer-events: none; transition: opacity .15s; }

.tceaf-loadmore-wrap { text-align: center; margin-top: 28px; }
.tceaf-loadmore-btn {
    padding: 12px 32px;
    background: #fff;
    border: 1.5px solid var(--tceaf-teal);
    color: var(--tceaf-teal);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}
.tceaf-loadmore-btn:hover { background: var(--tceaf-teal); color: #fff; }

.tceaf-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--tceaf-muted);
    font-size: 15px;
}
