/* ─── Fireside 3.0 Design System ─────────────────────────────────────────── */

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

/* ─── Tokens ─────────────────────────────────────────────────────────────── */

:root {
    --bg-base:        #08080f;
    --bg-surface:     #0f0f1c;
    --bg-card:        #14142a;
    --bg-card-hover:  #1a1a35;
    --bg-input:       #0f0f1c;
    --border:         rgba(255, 255, 255, 0.07);
    --border-focus:   rgba(232, 53, 74, 0.5);

    --primary:        #e8354a;
    --primary-hover:  #ff4560;
    --primary-dim:    rgba(232, 53, 74, 0.12);

    --text-primary:   #f0f0ff;
    --text-secondary: #8888aa;
    --text-muted:     #44445a;

    --success:        #22c55e;
    --success-dim:    rgba(34, 197, 94, 0.12);
    --warning:        #f59e0b;
    --warning-dim:    rgba(245, 158, 11, 0.12);
    --info:           #3b82f6;
    --info-dim:       rgba(59, 130, 246, 0.12);

    --radius-sm:  6px;
    --radius:     10px;
    --radius-lg:  16px;
    --radius-xl:  24px;

    --shadow:     0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg:  0 8px 48px rgba(0, 0, 0, 0.6);

    --transition: 0.18s ease;

    --max-w: 480px;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

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

img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ─── Layout ─────────────────────────────────────────────────────────────── */

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 20px;
}

.container--wide { max-width: 680px; }
.container--full { max-width: 100%; }

/* ─── Navigation ─────────────────────────────────────────────────────────── */

.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(8, 8, 15, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav__logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.nav__logo-star {
    color: var(--primary);
    font-size: 1rem;
}

.nav__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-dim);
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    overflow: hidden;
    cursor: pointer;
}

.nav__avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Dropdown menu */
.nav__menu-wrap {
    position: relative;
}

.nav__dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
    padding: 6px 0;
}

.nav__dropdown.open { display: block; }

.nav__dropdown-name {
    padding: 10px 16px 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.nav__dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}

.nav__dropdown-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}

.nav__dropdown-item i { width: 16px; text-align: center; }

.nav__dropdown-item--danger { color: var(--primary); }
.nav__dropdown-item--danger:hover { background: var(--primary-dim); color: var(--primary-hover); }

.nav__dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ─── Page Sections ──────────────────────────────────────────────────────── */

.page {
    flex: 1;
    padding: 24px 0 48px;
}

.page__header {
    padding: 0 20px 24px;
    max-width: var(--max-w);
    margin: 0 auto;
}

.page__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.page__subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: background var(--transition), border-color var(--transition);
}

.card--interactive {
    cursor: pointer;
}

.card--interactive:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.12);
}

.card--primary {
    border-color: rgba(232, 53, 74, 0.25);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(232, 53, 74, 0.05) 100%);
}

.card + .card { margin-top: 12px; }

.card__label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.card__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.card__body {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 8px;
    line-height: 1.6;
}

.card__footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ─── Score Badge ────────────────────────────────────────────────────────── */

.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    height: 52px;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 700;
    border: 2px solid;
    flex-shrink: 0;
}

.score-badge--weak   { color: var(--text-muted);   border-color: var(--text-muted);   background: rgba(68,68,90,0.1); }
.score-badge--low    { color: var(--warning);       border-color: var(--warning);      background: var(--warning-dim); }
.score-badge--medium { color: var(--info);          border-color: var(--info);         background: var(--info-dim); }
.score-badge--high   { color: var(--success);       border-color: var(--success);      background: var(--success-dim); }

/* ─── Match Bar ──────────────────────────────────────────────────────────── */

.match-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin: 12px 0 8px;
}

.match-bar__fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hover) 100%);
    transition: width 0.6s ease;
}

/* ─── Tags ───────────────────────────────────────────────────────────────── */

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.tag--match {
    background: var(--primary-dim);
    border-color: rgba(232, 53, 74, 0.3);
    color: var(--primary-hover);
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    transition: all var(--transition);
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

.btn--primary {
    background: var(--primary);
    color: #fff;
}
.btn--primary:hover {
    background: var(--primary-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(232, 53, 74, 0.35);
}

.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn--ghost:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.15);
}

.btn--full  { width: 100%; }
.btn--sm    { padding: 8px 14px; font-size: 0.8125rem; }
.btn--lg    { padding: 16px 28px; font-size: 1rem; }

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ─── Forms ──────────────────────────────────────────────────────────────── */

.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    -webkit-appearance: none;
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(232, 53, 74, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* ─── Auth Screens ───────────────────────────────────────────────────────── */

.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    background: var(--bg-base);
}

.auth-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 40px;
    text-align: center;
}

.auth-logo span { color: var(--primary); }

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px 28px;
}

.auth-card__title {
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.auth-card__subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

/* ─── Onboarding ─────────────────────────────────────────────────────────── */

.onboarding-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-base);
}

.onboarding-progress {
    height: 3px;
    background: var(--border);
    position: relative;
}

.onboarding-progress__fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.4s ease;
}

