/* AI Voice Interview (/student-tools/ai-voice-interview) -- Phase 1. Reuses the site's existing
   dark-mode.css variables (--bg-card, --text-primary, etc.) throughout, same convention as
   games.css / marriage-biodata.css / student-tools.css, so this file needs no separate dark-mode
   overrides -- it already adapts automatically. */

.aiv-wrap { max-width: 820px; margin: 0 auto; padding: 0 16px 60px; }

/* The site's fixed top header sits over page content with nothing pushing it down (.appHeader,
   56px on mobile, or #header.jrh-header-v2, height:80px on desktop, both position:fixed) -- same
   fix and same 100px value already used by .game-heading / .mbm-heading for the same header. */
.aiv-heading { text-align: center; margin-bottom: 20px; padding-top: 100px; }
.aiv-heading h1 { font-size: 30px; font-weight: 800; color: var(--text-primary, #1e293b); margin: 6px 0 10px; }
.aiv-heading p { font-size: 15px; color: var(--text-secondary, #64748b); max-width: 62ch; margin: 0 auto 14px; }
.aiv-tagline {
    display: inline-block; padding: 6px 16px; border-radius: 999px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff;
    font-size: 12.5px; font-weight: 700; letter-spacing: .02em; margin-bottom: 10px;
}

.aiv-card {
    background: var(--bg-card, #fff); border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 18px; padding: 26px; box-shadow: 0 8px 24px var(--shadow-color, rgba(15,23,42,0.07));
    margin-bottom: 22px;
}
.aiv-card h2 { margin: 0 0 4px; font-size: 18px; font-weight: 700; color: var(--text-primary, #1e293b); }
.aiv-card .aiv-hint { font-size: 12.5px; color: var(--text-secondary, #64748b); margin: 0 0 16px; }

.aiv-banner {
    display: flex; align-items: flex-start; gap: 10px; border-radius: 12px; padding: 12px 16px;
    font-size: 13px; margin: 0 0 18px;
}
.aiv-banner.is-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #92400e; }
.aiv-banner.is-info { background: rgba(37,99,235,0.08); border: 1px solid rgba(37,99,235,0.25); color: var(--text-primary, #1e293b); }
html[data-theme="dark"] .aiv-banner.is-warning { color: #fbbf24; }

/* ---- Setup form ---- */
.aiv-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 6px; }
.aiv-field { margin-bottom: 14px; }
.aiv-field.is-full { grid-column: 1 / -1; }
.aiv-field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary, #64748b); margin-bottom: 6px; }
.aiv-field select, .aiv-field input[type="text"], .aiv-field textarea {
    width: 100%; box-sizing: border-box; border: 1px solid var(--border-color, #e2e8f0); border-radius: 10px;
    padding: 10px 12px; font-size: 14px; background: var(--bg-card, #fff); color: var(--text-primary, #1e293b);
    font-family: inherit;
}
.aiv-field select:focus, .aiv-field input:focus, .aiv-field textarea:focus { outline: none; border-color: #4f46e5; }

.aiv-toggle-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 14px; border-radius: 12px; background: var(--bg-subtle, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0); margin-bottom: 14px;
}
.aiv-toggle-row .aiv-toggle-label { font-size: 13.5px; font-weight: 600; color: var(--text-primary, #1e293b); }
.aiv-toggle-row .aiv-toggle-sub { font-size: 12px; color: var(--text-secondary, #64748b); margin-top: 2px; }
.aiv-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.aiv-switch input { opacity: 0; width: 0; height: 0; }
.aiv-switch .aiv-slider {
    position: absolute; cursor: pointer; inset: 0; background: var(--border-color, #cbd5e1);
    border-radius: 999px; transition: background .15s ease;
}
.aiv-switch .aiv-slider::before {
    content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
    background: #fff; border-radius: 50%; transition: transform .15s ease;
}
.aiv-switch input:checked + .aiv-slider { background: #4f46e5; }
.aiv-switch input:checked + .aiv-slider::before { transform: translateX(18px); }

.aiv-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none;
    border-radius: 999px; padding: 12px 22px; font-size: 14.5px; font-weight: 700; cursor: pointer;
    text-decoration: none; transition: transform .15s ease, opacity .15s ease;
}
.aiv-btn:disabled { opacity: .55; cursor: not-allowed; }
.aiv-btn:not(:disabled):hover { transform: translateY(-1px); }
.aiv-btn-primary { background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; box-shadow: 0 8px 18px rgba(124,58,237,0.3); width: 100%; }
.aiv-btn-outline { background: transparent; color: var(--text-primary, #1e293b); border: 1px solid var(--border-color, #e2e8f0); }
.aiv-btn-outline:hover { background: var(--hover-bg, #eff6ff); }
.aiv-btn-danger { background: #ef4444; color: #fff; }

/* ---- Interview screen ---- */
.aiv-progress-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 700; color: var(--text-secondary, #64748b); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .03em; }
.aiv-progress-bar { height: 8px; border-radius: 5px; background: var(--bg-subtle, #f1f5f9); overflow: hidden; margin-bottom: 22px; }
.aiv-progress-fill { display: block; height: 100%; border-radius: 5px; background: linear-gradient(135deg, #4f46e5, #7c3aed); transition: width .4s ease; }

.aiv-question-card {
    display: flex; gap: 14px; align-items: flex-start; padding: 20px; border-radius: 16px;
    background: linear-gradient(135deg, rgba(79,70,229,0.06), rgba(124,58,237,0.06));
    border: 1px solid rgba(124,58,237,0.2); margin-bottom: 20px;
}
.aiv-question-avatar {
    flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; font-size: 18px;
}
.aiv-question-body { flex: 1; }
.aiv-question-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #7c3aed; margin-bottom: 4px; }
.aiv-question-text { font-size: 17px; font-weight: 600; color: var(--text-primary, #1e293b); line-height: 1.5; }
.aiv-question-status { font-size: 12.5px; color: var(--text-secondary, #64748b); margin-top: 8px; min-height: 16px; }
.aiv-replay-btn { margin-top: 10px; }

.aiv-answer-zone { text-align: center; margin-bottom: 18px; }
.aiv-mic-btn {
    width: 84px; height: 84px; border-radius: 50%; border: none; cursor: pointer;
    background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; font-size: 30px;
    box-shadow: 0 10px 24px rgba(124,58,237,0.35); position: relative; transition: transform .15s ease;
}
.aiv-mic-btn:hover:not(:disabled) { transform: scale(1.05); }
.aiv-mic-btn:disabled { opacity: .5; cursor: not-allowed; }
.aiv-mic-btn.is-listening { background: linear-gradient(135deg, #ef4444, #f97316); animation: aiv-pulse 1.4s ease-out infinite; }
@keyframes aiv-pulse {
    0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.45); }
    100% { box-shadow: 0 0 0 22px rgba(239,68,68,0); }
}
.aiv-mic-caption { margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--text-secondary, #64748b); }

.aiv-transcript-box {
    text-align: left; min-height: 64px; border-radius: 12px; border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-subtle, #f8fafc); padding: 14px 16px; font-size: 14.5px; color: var(--text-primary, #1e293b);
    line-height: 1.6; margin: 16px 0;
}
.aiv-transcript-box.is-placeholder { color: var(--text-secondary, #94a3b8); font-style: italic; }
.aiv-type-toggle { text-align: center; margin-bottom: 10px; }
.aiv-type-toggle button { background: none; border: none; color: #4f46e5; font-size: 12.5px; font-weight: 700; cursor: pointer; text-decoration: underline; }
.aiv-type-textarea { width: 100%; box-sizing: border-box; min-height: 110px; border-radius: 12px; border: 1px solid var(--border-color, #e2e8f0); background: var(--bg-card, #fff); color: var(--text-primary, #1e293b); padding: 14px 16px; font-size: 14.5px; font-family: inherit; resize: vertical; margin-bottom: 12px; }

.aiv-controls { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }

/* ---- Evaluation feedback ---- */
.aiv-feedback-card { border-radius: 14px; padding: 18px 20px; margin: 18px 0; border: 1px solid var(--border-color, #e2e8f0); background: var(--bg-subtle, #f8fafc); }
.aiv-feedback-score-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.aiv-feedback-score { font-size: 26px; font-weight: 800; color: #4f46e5; }
.aiv-feedback-score-label { font-size: 12px; color: var(--text-secondary, #64748b); }
.aiv-feedback-text { font-size: 14px; color: var(--text-primary, #1e293b); line-height: 1.6; margin-bottom: 12px; }
.aiv-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.aiv-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.aiv-chip.is-strength { background: rgba(34,197,94,0.12); color: #16a34a; }
.aiv-chip.is-weakness { background: rgba(245,158,11,0.12); color: #b45309; }
.aiv-star-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 12px; }
.aiv-star-item { padding: 10px; border-radius: 10px; background: var(--bg-card, #fff); border: 1px solid var(--border-color, #e2e8f0); }
.aiv-star-item b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: #7c3aed; margin-bottom: 3px; }
.aiv-star-item span { font-size: 12.5px; color: var(--text-primary, #1e293b); }

/* ---- Metrics tiles (filler words / WPM) ---- */
.aiv-metrics-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 16px 0; }
.aiv-metric-tile { text-align: center; padding: 12px 8px; border-radius: 12px; background: var(--bg-subtle, #f8fafc); border: 1px solid var(--border-color, #e2e8f0); }
.aiv-metric-value { display: block; font-size: 20px; font-weight: 800; color: var(--text-primary, #1e293b); }
.aiv-metric-label { display: block; font-size: 10.5px; color: var(--text-secondary, #64748b); margin-top: 2px; text-transform: uppercase; letter-spacing: .03em; }

/* ---- Report screen ---- */
.aiv-report-score-wrap { text-align: center; margin-bottom: 22px; }
.aiv-report-score { font-size: 52px; font-weight: 800; color: #4f46e5; line-height: 1; }
.aiv-report-score-sub { font-size: 13px; color: var(--text-secondary, #64748b); margin-top: 4px; }
.aiv-report-section { margin-bottom: 22px; }
.aiv-report-section h3 { font-size: 15px; font-weight: 700; color: var(--text-primary, #1e293b); margin: 0 0 10px; }
.aiv-list-check, .aiv-list-warn { list-style: none; padding: 0; margin: 0; }
.aiv-list-check li, .aiv-list-warn li { padding: 8px 0; font-size: 13.5px; color: var(--text-primary, #1e293b); border-bottom: 1px solid var(--border-color, #e2e8f0); }
.aiv-list-check li:last-child, .aiv-list-warn li:last-child { border-bottom: none; }
.aiv-list-check li::before { content: "\2713"; color: #22c55e; font-weight: 800; margin-right: 8px; }
.aiv-list-warn li::before { content: "\26A0"; color: #f59e0b; font-weight: 800; margin-right: 8px; }

.aiv-review-item { border: 1px solid var(--border-color, #e2e8f0); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.aiv-review-q { font-size: 13.5px; font-weight: 700; color: var(--text-primary, #1e293b); margin-bottom: 6px; }
.aiv-review-a { font-size: 13px; color: var(--text-secondary, #64748b); margin-bottom: 8px; line-height: 1.55; }
.aiv-review-score { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: rgba(79,70,229,0.1); color: #4f46e5; margin-bottom: 8px; }
.aiv-review-feedback { font-size: 12.5px; color: var(--text-primary, #1e293b); background: var(--bg-subtle, #f8fafc); border-radius: 8px; padding: 10px 12px; }

/* ---- Recommended Jobs (Phase 2) -- real jobs from the site's own database, matched by role;
   a job only ever appears here with a genuine word-overlap score, never a fabricated one. ---- */
.aiv-jobs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.aiv-job-card { display: block; border: 1px solid var(--border-color, #e2e8f0); border-radius: 12px; padding: 14px 16px; text-decoration: none; background: var(--bg-subtle, #f8fafc); transition: transform .15s ease, box-shadow .15s ease; }
.aiv-job-card:hover { transform: translateY(-2px); box-shadow: 0 8px 18px var(--shadow-color, rgba(15,23,42,0.08)); }
.aiv-job-card-title { font-size: 13.5px; font-weight: 700; color: var(--text-primary, #1e293b); margin-bottom: 4px; }
.aiv-job-card-meta { font-size: 12px; color: var(--text-secondary, #64748b); margin-bottom: 8px; }
.aiv-job-card-match { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: rgba(34,197,94,0.12); color: #16a34a; }
.aiv-jobs-loading, .aiv-jobs-empty { font-size: 13px; color: var(--text-secondary, #64748b); grid-column: 1 / -1; }

/* ---- Interview History page (Phase 2) ---- */
.aiv-history-list { display: flex; flex-direction: column; gap: 12px; }
.aiv-history-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; border: 1px solid var(--border-color, #e2e8f0); border-radius: 14px; padding: 16px 18px; background: var(--bg-card, #fff); }
.aiv-history-role { font-size: 14.5px; font-weight: 700; color: var(--text-primary, #1e293b); }
.aiv-history-meta { font-size: 12.5px; color: var(--text-secondary, #64748b); margin-top: 3px; }
.aiv-history-score { font-size: 20px; font-weight: 800; color: #4f46e5; }
.aiv-status-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 999px; margin-left: 8px; vertical-align: middle; }
.aiv-status-badge.is-completed { background: rgba(34,197,94,0.12); color: #16a34a; }
.aiv-status-badge.is-inprogress { background: rgba(37,99,235,0.12); color: #2563eb; }
.aiv-status-badge.is-abandoned { background: rgba(148,163,184,0.18); color: #64748b; }

/* ---- Progress strip (Phase 2) -- a simple honest bar per completed interview, not a charting
   library; height/color scale with OverallScore, oldest to newest, left to right. ---- */
.aiv-progress-row { display: flex; align-items: flex-end; gap: 6px; height: 90px; margin-bottom: 10px; padding: 0 4px; }
.aiv-progress-bar-item { flex: 1; max-width: 34px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, #4f46e5, #7c3aed); min-height: 6px; position: relative; }
.aiv-progress-bar-item span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 10.5px; font-weight: 700; color: var(--text-secondary, #64748b); white-space: nowrap; }
.aiv-progress-summary { font-size: 13px; color: var(--text-primary, #1e293b); margin: 0 0 20px; }
.aiv-progress-summary b { color: #4f46e5; }

[hidden] { display: none !important; }

@media (max-width: 700px) {
    .aiv-heading h1 { font-size: 24px; }
    .aiv-field-grid { grid-template-columns: 1fr; }
    .aiv-card { padding: 18px; }
    .aiv-mic-btn { width: 96px; height: 96px; font-size: 34px; }
    .aiv-question-text { font-size: 16px; }
    .aiv-report-score { font-size: 42px; }
}
