/* ==========================================================================
   Açılır liste (select) bileşeni — site ve panellerde ortak
   --------------------------------------------------------------------------
   Renkler bulunduğu sayfanın değişkenlerinden gelir:
     site   → --brand, --line, --ink, --surface
     panel  → --accent, --border, --text, --surface-raised
   ========================================================================== */

.sel {
    --sel-accent: var(--brand, var(--accent, #0e7c86));
    --sel-bg: var(--surface-raised, var(--surface, #fff));
    --sel-text: var(--ink, var(--text, #13262b));
    --sel-muted: var(--muted, var(--text-muted, #5d7077));
    --sel-faint: var(--faint, var(--text-faint, #93a3a9));
    --sel-line: var(--line, var(--border, #e3eaec));
    --sel-hover: color-mix(in srgb, var(--sel-accent) 10%, transparent);

    position: relative;
    width: 100%;
    min-width: 0;
}

/* Asıl select görünmez ama yerinde durur (form doğrulaması ve gönderim için) */
.sel__native {
    position: absolute !important;
    left: 0;
    bottom: 0;
    width: 100% !important;
    height: 1px !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0;
    pointer-events: none;
}

.sel__button {
    display: flex !important;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    background-image: none !important;
    -webkit-tap-highlight-color: transparent;
}

/* Sınıfı olmayan select'ler (ör. ana sayfa arama kutusu) için sade görünüm */
.sel__button:not(.select):not(.field-select) {
    min-height: 28px;
    padding: 0;
    border: 0;
    font: inherit;
    font-weight: 600;
    color: var(--sel-text);
    background: transparent;
}

.sel__button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.sel__label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sel__button.is-placeholder .sel__label {
    color: var(--sel-faint);
    font-weight: 500;
}

.sel__chevron {
    flex: none;
    width: 17px;
    height: 17px;
    color: var(--sel-muted);
    transition: transform 0.2s ease, color 0.2s;
}

.sel.is-open .sel__chevron {
    color: var(--sel-accent);
    transform: rotate(180deg);
}

.sel.is-open .sel__button.select,
.sel.is-open .sel__button.field-select {
    border-color: var(--sel-accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--sel-accent) 14%, transparent);
}

.sel__button.is-invalid {
    border-color: var(--danger, #dc3545) !important;
}

/* Seçenek paneli */

.sel__panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 80;
    display: flex;
    flex-direction: column;
    min-width: 220px;
    max-height: 320px;
    padding: 6px;
    border: 1px solid var(--sel-line);
    border-radius: 14px;
    background: var(--sel-bg);
    box-shadow: 0 18px 44px rgb(15 30 35 / 0.18), 0 2px 6px rgb(15 30 35 / 0.06);
    animation: sel-in 0.14s ease-out;
}

.sel__panel--up {
    top: auto;
    bottom: calc(100% + 6px);
}

@keyframes sel-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
}

.sel__search {
    flex: none;
    width: 100%;
    height: 38px;
    margin: 0 0 6px;
    padding: 0 12px;
    border: 1px solid var(--sel-line);
    border-radius: 10px;
    font: inherit;
    font-size: 16px;
    color: var(--sel-text);
    background: color-mix(in srgb, var(--sel-text) 4%, transparent);
    outline: none;
}

.sel__search:focus {
    border-color: var(--sel-accent);
}

.sel__list {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    outline: none;
    scrollbar-width: thin;
}

.sel__group {
    padding: 10px 10px 4px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sel-faint);
}

.sel__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 9px;
    font-size: 0.94rem;
    font-weight: 500;
    color: var(--sel-text);
    cursor: pointer;
    user-select: none;
}

.sel__option.is-active {
    background: var(--sel-hover);
}

.sel__option.is-selected {
    font-weight: 700;
    color: var(--sel-accent);
}

.sel__option.is-empty {
    color: var(--sel-muted);
}

.sel__tick {
    flex: none;
    width: 17px;
    height: 17px;
    opacity: 0;
}

.sel__option.is-selected .sel__tick {
    opacity: 1;
}

.sel__none {
    padding: 14px 10px;
    font-size: 0.9rem;
    text-align: center;
    color: var(--sel-faint);
}

/* Telefonda: alttan açılan panel */

.sel__backdrop {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgb(10 20 24 / 0.45);
    animation: sel-fade 0.2s ease-out;
}

@keyframes sel-fade {
    from {
        opacity: 0;
    }
}

.sel__panel--sheet {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    z-index: 310;
    max-height: 72vh;
    padding: 0 12px calc(12px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 22px 22px 0 0;
    animation: sel-up 0.22s ease-out;

    /* Panel body'ye eklendiği için değişkenler burada yeniden tanımlanır */
    --sel-accent: var(--brand, var(--accent, #0e7c86));
    --sel-bg: var(--surface-raised, var(--surface, #fff));
    --sel-text: var(--ink, var(--text, #13262b));
    --sel-muted: var(--muted, var(--text-muted, #5d7077));
    --sel-faint: var(--faint, var(--text-faint, #93a3a9));
    --sel-line: var(--line, var(--border, #e3eaec));
    --sel-hover: color-mix(in srgb, var(--sel-accent) 10%, transparent);
    background: var(--sel-bg);
}

.sel__panel--sheet::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    margin: 10px auto 4px;
    border-radius: 4px;
    background: var(--sel-line);
}

@keyframes sel-up {
    from {
        transform: translateY(100%);
    }
}

.sel__sheet-head {
    padding: 8px 4px 12px;
    font-size: 1.02rem;
    font-weight: 800;
    color: var(--sel-text);
}

.sel__panel--sheet .sel__option {
    min-height: 48px;
    font-size: 1rem;
}

body.sel-locked {
    overflow: hidden;
}
