/*
 * Kategori filtre paneli - TEK TASARIM KAYNAGI (kamis + makine).
 *
 * NEDEN AYRI DOSYA (Tailwind utility'leri yerine):
 * Tailwind v4 sinif taramasini DERLEME aninda yapiyor ve public/build/ icindeki
 * derlenmis CSS elle uretiliyor. Blade'e bugun yeni bir utility yazilirsa
 * (ornegin "sticky bottom-0") derleme yenilenmedikce o sinif CSS'te YOK ve
 * sessizce etkisiz kaliyor. Panelin govdesi bu yuzden derleme gerektirmeyen
 * duz CSS; public/js/*.js dosyalari gibi dogrudan servis ediliyor.
 *
 * Yerlesim sozlesmesi: .cf-panel bir FLEX SUTUN'dur.
 *   .cf-head  -> sabit yukseklik
 *   .cf-body  -> kalan alan, kendi icinde kayar (overflow-y:auto)
 *   .cf-foot  -> panelin altina yapisik ("ARA" butonu)
 * Panel yuksekligi masaustunde ekran yuksekligine kilitli oldugu icin buton
 * filtre ne kadar uzarsa uzasin EKRANIN ALTINDA kalir; kisa filtrelerde ise
 * dogal olarak listenin hemen altindadir.
 */

:root {
    --cf-border: #e5e7eb;
    --cf-border-strong: #d1d5db;
    --cf-text: #374151;
    --cf-text-muted: #6b7280;
    --cf-text-faint: #9ca3af;
    --cf-accent: #0284c7;
    --cf-accent-soft: #e0f2fe;
    --cf-accent-hover: #0369a1;
    --cf-surface: #ffffff;
    --cf-surface-alt: #f9fafb;
    --cf-radius: 10px;
}

/* ------------------------------------------------------------------ panel */

.cf-panel {
    display: flex;
    flex-direction: column;
    background: var(--cf-surface);
    border: 1px solid var(--cf-border);
    border-radius: var(--cf-radius);
    overflow: hidden;
    font-size: 14px;
    color: var(--cf-text);
}

@media (min-width: 1024px) {
    .cf-panel {
        position: sticky;
        top: 16px;
        /* Panel ekrandan uzun olamaz: govde kendi icinde kayar, "ARA"
           butonu her zaman gorunur kalir. Eski panel `sticky top-8` ile
           yapisiyordu ve uzun filtrelerde alt ucu HIC ERISILEMIYORDU. */
        max-height: calc(100vh - 32px);
    }
}

/* ------------------------------------------------------------------- head */

.cf-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--cf-border);
    background: var(--cf-surface);
    flex: 0 0 auto;
}

.cf-head__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    color: #111827;
    margin: 0;
}

.cf-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--cf-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.cf-badge[hidden] {
    display: none;
}

.cf-head__clear {
    border: 0;
    background: none;
    padding: 4px 2px;
    font-size: 13px;
    color: var(--cf-text-muted);
    text-decoration: underline;
    cursor: pointer;
}

.cf-head__clear:hover {
    color: var(--cf-accent);
}

.cf-head__close {
    display: none;
    border: 0;
    background: none;
    padding: 4px 8px;
    font-size: 20px;
    line-height: 1;
    color: var(--cf-text-muted);
    cursor: pointer;
}

/* ------------------------------------------------------------------- body */

.cf-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 14px;
    -webkit-overflow-scrolling: touch;
}

.cf-body::-webkit-scrollbar {
    width: 6px;
}

.cf-body::-webkit-scrollbar-thumb {
    background: var(--cf-border-strong);
    border-radius: 999px;
}

/* ------------------------------------------------------------------ arama */

.cf-search {
    position: relative;
    padding: 12px 0;
}

.cf-search input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px 9px 34px;
    border: 1px solid var(--cf-border-strong);
    border-radius: 8px;
    font-size: 14px;
    color: var(--cf-text);
    background: var(--cf-surface-alt);
}

