/* =========================================================================
   HKU KYS - Sidebar Search + Keyboard Shortcuts
   - Sidebar üstüne inject edilen arama kutusu
   - Eşleşmeyen nav-item'larin fade-out davranisi
   - Eşleşen text icin <mark> stili
   - Klavye kisayollari yardim modali
   ========================================================================= */

/* -------------------------------------------------------------------------
   1) Search kutusu (sidebar header'in hemen altina inject edilir)
   ------------------------------------------------------------------------- */
.hku-sidebar-search {
    position: relative;
    display: flex;
    align-items: center;
    margin: 10px 14px 6px 14px;
    padding: 8px 12px;
    background: var(--hku-bg-soft, #f4f6f9);
    border: 1px solid var(--hku-sidebar-border, #eef1f5);
    border-radius: 999px;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.hku-sidebar-search:focus-within {
    background: #fff;
    border-color: var(--hku-primary, #003865);
    box-shadow: 0 0 0 3px var(--hku-primary-tint, rgba(0, 56, 101, .08));
}

.hku-sidebar-search > i.fa {
    color: var(--hku-sidebar-title, #9aa6ba);
    font-size: 13px;
    margin-right: 8px;
    flex: 0 0 auto;
    pointer-events: none;
}

.hku-sidebar-search:focus-within > i.fa {
    color: var(--hku-primary, #003865);
}

.hku-sidebar-search input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: none;
    color: var(--hku-text, #212a3a);
    font-size: 13px;
    line-height: 1.4;
    padding: 0;
    margin: 0;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.hku-sidebar-search input[type="search"]::placeholder {
    color: var(--hku-sidebar-title, #9aa6ba);
    opacity: 1;
}

/* Webkit clear button kaldir (kendi escape mantigimiz var) */
.hku-sidebar-search input[type="search"]::-webkit-search-cancel-button,
.hku-sidebar-search input[type="search"]::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

/* Kbd hint (Ctrl+K) */
.hku-sidebar-search kbd {
    flex: 0 0 auto;
    margin-left: 8px;
    padding: 2px 6px;
    background: #fff;
    border: 1px solid var(--hku-border, #dce2ea);
    border-radius: 5px;
    color: var(--hku-text-muted, #66718a);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
}

/* Input doluyken kbd hint'i gizle */
.hku-sidebar-search.is-filled kbd {
    display: none;
}

/* Collapsed sidebar (dar mod): search'u tamamen gizle */
.hku-app.sidebar-collapsed .hku-sidebar-search {
    display: none;
}

/* -------------------------------------------------------------------------
   2) Filter durumu (eslesmeyen nav-item'lar)
   ------------------------------------------------------------------------- */
.hku-sidebar-nav .nav-item,
.hku-sidebar-nav .nav-section-title {
    transition: opacity .15s ease;
}

.hku-sidebar-nav .nav-item.hidden-by-search {
    display: none;
}

.hku-sidebar-nav .nav-section-title.hidden-by-search {
    display: none;
}

/* Search aktifken section title'lar daha sonuk */
.hku-sidebar-search.is-filled ~ * .hku-sidebar-nav .nav-section-title {
    opacity: .55;
}

/* Match highlight - sari arka, koyu yazi */
.hku-sidebar-nav mark.hku-search-hl {
    background: #ffe566;
    color: #1a1a1a;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* "Sonuc yok" mesaji */
.hku-search-empty {
    display: none;
    margin: 20px 18px;
    padding: 14px 12px;
    text-align: center;
    color: var(--hku-text-muted, #66718a);
    font-size: 12.5px;
    font-style: italic;
    background: var(--hku-bg-soft, #f4f6f9);
    border: 1px dashed var(--hku-border, #dce2ea);
    border-radius: 8px;
}

.hku-search-empty.is-visible {
    display: block;
}

/* -------------------------------------------------------------------------
   3) Klavye kisayollari yardim modali
   ------------------------------------------------------------------------- */
.hku-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--hku-z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 22, 38, 0.62);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
}

.hku-modal-overlay[hidden] {
    display: none;
}

.hku-modal-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.hku-modal {
    background: #ffffff;
    color: #1f2937;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    padding: 22px 26px 18px 26px;
    transform: translateY(8px) scale(.985);
    transition: transform .18s ease;
    font-family: inherit;
}

.hku-modal-overlay.is-open .hku-modal {
    transform: translateY(0) scale(1);
}

.hku-modal h3 {
    margin: 0 0 14px 0;
    padding: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--hku-text, #212a3a);
    border-bottom: 1px solid var(--hku-line, #eef1f5);
}

.hku-modal table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 16px 0;
    font-size: 13px;
}

.hku-modal table td {
    padding: 8px 4px;
    border-bottom: 1px solid #f1f3f7;
    vertical-align: middle;
}

.hku-modal table tr:last-child td {
    border-bottom: 0;
}

.hku-modal table td:first-child {
    width: 38%;
    white-space: nowrap;
}

.hku-modal table td:last-child {
    color: #4b5563;
}

.hku-modal kbd {
    display: inline-block;
    min-width: 22px;
    padding: 2px 7px;
    margin: 0 2px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-bottom-width: 2px;
    border-radius: 4px;
    color: #1f2937;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
}

.hku-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid #f1f3f7;
}

.hku-modal-actions button {
    padding: 7px 16px;
    background: var(--hku-primary, #003865);
    color: #ffffff;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    transition: background-color .15s ease;
}

.hku-modal-actions button:hover {
    background: var(--hku-primary-dark);
}

.hku-modal-actions button:focus-visible {
    outline: 2px solid var(--hku-primary);
    outline-offset: 2px;
}

/* -------------------------------------------------------------------------
   4) Erisilebilirlik / reduced motion
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .hku-sidebar-search,
    .hku-sidebar-nav .nav-item,
    .hku-sidebar-nav .nav-section-title,
    .hku-modal-overlay,
    .hku-modal,
    .hku-modal-actions button {
        transition: none !important;
    }
}

/* -------------------------------------------------------------------------
   5) Mobil ayar
   ------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .hku-sidebar-search kbd {
        display: none;
    }
    .hku-modal {
        padding: 18px 18px 14px 18px;
    }
    .hku-modal h3 {
        font-size: 15px;
    }
}

/* Print: search ve modal yazdirma */
@media print {
    .hku-sidebar-search,
    .hku-modal-overlay,
    .hku-search-empty {
        display: none !important;
    }
}

/* ============================================================================
   ARAMA TOPBAR'DA  (kullanıcı kararı, 2026-09-15)
   Sol menüdeyken menünün kendi yüksekliğini yiyordu ve menü daraltılınca
   (sidebar-collapsed) kutu kullanılamaz hâle geliyordu. Topbar her durumda
   görünür. Sidebar'daki eski stiller KORUNDU — JS topbar yuvası yoksa oraya
   düşüyor, yani bu dosya iki yerleşimi birden destekler.
   ========================================================================== */
.hku-topbar-arama {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    min-width: 0;          /* uzun sayfa başlığı kutuyu ezmesin */
    padding: 0 12px;
}
.hku-sidebar-search.hku-arama-topbar {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
}
.hku-sidebar-search.hku-arama-topbar input {
    width: 100%;
    height: 32px;
    padding: 0 2.2rem 0 2rem;
    font-size: .85rem;
    color: var(--hku-text);
    background: var(--hku-bg-soft);
    border: 1px solid var(--hku-border);
    border-radius: 999px;
    transition: border-color .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.hku-sidebar-search.hku-arama-topbar input:focus {
    outline: 0;
    background: var(--hku-card);
    border-color: var(--hku-primary);
    box-shadow: 0 0 0 3px var(--hku-primary-tint);
}
.hku-sidebar-search.hku-arama-topbar i.fa-search {
    position: absolute;
    left: .7rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: .8rem;
    color: var(--hku-text-muted);
    pointer-events: none;
}
.hku-sidebar-search.hku-arama-topbar kbd {
    position: absolute;
    right: .45rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: .65rem;
    padding: .1rem .3rem;
    color: var(--hku-text-muted);
    background: var(--hku-card);
    border: 1px solid var(--hku-line);
    border-radius: 4px;
    pointer-events: none;
}
/* Dar ekranda arama kutusu başlığı sıkıştırmasın: kutu gizlenir, Ctrl+K çalışır. */
@media (max-width: 860px) {
    .hku-topbar-arama { display: none; }
}

/* --- MİNİMAL sol menü araması (kullanıcı kararı, 2026-09-16) ------------------
   Topbar denemesi geri alındı. Menüdeki kutu artık bir "alan" değil, tek satırlık
   ince bir çizgi: menü öğeleriyle aynı hizada durur, kendi zeminini çizmez ve
   yalnız odaklanınca belirginleşir. Amaç menünün dikkatini dağıtmamak. */
.hku-sidebar-search:not(.hku-arama-topbar) {
    margin: 2px 8px 6px;
    padding: 0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--hku-sidebar-border);
    border-radius: 0;
}
.hku-sidebar-search:not(.hku-arama-topbar) > i.fa {
    font-size: .8rem;
    opacity: .5;
}
.hku-sidebar-search:not(.hku-arama-topbar) input[type="search"] {
    height: 28px;
    font-size: .82rem;
    background: transparent;
    border: 0;
}
.hku-sidebar-search:not(.hku-arama-topbar):focus-within {
    border-bottom-color: var(--hku-sidebar-active);
    box-shadow: none;
}
