/* ================================================================
   SWISS LEARN — Brand-aligned LMS styling
   Editorial-engineering aesthetic. Same palette + type as the public site.
   ================================================================ */

/* ===== Design tokens ===== */
:root {
    --ink: #001433;
    --ink-2: #002857;
    --ink-3: #1a2842;
    --green: #1f9d6b;
    --green-lo: #178a5d;
    --green-hi: #25b87d;
    --green-soft: rgba(31, 157, 107, .08);
    --rose: #e85b6b;
    --rose-soft: rgba(232, 91, 107, .08);
    --amber: #ffb100;
    --amber-soft: rgba(255, 177, 0, .1);

    --paper: #ffffff;
    --paper-2: #f6f8fb;
    --paper-3: #ecf0f5;
    --line: #e3e8ef;
    --line-2: #cdd5e0;

    --text-1: var(--ink);
    --text-2: #4a5568;
    --text-3: #6b7588;

    --t-xs: 12px;
    --t-sm: 14px;
    --t-base: 15px;
    --t-md: 17px;
    --t-lg: 22px;
    --t-xl: 28px;
    --t-2xl: 38px;
    --t-3xl: 52px;

    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 18px;
    --s-5: 24px;
    --s-6: 36px;
    --s-7: 56px;
    --s-8: 80px;

    --maxw: 1200px;
    --gutter: 24px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 18px;

    --shadow-1: 0 1px 2px rgba(0, 20, 51, .06);
    --shadow-2: 0 4px 14px rgba(0, 20, 51, .08);
    --shadow-3: 0 16px 40px rgba(0, 20, 51, .14);

    --d-1: 100ms;
    --d-2: 180ms;
    --d-3: 280ms;
    --ease: cubic-bezier(.4, 0, .2, 1);
    --ease-out: cubic-bezier(0, 0, .2, 1);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: 'Inter Tight', system-ui, -apple-system, sans-serif;
    font-size: var(--t-base);
    line-height: 1.5;
    color: var(--text-1);
    background: var(--paper-2);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--green-lo); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; }

h1, h2, h3, h4, h5, h6 { font-family: 'Inter Tight', system-ui, sans-serif; letter-spacing: -.015em; margin: 0; }
h1 { font-size: var(--t-2xl); font-weight: 600; }
h2 { font-size: var(--t-xl); font-weight: 600; }
h3 { font-size: var(--t-lg); font-weight: 600; }
h4 { font-size: var(--t-md); font-weight: 600; }

.eyebrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--green);
    display: block;
    margin-bottom: var(--s-3);
}

/* ===== Layout shell ===== */
.shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-bar {
    background: var(--ink);
    color: #fff;
    border-bottom: 1px solid var(--ink-2);
    position: sticky;
    top: 0;
    z-index: 100;
}
.app-bar__inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 14px var(--gutter);
    display: flex;
    align-items: center;
    gap: var(--s-5);
}
.app-bar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
    flex-shrink: 0;
}
.app-bar__brand:hover { text-decoration: none; opacity: .9; }
.app-bar__brand svg { width: 36px; height: 36px; flex-shrink: 0; }
.app-bar__brand-text { display: flex; flex-direction: column; line-height: 1; gap: 3px; }
.app-bar__brand-text strong { font-size: 14px; font-weight: 700; letter-spacing: -.02em; }
.app-bar__brand-text span { font: 500 9px/1 'JetBrains Mono', monospace; letter-spacing: .18em; text-transform: uppercase; color: var(--green-hi); }

.app-bar__nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: var(--s-5);
}
.app-bar__nav a {
    padding: 8px 14px;
    border-radius: 6px;
    color: rgba(255, 255, 255, .82);
    font-size: 14px;
    font-weight: 500;
    transition: background var(--d-2) var(--ease), color var(--d-2) var(--ease);
}
.app-bar__nav a:hover, .app-bar__nav a.active { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }

.app-bar__user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--s-3);
}
.app-bar__user-name { font-size: 13px; color: rgba(255, 255, 255, .82); }
.app-bar__signout {
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, .18);
    background: transparent;
    color: rgba(255, 255, 255, .9);
    border-radius: 6px;
    font: 500 13px/1 'Inter Tight', sans-serif;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--d-2) var(--ease);
}
.app-bar__signout:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }

main {
    flex: 1;
    padding: var(--s-7) 0;
}
.container {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 var(--gutter);
}
.container-narrow {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 var(--gutter);
}

footer.app-foot {
    background: var(--ink);
    color: rgba(255, 255, 255, .65);
    padding: var(--s-5) var(--gutter);
    text-align: center;
    font: 500 11px/1.5 'JetBrains Mono', monospace;
    letter-spacing: .15em;
    text-transform: uppercase;
}

/* ===== Cards ===== */
.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--s-5);
}
.card--prominent {
    box-shadow: var(--shadow-2);
    border-color: transparent;
}
.card__head {
    margin-bottom: var(--s-4);
    padding-bottom: var(--s-4);
    border-bottom: 1px solid var(--line);
}
.card__title { font-size: var(--t-lg); font-weight: 600; margin: 0; }
.card__subtitle { color: var(--text-3); font-size: var(--t-sm); margin-top: 4px; }

