/* ========================================================================
   Layout — Header, Navigation, Active Bar, Login, Overlay
   ======================================================================== */

/* --- Header --- */
.header {
    background: var(--brand-navy);
    color: var(--text-on-brand);
    padding: var(--space-4) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.header h1 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--text-xl);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: var(--lh-tight);
}

.header .status {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.header .active-badge {
    background: var(--brand-red);
    color: var(--text-on-brand);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    line-height: var(--lh-snug);
}

.header .timer {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--brand-blue);
}

@media (prefers-color-scheme: dark) {
    .header .timer {
        color: oklch(0.70 0.14 250);
    }
}
[data-theme="dark"] .header .timer {
    color: oklch(0.70 0.14 250);
}
[data-theme="light"] .header .timer {
    color: var(--brand-blue);
}

.header .idle {
    color: var(--text-muted);
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.header .sync-badge {
    background: var(--brand-orange);
    color: var(--brand-navy);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: var(--lh-snug);
}

/* --- Theme toggle (nav bar) --- */
.nav-theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border: 1px solid oklch(0.45 0.02 250);
    border-radius: var(--radius-full);
    background: oklch(0.25 0.02 250);
    color: var(--text);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease-out),
                border-color var(--duration-fast) var(--ease-out),
                background var(--duration-fast) var(--ease-out);
    line-height: 1;
}
.nav-theme-toggle:hover {
    color: oklch(0.98 0.003 250);
    border-color: oklch(0.55 0.02 250);
    background: oklch(0.30 0.025 250);
}
.nav-theme-toggle:active {
    transform: scale(0.95);
    transition-duration: 50ms;
}
.nav-theme-toggle .theme-icon {
    font-size: var(--text-lg);
}
.nav-theme-toggle .theme-label {
    font-size: var(--text-sm);
}
/* Light mode override for theme toggle */
[data-theme="light"] .nav-theme-toggle {
    background: oklch(0.93 0.006 250);
    border-color: oklch(0.82 0.01 250);
    color: var(--text);
}
[data-theme="light"] .nav-theme-toggle:hover {
    background: oklch(0.88 0.008 250);
    border-color: oklch(0.72 0.015 250);
}

/* User chip in header */
.header .user-chip {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: oklch(0.75 0.01 250);
    margin-left: var(--space-4);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
    position: relative;
}
.header .user-chip:hover {
    color: var(--text-on-brand);
}
.header .user-chip img {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid oklch(1 0 0 / 0.15);
}
.header .user-chip span {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: var(--lh-snug);
}
.header .user-chip .chip-edit-icon {
    font-size: var(--text-xs);
    opacity: 0;
    transition: opacity var(--duration-fast);
    line-height: 1;
}
.header .user-chip:hover .chip-edit-icon {
    opacity: 1;
}

/* --- Navigation --- */
.nav {
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
    padding: 0 var(--space-6);
    display: flex;
    align-items: center;
    gap: 0;
    min-height: 52px;
}

.nav a {
    padding: var(--space-3) var(--space-4);
    text-decoration: none;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-weight: 600;
    text-transform: uppercase;
    font-size: var(--text-base);
    letter-spacing: 0.06em;
    line-height: var(--lh-snug);
    border-bottom: 3px solid transparent;
    transition: color var(--duration-fast) var(--ease-out),
                border-color var(--duration-fast) var(--ease-out);
    position: relative;
}

.nav a:hover {
    color: var(--text);
}

.nav a.active {
    color: var(--text);
    font-weight: 700;
    border-bottom-color: var(--brand-red);
}

.nav a.logout-link {
    color: var(--text-muted);
    font-size: var(--text-sm);
}
.nav a.logout-link:hover {
    color: var(--brand-red);
}

/* --- Container --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-6);
}

/* --- Active Slot Status Bar --- */
#active-bar {
    background: var(--bg-sunken);
    color: var(--text);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-sm);
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: var(--lh-snug);
    min-height: 2rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

