/*
 * Mercury sol gezinme menüsü — MercuryNavSection + MercuryNavGroup + MercuryNavLink ortak stilleri.
 * Bileşenler aynı .mnav-* sınıflarını paylaştığı için GLOBAL (scoped değil) — App.razor'da linklenir.
 * Renkler FluentUI design token'larıyla (var(--colorX)) → tema-uyumlu.
 *
 * Design "E · Kart + Kılavuz" (planets/mercury-menu-v2): each role section is a card, group headers
 * are regular weight, and a group's children hang off a thin guide line under the group's icon.
 * Designed for the light theme; the tokens below are the exact light values of the mockup's hex
 * colours, so the dark theme adapts — except the section header colours, which are fixed.
 */

.mnav-link,
.mnav-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    min-height: 36px;
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--colorNeutralForeground2);
    font-family: var(--fontFamilyBase);
    font-size: var(--fontSizeBase300);
    line-height: var(--lineHeightBase300);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    border-radius: var(--borderRadiusMedium);
    transition: background-color 0.1s ease, color 0.1s ease;
}

.mnav-group-header {
    font-weight: var(--fontWeightRegular);
}

.mnav-link:hover,
.mnav-group-header:hover {
    background-color: var(--colorNeutralBackground1Hover);
    color: var(--colorNeutralForeground1);
}

.mnav-link:active,
.mnav-group-header:active {
    background-color: var(--colorNeutralBackground1Pressed);
}

/* An open group's title and icon turn brand blue (the chevron keeps its own colour). */
.mnav-group.mnav-group-open > .mnav-group-header {
    color: var(--colorBrandForeground1);
}

/* Aktif link — v4'teki vurguya benzer: marka tonlu zemin + marka metin + sol aksan çubuğu. */
.mnav-link.mnav-active {
    background-color: var(--colorBrandBackground2);
    color: var(--colorBrandForeground1);
    font-weight: var(--fontWeightSemibold);
    box-shadow: inset 3px 0 0 0 var(--colorBrandStroke1);
}

.mnav-link.mnav-active:hover {
    color: var(--colorBrandForeground1);
}

.mnav-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mnav-icon svg {
    width: 20px;
    height: 20px;
}

.mnav-text {
    flex: 1 1 auto;
    /* min-width:0 açıkça yazıldı: flex item'ın otomatik min boyutu overflow:hidden sayesinde
       zaten 0'a düşer, ama overflow bir gün değişirse uzun etiketler 280px rayı taşırıp
       yatay kaydırmayı geri getirir — bu satır o tuzağı kalıcı kapatır. */
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mnav-chevron {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--colorNeutralForeground3);
    transition: transform 0.15s ease;
}

.mnav-chevron svg {
    width: 16px;
    height: 16px;
}

.mnav-chevron-open {
    transform: rotate(90deg);
}

/* Group body: the guide line sits under the group's icon (12px padding + half the 20px icon), and
   the children indent from it. Nested groups step in by the same icon-centre offset. */
.mnav-group-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-left: 21px;
    padding-left: 4px;
    border-left: var(--strokeWidthThin) solid var(--colorNeutralStroke1);
}

.mnav-group-body .mnav-group-body {
    margin-left: 17px;
}

.mnav-group-body > .mnav-link,
.mnav-group-body > .mnav-group > .mnav-group-header {
    padding-left: 8px;
}

.mnav-group-body .mnav-link .mnav-icon {
    color: var(--colorNeutralForeground3);
}

.mnav-group-body .mnav-link.mnav-active .mnav-icon {
    color: var(--colorBrandForeground1);
}

/* Grup / kart gövdesi — kapalıyken gizli (ama DOM'da: içerideki aktif link kendini bildirip açar). */
.mnav-group-body.mnav-collapsed,
.mnav-card-body.mnav-collapsed {
    display: none;
}