/* Hero card on dashboard */
.hero-card {
    background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: var(--s-7);
    position: relative;
    overflow: hidden;
}
.hero-card::before {
    content: '';
    position: absolute;
    inset: auto -120px -160px auto;
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, rgba(31, 157, 107, .25) 0%, transparent 70%);
    pointer-events: none;
}
.hero-card__eyebrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--green-hi);
    display: block;
    margin-bottom: var(--s-3);
    position: relative;
}
.hero-card h1 {
    font-size: var(--t-2xl);
    color: #fff;
    margin: 0 0 var(--s-3);
    position: relative;
    letter-spacing: -.02em;
}
.hero-card p {
    color: rgba(255, 255, 255, .78);
    font-size: var(--t-md);
    margin: 0 0 var(--s-5);
    max-width: 640px;
    line-height: 1.55;
    position: relative;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 8px;
    font: 600 14px/1 'Inter Tight', sans-serif;
    text-decoration: none;
    border: 0;
    cursor: pointer;
    transition: transform var(--d-2) var(--ease), background var(--d-2) var(--ease), box-shadow var(--d-2) var(--ease);
    font-family: inherit;
}
.btn-primary {
    background: var(--green);
    color: #fff;
    box-shadow: 0 1px 2px rgba(0, 20, 51, .08);
}
.btn-primary:hover { background: var(--green-lo); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(31, 157, 107, .3); text-decoration: none; }
.btn-secondary {
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--line);
}
.btn-secondary:hover { background: var(--paper-2); border-color: var(--ink); text-decoration: none; }
.btn-ghost {
    background: rgba(255, 255, 255, .08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .18);
}
.btn-ghost:hover { background: rgba(255, 255, 255, .15); color: #fff; text-decoration: none; }
.btn-lg { padding: 16px 28px; font-size: 15px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ===== Forms ===== */
.form-group { margin-bottom: var(--s-4); }
.form-group label { display: block; font: 600 13px/1 'Inter Tight', sans-serif; margin-bottom: 8px; color: var(--text-1); }
.form-group .help { font-size: 12px; color: var(--text-3); margin-top: 6px; }
input[type=text], input[type=email], input[type=number], select, textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: 400 14px/1.4 'Inter Tight', sans-serif;
    background: #fff;
    color: var(--text-1);
    transition: border-color var(--d-2) var(--ease), box-shadow var(--d-2) var(--ease);
}
input:focus, select:focus, textarea:focus {
    outline: 0;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(31, 157, 107, .15);
}
textarea { resize: vertical; min-height: 100px; font-family: inherit; }

.alert {
    padding: var(--s-4);
    border-radius: 8px;
    font-size: var(--t-sm);
    margin-bottom: var(--s-4);
}
.alert-error { background: var(--rose-soft); color: var(--rose); border-left: 3px solid var(--rose); }
.alert-info { background: var(--green-soft); color: var(--green-lo); border-left: 3px solid var(--green); }
.alert-warn { background: var(--amber-soft); color: #6b4a00; border-left: 3px solid var(--amber); }

/* ===== Test taking screen ===== */
.test-screen {
    background: var(--paper-2);
    min-height: calc(100vh - 56px);
}
.test-shell {
    max-width: 760px;
    margin: 0 auto;
    padding: var(--s-6) var(--gutter);
}

.test-bar {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--s-4) var(--s-5);
    display: flex;
    align-items: center;
    gap: var(--s-5);
    margin-bottom: var(--s-5);
}
.test-bar__progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--s-3);
}
.test-bar__progress-track {
    flex: 1;
    height: 6px;
    background: var(--paper-3);
    border-radius: 3px;
    overflow: hidden;
}
.test-bar__progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green) 0%, var(--green-hi) 100%);
    border-radius: 3px;
    transition: width var(--d-3) var(--ease);
}
.test-bar__progress-text {
    font: 600 12px/1 'JetBrains Mono', monospace;
    letter-spacing: .1em;
    color: var(--text-2);
    flex-shrink: 0;
}
.test-bar__timer {
    font: 700 16px/1 'JetBrains Mono', monospace;
    color: var(--ink);
    background: var(--paper-3);
    padding: 8px 14px;
    border-radius: 6px;
}
.test-bar__timer.warn { background: var(--rose-soft); color: var(--rose); }

