/* ── Deviatta MVP — Global stylesheet ────────────────────────────────────── */
/* Track C light-theme palette. Branch: feature/track-c-ux-overhaul          */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&display=swap');

/* ── CSS custom properties ─────────────────────────────────────────────────── */
:root {
    /* ================================================================
       TRACK C - LIGHT THEME TOKENS (Brand-Birger, 2026-05-07)
       All semantic --color-* tokens are authoritative.
       --teal / --teal-dim / --teal-glow are legacy aliases kept so
       existing components do not break during the Track C refactor.
    ================================================================ */

    /* Foundation - backgrounds */
    --color-bg-canvas:   #F5F7F9;   /* Primary page background */
    --color-bg-surface:  #FFFFFF;   /* Cards, panels, input fields */
    --color-bg-elevated: #FFFFFF;   /* Modals, popovers (shadow separates, not colour) */

    /* Text */
    --color-text-primary:   #1A2733;   /* Body text, headlines */
    --color-text-secondary: #4A6072;   /* Captions, labels, meta */
    --color-text-disabled:  #9EB0BE;   /* Disabled state - intentionally below 4.5:1 */
    --color-text-on-action: #0A1E2E;   /* Text on teal buttons - dark, not pure black */

    /* Brand teal - unchanged from existing brand */
    --color-brand-primary:   #0097A9;  /* Logo, primary buttons, focus ring */
    --color-brand-secondary: #006B79;  /* Tertiary accents, hover states */

    /* Brand surface tints */
    --color-brand-tint:        rgba(0, 151, 169, 0.15);   /* Alias for medium tint */
    --color-brand-tint-soft:   rgba(0, 151, 169, 0.08);   /* Very subtle teal bg */
    --color-brand-tint-medium: rgba(0, 151, 169, 0.15);   /* Active state, selected card */

    /* Status colours */
    --color-recording-active: #E8720C;  /* Mic recording - ORANGE (not red) */
    --color-transcribing:     #006B79;  /* AI processing - teal-dim */
    --color-success:          #1E8A5E;  /* Confirmed / "Yes, I agree" */
    --color-warning:          #B45309;  /* Warning - uncertain field, missing data */
    --color-error:            #C0392B;  /* Error only - never recording */

    /* Status tints - for background use in pills/cards */
    --color-recording-tint:    rgba(232, 114, 12, 0.10);
    --color-transcribing-tint: rgba(0, 107, 121, 0.10);
    --color-success-tint:      rgba(30, 138, 94, 0.10);
    --color-warning-tint:      rgba(180, 83, 9, 0.10);
    --color-error-tint:        rgba(192, 57, 43, 0.10);

    /* Borders */
    --color-border-subtle: #D8E2EA;   /* Card borders, input borders */
    --color-border-strong: #9EB0BE;   /* Separators, active borders */
    --color-border-focus:  #0097A9;   /* Focus ring - brand teal */

    /* ================================================================
       LEGACY ALIASES - map to semantic tokens so existing components
       using var(--teal), var(--bg), etc. continue to work unchanged
       until each screen is fully migrated to Track C components.
    ================================================================ */
    --teal:       var(--color-brand-primary);
    --teal-dim:   var(--color-brand-secondary);
    --teal-glow:  var(--color-brand-tint-medium);
    --bg:         var(--color-bg-canvas);
    --surface:    var(--color-bg-surface);
    --border:     var(--color-border-subtle);
    --text:       var(--color-text-primary);
    --text-muted: var(--color-text-secondary);
    --amber:      var(--color-warning);
    --green:      var(--color-success);
    --red:        var(--color-error);

    /* ================================================================
       TYPOGRAPHY SCALE
       Font: IBM Plex Sans (existing brand choice - unchanged)
       Sizes: 11 / 13 / 14 / 15 / 16 / 20 / 24px
       Weights: 400 / 500 / 600 / 700
    ================================================================ */
    --font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;

    --text-xs:  11px;   /* Labels, pills, uppercase captions */
    --text-sm:  13px;   /* Secondary body, meta */
    --text-md:  14px;   /* Primary body (mobile) */
    --text-base: 15px;  /* Primary body (desktop) */
    --text-lg:  16px;   /* Action buttons, lead text */
    --text-xl:  20px;   /* Section headings */
    --text-2xl: 24px;   /* Page headings */

    --weight-normal:    400;
    --weight-medium:    500;
    --weight-semibold:  600;
    --weight-bold:      700;
}

/* ── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: var(--font-family);
    background: var(--color-bg-canvas);
    color: var(--color-text-primary);
    font-size: var(--text-md);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--color-brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Visually hidden utility - for screen readers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Logo / Header ─────────────────────────────────────────────────────────── */
.logo img,
.logo svg {
    height: 22px;
    width: auto;
    display: block;
}

/* Legacy size kept for index.html hero wordmark */
.logo-hero img {
    height: 40px;
    width: auto;
    display: block;
}

header {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--color-border-subtle);
    background: var(--color-bg-surface);
    position: sticky;
    top: 0;
    z-index: 50;
}

/* Session chip - shown in header of authenticated pages */
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    letter-spacing: 0.02em;
}
.user-chip .who {
    color: var(--color-text-secondary);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-chip .who.loaded {
    color: var(--color-text-primary);
}
.btn-logout {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    text-decoration: none;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    background: transparent;
    transition: border-color 0.15s, color 0.15s;
}
.btn-logout:hover {
    border-color: var(--color-brand-primary);
    color: var(--color-brand-primary);
    text-decoration: none;
}

/* Top-nav module links — Interview · Review · Report · Admin
 * Used by sme-dashboard, archive, audit, supervisor. Role-aware
 * Admin link is toggled by static/nav.js. */
.nav-links {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    font-size: var(--text-sm);
}
.nav-links a {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color 0.12s;
}
.nav-links a:hover { color: var(--color-brand-primary); }
.nav-links a.active {
    color: var(--color-text-primary);
    font-weight: 500;
}
@media (max-width: 560px) {
    .nav-links { gap: 0.85rem; font-size: var(--text-xs); }
}

/* ── Badges & status ───────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.badge-open     { background: var(--color-warning-tint);  color: var(--color-warning); }
.badge-progress { background: var(--color-brand-tint-medium); color: var(--color-brand-primary); }
.badge-done     { background: var(--color-success-tint);   color: var(--color-success); }
.badge-closed   { background: rgba(158,176,190,0.15);      color: var(--color-text-secondary); }

/* ── Knapper ───────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.4rem;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    min-height: 44px;
}

.btn:hover  { opacity: 0.85; }
.btn:active { transform: scale(0.97); }

.btn-primary   {
    background: var(--color-brand-primary);
    color: var(--color-text-on-action);
}
.btn-secondary { background: var(--color-border-subtle); color: var(--color-text-primary); }
.btn-danger    { background: var(--color-error); color: #fff; }
.btn-success   { background: var(--color-success); color: #fff; }
.btn-ghost     {
    background: transparent;
    border: 1px solid var(--color-border-subtle);
    color: var(--color-text-primary);
}

.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

/* Focus ring - WCAG 2.1 AA */
.btn:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
}

/* ── Kort / Panel ──────────────────────────────────────────────────────────── */
.card {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 12px;
    padding: 1.5rem;
}

/* ── Fade-in animation ─────────────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease both;
}

@media (prefers-reduced-motion: reduce) {
    .fade-in { animation: none; }
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Spinner ───────────────────────────────────────────────────────────────── */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border-subtle);
    border-top-color: var(--color-brand-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

/* ── Sprogskifter ──────────────────────────────────────────────────────────── */
.lang-toggle {
    display: flex;
    gap: 0.3rem;
}

.lang-toggle button {
    background: var(--color-border-subtle);
    border: none;
    color: var(--color-text-secondary);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
    min-height: 32px;
}

.lang-toggle button.active {
    background: var(--color-brand-primary);
    color: var(--color-text-on-action);
}

/* ── Index-side ────────────────────────────────────────────────────────────── */
.index-hero {
    min-height: calc(100vh - 56px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    padding: 2rem;
}

.role-cards {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.role-card {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    animation: fadeIn 0.6s ease both;
}

.role-card:hover {
    border-color: var(--color-brand-primary);
    transform: translateY(-4px);
    box-shadow: 0 8px 32px var(--color-brand-tint-medium);
}

.role-card .icon {
    width: 72px;
    height: 72px;
    background: var(--color-brand-tint-medium);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.role-card .icon svg {
    width: 36px;
    height: 36px;
    stroke: var(--color-brand-primary);
}

.role-card h2 {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
}

.role-card p {
    color: var(--color-text-secondary);
    font-size: var(--text-md);
}

.role-card .card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.shift-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.shift-item {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    margin-bottom: 0.35rem;
    background: var(--color-bg-canvas);
    color: var(--color-text-secondary);
    font-size: var(--text-md);
    text-align: left;
}

.shift-item.is-me {
    background: var(--color-brand-tint-medium);
    border-color: var(--color-brand-primary);
    color: var(--color-text-primary);
    font-weight: var(--weight-medium);
}

.shift-item .role {
    font-size: var(--text-xs);
    opacity: 0.7;
    margin-left: 0.4rem;
}

/* ── Interview-side ────────────────────────────────────────────────────────── */
.interview-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
    max-width: 640px;
    margin: 0 auto;
    padding: 0 1rem;
}

.incident-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--color-bg-surface);
    border-bottom: 1px solid var(--color-border-subtle);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.incident-bar strong { color: var(--color-brand-primary); }

.phase-indicator {
    font-size: var(--text-xs);
    background: var(--color-brand-tint-medium);
    color: var(--color-brand-primary);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
}

.ai-bubble {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-message {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 12px 12px 12px 2px;
    padding: 1rem 1.2rem;
    font-size: var(--text-base);
    color: var(--color-text-primary);
    line-height: 1.7;
}

.user-message {
    background: var(--color-brand-tint-soft);
    border: 1px solid var(--color-border-subtle);
    border-left: 3px solid var(--color-brand-primary);
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    font-size: var(--text-md);
    align-self: flex-end;
    max-width: 90%;
}

.transcript-box {
    min-height: 60px;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    font-size: var(--text-md);
    color: var(--color-text-primary);
    margin-bottom: 0.5rem;
}

.record-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0 1.5rem;
}

.record-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--color-brand-primary);
    background: var(--color-brand-tint-medium);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

.record-btn:hover { background: rgba(0,151,169,0.22); }

.record-btn.recording {
    border-color: var(--color-recording-active);
    background: var(--color-recording-tint);
    animation: pulse 1s ease infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(232,114,12,0.3); }
    50%       { box-shadow: 0 0 0 12px rgba(232,114,12,0); }
}