/* Role section card. --mnav-section-color is set per section at the end of this block. */
.mnav-card {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin: 4px 0;
    padding: 2px;
    background-color: var(--colorNeutralBackground1);
    border: var(--strokeWidthThin) solid var(--colorNeutralStroke2);
    border-radius: var(--borderRadiusXLarge);
    /* Lighter than Fluent's --shadow2: the cards sit close together and should read as paper, not float. */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.mnav-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: none;
    border-radius: var(--borderRadiusLarge) var(--borderRadiusLarge) 0 0;
    background: transparent;
    color: var(--mnav-section-color);
    font-family: var(--fontFamilyBase);
    font-size: var(--fontSizeBase200);
    font-weight: var(--fontWeightSemibold);
    line-height: var(--lineHeightBase300);
    letter-spacing: 0.4px;
    text-align: left;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.mnav-card-header:hover {
    background-color: var(--colorNeutralBackground1Hover);
}

.mnav-card-open > .mnav-card-header {
    margin-bottom: 4px;
    border-bottom: var(--strokeWidthThin) solid var(--colorNeutralStroke2);
}

.mnav-card-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* Section header colours, in the menu's fixed section order. Fixed hex, not tokens: Fluent has no
   token per hue that matches the design, so these do not follow the dark theme. The support and the
   accounting blocks (NavCatalog.BlockOf) share one colour each. */
/* Admin draws in the plain text colour and Personel takes the blue (owner swapped them). */
.mnav-card[data-section="personnel"] { --mnav-section-color: #0f6cbd; }
.mnav-card[data-section="pharmacist"] { --mnav-section-color: #8764b8; }
.mnav-card[data-section="call_support"],
.mnav-card[data-section="support"],
.mnav-card[data-section="super_support"] { --mnav-section-color: #107c10; }
.mnav-card[data-section="invoice_support"],
.mnav-card[data-section="super_invoice_support"],
.mnav-card[data-section="accountant"] { --mnav-section-color: #c239b3; }
.mnav-card[data-section="developer_tools"] { --mnav-section-color: #d13438; }

/* The line around the support and the accounting blocks (NavMenu). A div, not an <hr>: an <hr> as a
   flex item brought back the horizontal scrollbar once (1dde6c145). */
.mnav-divider {
    flex-shrink: 0;
    margin: 6px 8px;
    border-top: var(--strokeWidthThin) solid var(--colorNeutralStroke1);
}

.mnav-root {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 8px;
    width: 100%;
    box-sizing: border-box;
}

/* KONTROL PANELİ, Dökümanlar and Geri Bildirim — the rows outside the cards. */
.mnav-root > .mnav-link,
.mnav-root > .mnav-group {
    margin: 2px 0;
}

/* ─────────────────────────────────────────────────────────────────────────────
 * Sayfa arama (#911) — sol menünün tepesindeki süzme kutusu + Ctrl+K paleti.
 * Renkler yine FluentUI design token'ları; ikisi de tema değişiminde kendiliğinden uyar.
 * ───────────────────────────────────────────────────────────────────────────── */

.mnav-search {
    position: relative;
    padding: 4px 4px 8px;
}

/* Kutunun içindeki temizle (×) düğmesi. FluentTextInput'un kendi gövdesinin ÜSTÜNDE durur, bu yüzden
   mutlak konumlu. Dikeyde ortalamak için top:50%+translate DEĞİL, kabın kendi dolgularına yapışmak
   kullanıldı: .mnav-search'ün altında 8px dolgu var, yani %50 input satırının ortası değil. */
.mnav-search-clear {
    position: absolute;
    top: 4px;
    bottom: 8px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border: none;
    background: transparent;
    color: var(--colorNeutralForeground3);
    cursor: pointer;
}

.mnav-search-clear:hover {
    color: var(--colorNeutralForeground1);
}

.mnav-search-clear svg {
    width: 16px;
    height: 16px;
}

.mnav-search-summary {
    padding: 0 10px 8px;
    font-size: var(--fontSizeBase200);
    color: var(--colorNeutralForeground3);
}

/* Süzme sırasında grubun kaç sayfası hayatta kaldı. .mnav-text'in DIŞINDA durur (metin
   üç-nokta ile kısaldığı için içeride kırpılırdı), chevron'dan önce. */
.mnav-hit {
    flex-shrink: 0;
    min-width: 18px;
    padding: 1px 6px;
    border-radius: 9px;
    background-color: var(--colorBrandBackground2);
    color: var(--colorBrandForeground2);
    font-size: var(--fontSizeBase100);
    font-weight: var(--fontWeightSemibold);
    line-height: 16px;
    text-align: center;
}

/* Open items on a Takipler page (NavCounts), after the text like .mnav-hit but filled, so a count
   never reads as a search hit. A closed group shows the sum. The number is aria-hidden; .mnav-sr
   carries "N açık kayıt" for screen readers. */
.mnav-count {
    flex-shrink: 0;
    min-width: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background-color: var(--colorBrandBackground);
    color: var(--colorNeutralForegroundOnBrand);
    font-size: var(--fontSizeBase100);
    font-weight: var(--fontWeightSemibold);
    line-height: 16px;
    text-align: center;
    box-sizing: border-box;
}
.mnav-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Eşleşen harfler. <mark>'ın tarayıcı varsayılanı sabit sarı/siyahtır — koyu temada okunmaz. */
.mnav-mark {
    padding: 0 1px;
    border-radius: var(--borderRadiusSmall);
    background-color: var(--colorBrandBackground2);
    color: var(--colorBrandForeground1);
    font-weight: var(--fontWeightSemibold);
}

/* ── Ctrl+K paleti ─────────────────────────────────────────────────────────── */

.npal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 12vh;
    background-color: rgba(0, 0, 0, 0.38);
}

.npal-panel {
    width: min(640px, 92vw);
    overflow: hidden;
    border: var(--strokeWidthThin) solid var(--colorNeutralStroke1);
    border-radius: var(--borderRadiusLarge);
    background-color: var(--colorNeutralBackground1);
    box-shadow: var(--shadow64);
    font-family: var(--fontFamilyBase);
}

.npal-input {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 15px;
    border-bottom: var(--strokeWidthThin) solid var(--colorNeutralStroke2);
    color: var(--colorNeutralForeground3);
}

.npal-field {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--colorNeutralForeground1);
    font-family: inherit;
    font-size: var(--fontSizeBase400);
}

.npal-results {
    max-height: 46vh;
    overflow-y: auto;
    padding: 6px;
}

.npal-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 11px;
    border-radius: var(--borderRadiusMedium);
    color: var(--colorNeutralForeground2);
    cursor: pointer;
}

.npal-sel {
    background-color: var(--colorNeutralBackground1Selected);
    color: var(--colorNeutralForeground1);
}

.npal-row-icon {
    flex-shrink: 0;
    display: inline-flex;
}

.npal-row-icon svg {
    width: 20px;
    height: 20px;
}

.npal-row-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.npal-row-title,
.npal-row-crumb {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.npal-row-title {
    font-size: var(--fontSizeBase300);
}

.npal-row-crumb {
    color: var(--colorNeutralForeground3);
    font-size: var(--fontSizeBase200);
}

.npal-row-href {
    flex-shrink: 0;
    color: var(--colorNeutralForeground4);
    font-family: var(--fontFamilyMonospace);
    font-size: var(--fontSizeBase200);
    white-space: nowrap;
}

.npal-empty {
    padding: 26px;
    color: var(--colorNeutralForeground3);
    text-align: center;
}

.npal-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 9px 15px;
    border-top: var(--strokeWidthThin) solid var(--colorNeutralStroke2);
    color: var(--colorNeutralForeground3);
    font-size: var(--fontSizeBase200);
}

.npal-footer-right {
    margin-left: auto;
}

.npal-panel kbd {
    display: inline-block;
    margin: 0 1px;
    padding: 1px 5px;
    border: var(--strokeWidthThin) solid var(--colorNeutralStroke1);
    border-bottom-width: 2px;
    border-radius: var(--borderRadiusSmall);
    background-color: var(--colorNeutralBackground3);
    font-family: inherit;
    font-size: var(--fontSizeBase100);
}
