/**
 * e-Koç Dashboard – Tek dropdown tasarımı (main-dropdown + exam-filter-chip)
 * Referans: pill-style, border-2, chevron rotasyonu, panel animasyonu, seçili check
 */

/* ---- Sidebar logo stability ---- */
#sidebar-header {
    min-height: 76px;
    overflow: visible;
    contain: layout style paint;
    will-change: contents;
}
#sidebar.sidebar-spa-shell {
    contain: layout style paint;
}
#sidebar-header img,
#sidebar-header .sidebar-logo-img,
#dashboard-mobile-header img,
#dashboard-mobile-header .sidebar-logo-img {
    display: block;
    width: 120px !important;
    height: 40px !important;
    max-width: 120px;
    max-height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}
#dashboard-mobile-header .sidebar-logo-img--mobile,
#dashboard-mobile-header img.sidebar-logo-img--mobile {
    width: 108px !important;
    height: 36px !important;
    max-width: 108px;
    max-height: 36px;
}
#sidebar-header a,
#dashboard-mobile-header a {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 0;
}
/* Navigasyonda sidebar transform animasyonu logo titremesine yol açar — sadece etkileşim sonrası */
#sidebar {
    transition: none;
}
#sidebar.sidebar-anim {
    transition: transform 0.3s ease-in-out !important;
}
#sidebar-header img,
#dashboard-mobile-header img {
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transition: none !important;
    animation: none !important;
}

#dashboard-page-root {
    contain: layout style;
}

/* ---- Hidden native select ---- */
.custom-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: none;
}
.custom-select:focus {
    outline: none;
}

.main-dropdown .main-dropdown-select-hidden {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    margin: 0;
    padding: 0;
    border: none;
}

/* ---- Main dropdown wrapper ---- */
.main-dropdown {
    position: relative;
}
.main-dropdown--open {
    z-index: 99999;
}

/* ---- Trigger (kapalı/açık ortak) ---- */
.main-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.75rem 0.75rem 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 2px solid var(--border-default);
    background: var(--bg-surface-1);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.main-dropdown-trigger:hover {
    border-color: var(--accent-strong);
}

.main-dropdown-chevron {
    flex-shrink: 0;
    transition: rotate 0.3s ease, color 0.3s ease;
    color: var(--text-tertiary);
    rotate: 0deg;
}
.main-dropdown--open .main-dropdown-chevron {
    rotate: 180deg;
    color: var(--accent);
}

/* ---- Panel (açılır liste) ---- */
.main-dropdown-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    z-index: 99999;
    min-width: 100%;
    max-height: 280px;
    overflow-y: auto;
    border-radius: 0.75rem;
    border: 1px solid var(--border-strong);
    background: var(--bg-overlay);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.3);
    opacity: 0;
    transform: scale(0.95);
    transform-origin: top;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}
.main-dropdown-panel.main-dropdown-panel--visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* ---- Panel yukarı açılan (dropup – altta kalan alanlar için) ---- */
.main-dropdown-panel--dropup {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 0.5rem;
    transform-origin: bottom;
}
.main-dropdown-panel--dropup.main-dropdown-panel--visible {
    transform: scale(1);
}

/* Profil düzenleme: il listesi kart sınırını aşmasın diye yukarı açılır */
#profileFormBlock .main-dropdown--open {
    z-index: 100000;
}
#profileFormBlock .main-dropdown-panel {
    z-index: 100001;
}

/* ---- Option (her seçenek) ---- */
@keyframes slideInOpt {
    0% { opacity: 0; transform: translate3d(-10px, 0, 0); }
    100% { opacity: 1; transform: translate3d(0, 0, 0); }
}

.main-dropdown-opt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    opacity: 0;
}
.main-dropdown-panel--visible .main-dropdown-opt {
    animation: slideInOpt 0.2s ease-out forwards;
}

/* Option animasyon gecikmeleri (max 5, 0.03s aralik — performans) */
.main-dropdown-panel--visible .main-dropdown-opt:nth-child(1) { animation-delay: 0.03s; }
.main-dropdown-panel--visible .main-dropdown-opt:nth-child(2) { animation-delay: 0.06s; }
.main-dropdown-panel--visible .main-dropdown-opt:nth-child(3) { animation-delay: 0.09s; }
.main-dropdown-panel--visible .main-dropdown-opt:nth-child(4) { animation-delay: 0.12s; }
.main-dropdown-panel--visible .main-dropdown-opt:nth-child(5) { animation-delay: 0.15s; }

