/* Plan 006: layout.css — Page structure and major layout regions
   Extracted from frontend/styles.css on 2026-04-03
   Extended: header/nav chrome, inspector tabs added on 2026-04-03 (Milestone 19) */

.container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

#appContainer.container {
    grid-template-columns: minmax(340px, 0.92fr) minmax(500px, 1.18fr);
}


.left-column {
    position: sticky;
    top: 20px;
    align-self: start;
}

.right-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}


.profile-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}


.profile-tab.active {
    background-color: var(--color-primary-700);
    border-color: var(--color-primary-700);
    color: var(--fg-on-primary);
}


/* ── Page header ── */
header {
    background: linear-gradient(to right, var(--primary), var(--primary-container));
    color: white;
    padding: 14px 18px;
    text-align: center;
    border-radius: 12px;
    margin-bottom: 20px;
}

header.index-header {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    padding: 0 2rem;
    background-color: var(--color-primary-900);
    text-align: left;
    border-radius: 12px;
    position: relative;
}

header.index-header .profile-dropdown {
    margin-left: auto;
}

header.detail-header {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
}

header h1 {
    margin: 0;
    flex-grow: 1;
}

.header-title-group {
    display: inline-flex;
    align-items: baseline;
    gap: 0.65rem;
    min-width: 0;
}

.header-title-group h1 {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.2;
}

.header-title-group .header-subtitle {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.78);
    white-space: nowrap;
}


/* ── Profile dropdown ── */
.profile-dropdown {
    position: relative;
    margin-left: 12px;
    flex-shrink: 0;
}

.profile-dropdown::before {
    content: '';
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    height: 10px;
    background: transparent;
}

.profile-person-icon {
    width: 20px;
    height: 20px;
}

.profile-dropdown-menu {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    min-width: 180px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-1);
    z-index: var(--z-dropdown);
    display: none;
}

.profile-dropdown:hover .profile-dropdown-menu,
.profile-dropdown.is-open .profile-dropdown-menu {
    display: block;
}

/* ── Inspector tabs ── */

/* ── UI Overhaul: SPA chrome layout ── */

html {
    height: 100%;
    overflow: hidden;
}

/* #appContainer carries the legacy .container class (display: grid), but the
   sidebar is now position: fixed so the grid is vestigial. Override to a plain
   height-100% block so the height chain (html → body → shell → canvas) works. */
#appContainer {
    height: 100%;
    display: block;
}

/* Shell body (sits to the right of the fixed sidebar) */
.app-shell-body {
    margin-left: 16rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    transition: margin-left 300ms ease-in-out;
}

.app-shell-body--sidebar-collapsed {
    margin-left: 4rem;
}

/* TopNavBar */
.topnav {
    position: sticky;
    top: 0;
    z-index: var(--z-nav);
    background: var(--surface);
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.topnav__brand {
    font-family: var(--font-headline);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.025em;
}

.topnav__actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topnav__icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: var(--ghost-border);
    background: transparent;
    color: var(--on-surface-variant);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 120ms ease;
}

.topnav__icon-btn:hover {
    background: var(--surface-container-low);
}

.topnav__profile {
    position: relative;
}

.topnav__profile-trigger {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: var(--ghost-border);
    background: var(--surface-container-low);
    color: var(--on-surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 120ms ease;
}

.topnav__profile-trigger:hover {
    background: var(--surface-container);
}

.topnav__profile-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--surface-container-lowest);
    border: var(--ghost-border);
    border-radius: 12px;
    box-shadow: var(--ambient-shadow);
    z-index: var(--z-dropdown);
    display: none;
    flex-direction: column;
    padding: 4px;
}

.topnav__profile-menu.is-open {
    display: flex;
}

.topnav__menu-item {
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--on-surface);
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    transition: background 120ms ease;
}

.topnav__menu-item:hover {
    background: var(--surface-container-low);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 16rem;
    height: 100vh;
    z-index: var(--z-sidebar);
    background: var(--surface-container-low);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 300ms ease-in-out;
}

.sidebar--collapsed {
    width: 4rem;
}

/* Hide text labels when collapsed; keep icons visible */
.sidebar--collapsed .sidebar__brand-name,
.sidebar--collapsed .sidebar__brand-sub,
.sidebar--collapsed .sidebar-item__label,
.sidebar--collapsed .sidebar__new-session-label {
    opacity: 0;
    pointer-events: none;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 200ms ease-in-out, width 300ms ease-in-out;
}

.sidebar__brand-name, .sidebar__brand-sub, .sidebar-item__label {
    transition: opacity 200ms ease-in-out, width 300ms ease-in-out;
}

