/* =====================================================
   NavMenu — scoped styles (Blazor CSS isolation)
   Refinement pass (ui-rewrite-2026-05-11):
     - Logo block breathes: separator rule below the yellow header bar
     - Section labels: mono uppercase + 2px-thick dotted divider
     - NavLink hover: low-opacity background fade BEFORE the rail draws
     - NavLink active: yellow rail + small yellow glow + brighter dot
     - User profile: avatar gets a yellow ring, role tag is a chip,
       logout button is more inviting (yellow tint on hover)
     - Sidebar carries a very faint dot-grid backdrop (~5% opacity) for
       the industrial-schematic feel
     - Custom thin scrollbar (matches polish 7) + top/bottom edge fade
       cues when nav scrolls
     - Collapsed (72px) mode: 48px hit area, centred icon, native title
       tooltips, active rail still visible
     - All motion respects prefers-reduced-motion
   ===================================================== */

/* =====================================================
   Sidebar backdrop — very faint dot grid for industrial identity.
   The :global() lets the scoped sheet reach the parent <aside id="sidebar">.
   The dots sit *behind* every NavMenu element (z-index:0 on the
   pseudo-element, NavMenu content stays at default z-index).
   ===================================================== */
/* position:fixed main-layout.css'te — relative burada sidebar'ı scroll ile kaydırır */
#sidebar.gs-sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(
        circle,
        var(--gs-border) 1px,
        transparent 1px
    );
    background-size: 28px 28px;
    background-position: 0 0;
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
}

/* Make sure NavMenu content paints on top of the dot grid. */
.nav-logo-section,
.nav-logo-rule,
.nav-main,
.nav-user-wrapper {
    position: relative;
    z-index: 1;
}

/* =====================================================
   Logo Section
   ===================================================== */