.main-dropdown-opt:last-child {
    border-bottom: none;
}

.main-dropdown-search-wrap {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-overlay);
}

.main-dropdown-search {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-default);
    background: var(--bg-surface-1);
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
}
.main-dropdown-search:focus {
    border-color: var(--accent-strong);
}

.main-dropdown-options {
    max-height: 220px;
    overflow-y: auto;
}

.main-dropdown-empty {
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    text-align: center;
    margin: 0;
}

.main-dropdown-opt:hover {
    background: var(--accent-subtle);
    color: var(--accent);
}
.main-dropdown-opt-check {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    color: inherit;
    /* İkon geçişindeki gereksiz yükü azaltıyoruz */
    pointer-events: none;
}

/* ---- Exam filter chip (student sayfası – main-dropdown ile aynı görsel dil) ---- */
.exam-filter-chip {
    position: relative;
}
.exam-filter-chip.exam-filter-chip--open {
    z-index: 99999;
}
.exam-filter-chip-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.375rem;
    width: 100%;
    min-height: 2rem;
    padding: 0.375rem 0.5rem 0.375rem 0.75rem;
    border-radius: 0.5rem;
    border: 2px solid var(--border-default);
    background: var(--bg-surface-1);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.exam-filter-chip-btn:hover {
    border-color: var(--accent-strong);
}
.exam-filter-chevron {
    flex-shrink: 0;
    width: 0.875rem;
    height: 0.875rem;
    transition: rotate 0.3s ease, color 0.3s ease;
    color: var(--text-tertiary);
    rotate: 0deg;
}
.exam-filter-chip.exam-filter-chip--open .exam-filter-chevron {
    rotate: 180deg;
    color: var(--accent);
}
.exam-filter-chip .exam-filter-dropdown {
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 0.375rem;
    z-index: 99999;
    min-width: 100%;
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--border-strong);
    background: var(--bg-overlay);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.35), 0 4px 6px -4px rgb(0 0 0 / 0.2);
    border-radius: 0.5rem;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.96);
    transform-origin: top;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}
.exam-filter-chip.exam-filter-chip--open .exam-filter-dropdown {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}
.exam-filter-chip .exam-filter-dropdown button,
.exam-filter-chip .exam-filter-dropdown a,
.exam-filter-chip .exam-filter-dropdown [role="button"],
.exam-filter-chip .exam-filter-dropdown > div {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.8125rem;
    transition: background 0.15s ease, color 0.15s ease;
    opacity: 0;
}
.exam-filter-chip.exam-filter-chip--open .exam-filter-dropdown button,
.exam-filter-chip.exam-filter-chip--open .exam-filter-dropdown a,
.exam-filter-chip.exam-filter-chip--open .exam-filter-dropdown [role="button"],
.exam-filter-chip.exam-filter-chip--open .exam-filter-dropdown > div {
    animation: slideInOpt 0.2s ease-out forwards;
}

.exam-filter-chip.exam-filter-chip--open .exam-filter-dropdown button:nth-child(1) { animation-delay: 0.03s; }
.exam-filter-chip.exam-filter-chip--open .exam-filter-dropdown button:nth-child(2) { animation-delay: 0.06s; }
.exam-filter-chip.exam-filter-chip--open .exam-filter-dropdown button:nth-child(3) { animation-delay: 0.09s; }
.exam-filter-chip.exam-filter-chip--open .exam-filter-dropdown button:nth-child(4) { animation-delay: 0.12s; }
.exam-filter-chip.exam-filter-chip--open .exam-filter-dropdown button:nth-child(5) { animation-delay: 0.15s; }

.exam-filter-chip .exam-filter-dropdown button:hover,
.exam-filter-chip .exam-filter-dropdown a:hover {
    background: var(--accent-subtle);
    color: var(--accent);
}