/* Collapse toggle button */
.sidebar__collapse-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: var(--ghost-border);
    background: transparent;
    color: var(--on-surface-variant);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 120ms ease, transform 300ms ease-in-out;
}

.sidebar__collapse-btn:hover {
    background: var(--surface-container-high);
    color: var(--on-surface);
}

.sidebar--collapsed .sidebar__collapse-btn {
    transform: rotate(180deg);
}

.sidebar__brand {
    padding: 1.5rem 1.5rem 1rem;
    flex-shrink: 0;
}

.sidebar__brand-name {
    font-family: var(--font-headline);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.025em;
}

.sidebar__brand-sub {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--on-surface-variant);
    margin-top: 2px;
}

.sidebar__nav {
    flex: 1;
    padding: 0.5rem 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--on-surface-variant);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-body);
    border: none;
    border-left: 4px solid transparent;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: color 120ms ease, background 120ms ease;
}

.sidebar-item:hover:not([aria-disabled="true"]) {
    background: var(--surface-container-high);
    color: var(--on-surface);
}

.sidebar-item--active {
    border-left-color: var(--color-primary-700);
    color: var(--color-primary-700);
    background: var(--color-primary-light);
}

.sidebar-item--gated {
    opacity: 0.45;
    cursor: not-allowed;
}

.sidebar-item--coming-soon {
    opacity: 0.5;
    cursor: not-allowed;
    color: var(--on-surface-variant);
}

.sidebar-item--coming-soon:hover {
    background: transparent;
    color: var(--on-surface-variant);
}

.sidebar-item__lock {
    width: 14px;
    height: 14px;
    font-size: 14px;
    margin-left: auto;
    color: var(--outline-variant);
    flex-shrink: 0;
}

.sidebar__footer {
    padding: 0.75rem;
    border-top: var(--ghost-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}


/* View canvas — full-bleed by default; overflow hidden so each view
   manages its own scroll. Non-calendar views get 2rem padding and
   allow vertical scroll within the canvas. */
.view-canvas {
    flex: 1;
    padding: 0;
    background: var(--surface);
    overflow: hidden;
    min-height: 0;
}

.view-canvas:not([data-view="calendar"]):not([data-view="attendance"]):not([data-view="session-entry"]) {
    overflow-y: auto;
    padding: var(--space-8);
}
.view-canvas[data-view="session-entry"] {
    overflow: hidden;
    padding: 0;
    position: relative; /* allows .session-editor-standalone to anchor inside */
}

/* Canvas overlay (for click-outside dismiss) */
.canvas-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-raised);
    pointer-events: none;
}

.canvas-overlay.is-active {
    pointer-events: all;
}

/* Loading spinner shown while a view module is importing */
.view-canvas-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--on-surface-variant);
    font-size: 0.875rem;
    font-family: var(--font-body);
    gap: 0.75rem;
}

.view-canvas-spinner::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--surface-container-high);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: curator-spin 0.6s linear infinite;
    flex-shrink: 0;
}

@keyframes curator-spin {
    to { transform: rotate(360deg); }
}

/* ── SPA shell responsive behavior ── */
@media (max-width: 1024px) {
    /* Sidebar becomes a hamburger drawer at this breakpoint.
       mobile-nav.css takes over sidebar positioning; body gets full width. */
    .sidebar {
        width: 0;
        border-right: 0;
    }

    .app-shell-body {
        margin-left: 0;
    }

    .topnav {
        padding: 0 var(--space-5);
    }

    .topnav__brand {
        font-size: 1.1rem;
    }

    .view-canvas:not([data-view="calendar"]):not([data-view="attendance"]) {
        padding: var(--space-6);
    }
}

@media (max-width: 768px) {
    .topnav {
        height: 3.5rem;
        padding: 0 var(--space-4);
    }

    .topnav__brand {
        font-size: 1rem;
    }

    .topnav__actions {
        gap: var(--space-2);
    }

    .view-canvas:not([data-view="calendar"]):not([data-view="attendance"]) {
        padding: var(--space-5);
    }
}

@media (max-width: 640px) {
    .topnav__brand {
        display: none;
    }

    .topnav {
        justify-content: flex-end;
    }

    .view-canvas:not([data-view="calendar"]):not([data-view="attendance"]) {
        padding: var(--space-4);
    }
}

@media (max-width: 480px) {
    .app-shell-body {
        margin-left: 0;
    }

    .sidebar {
        width: 0;
        border-right: 0;
    }

    .sidebar--collapsed {
        width: 0;
    }

    .topnav {
        padding: 0 var(--space-3);
    }

    .view-canvas:not([data-view="calendar"]):not([data-view="attendance"]) {
        padding: var(--space-3);
    }
}