.question-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--s-7);
    box-shadow: var(--shadow-2);
}
.question-meta {
    display: flex;
    gap: var(--s-3);
    margin-bottom: var(--s-4);
    flex-wrap: wrap;
}
.question-meta__chip {
    font: 600 10px/1 'JetBrains Mono', monospace;
    letter-spacing: .15em;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: 4px;
    background: var(--paper-3);
    color: var(--text-2);
}
.question-meta__chip--section { background: var(--green-soft); color: var(--green-lo); }
.question-meta__chip--type-mc { background: rgba(31, 157, 107, .12); color: var(--green-lo); }
.question-meta__chip--type-short { background: rgba(255, 177, 0, .14); color: #6b4a00; }
.question-meta__chip--type-scenario { background: rgba(232, 91, 107, .12); color: var(--rose); }
.question-meta__chip--type-roleplay { background: var(--ink); color: #fff; }

.question-prompt {
    font-size: var(--t-md);
    line-height: 1.55;
    color: var(--text-1);
    margin-bottom: var(--s-5);
}

.options-list {
    display: grid;
    gap: var(--s-3);
    margin-bottom: var(--s-5);
    list-style: none;
    padding: 0;
}
.option {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 18px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color var(--d-2) var(--ease), background var(--d-2) var(--ease);
}
.option:hover { border-color: var(--ink); background: var(--paper-2); }
.option input[type=radio] { display: none; }
.option__marker {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--line-2);
    flex-shrink: 0;
    margin-top: 1px;
    transition: border-color var(--d-2) var(--ease), background var(--d-2) var(--ease);
}
.option__marker::after {
    content: '';
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--green);
    margin: 4px;
    opacity: 0;
    transition: opacity var(--d-2) var(--ease);
}
.option input:checked + .option__inner .option__marker { border-color: var(--green); }
.option input:checked + .option__inner .option__marker::after { opacity: 1; }
.option input:checked ~ .option__text,
.option input:checked + .option__inner { background: var(--green-soft); }
.option__inner { display: flex; align-items: flex-start; gap: 14px; flex: 1; }
.option__text { font-size: 14px; color: var(--text-1); line-height: 1.5; }

.option:has(input:checked) {
    border-color: var(--green);
    background: var(--green-soft);
}

/* ===== Question type indicators ===== */
.text-response {
    width: 100%;
    min-height: 160px;
    padding: 14px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    font: 400 14px/1.55 'Inter Tight', sans-serif;
    resize: vertical;
}
.text-response:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31, 157, 107, .12); outline: 0; }

.test-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--s-5);
}

/* ===== Tables ===== */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--line);
}
.table thead th {
    background: var(--paper-2);
    padding: 12px 16px;
    text-align: left;
    font: 600 12px/1 'JetBrains Mono', monospace;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-3);
    border-bottom: 1px solid var(--line);
}
.table tbody td {
    padding: 14px 16px;
    border-top: 1px solid var(--line);
    font-size: var(--t-sm);
    color: var(--text-1);
}
.table tbody tr:hover { background: var(--paper-2); }

/* ===== Stat tiles ===== */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--s-3);
    margin-bottom: var(--s-5);
}
.stat-tile {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--s-5);
}
.stat-tile__label {
    font: 500 10px/1 'JetBrains Mono', monospace;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: var(--s-3);
}
.stat-tile__value {
    font: 700 var(--t-2xl)/1 'Inter Tight', sans-serif;
    color: var(--ink);
    letter-spacing: -.02em;
}
.stat-tile__sub {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 4px;
}

/* ===== Status pills ===== */
.pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font: 600 10px/1 'JetBrains Mono', monospace;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.pill-success { background: var(--green-soft); color: var(--green-lo); }
.pill-warn { background: var(--amber-soft); color: #6b4a00; }
.pill-danger { background: var(--rose-soft); color: var(--rose); }
.pill-info { background: var(--paper-3); color: var(--text-2); }

/* ===== Login screen ===== */
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%);
    padding: var(--s-5);
    position: relative;
}
.auth-shell::before {
    content: '';
    position: absolute;
    inset: auto -200px -200px auto;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(31, 157, 107, .15) 0%, transparent 70%);
    pointer-events: none;
}
.auth-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: var(--s-7);
    width: 100%;
    max-width: 460px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, .25);
    position: relative;
}
.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: var(--s-6);
}
.auth-brand svg { width: 48px; height: 48px; }
.auth-brand-text { display: flex; flex-direction: column; line-height: 1; gap: 4px; }
.auth-brand-text strong { font-size: 16px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.auth-brand-text span { font: 500 10px/1 'JetBrains Mono', monospace; letter-spacing: .18em; text-transform: uppercase; color: var(--green); }

/* ===== Section dividers ===== */
.section-divider {
    margin: var(--s-7) 0 var(--s-5);
    display: flex;
    align-items: center;
    gap: var(--s-3);
}
.section-divider h2 { margin: 0; }
.section-divider .line { flex: 1; height: 1px; background: var(--line); }

/* ===== Grid layouts ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); }
@media (max-width: 880px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ===== Mobile ===== */
@media (max-width: 720px) {
    .app-bar__inner { flex-wrap: wrap; }
    .app-bar__nav { order: 3; width: 100%; margin-left: 0; padding-top: var(--s-3); border-top: 1px solid var(--ink-2); }
    .app-bar__user { order: 2; margin-left: auto; }
    .question-card { padding: var(--s-5); }
    .test-shell { padding: var(--s-4) var(--gutter); }
    h1 { font-size: 28px; }
    .stat-tile__value { font-size: 28px; }
}