/* — Auth light panel dropdown (register location) — */
.auth-split__panel .main-dropdown-trigger {
    min-height: auto;
    padding: 0.5rem 1.5rem 0.625rem 0;
    border: none;
    border-bottom: 1px solid rgba(17, 17, 17, 0.22);
    border-radius: 0;
    background: transparent;
    color: #111;
    font-size: 0.9375rem;
    font-weight: 400;
}

.auth-split__panel .main-dropdown-trigger:hover {
    border-bottom-color: rgba(17, 17, 17, 0.4);
}

.auth-split__panel .main-dropdown--open .main-dropdown-trigger {
    border-bottom-color: #111;
}

.auth-split__panel .main-dropdown-chevron {
    color: #9ca3af;
    width: 1.25rem;
    height: 1.25rem;
}

.auth-split__panel .main-dropdown--open .main-dropdown-chevron {
    color: #111;
}

.auth-split__panel .main-dropdown-panel {
    border: 1px solid rgba(17, 17, 17, 0.12);
    border-radius: 0.5rem;
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 4px 10px -4px rgba(0, 0, 0, 0.08);
}

.auth-split__panel .main-dropdown-search-wrap {
    background: #fff;
    border-bottom-color: rgba(17, 17, 17, 0.1);
}

.auth-split__panel .main-dropdown-search {
    border-color: rgba(17, 17, 17, 0.15);
    background: #f9fafb;
    color: #111;
}

.auth-split__panel .main-dropdown-search:focus {
    border-color: #111;
}

.auth-split__panel .main-dropdown-opt {
    color: #374151;
    border-bottom-color: rgba(17, 17, 17, 0.08);
}

.auth-split__panel .main-dropdown-opt:hover {
    background: rgba(219, 242, 39, 0.15);
    color: #111;
}

.auth-split__panel .main-dropdown-empty {
    color: #9ca3af;
}

@media (max-width: 1023px) {
    .auth-split__panel--register .main-dropdown-trigger {
        font-size: 1rem;
        color: #fff;
        border-bottom-color: rgba(255, 255, 255, 0.22);
    }

    .auth-split__panel--register .main-dropdown-trigger:hover {
        border-bottom-color: rgba(255, 255, 255, 0.35);
    }

    .auth-split__panel--register .main-dropdown--open .main-dropdown-trigger {
        border-bottom-color: #fff;
    }

    .auth-split__panel--register .main-dropdown-chevron {
        color: #9ca3af;
    }

    .auth-split__panel--register .main-dropdown--open .main-dropdown-chevron {
        color: #fff;
    }

    .auth-split__panel--register .main-dropdown-panel {
        border-color: rgba(255, 255, 255, 0.12);
        background: #1a1a1a;
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 4px 10px -4px rgba(0, 0, 0, 0.3);
    }

    .auth-split__panel--register .main-dropdown-search-wrap {
        background: #1a1a1a;
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }

    .auth-split__panel--register .main-dropdown-search {
        font-size: 1rem;
        border-color: rgba(255, 255, 255, 0.15);
        background: #0a0a0a;
        color: #fff;
    }

    .auth-split__panel--register .main-dropdown-search:focus {
        border-color: #dbf227;
    }

    .auth-split__panel--register .main-dropdown-opt {
        color: #d1d5db;
        border-bottom-color: rgba(255, 255, 255, 0.08);
    }

    .auth-split__panel--register .main-dropdown-opt:hover {
        background: rgba(219, 242, 39, 0.12);
        color: #fff;
    }

    .auth-split__panel--register .main-dropdown-empty {
        color: #6b7280;
    }
}

/* ---- Öğrenci listesi satır işlemler menüsü ---- */
/* animate-fade-in-up her satırda stacking context oluşturur; açık satırı yükselt */
.row-actions-open {
    position: relative;
    z-index: 70;
}

#studentsList > [data-row-student-id]:last-of-type {
    border-bottom-left-radius: 1rem;
    border-bottom-right-radius: 1rem;
}

[id^="rowActions-"].main-dropdown-panel {
    z-index: 100000;
}

@media (max-width: 1023px) {
    [id^="rowActions-"].main-dropdown-panel {
        right: 0;
        left: auto;
        max-width: min(13rem, calc(100vw - 2rem));
    }
}