.nav-logo-section {
    height: 72px;
    background: var(--gs-surface);
    /* Single chrome line — same spec as .gs-topbar for a continuous joint. */
    border-bottom: 2px solid var(--gs-primary);
    box-shadow: none;
    padding: 0 var(--gs-space-6);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.nav-logo-link {
    display: flex;
    align-items: center;
    gap: var(--gs-space-3);
    text-decoration: none;
    min-width: 0;
    flex: 1;
    /* Wave 7 signature touch: hover draws a 2px underline beneath the
       wordmark from left to right. */
    position: relative;
    padding-bottom: 6px;
}

.nav-logo-link::after {
    content: "";
    position: absolute;
    left: var(--gs-space-3);
    right: var(--gs-space-3);
    bottom: 0;
    height: 2px;
    background: color-mix(in srgb, var(--gs-primary) 75%, transparent);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0.85;
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
    .nav-logo-link:hover::after,
    .nav-logo-link:focus-visible::after {
        transform: scaleX(1);
    }
}

.nav-logo-square {
    width: 36px;
    height: 36px;
    background: #ffffff;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: var(--gs-radius-sm);
    /* Tile edge on dark chrome — logo reads on white field */
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.nav-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.nav-logo-text {
    font-family: var(--gs-font-heading);
    font-size: var(--gs-text-md);
    font-weight: 800;
    color: var(--gs-text);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Refinement: slim separator line directly below the yellow logo bar.
   The bar already provides bold colour separation; this adds a 1px
   carbon hairline so the join feels engineered, not glued. */
.nav-logo-rule {
    height: 1px;
    background: linear-gradient(
        to right,
        transparent 0%,
        var(--gs-border) 12%,
        var(--gs-border) 88%,
        transparent 100%
    );
    flex-shrink: 0;
    margin: 0;
}

/* =====================================================
   Main Navigation
   ===================================================== */
.nav-main {
    flex: 1;
    /* Inset rail: items sit inside a 12px gutter on each side instead of
       hugging the sidebar wall. Combined with the per-item border-radius
       below, every nav row reads as a contained tile, not a strip glued
       to the edge. */
    padding: var(--gs-space-3) var(--gs-space-3) var(--gs-space-4);
    /* WHY overflow-y:scroll (was auto): on shorter viewports the menu
       overflows but a transparent scrollbar made the cut-off invisible
       — users couldn't reach AYARLAR / KULLANICILAR / AKTİVİTE TAKİP
       at the bottom of the list because they didn't know to scroll.
       `scroll` always reserves space for the bar. */
    overflow-y: scroll;
    display: flex;
    flex-direction: column;
    gap: var(--gs-space-1);

    /* Visible thin scrollbar — needs to be obvious enough that users see
       there's more menu below the fold but still slim enough to read as
       part of the rail. */
    scrollbar-width: thin;
    scrollbar-color: var(--gs-border) var(--gs-surface);
}

.nav-main::-webkit-scrollbar {
    width: 8px;
}

.nav-main::-webkit-scrollbar-track {
    background: var(--gs-surface);
}

.nav-main::-webkit-scrollbar-thumb {
    background: var(--gs-border);
    border-radius: 4px;
    border: 2px solid var(--gs-surface);
}

.nav-main::-webkit-scrollbar-thumb:hover {
    background: var(--gs-border-light);
}

.nav-section {
    margin-top: var(--gs-space-3);
}

/* Section markup = .nav-divider + .nav-section-title; hide the hairline
   divider so only the title's thicker brand accent reads as the break. */
.nav-section .nav-divider {
    display: none;
}

.nav-section-title {
    margin: 0 var(--gs-space-3) var(--gs-space-1);
    padding: var(--gs-space-2) var(--gs-space-3) var(--gs-space-1) 0;
    border-top: 1px solid var(--gs-primary);
    color: var(--gs-text-muted);
    font-family: var(--gs-font-sans);
    font-size: 10px;
    line-height: 1.35;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.88;
    display: block;
}

.nav-section-title::before {
    display: none;
}

/* =====================================================
   Dividers
   Refinement: dotted pattern (matches Pencil "blueprint" identity).
   ===================================================== */
/* WHY larger margin-top (space-3): nav items are 48px tall and stack
   tightly with 2px gap; the divider needed more vertical breathing room
   to read as a true section break vs. a subtle line-noise element. */
.nav-divider {
    height: 1px;
    background-image: none;
    background-color: color-mix(in srgb, var(--gs-border) 70%, var(--gs-primary) 12%);
    margin: var(--gs-space-3) var(--gs-space-3) var(--gs-space-3);
    flex-shrink: 0;
    opacity: 1;
}

.nav-divider--full {
    margin: 0;
    background-image: none;
    background-color: var(--gs-border);
    height: 1px;
}

/* =====================================================
   Sidebar Nav Item — Base State
   ===================================================== */
.sidebar-nav-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--gs-space-3);
    min-height: 46px;
    height: auto;
    padding-top: var(--gs-space-1);
    padding-bottom: var(--gs-space-1);
    /* Inset card: lives inside the .nav-main 12px gutter (space-3) and
       has its own internal padding so icon + text breathe instead of
       hugging the sidebar wall. Border-radius makes the hover/active
       wash read as a tile, not a wall-to-wall band. */
    padding: 0 var(--gs-space-3);
    border-radius: var(--gs-radius-sm);
    /* NavLink root <a> is a child component — pierces isolation so
       rules apply; yellow-forward idle state (was browser default blue). */
    color: color-mix(in srgb, var(--gs-primary) 82%, var(--gs-text-muted) 18%);
    text-decoration: none;
    font-family: var(--gs-font-sans);
    font-size: var(--gs-text-sm);
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: none;
    position: relative;
    transition:
        color 150ms ease,
        background-color 120ms ease-out;
}

/* Wave 7: animated activation indicator. The 3px yellow line draws
   top→bottom (200ms) on the inactive→active transition. Sits on the
   left edge of the inset card (not the sidebar wall) so it lines up
   with the rounded tile geometry. */
.sidebar-nav-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: color-mix(in srgb, var(--gs-primary) 70%, var(--gs-text) 30%);
    border-radius: 0 2px 2px 0;
    transform: scaleY(0);
    transform-origin: top center;
    opacity: 0;
    transition:
        transform 200ms cubic-bezier(0.16, 1, 0.3, 1),
        opacity 150ms ease;
    pointer-events: none;
}