.record-btn svg {
    width: 32px;
    height: 32px;
}

.record-label {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    text-align: center;
}

.action-row {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.thinking-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
}

/* ── Signoff-overlay ───────────────────────────────────────────────────────── */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26,39,51,0.60);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.overlay.show { display: flex; }

.overlay-card {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.overlay-card h2 {
    font-size: var(--text-xl);
    color: var(--color-text-primary);
}

.summary-text {
    font-size: var(--text-md);
    color: var(--color-text-primary);
    line-height: 1.7;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
    background: var(--color-bg-canvas);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid var(--color-border-subtle);
}

/* ── Dashboard ─────────────────────────────────────────────────────────────── */
.dashboard-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: calc(100vh - 56px);
    overflow: hidden;
}

.sidebar {
    border-right: 1px solid var(--color-border-subtle);
    overflow-y: auto;
    padding: 1rem;
    background: var(--color-bg-canvas);
}

.sidebar h3 {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
    padding: 0 0.25rem;
}

.incident-item {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 0.25rem;
    transition: background 0.15s;
}

.incident-item:hover { background: var(--color-border-subtle); }
.incident-item.active {
    background: var(--color-brand-tint-medium);
    border: 1px solid var(--color-brand-secondary);
}

.incident-item .inc-id    { font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--color-brand-primary); }
.incident-item .inc-batch { font-size: var(--text-xs); color: var(--color-text-secondary); margin-top: 0.1rem; }

.detail-panel {
    overflow-y: auto;
    padding: 2rem;
    background: var(--color-bg-canvas);
}

.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.detail-header h1 { font-size: var(--text-2xl); font-weight: var(--weight-semibold); }
.detail-header p  { color: var(--color-text-secondary); font-size: var(--text-md); margin-top: 0.2rem; }

.participants-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-md);
    margin-bottom: 1.5rem;
}

.participants-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--color-border-subtle);
}

.participants-table td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid var(--color-border-subtle);
    color: var(--color-text-primary);
}

.status-icon-done    { color: var(--color-success); }
.status-icon-pending { color: var(--color-warning); }

.report-section {
    margin-top: 2rem;
}

.report-section h3 {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border-subtle);
}

.report-block {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.report-block h4 {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-brand-primary);
    margin-bottom: 0.5rem;
    font-weight: var(--weight-semibold);
}

.report-block p, .report-block li {
    font-size: var(--text-md);
    color: var(--color-text-primary);
    line-height: 1.7;
}

.report-block ul, .report-block ol {
    padding-left: 1.2rem;
}

.report-block li { margin-bottom: 0.25rem; }

/* ── Responsiv: mobil ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--color-border-subtle);
        max-height: 180px;
    }

    .role-cards {
        flex-direction: column;
    }

    .role-card { width: 100%; }

    header { padding: 0 1rem; }
}
