/* AdminPortal css 05: Blazor error UI + app shell (sidebar, main column, sticky top header).

   Rewritten for the flat language. Three things changed that are visible on every
   authenticated screen:

   1. .dashboard-layout no longer paints two fixed radial gradients over the page.
      That wash - not the .aurora-bg element - was what made the dashboards glow.
   2. The top header is a solid --surface with a hairline bottom edge instead of a
      55%-black pane with a 14px backdrop blur. Blur over scrolling dense tables is
      expensive and made figures shimmer as rows passed under it.
   3. The active nav item is a flat --primary-subtle block with a solid brand rail,
      not a horizontal gradient fading to transparent.

   Removed as dead (no .razor emits them): .blazor-error-boundary, .unread-badge,
   .nav-badge-dot, and the entire global header search component. */

/* ============================================
   Blazor defaults
   ============================================ */

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--danger);
    color: var(--danger-ink);
    padding: 12px 16px;
    font-size: 0.875rem;
}

/* ============================================
   Layout
   ============================================ */

.dashboard-layout {
    display: flex;
    min-height: 100vh;
    background: var(--background);
}

/* ---- Sidebar ---- */
.sidebar {
    width: 240px;
    background: var(--surface);
    border-right: var(--hairline) solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar.collapsed {
    width: 72px;
}

.sidebar.collapsed .sidebar-header {
    padding: 12px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-nav {
    padding: 8px 6px;
    gap: 2px;
}

.sidebar.collapsed .nav-item {
    padding: 8px 16px;
    justify-content: center;
}

.sidebar.collapsed .nav-section-head {
    margin: 12px 12px 8px;
}

.sidebar.collapsed .sidebar-footer {
    padding: 8px 6px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    min-height: var(--app-header-h);
    border-bottom: var(--hairline) solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--foreground);
    font-weight: 600;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--foreground-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius);
    transition: background var(--transition), color var(--transition);
}

.sidebar-toggle:hover {
    background: var(--card-hover);
    color: var(--foreground);
}

.sidebar-nav {
    flex: 1;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section-head {
    margin: 14px 8px 6px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--foreground-subtle);
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--radius);
    color: var(--foreground-muted);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    flex-shrink: 0;
}

/* Active rail. Kept as a solid 2px bar rather than a gradient: at 2px a gradient
   is invisible, so it was decoration that cost a repaint. */
.nav-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 2px;
    height: 0;
    background: var(--primary);
    transform: translateY(-50%);
    transition: height 0.18s ease;
}

.nav-item:hover {
    background: var(--card-hover);
    color: var(--foreground);
}

.nav-item.active {
    background: var(--primary-subtle);
    /* -strong: label on the 10% tint. The 2px rail below keeps the fill value. */
    color: var(--primary-strong);
    font-weight: 600;
}

.nav-item.active::before {
    height: 100%;
}

.nav-icon {
    position: relative;
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.sidebar-footer {
    padding: 10px 8px;
    border-top: var(--hairline) solid var(--border);
}

/* ---- Main column ---- */
.dashboard-main {
    flex: 1;
    margin-left: 240px;
    transition: margin-left 0.2s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* clip (not hidden): hidden would make this a scroll container and
       break position:sticky descendants (sticky table headers, filter bars) */
    overflow-x: clip;
    min-width: 0;
}

.sidebar.collapsed + .dashboard-main {
    margin-left: 72px;
}

/* The sticky top app header occupies this height. --sticky-top is the offset any
   position:sticky content BELOW the header must use for its `top` so it parks just under
   the header (not behind it). ALWAYS use `top: var(--sticky-top)` for such elements -
   never a bare pixel value - so this stays correct everywhere if the header changes. */
:root {
    --app-header-h: 50px;
    --sticky-top: calc(var(--app-header-h) + 12px);
}

/* ---- Top header ---- */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 20px;
    min-height: var(--app-header-h);
    box-sizing: border-box;
    background: var(--surface);
    border-bottom: var(--hairline) solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
    min-width: 0;
}

.page-heading {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.page-eyebrow {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--foreground-subtle);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Blazor's own error bar markup (MainLayout) - the framework toggles the bar's
   display, these just make its two controls legible on the danger fill. */
#blazor-error-ui .reload,
#blazor-error-ui .dismiss {
    color: inherit;
    cursor: pointer;
    margin-left: 10px;
}

.sidebar-overlay {
    display: none;
}

/* Mobile hamburger - opens the off-canvas sidebar drawer. Hidden on desktop. */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    border: var(--hairline) solid var(--border);
    background: transparent;
    color: var(--foreground);
    font-size: 1.25rem;
    cursor: pointer;
    flex-shrink: 0;
}

.mobile-menu-btn:hover {
    background: var(--card-hover);
}

@media (max-width: 768px) {
    .mobile-menu-btn { display: inline-flex; }
    .dashboard-header .header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .dashboard-main,
    .nav-item,
    .nav-item::before {
        transition: none;
    }
}
