/*
 * Layout-wide CSS extracted from _Layout.cshtml so the inline <style>
 * block can be removed and CSP can drop 'unsafe-inline'.
 */

html, body {
    background: var(--color-brand-surface-muted);
    color: var(--color-text-default);
    font-family: var(--font-family-sans);
    font-size: var(--font-size-base);
    line-height: 1.5;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-shell main {
    flex: 1 0 auto;
}

.app-shell footer {
    flex-shrink: 0;
    background: var(--color-brand-ink);
    color: var(--color-text-inverse);
    padding: var(--space-5) 0;
}

.app-shell footer a {
    color: var(--color-brand-accent);
}

/* ------------------------------------------------------------------ */
/* Left sidebar navigation (replaces top navbar)                       */
/* ------------------------------------------------------------------ */

:root {
    --sidebar-width: 260px;
}

body.has-sidebar {
    overflow-x: hidden;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(180deg, var(--color-brand-ink) 0%, var(--secondary-color, #1a2a44) 100%);
    color: var(--color-text-inverse);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.12);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-5) var(--space-4);
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-brand:hover {
    color: #fff;
    opacity: 0.92;
}

.sidebar-user {
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    line-height: 1.4;
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: var(--space-3) 0;
    flex: 1 1 auto;
}

.sidebar-nav .nav-item {
    margin: 0;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0.65rem var(--space-4);
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.sidebar-nav .nav-link i {
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link:focus {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-theme-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: calc(100% - var(--space-4) * 2);
    margin: var(--space-2) var(--space-4);
    padding: 0.55rem var(--space-3);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.9);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: background 0.2s ease;
}

.sidebar-theme-toggle:hover,
.sidebar-theme-toggle:focus {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.sidebar-theme-toggle i {
    width: 1.25rem;
    text-align: center;
}

/* Floating theme toggle on public home (no sidebar) */
.theme-fab {
    position: fixed;
    bottom: var(--space-5);
    right: var(--space-5);
    z-index: 1050;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    border: 1px solid var(--color-brand-divider);
    background: var(--color-brand-surface);
    color: var(--color-text-default);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.theme-fab:hover,
.theme-fab:focus {
    background: var(--color-brand-surface-muted);
    transform: scale(1.05);
}

.sidebar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.14);
    border-left-color: var(--color-brand-accent);
    color: #fff;
}

.sidebar-nav .nav-divider {
    height: 1px;
    margin: var(--space-2) var(--space-4);
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-nav .nav-section-label {
    padding: var(--space-2) var(--space-4) var(--space-1);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.45);
}

.sidebar-login-group .nav-link {
    padding-left: calc(var(--space-4) + 1.25rem + var(--space-3));
    font-size: var(--font-size-sm);
}

.app-content {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-content main {
    flex: 1 0 auto;
}

.sidebar-mobile-bar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 1030;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: linear-gradient(135deg, var(--color-brand-ink) 0%, var(--secondary-color, #1a2a44) 100%);
    color: var(--color-text-inverse);
    box-shadow: var(--shadow-sm);
}

.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1035;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .app-content {
        margin-left: 0;
    }

    .sidebar-mobile-bar {
        display: flex;
    }

    .sidebar-backdrop {
        display: block;
    }
}

.brand-link {
    color: var(--color-brand-ink);
    font-weight: 600;
    text-decoration: none;
}

.brand-link:hover {
    color: var(--color-brand-primary-dark);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}