.cf-search input:focus {
    outline: none;
    border-color: var(--cf-accent);
    background: var(--cf-surface);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.cf-search__icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--cf-text-faint);
    pointer-events: none;
}

/* ------------------------------------------------------------- secili rozet */

.cf-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 12px;
}

.cf-chips:empty {
    display: none;
}

.cf-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 3px 6px 3px 9px;
    border: 1px solid var(--cf-accent-soft);
    border-radius: 999px;
    background: var(--cf-accent-soft);
    color: var(--cf-accent-hover);
    font-size: 12px;
    line-height: 1.6;
}

.cf-chip__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cf-chip__remove {
    border: 0;
    background: none;
    padding: 0;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    color: inherit;
    font-size: 14px;
    line-height: 14px;
    cursor: pointer;
    flex: 0 0 auto;
}

.cf-chip__remove:hover {
    background: rgba(2, 132, 199, 0.18);
}

/* ------------------------------------------------------------------- grup */

.cf-group {
    border-top: 1px solid var(--cf-border);
    padding: 2px 0;
}

.cf-group[hidden] {
    display: none;
}

.cf-group__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 12px 0;
    border: 0;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--cf-text);
    text-align: left;
    cursor: pointer;
}

.cf-group__toggle:hover {
    color: var(--cf-accent);
}

.cf-group__name {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.cf-group__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--cf-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.cf-group__count[hidden] {
    display: none;
}

.cf-group__chevron {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    color: var(--cf-text-faint);
    transition: transform 0.18s ease;
}

.cf-group[data-open="false"] .cf-group__chevron {
    transform: rotate(-90deg);
}

.cf-group[data-open="false"] .cf-group__body {
    display: none;
}

.cf-group__body {
    padding-bottom: 12px;
}

/* --------------------------------------------------------------- secenekler */

.cf-filter {
    position: relative;
    margin-bottom: 8px;
}

.cf-filter input {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 10px;
    border: 1px solid var(--cf-border);
    border-radius: 7px;
    font-size: 13px;
}

.cf-filter input:focus {
    outline: none;
    border-color: var(--cf-accent);
}

.cf-options {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 260px;
    overflow-y: auto;
}

.cf-options::-webkit-scrollbar {
    width: 5px;
}

.cf-options::-webkit-scrollbar-thumb {
    background: var(--cf-border-strong);
    border-radius: 999px;
}

.cf-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 4px;
    border-radius: 6px;
    cursor: pointer;
    line-height: 1.35;
}

.cf-option:hover {
    background: var(--cf-surface-alt);
}

.cf-option[hidden] {
    display: none;
}

.cf-option input[type="checkbox"] {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--cf-accent);
    cursor: pointer;
}

.cf-option__label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--cf-text);
    font-size: 13.5px;
}

.cf-option__count {
    flex: 0 0 auto;
    color: var(--cf-text-faint);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.cf-option input:checked ~ .cf-option__label {
    font-weight: 600;
    color: var(--cf-accent-hover);
}

.cf-more {
    margin-top: 6px;
    border: 0;
    background: none;
    padding: 2px 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--cf-accent);
    cursor: pointer;
}

.cf-more:hover {
    text-decoration: underline;
}

.cf-empty {
    padding: 6px 4px;
    color: var(--cf-text-faint);
    font-size: 13px;
}

/* --------------------------------------------------------------- bool grup */

.cf-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 4px;
    cursor: pointer;
}

.cf-switch input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--cf-accent);
    cursor: pointer;
}

.cf-switch__label {
    flex: 1 1 auto;
    font-weight: 600;
    font-size: 14px;
}

/* -------------------------------------------------------------- aralik grup */

.cf-range__inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cf-range__inputs input {
    flex: 1 1 0;
    min-width: 0;
    box-sizing: border-box;
    padding: 7px 8px;
    border: 1px solid var(--cf-border-strong);
    border-radius: 7px;
    font-size: 13px;
    text-align: center;
    color: var(--cf-text);
    -moz-appearance: textfield;
}

