/* ═══════════════════════════════════════════════════════════
   FILTER SIDEBAR — Shared Component
   JustRate · v1.0 · 2026-04-26
   Réutilisable : athletes, coaches, referees, clubs
   ═══════════════════════════════════════════════════════════ */

/* ── LEFT COLUMN BASE OVERRIDE ─────────────────────────────
   Transforms the left-col into a flex-column so the action
   buttons are pinned to the bottom.
   ─────────────────────────────────────────────────────────── */
.left-col {
    display: flex;
    flex-direction: column;
}

/* ── SIDEBAR TOPBAR (tablet/mobile only) ────────────────────
   Shows close button when sidebar is an overlay/slide-out.
   ─────────────────────────────────────────────────────────── */
.fs-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 0.9rem 0.65rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.fs-topbar-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.fs-topbar-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.05rem;
    padding: 0.2rem 0.35rem;
    border-radius: 5px;
    transition: color 0.12s, background 0.12s;
    line-height: 1;
}
.fs-topbar-close:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.07);
}

/* ── SEARCH SECTION (always visible, pinned at top) ─────── */
.fs-search-wrap {
    padding: 0.7rem 0.85rem 0.55rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

/* ── SCROLLABLE FILTER SECTIONS ─────────────────────────── */
.fs-sections {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.06) transparent;
    min-height: 0;
}
.fs-sections::-webkit-scrollbar { width: 3px; }
.fs-sections::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
}

/* ── COLLAPSIBLE SECTION ─────────────────────────────────── */
.fs-section {
    border-bottom: 1px solid var(--border);
}

/* Toggle header button */
.fs-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.58rem 0.85rem;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
}
.fs-toggle:hover {
    background: rgba(255,255,255,0.025);
}

.fs-toggle-icon {
    font-size: 0.82rem;
    flex-shrink: 0;
    width: 1.1rem;
    text-align: center;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* SVG icon styling */
.fs-svg-icon {
    width: 16px;
    height: 16px;
    color: rgba(255, 255, 255, 0.85);
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.fs-toggle:hover .fs-svg-icon {
    color: rgba(255, 255, 255, 1);
}

.fs-section.open > .fs-toggle .fs-svg-icon {
    color: rgba(255, 255, 255, 1);
}

.fs-section.has-value > .fs-toggle .fs-svg-icon {
    color: var(--accent);
}
.fs-toggle-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.69rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fs-section.has-value .fs-toggle-label {
    color: var(--accent);
}

/* "Bientôt" pill */
.fs-soon {
    font-size: 0.54rem;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 0.1rem 0.38rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* Chevron arrow — SVG-based, 24px icon in 40px touch zone */
.fs-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    transition: transform 0.2s ease, color 0.2s ease;
    color: var(--text-secondary);
}
.fs-chevron svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.fs-section.open > .fs-toggle .fs-chevron {
    transform: rotate(90deg);
    color: var(--text-primary);
}
.fs-toggle:hover .fs-chevron {
    color: var(--text-primary);
}

/* ── COLLAPSIBLE BODY ────────────────────────────────────── */
.fs-collapse {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.22s ease-out;
}
.fs-section.open > .fs-collapse {
    max-height: 320px;
    overflow-y: auto;
}
/* Competition section needs much more height for Favoris + Majeures + Nationales accordions */
.fs-section.open#fsSecCompetition > .fs-collapse {
    max-height: 3000px;
    overflow-y: auto;
}
.fs-collapse-inner {
    padding: 0.25rem 0.85rem 0.7rem;
}

/* ── COMPACT SELECT ──────────────────────────────────────── */
.fs-select {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 0.4rem 1.75rem 0.4rem 0.65rem;
    color: var(--text-secondary);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.74rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s, color 0.15s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2355556a' stroke-width='3'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    box-sizing: border-box;
}
.fs-select:hover:not(:disabled),
.fs-select:focus:not(:disabled) {
    border-color: rgba(0,230,118,0.4);
    color: var(--text-primary);
}
.fs-select.has-value:not(:disabled) {
    border-color: rgba(0,230,118,0.3);
    color: var(--accent);
    background-color: rgba(0,230,118,0.04);
}
.fs-select:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2333334a' stroke-width='3'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
.fs-select option {
    background: #1a1a2e;
    color: #d0d0e8;
}

/* ── DISABLED TOOLTIP WRAPPER ────────────────────────────── */
.fs-disabled-wrap {
    position: relative;
}
.fs-disabled-wrap[title] {
    cursor: not-allowed;
}

/* ── FILTER ACTIONS BAR ──────────────────────────────────── */
.fs-actions {
    padding: 0.65rem 0.85rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: #0e0e18;
    flex-shrink: 0;
}

.fs-btn-apply {
    flex: 1;
    background: rgba(0,230,118,0.12);
    border: 1px solid rgba(0,230,118,0.3);
    color: var(--accent);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.69rem;
    font-weight: 700;
    padding: 0.45rem 0.5rem;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}
.fs-btn-apply:hover {
    background: rgba(0,230,118,0.22);
    border-color: var(--accent);
}
.fs-btn-apply.pending {
    background: rgba(0,230,118,0.2);
    border-color: var(--accent);
    animation: fs-pulse 1.8s ease-in-out infinite;
}
@keyframes fs-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0,230,118,0); }
    50%       { box-shadow: 0 0 10px 2px rgba(0,230,118,0.22); }
}

