/* UKLB CORE v5.0.1 - Global Stylesheet */
:root {
    --core-navy: #0f172a;
    --core-slate: #1e293b;
    --core-accent: #2563eb;
    --core-accent-soft: #dbeafe;
    --core-bg: #f1f5f9;
    --core-surface: #ffffff;
    --core-border: #e2e8f0;
    --core-text: #0f172a;
    --core-muted: #64748b;
}

html {
    scroll-behavior: smooth;
    overflow-y: auto;
}

body {
    background-color: var(--core-bg);
    color: var(--core-text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Top Bar 1: Department Switcher + User / Admin Controls */
.core-topbar-primary {
    background-color: var(--core-navy);
    color: #fff;
    padding: 0.55rem 1.25rem;
    min-height: 58px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.core-dept-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.core-dept-pill {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 0.375rem;
    transition: background-color 0.15s ease, color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.core-dept-pill:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.core-dept-pill.active {
    background-color: var(--core-accent);
    color: #fff;
}

.core-topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Top Bar 2: Global Search + Notifications (Next to Sidebar) */
.core-topbar-secondary {
    background-color: var(--core-surface);
    border-bottom: 1px solid var(--core-border);
    padding: 0.55rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

/* Main 2-Column Workspace Grid (Full-Height Sidebar + Right Column) */
.core-workspace-grid {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
    align-items: stretch;
}

.core-right-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

@media (max-width: 991.98px) {
    .core-workspace-grid {
        grid-template-columns: 1fr;
    }
}

/* Left Sidebar (Starts at Top Bar and Extends Down) */
.core-sidebar {
    background-color: var(--core-slate);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(15, 23, 42, 0.25);
}

.core-brand-box {
    padding: 0.65rem 1.25rem;
    min-height: 58px;
    background-color: var(--core-navy);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.core-brand-title {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.core-brand-subtitle {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 0.2rem;
}

.core-nav-section-title {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    padding: 1rem 1.25rem 0.4rem;
    font-weight: 700;
}

.core-nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 1.25rem;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
    min-width: 0;
}

.core-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.core-nav-link.active {
    background-color: rgba(37, 99, 235, 0.18);
    color: #fff;
    border-left-color: #3b82f6;
    font-weight: 600;
}

.core-nav-sublist {
    background-color: rgba(15, 23, 42, 0.45);
    border-left: 3px solid rgba(59, 130, 246, 0.35);
}

.core-nav-sublink {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.42rem 1rem 0.42rem 2.25rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.81rem;
    transition: all 0.15s ease;
    min-width: 0;
}

.core-nav-sublink:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.04);
}

.core-nav-sublink.active {
    color: #60a5fa;
    background-color: rgba(37, 99, 235, 0.12);
    font-weight: 600;
}

.core-sidebar-footer {
    margin-top: auto;
    padding: 0.85rem 1.25rem;
    background-color: rgba(15, 23, 42, 0.55);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.74rem;
    color: #94a3b8;
    letter-spacing: 0.02em;
    text-align: center;
}

body:has(#core-debug-bar) .core-sidebar-footer {
    padding-bottom: 2.75rem;
}

/* Main Content Pane */
.core-main-pane {
    padding: 1.5rem;
    min-width: 0;
}

/* Wiki Documentation Navigation */
.wiki-toc-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.wiki-toc-nav a {
    color: var(--core-muted);
    text-decoration: none;
    font-size: 0.82rem;
    padding: 0.35rem 0.75rem;
    border-left: 2px solid var(--core-border);
    transition: all 0.15s ease;
}

.wiki-toc-nav a:hover,
.wiki-toc-nav a.active {
    color: var(--core-accent);
    border-left-color: var(--core-accent);
    background-color: var(--core-accent-soft);
    font-weight: 600;
}

.wiki-code-block {
    background-color: #0f172a;
    color: #e2e8f0;
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.82rem;
    overflow-x: auto;
    line-height: 1.55;
    margin-bottom: 1rem;
}

.wiki-section {
    scroll-margin-top: 1.25rem;
}

/* Bottom Developer Debug Bar (Active when APP_DEBUG=true) */
body.has-debug-bar {
    padding-bottom: 42px;
}

.core-debugbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1080;
    background-color: #090d16;
    color: #e2e8f0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.76rem;
    border-top: 2px solid #3b82f6;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
}

.core-debugbar-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    padding: 0 0.75rem;
    min-height: 36px;
}

.core-debugbar-tab {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 0.35rem 0.65rem;
    border-radius: 0.25rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: inherit;
    font-size: 0.75rem;
}

.core-debugbar-tab:hover,
.core-debugbar-tab.active {
    background-color: rgba(59, 130, 246, 0.2);
    color: #fff;
}

.core-debugbar-drawer {
    display: none;
    max-height: 42vh;
    overflow-y: auto;
    background-color: #0f172a;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
}

.core-debugbar-drawer.open {
    display: block;
}