.sidebar-nav-item svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: currentColor;
    opacity: 0.92;
    transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Sidebar Nav Dot */
.sidebar-nav-dot {
    width: 4px;
    height: 4px;
    background: color-mix(in srgb, var(--gs-border-light) 85%, var(--gs-text-muted) 15%);
    flex-shrink: 0;
    border-radius: 1px;
    transition:
        background-color 150ms ease,
        transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Sidebar Nav Text */
.sidebar-nav-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Hover only on devices that support hover (avoid sticky tap state on touch) */
@media (hover: hover) and (pointer: fine) {
    .sidebar-nav-item:hover {
        color: var(--gs-primary);
        background: color-mix(in srgb, var(--gs-primary) 12%, transparent);
    }

    .sidebar-nav-item:hover .sidebar-nav-dot {
        background: color-mix(in srgb, var(--gs-primary) 55%, var(--gs-border-light) 45%);
        transform: scale(1.08);
    }

    /* Wave 7: hover preview — non-active items get a faint 50%-opacity
       preview of the active rail. Active items stay solid. */
    .sidebar-nav-item:hover:not(.sidebar-nav-item--active)::before {
        transform: scaleY(1);
        opacity: 0.35;
    }
}

/* Keyboard focus — distinct from hover, never invisible. */
.sidebar-nav-item:focus-visible {
    outline: 2px solid var(--gs-primary);
    outline-offset: -4px;
    color: var(--gs-primary);
}

/* Active State — full tile fill so the selected row is unmistakable
   inside the inset rail. */
.sidebar-nav-item--active {
    color: var(--gs-text);
    font-weight: 600;
    background: color-mix(in srgb, var(--gs-primary) 14%, transparent);
}

.sidebar-nav-item--active::before {
    transform: scaleY(1);
    opacity: 1;
    background: var(--gs-primary);
    box-shadow: 0 0 10px 0
        color-mix(in srgb, var(--gs-primary) 22%, transparent);
}

.sidebar-nav-item--active .sidebar-nav-dot {
    width: 6px;
    height: 6px;
    background: var(--gs-primary);
    border-radius: 50%;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--gs-primary) 18%, transparent);
}

.sidebar-nav-item--active svg {
    color: var(--gs-primary);
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .sidebar-nav-item,
    .sidebar-nav-item svg,
    .sidebar-nav-dot,
    .sidebar-nav-item::before,
    .nav-logo-link::after {
        transition: none !important;
        animation: none !important;
    }
    .sidebar-nav-item::before {
        transform: scaleY(1);
    }
}

/* =====================================================
   COLLAPSED MODE (72px sidebar)
   The global app.css handles the structural collapse via !important
   overrides; here we layer on the polish: tooltip-on-hover for the
   icon-only state, the active rail still riding the left edge.
   ===================================================== */

/* Native title-attribute tooltip is good enough (delivered by browser)
   for screen-reader + sighted users in collapsed mode; we already added
   title="..." on every NavLink. The CSS below ensures the icon hit area
   is visually solid and the active rail remains visible at 72px. */

#sidebar.gs-sidebar--collapsed .sidebar-nav-item {
    /* Re-paint the active rail flush to the inner edge of the 48x44 hit
       box so it remains visible after the global !important rules
       null out the standard left padding. */
    overflow: visible;
}

#sidebar.gs-sidebar--collapsed .sidebar-nav-item::before {
    left: -2px;
    width: 2px;
    border-radius: 0 2px 2px 0;
}

#sidebar.gs-sidebar--collapsed .sidebar-nav-item--active {
    background: color-mix(in srgb, var(--gs-text) 10%, transparent);
}

@media (hover: hover) and (pointer: fine) {
    #sidebar.gs-sidebar--collapsed .sidebar-nav-item:hover {
        background: color-mix(in srgb, var(--gs-text) 7%, transparent);
    }
}

/* Logo collapses to monogram-only (the wordmark is already display:none'd
   by the global app.css collapsed rules). Keep the square crisp. */
#sidebar.gs-sidebar--collapsed .nav-logo-square {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