#active-bar .ab-slot {
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: var(--text-sm);
    letter-spacing: 0.1em;
    line-height: var(--lh-snug);
}
#active-bar .ab-label {
    color: var(--text);
    font-size: var(--text-sm);
}
#active-bar .ab-issue {
    color: var(--brand-blue);
}
#active-bar .ab-elapsed {
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--brand-red);
    min-width: 4rem;
}
#active-bar .ab-idle {
    color: var(--text-muted);
    font-weight: 600;
    font-size: var(--text-sm);
    letter-spacing: 0.06em;
}
#active-bar .ab-sep {
    color: var(--text-muted);
    opacity: 0.5;
}
#active-bar .ab-stop-btn {
    margin-left: auto;
    background: var(--brand-red);
    color: var(--text-on-brand);
    border: none;
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out);
}
#active-bar .ab-stop-btn:hover {
    background: var(--brand-red-hover);
}

/* --- Page sections --- */
.page { display: none; }
.page.active { display: block; }

/* --- Login overlay --- */
#login-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--brand-navy);
    color: var(--text-on-brand);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
    overflow: hidden;
}
#login-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 50% at 20% 50%, oklch(0.59 0.25 27 / 0.10) 0%, transparent 70%),
        radial-gradient(ellipse 50% 60% at 80% 60%, oklch(0.59 0.25 27 / 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 40% 40% at 50% 20%, oklch(0.55 0.17 250 / 0.05) 0%, transparent 70%);
    pointer-events: none;
}
#login-overlay.active { display: flex; }

.login-logo {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-5);
}
.login-logo svg {
    width: 280px;
    height: auto;
}
.login-app-name {
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: oklch(0.70 0.01 250);
}
.login-divider {
    width: 40px;
    height: 2px;
    background: var(--brand-red);
    border: none;
    position: relative;
}
#login-overlay p {
    color: oklch(0.70 0.01 250);
    font-size: var(--text-base);
    position: relative;
}
.login-google-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--bg-raised);
    color: var(--text);
    border: none;
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out);
    position: relative;
}
.login-google-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.login-google-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* --- Hamburger menu (hidden on desktop) --- */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--space-2);
    line-height: 1;
}

/* --- Full-screen overlay (hidden by default) --- */
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: var(--brand-navy);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}
.nav-overlay.open {
    display: flex;
}
.nav-overlay-close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    background: none;
    border: none;
    color: var(--text-on-brand);
    font-size: 2rem;
    cursor: pointer;
    padding: var(--space-2);
    line-height: 1;
}
.nav-overlay-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
}
.nav-overlay-links a {
    color: var(--text-on-brand);
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--text-lg);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-sm);
    transition: background var(--duration-fast) var(--ease-out);
    min-height: 44px;
    display: flex;
    align-items: center;
}
.nav-overlay-links a:hover {
    background: oklch(1 0 0 / 0.08);
}

/* Theme toggle in mobile overlay */
.nav-overlay-theme {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    color: oklch(0.75 0.01 250);
    background: none;
    border: 1px solid oklch(1 0 0 / 0.12);
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--text-base);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: var(--space-3) var(--space-6);
    min-height: 44px;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out),
                color var(--duration-fast) var(--ease-out);
}
.nav-overlay-theme:hover {
    background: oklch(1 0 0 / 0.08);
    color: var(--text-on-brand);
}
.nav-overlay-theme .theme-icon {
    font-size: var(--text-lg);
}

.nav-overlay-divider {
    width: 40px;
    height: 2px;
    background: var(--brand-red);
    border: none;
    margin: var(--space-3) 0;
}
.nav-overlay-user {
    position: absolute;
    bottom: var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: oklch(0.70 0.01 250);
    font-size: var(--text-sm);
}
.nav-overlay-user img {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    object-fit: cover;
}