.onboarding-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 32px 20px 48px;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}

.onboarding-step__icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: var(--primary-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 24px;
}

.onboarding-step__title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.onboarding-step__subtitle {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.6;
}

.onboarding-step__content { flex: 1; }

.onboarding-step__footer {
    padding-top: 24px;
    display: flex;
    gap: 10px;
}

/* Intent selector */
.intent-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 28px;
}

.intent-option {
    position: relative;
}

.intent-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.intent-option__card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    gap: 10px;
}

.intent-option__icon {
    font-size: 2rem;
}

.intent-option__label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.intent-option input:checked + .intent-option__card {
    border-color: var(--primary);
    background: var(--primary-dim);
}

.intent-option input:checked + .intent-option__card .intent-option__label {
    color: var(--text-primary);
}

/* ─── Dashboard ──────────────────────────────────────────────────────────── */

.dashboard-hero {
    padding: 28px 20px 0;
    max-width: var(--max-w);
    margin: 0 auto;
}

.dashboard-hero__greeting {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.dashboard-hero__name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.dashboard-section {
    padding: 24px 20px 0;
    max-width: var(--max-w);
    margin: 0 auto;
}

.dashboard-section__heading {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 14px;
}

/* Conundrum match card */
.match-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    transition: all var(--transition);
    margin-bottom: 12px;
}

.match-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255,255,255,0.1);
}

.match-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.match-card__title {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    flex: 1;
}

.match-card__score {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--warning);
    white-space: nowrap;
}

.match-card__description {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.match-card__cta {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

/* ─── Interview Screen ───────────────────────────────────────────────────── */

.interview-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-base);
}

.interview-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.interview-header__title {
    font-size: 0.875rem;
    font-weight: 600;
    flex: 1;
}

.interview-header__status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.interview-body {
    flex: 1;
    padding: 24px 20px;
    max-width: var(--max-w);
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.interview-bubble {
    max-width: 88%;
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.interview-bubble--ai {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom-left-radius: var(--radius-sm);
    align-self: flex-start;
    color: var(--text-primary);
}

.interview-bubble--user {
    background: var(--primary-dim);
    border: 1px solid rgba(232, 53, 74, 0.2);
    border-bottom-right-radius: var(--radius-sm);
    align-self: flex-end;
    color: var(--text-primary);
}

.interview-footer {
    padding: 16px 20px 32px;
    border-top: 1px solid var(--border);
    max-width: var(--max-w);
    margin: 0 auto;
    width: 100%;
}

/* Record button */
.record-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    transition: all var(--transition);
    box-shadow: 0 4px 20px rgba(232, 53, 74, 0.3);
}

.record-btn:hover { transform: scale(1.05); box-shadow: 0 6px 28px rgba(232, 53, 74, 0.45); }
.record-btn--recording { background: #fff; animation: pulse 1.5s infinite; }

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

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

.record-status {
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ─── Knowledge Matrix ───────────────────────────────────────────────────── */

.matrix-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 12px;
}

.matrix-card__domain {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.matrix-card__bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.matrix-card__fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, #ff8c00 100%);
}

.matrix-card__meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.matrix-card__source {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.matrix-card__confidence {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Source badge colours */
.source--inferred    { color: var(--text-muted); }
.source--elicited    { color: var(--warning); }
.source--demonstrated { color: var(--info); }
.source--validated   { color: var(--success); }

/* ─── Alerts ─────────────────────────────────────────────────────────────── */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    border: 1px solid;
    margin-bottom: 16px;
}

.alert--error   { background: rgba(239,68,68,0.1);  border-color: rgba(239,68,68,0.25);  color: #fca5a5; }
.alert--success { background: var(--success-dim);   border-color: rgba(34,197,94,0.25);  color: #86efac; }
.alert--info    { background: var(--info-dim);      border-color: rgba(59,130,246,0.25); color: #93c5fd; }

/* ─── Bottom Nav ─────────────────────────────────────────────────────────── */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(8, 8, 15, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    display: flex;
}

.bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 0;
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-decoration: none;
    transition: color var(--transition);
}

.bottom-nav__item svg { width: 22px; height: 22px; }
.bottom-nav__item i   { font-size: 20px; }

.bottom-nav__item--active { color: var(--primary); }

/* ─── Utilities ──────────────────────────────────────────────────────────── */

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-red       { color: var(--primary); }
.text-success   { color: var(--success); }
.text-warning   { color: var(--warning); }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.flex            { display: flex; }
.flex-col        { flex-direction: column; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8           { gap: 8px; }
.gap-12          { gap: 12px; }
.flex-1          { flex: 1; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}

/* ─── Divider ────────────────────────────────────────────────────────────── */

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

/* ─── Loading Spinner ────────────────────────────────────────────────────── */

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

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

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (min-width: 520px) {
    :root { --max-w: 520px; }

    .intent-options { grid-template-columns: 1fr 1fr; }

    .bottom-nav { display: none; }

    .nav { padding: 0 32px; }
}

@media (max-width: 519px) {
    .page { padding-bottom: 80px; }
}