/* Hide the dotted nav-divider entries in collapsed mode (the global
   app.css does this with !important; we just keep our scoped style
   in sync so the cascade is calm). */

/* =====================================================
   User Profile Section
   ===================================================== */
.nav-user-wrapper {
    margin-top: auto;
    flex-shrink: 0;
    position: relative;
}

/* Refinement: 2px yellow accent line at the top edge of the footer —
   echoes the brand-yellow border-right on the sidebar and the page
   shimmer at the top of the content area. */
.nav-user-accent {
    height: 1px;
    background: linear-gradient(
        to right,
        var(--gs-border) 0%,
        color-mix(in srgb, var(--gs-primary) 40%, var(--gs-border)) 45%,
        transparent 100%
    );
    opacity: 1;
    flex-shrink: 0;
}

.nav-user-section {
    background: var(--bg-row);
    min-height: 68px;
    padding: var(--gs-space-3) var(--gs-space-5);
    display: flex;
    align-items: center;
    gap: var(--gs-space-3);
}

.nav-user-avatar {
    width: 38px;
    height: 38px;
    background: var(--gs-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: color-mix(in srgb, var(--gs-primary) 75%, var(--gs-text) 25%);
    font-family: var(--gs-font-heading);
    font-size: var(--gs-text-sm);
    font-weight: 700;
    flex-shrink: 0;
    border-radius: 50%;
    box-shadow:
        0 0 0 1px var(--gs-border-light),
        inset 0 0 0 1px rgba(0, 0, 0, 0.25);
    position: relative;
}

.nav-user-avatar-mark {
    line-height: 1;
    letter-spacing: 0.04em;
}

.nav-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.nav-user-name {
    color: var(--gs-text);
    font-family: var(--gs-font-heading);
    font-size: var(--gs-text-sm);
    font-weight: 700;
    letter-spacing: 0.06em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* WHY tighter font + more horizontal padding: 10px text with 1px vertical
   padding read as a thin sliver; bumping vertical padding to 2px gives
   the chip a stable rectangular shape. Wider letter-spacing reinforces
   the engineering-tag identity. */
.nav-user-role {
    color: var(--gs-text-muted);
    font-family: var(--gs-font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    border: 1px solid var(--gs-border);
    padding: 2px 7px;
    align-self: flex-start;
    border-radius: 2px;
    line-height: 1.3;
    background: color-mix(in srgb, var(--gs-text) 5%, transparent);
    text-transform: uppercase;
}

.nav-logout-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--gs-border);
    border-radius: var(--gs-radius-sm);
    color: var(--gs-text-muted);
    cursor: pointer;
    transition:
        color 150ms ease,
        background-color 150ms ease,
        border-color 150ms ease,
        transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
    margin-left: auto;
    flex-shrink: 0;
}

@media (hover: hover) and (pointer: fine) {
    .nav-logout-btn:hover {
        color: var(--gs-primary);
        border-color: var(--gs-primary);
        background: color-mix(in srgb, var(--gs-primary) 10%, transparent);
        transform: translateX(2px);
    }
}

.nav-logout-btn:focus-visible {
    outline: 2px solid var(--gs-primary);
    outline-offset: 2px;
    color: var(--gs-primary);
    border-color: var(--gs-primary);
}

.nav-logout-btn:active {
    transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
    .nav-logout-btn,
    .nav-user-avatar {
        transition: none !important;
        animation: none !important;
    }
    .nav-logout-btn:hover {
        transform: none !important;
    }
}

/* =====================================================
   Mobile drawer refinements (≤1023.98px)
   The drawer itself (transform, backdrop) lives in MainLayout.razor.css.
   Here we tighten footer ergonomics for touch.
   ===================================================== */
@media (max-width: 1023.98px) {
    .nav-user-section {
        min-height: 72px;
        padding: var(--gs-space-3) var(--gs-space-5);
    }

    .nav-logout-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    /* In drawer mode, the dotted divider is too subtle on top of the
       drawer's solid background — make it a single hairline. */
    .nav-divider {
        background-image: none;
        background-color: var(--gs-border);
    }
}

/* =====================================================
   Light Theme — Corporate Sidebar
   ===================================================== */

[data-theme="light"] .nav-logo-section {
    background: var(--gs-surface);
    border-bottom: 1px solid var(--gs-border);
    box-shadow: none;
}

[data-theme="light"] .nav-logo-square {
    background: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .nav-logo-text {
    color: var(--gs-text);
}

[data-theme="light"] .nav-logo-rule {
    background: linear-gradient(
        to right,
        transparent 0%,
        var(--gs-border-light) 12%,
        var(--gs-border-light) 88%,
        transparent 100%
    );
}

[data-theme="light"] .sidebar-nav-item {
    color: color-mix(in srgb, var(--gs-warning) 72%, var(--gs-text-muted) 28%);
}

@media (hover: hover) and (pointer: fine) {
    [data-theme="light"] .sidebar-nav-item:hover {
        color: var(--gs-warning);
        background: linear-gradient(
            to right,
            color-mix(in srgb, var(--gs-warning) 14%, transparent) 0%,
            transparent 100%
        );
    }
    [data-theme="light"] .sidebar-nav-item:hover .sidebar-nav-dot {
        background: var(--gs-warning);
    }
}

[data-theme="light"] .sidebar-nav-dot {
    background: var(--gs-dark-muted);
}

[data-theme="light"] .sidebar-nav-item--active {
    color: var(--gs-text);
    border-left-color: transparent;
    background: linear-gradient(
        to right,
        var(--gs-warning-bg) 0%,
        transparent 80%
    );
}

[data-theme="light"] .sidebar-nav-item::before {
    background: var(--gs-warning);
}

[data-theme="light"] .sidebar-nav-item--active::before {
    box-shadow: 0 0 12px 0
        color-mix(in srgb, var(--gs-warning) 30%, transparent);
}

[data-theme="light"] .sidebar-nav-item--active .sidebar-nav-dot {
    background: var(--gs-warning);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--gs-warning) 22%, transparent);
}

