/*
 * BLACKLANT UST MENU V1 — VISUAL LAYOUT ONLY
 * Scope: admin pages with #adminSidebar.
 * Existing <a href> links, PHP conditions, routes, sessions and business operations remain unchanged.
 * A wide menu stays in one row and scrolls horizontally instead of hiding buttons.
 */

body:has(> #adminSidebar) {
    flex-direction: column !important;
    width: 100%;
}

body:has(> #adminSidebar) > #adminMobileOverlay {
    display: none !important;
}

body:has(> #adminSidebar) > #adminSidebar {
    position: relative !important;
    inset: auto !important;
    transform: none !important;
    flex: 0 0 54px !important;
    flex-direction: row !important;
    align-items: center !important;
    height: 54px !important;
    min-height: 54px !important;
    max-height: 54px !important;
    width: 100% !important;
    overflow: hidden !important;
    border-right: 0 !important;
    border-bottom: 1px solid #27272a !important;
    box-shadow: none !important;
}

/* Left-side brand becomes the brand at the start of the top bar. */
#adminSidebar > div:first-of-type {
    display: flex !important;
    flex: 0 0 auto !important;
    width: auto !important;
    height: 54px !important;
    padding: 0 12px !important;
    border-bottom: 0 !important;
    border-right: 1px solid #27272a !important;
}

#adminSidebar > div:first-of-type a {
    white-space: nowrap !important;
    gap: 6px !important;
}

#adminSidebar > div:first-of-type a span {
    font-size: 14px !important;
}

#adminSidebar > div:first-of-type button,
body:has(> #adminSidebar) > div > header button[onclick*="toggleAdminSidebar"] {
    display: none !important;
}

/* Preserve the original link elements and ordering: display only changes. */
#adminSidebar > div:nth-of-type(2) {
    display: flex !important;
    flex-direction: row !important;
    flex: 1 1 auto !important;
    align-items: center !important;
    gap: 3px !important;
    min-width: 0 !important;
    width: auto !important;
    height: 54px !important;
    padding: 0 8px !important;
    margin: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: thin;
    scrollbar-color: #52525b transparent;
    overscroll-behavior-x: contain;
}

#adminSidebar > div:nth-of-type(2) > * {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Section headings are decorative; every existing menu link stays present. */
#adminSidebar > div:nth-of-type(2) > p {
    display: none !important;
}

#adminSidebar > div:nth-of-type(2) > a {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 8px !important;
    border-radius: 8px !important;
    font-family: inherit !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    white-space: nowrap !important;
}

#adminSidebar > div:nth-of-type(2) > a > div {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
}

#adminSidebar > div:nth-of-type(2) > a i {
    width: auto !important;
    min-width: 12px !important;
    font-size: 11px !important;
}

/* Original admin identity / log-out area moves to the right of the top bar. */
#adminSidebar > div:last-of-type {
    display: flex !important;
    flex: 0 0 auto !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 5px !important;
    height: 54px !important;
    padding: 0 8px !important;
    border-top: 0 !important;
    border-left: 1px solid #27272a !important;
}

#adminSidebar > div:last-of-type > div {
    margin: 0 !important;
    padding: 4px 6px !important;
    gap: 5px !important;
    border: 0 !important;
    background: transparent !important;
}

#adminSidebar > div:last-of-type > div > div:first-child {
    width: 26px !important;
    height: 26px !important;
    font-size: 11px !important;
}

#adminSidebar > div:last-of-type > div p:first-child {
    font-size: 11px !important;
}

#adminSidebar > div:last-of-type > div p:last-child {
    display: none !important;
}

#adminSidebar > div:last-of-type > a {
    width: auto !important;
    padding: 5px !important;
    gap: 4px !important;
    white-space: nowrap !important;
    font-size: 10px !important;
}

/* Admin content now fills the width below the top navigation. */
body:has(> #adminSidebar) > div.flex-1.flex.flex-col.h-screen.overflow-hidden {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    width: 100% !important;
    height: calc(100vh - 54px) !important;
    min-height: 0 !important;
    min-width: 0 !important;
}

body:has(> #adminSidebar) > div.flex-1.flex.flex-col.h-screen.overflow-hidden > header {
    height: 60px !important;
    min-height: 60px !important;
    flex: 0 0 60px !important;
}

body:has(> #adminSidebar) > div.flex-1.flex.flex-col.h-screen.overflow-hidden > main {
    min-height: 0 !important;
    min-width: 0 !important;
    width: 100% !important;
}