.cf-range__inputs input::-webkit-outer-spin-button,
.cf-range__inputs input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cf-range__inputs input:focus {
    outline: none;
    border-color: var(--cf-accent);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.cf-range__dash {
    color: var(--cf-text-faint);
}

.cf-range__unit {
    flex: 0 0 auto;
    color: var(--cf-text-muted);
    font-size: 12px;
}

.cf-slider {
    position: relative;
    height: 22px;
    margin-top: 12px;
}

.cf-slider__track,
.cf-slider__fill {
    position: absolute;
    top: 9px;
    height: 4px;
    border-radius: 999px;
}

.cf-slider__track {
    left: 0;
    right: 0;
    background: var(--cf-border);
}

.cf-slider__fill {
    background: var(--cf-accent);
}

.cf-slider input[type="range"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 22px;
    margin: 0;
    background: none;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
}

.cf-slider input[type="range"]:focus {
    outline: none;
}

.cf-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    pointer-events: all;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--cf-accent);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
    cursor: pointer;
}

.cf-slider input[type="range"]::-moz-range-thumb {
    pointer-events: all;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--cf-accent);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
    cursor: pointer;
}

.cf-slider input[type="range"]:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.25);
}

/* ------------------------------------------------------------------- ayak */

.cf-foot {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--cf-border);
    background: var(--cf-surface);
    box-shadow: 0 -4px 12px rgba(17, 24, 39, 0.06);
}

.cf-apply {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border: 0;
    border-radius: 8px;
    background: var(--cf-accent);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.15s ease;
}

.cf-apply:hover {
    background: var(--cf-accent-hover);
}

.cf-apply:disabled {
    background: var(--cf-border-strong);
    cursor: not-allowed;
}

.cf-apply__spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cf-spin 0.7s linear infinite;
}

.cf-apply__spinner[hidden] {
    display: none;
}

@keyframes cf-spin {
    to {
        transform: rotate(360deg);
    }
}

.cf-reset {
    flex: 0 0 auto;
    padding: 11px 14px;
    border: 1px solid var(--cf-border-strong);
    border-radius: 8px;
    background: var(--cf-surface);
    color: var(--cf-text-muted);
    font-size: 14px;
    cursor: pointer;
}

.cf-reset:hover {
    background: var(--cf-surface-alt);
    color: var(--cf-text);
}

/* --------------------------------------------------- mobil cekmece (drawer) */

.cf-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
    z-index: 60;
}

body.cf-open .cf-backdrop {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 1023px) {
    .cf-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 88%;
        max-width: 380px;
        z-index: 70;
        transform: translateX(-100%);
        transition: transform 0.24s ease;
    }

    body.cf-open .cf-sidebar {
        transform: translateX(0);
    }

    body.cf-open {
        overflow: hidden;
    }

    .cf-panel {
        height: 100%;
        border: 0;
        border-radius: 0;
    }

    .cf-head__close {
        display: block;
    }

    /* Mobilde ayak, cihaz cubugunun altina girmesin. */
    .cf-foot {
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
}

@media (min-width: 1024px) {
    .cf-backdrop {
        display: none;
    }
}

/* ------------------------------------------------- liste yukleme gostergesi */

.cf-results {
    position: relative;
}

.cf-progress {
    position: relative;
    height: 3px;
    margin-bottom: 10px;
    border-radius: 999px;
    background: var(--cf-border);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.cf-progress[data-active="true"] {
    opacity: 1;
}

.cf-progress::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 40%;
    border-radius: 999px;
    background: var(--cf-accent);
    animation: cf-slide 1.1s ease-in-out infinite;
}

@keyframes cf-slide {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(350%);
    }
}

.cf-results[data-loading="true"] .cf-results__list {
    opacity: 0.45;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.cf-results__list {
    transition: opacity 0.15s ease;
}

/* ------------------------------------------------------- mobil filtre cubugu */

.cf-mobilebar__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    border-radius: 999px;
    background: var(--cf-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.cf-mobilebar__count[hidden] {
    display: none;
}