[data-theme="light"] .sidebar-nav-item--active svg {
    color: var(--gs-warning);
    opacity: 1;
}

[data-theme="light"] .sidebar-nav-item:focus-visible {
    outline-color: var(--gs-warning);
}

[data-theme="light"] .nav-divider {
    background-image: linear-gradient(
        to right,
        var(--gs-border-light) 50%,
        transparent 50%
    );
}

[data-theme="light"] .nav-divider--full {
    background-color: var(--gs-border-light);
    background-image: none;
}

[data-theme="light"] .nav-section-title {
    color: var(--gs-text-muted);
    opacity: 0.9;
    border-top: 1px solid var(--gs-warning);
}

[data-theme="light"] .nav-section-title::before {
    display: none;
}

[data-theme="light"] .nav-user-accent {
    background: linear-gradient(
        to right,
        var(--gs-warning) 0%,
        var(--gs-warning) 60%,
        transparent 100%
    );
}

[data-theme="light"] .nav-user-section {
    background: var(--bg-row);
}

[data-theme="light"] .nav-user-avatar {
    background: var(--gs-warning-bg);
    color: var(--gs-text);
    box-shadow:
        0 0 0 2px var(--gs-warning),
        inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .nav-user-name {
    color: var(--gs-text);
}

[data-theme="light"] .nav-user-role {
    color: var(--gs-warning);
    border-color: color-mix(in srgb, var(--gs-warning) 50%, transparent);
    background: color-mix(in srgb, var(--gs-warning) 10%, transparent);
}

[data-theme="light"] .nav-logout-btn {
    border-color: var(--gs-border-light);
    color: var(--gs-text-muted);
}

@media (hover: hover) and (pointer: fine) {
    [data-theme="light"] .nav-logout-btn:hover {
        color: var(--gs-warning);
        border-color: var(--gs-warning);
        background: color-mix(in srgb, var(--gs-warning) 10%, transparent);
    }
}

[data-theme="light"] .nav-logout-btn:focus-visible {
    outline-color: var(--gs-warning);
    color: var(--gs-warning);
    border-color: var(--gs-warning);
}

/* Lighten the dot-grid on light theme so it doesn't darken the surface. */
[data-theme="light"] #sidebar::before {
    opacity: 0.07;
}