/* BLACKLANT - UST MENU V2: YALNIZ GORUNUM / TURUNCU SECIM VURGUSU
 * Sadece nav icindeki asli 6 sayfa linkini hedefler.
 * Ayarlar, Gece/Gunduz, profil, oturum ve baglantilar degismez.
 */
#adminSidebar > div:nth-of-type(2) > a {
    border: 1px solid #52525b !important;
    background-color: #18181b !important;
    color: #d4d4d8 !important;
    box-shadow: none !important;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease !important;
}

#adminSidebar > div:nth-of-type(2) > a:not([class~="text-emerald-400"]):hover,
#adminSidebar > div:nth-of-type(2) > a:not([class~="text-emerald-400"]):focus-visible {
    background-color: #27272a !important;
    border-color: #a1a1aa !important;
    color: #ffffff !important;
}

/* Sidebar'in kendi PHP active sinifi kullanilir; yeni JS / route kontrolu yok. */
#adminSidebar > div:nth-of-type(2) > a[class~="text-emerald-400"] {
    border-color: #f97316 !important;
    background-color: #422a1e !important;
    color: #fdba74 !important;
}

#adminSidebar > div:nth-of-type(2) > a[class~="text-emerald-400"] i {
    color: #fb923c !important;
}

#adminSidebar > div:nth-of-type(2) > a[class~="text-emerald-400"]:hover,
#adminSidebar > div:nth-of-type(2) > a[class~="text-emerald-400"]:focus-visible {
    border-color: #fb923c !important;
    background-color: #513221 !important;
    color: #ffedd5 !important;
}

@media (max-width: 850px) {
    #adminSidebar > div:first-of-type a span {
        display: none !important;
    }
    #adminSidebar > div:last-of-type > div {
        display: none !important;
    }
  /* BLACKLANT - Beyaz perde olmadan ortada yükleme göstergesi */
#pageLoadingScreen {
    position: fixed !important;
    inset: auto !important;
    top: 50% !important;
    left: 50% !important;
    width: auto !important;
    height: auto !important;
    transform: translate(-50%, -50%) !important;
    background: transparent !important;
    pointer-events: none !important;
    display: flex !important;
}
}

/* BLACKLANT - right-hand DEPO STOK + MUHASEBE controls (before the theme toggle).
 * The JS may place this element inside the theme button's parent or directly
 * before the existing right-hand profile. No existing menu links are moved.
 */
#adminSidebar #blDepotAccountingRight {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 3px !important;
    height: 54px !important;
    margin: 0 5px 0 auto !important;
    padding: 0 !important;
    white-space: nowrap !important;
    vertical-align: middle !important;
}

/* Same font, height, borders and padding as the original page links. */
#adminSidebar #blDepotMenuButton,
#adminSidebar #blAccountingMenuButton,
#adminSidebar #blReportsMenuLink {
    font-family: inherit !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    height: 34px !important;
    min-height: 34px !important;
    border-radius: 8px !important;
    padding: 0 8px !important;
    gap: 5px !important;
}

#adminSidebar #blDepotMenuButton > i,
#adminSidebar #blAccountingMenuButton > i,
#adminSidebar #blReportsMenuLink > i {
    width: auto !important;
    min-width: 12px !important;
    font-size: 11px !important;
}

#adminSidebar #blDepotMenuButton > i.fa-chevron-down,
#adminSidebar #blAccountingMenuButton > i.fa-chevron-down {
    min-width: auto !important;
    font-size: 9px !important;
}

/* V7: Raporlar, Muhasebe'nin hemen saginda; diğerleriyle aynı yazı stili. */
#adminSidebar #blReportsMenuLink {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    text-decoration: none !important;
    border: 1px solid #52525b !important;
    background: #18181b !important;
    color: #d4d4d8 !important;
    box-shadow: none !important;
}
#adminSidebar #blReportsMenuLink:hover,
#adminSidebar #blReportsMenuLink:focus-visible {
    background: #27272a !important;
    border-color: #a1a1aa !important;
    color: #fff !important;
}
#adminSidebar #blReportsMenuLink[aria-current="page"] {
    border-color: #f97316 !important;
    background: #422a1e !important;
    color: #fdba74 !important;
}
#adminSidebar #blReportsMenuLink[aria-current="page"] > i { color: #fb923c !important; }