.fs-btn-reset {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.69rem;
    font-weight: 600;
    padding: 0.45rem 0.5rem;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.fs-btn-reset:hover {
    background: rgba(255,255,255,0.07);
    color: var(--text-secondary);
}

.fs-btn-fav {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.88rem;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    padding: 0;
}
.fs-btn-fav:hover {
    background: rgba(255,215,0,0.1);
    border-color: rgba(255,215,0,0.3);
    color: #FFD700;
}
.fs-btn-fav.saved {
    background: rgba(255,215,0,0.12);
    border-color: rgba(255,215,0,0.38);
    color: #FFD700;
}

/* ── MOBILE FILTER OPEN BUTTON ───────────────────────────── */
.filter-open-btn {
    display: none;          /* hidden on desktop — shown via @media */
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s;
    flex-shrink: 0;
}

/* ── STICKY JRI BLOCK — styles now in theme.css ────────── */

/* JRI scale badges (used in sticky block) */
.jri-scale-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.18rem 0;
}
.jri-scale-badge {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.58rem;
    font-weight: 700;
    padding: 0.08rem 0.38rem;
    border-radius: 4px;
    flex-shrink: 0;
}
.jri-scale-label { font-size: 0.6rem; color: var(--text-muted); flex: 1; }
.jri-elite   { background: linear-gradient(135deg,rgba(0,230,118,0.2),rgba(0,179,230,0.2)); color: #00e676; border: 1px solid rgba(0,230,118,0.3); }
.jri-great   { background: linear-gradient(135deg,rgba(0,200,100,0.15),rgba(0,150,200,0.15)); color: #00c878; border: 1px solid rgba(0,200,100,0.25); }
.jri-good    { background: rgba(80,200,130,0.12); color: #50c882; border: 1px solid rgba(80,200,130,0.2); }
.jri-average { background: rgba(255,187,51,0.1); color: #ffbb33; border: 1px solid rgba(255,187,51,0.2); }
.jri-weak    { background: rgba(255,80,80,0.1); color: #ff5555; border: 1px solid rgba(255,80,80,0.2); }
.filter-open-btn:hover {
    border-color: rgba(0,230,118,0.3);
    color: var(--accent);
}
.filter-count-badge {
    background: var(--accent);
    color: #000;
    font-size: 0.58rem;
    font-weight: 800;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── DARK OVERLAY (behind slide-out panel) ───────────────── */
.fs-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 89;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.fs-overlay.active {
    display: block;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════ */

/* ── TABLET (≤900px) ─── left-col becomes slide-out panel ── */
@media (max-width: 900px) {
    .left-col {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 90;
        width: 260px !important;
        min-width: 260px !important;
        max-width: 260px !important;
        transform: translateX(-105%);
        transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 28px rgba(0,0,0,0.5);
    }
    .left-col.sidebar-open {
        transform: translateX(0);
    }
    .fs-topbar {
        display: flex;
    }
    .filter-open-btn {
        display: flex;
    }
}

/* ── MOBILE (≤600px) ─── full-width overlay ─────────────── */
@media (max-width: 600px) {
    .left-col {
        width: 88vw !important;
        min-width: unset !important;
        max-width: 320px !important;
    }
}
