/* interview.html — chat page styles */

body {
    background-image: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(50,160,254,0.06) 0%, transparent 70%);
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.header { flex-shrink: 0; }

/* ── App layout ── */
.app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
}

.step { display: none; }
.step.active { display: flex; flex-direction: column; flex: 1; animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
/* While resuming, keep every step hidden (overriding .active) so the default contact
   form doesn't flash; showStep() removes .resuming once the right step is chosen. */
html.resuming .step { display: none; }

/* ── Contact form step ── */
.contact-step { justify-content: center; align-items: center; padding: 40px 24px; }
.contact-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    max-width: 500px;
    width: 100%;
}
.contact-card h2 {
    font-family: var(--font-head);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
    letter-spacing: -0.3px;
}
.contact-card p { color: var(--text-muted); margin-bottom: 24px; font-size: 15px; }

.consent-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}
.consent-label input[type="checkbox"] {
    flex-shrink: 0;
    accent-color: var(--accent-teal);
    width: 15px;
    height: 15px;
    cursor: pointer;
}
.consent-text { cursor: pointer; user-select: none; -webkit-user-select: none; }
.info-icon {
    position: relative;
    flex-shrink: 0;
    font-size: 13px;
    color: var(--text-muted);
    cursor: default;
    opacity: 0.6;
    margin-top: 1px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}
.info-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    max-width: calc(100vw - 32px);
    padding: 8px 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    white-space: pre-line;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 10;
}
.info-icon:hover { opacity: 1; }
.info-icon:hover::after { opacity: 1; }
.info-icon--down::after { bottom: auto; top: calc(100% + 8px); }
/* The consent icon sits at the form's left edge, so a centred tooltip runs off the
   left of the screen. Anchor it to the icon and extend right, capped to the viewport. */
.consent-label .info-icon::after {
    left: 0;
    transform: none;
    max-width: min(260px, calc(100vw - 88px));
}
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.form-group input, .form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group select option { background: var(--bg-panel); }
/* Replace the native arrow with a custom chevron so it's consistent across browsers and
   sits with a comfortable gap from the edge (native padding doesn't move the OS arrow). */
.form-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23F2F2F3' stroke-opacity='0.55' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}
.form-group input:focus, .form-group select:focus {
    border-color: var(--accent-teal);
    box-shadow: 0 0 0 3px rgba(50, 223, 157, 0.15);
}
.form-group input::placeholder { color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn-primary { width: 100%; margin-top: 8px; }

/* ── Chat step ── */
/* Page-scroll layout: the header scrolls away with the content, while the coverage bar
   sticks to the top and the input dock sticks to the bottom. Messages flex-grow so the
   dock still sits at the bottom of the viewport when the conversation is short. */
.chat-step { flex: 1; }
.chat-container { display: flex; flex-direction: column; flex: 1; }

/* ── Coverage bar ── */
.coverage-bar {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 20;
}
.coverage-bar .label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-right: 4px; }
.dim-pill {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(50,160,254,0.08);
    color: var(--text-muted);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid transparent;
}
.dim-pill.covered { background: var(--teal-light); color: var(--accent-teal); border-color: var(--teal-border); }

/* ── Radar tooltip ── */
.radar-tooltip {
    position: absolute;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text);
    pointer-events: none;
    z-index: 200;
    max-width: 280px;
    opacity: 0;
    transition: opacity 0.15s;
    transform: translate(-50%, -110%);
}
.radar-tooltip-title { font-weight: 600; margin-bottom: 6px; color: var(--accent-teal); }
.radar-tooltip-facts { margin: 0; padding-left: 14px; }
.radar-tooltip-facts li { margin-bottom: 3px; line-height: 1.4; }

/* ── Messages ── */
.messages {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg);
}
.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb { background: rgba(50,160,254,0.3); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
.messages::-webkit-scrollbar-thumb:hover { background: rgba(50,160,254,0.5); background-clip: padding-box; }
.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.message.assistant { align-self: flex-start; }
.message.user      { align-self: flex-end; flex-direction: row-reverse; }
.message-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.message.assistant .message-avatar { background: var(--primary-light); color: var(--primary); border: 1px solid var(--border); }
.message.user      .message-avatar { background: var(--teal-light);    color: var(--accent-teal); border: 1px solid var(--teal-border); }
.message-bubble { padding: 12px 16px; border-radius: 16px; font-size: 15px; line-height: 1.6; }
.message.assistant .message-bubble { background: var(--bg-panel); border: 1px solid var(--border); border-bottom-left-radius: 4px; color: var(--text); }
.message.user      .message-bubble { background: rgba(50,160,254,0.15); border: 1px solid rgba(50,160,254,0.3); color: var(--text); border-bottom-right-radius: 4px; }
.message-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.message.user .message-time { text-align: right; }

/* ── Typing indicator ── */
.typing-indicator {
    display: none;
    align-self: flex-start;
    padding: 0;
    gap: 12px;
}
.typing-indicator.visible { display: flex; }
.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}
.typing-dots span {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: bounce 1.4s infinite ease-in-out;
}
.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%           { transform: scale(1);   opacity: 1; }
}

/* ── Input dock (sticks to the bottom of the viewport) ── */
.input-dock {
    position: sticky;
    bottom: 0;
    z-index: 20;
    flex-shrink: 0;
}

/* ── Input area ── */
.input-area {
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    padding: 16px 20px;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-shrink: 0;
}
.input-area textarea {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    font-family: var(--font);
    line-height: 1.5;
    resize: none;
    overflow-y: hidden;
    outline: none;
    max-height: 120px;
    min-height: 48px;
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-area textarea::placeholder { color: var(--text-muted); }
.input-area textarea:focus { border-color: var(--accent-teal); box-shadow: 0 0 0 3px rgba(50, 223, 157, 0.15); }
.send-btn {
    width: 48px; height: 48px;
    border-radius: 12px;
    border: 1px solid var(--border-bright);
    background: var(--bg-panel);
    color: var(--primary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}
.send-btn:hover    { background: rgba(50,160,254,0.15); box-shadow: 0 0 16px rgba(50,160,254,0.25); }
.send-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.send-btn svg      { width: 20px; height: 20px; }
.input-hint {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding-bottom: 8px;
    background: var(--bg-panel);
}

.report-generating {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0;
}

/* ── Results step ── */
.results-step { padding: 24px; overflow-y: auto; width: 100%; max-width: 900px; margin: 0 auto; }
.results-header { text-align: center; margin-bottom: 32px; }
.results-header h2 {
    font-family: var(--font-head);
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}
.results-header p { color: var(--text-muted); font-size: 15px; }
.score-display { display: flex; flex-direction: column; align-items: center; margin-bottom: 32px; }
.score-circle {
    width: 160px; height: 160px;
    border-radius: 50%;
    --score-color: var(--accent-teal);
    background: conic-gradient(var(--score-color) calc(var(--score) * 3.6deg), rgba(50,160,254,0.1) 0);
    display: inline-flex;
    align-items: center; justify-content: center;
    margin-bottom: 12px;
    box-shadow: 0 0 40px rgba(50,223,157,0.1);
}
.score-inner {
    width: 126px; height: 126px;
    border-radius: 50%;
    background: var(--bg);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.score-number {
    font-family: var(--font-head);
    font-size: 42px;
    font-weight: 800;
    color: var(--score-color, var(--accent-teal));
    text-shadow: 0 0 30px rgba(50,223,157,0.2);
    letter-spacing: -1px;
}
.score-label    { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; text-align: center; max-width: 88px; line-height: 1.3; }
.maturity-display { position: relative; display: inline-block; margin-bottom: 6px; }
.maturity-display .info-icon { position: absolute; left: calc(100% + 6px); top: 50%; transform: translateY(-50%); }
.maturity-label { font-family: var(--font-head); font-size: 15px; font-weight: 700; display: inline-block; padding: 4px 14px; border-radius: 999px; }
.maturity-1 { background: rgba(239,68,68,0.15);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.maturity-2 { background: rgba(249,115,22,0.15); color: #fdba74; border: 1px solid rgba(249,115,22,0.3); }
.maturity-3 { background: rgba(234,179,8,0.15);  color: #fde047; border: 1px solid rgba(234,179,8,0.3); }
.maturity-4 { background: rgba(34,197,94,0.15);  color: #86efac; border: 1px solid rgba(34,197,94,0.3); }
.maturity-5 { background: rgba(50,160,254,0.15); color: #7dd3fc; border: 1px solid rgba(50,160,254,0.3); }
.pattern-label  {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 14px;
    background: rgba(50,160,254,0.12);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
}
.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: border-color 0.3s, box-shadow 0.3s;
}
.result-card:hover { border-color: rgba(50,160,254,0.4); box-shadow: var(--shadow), 0 0 24px rgba(50,160,254,0.08); }
.result-card h3 { font-family: var(--font-head); font-size: 16px; font-weight: 700; margin-bottom: 12px; color: var(--primary); letter-spacing: -0.1px; }
.result-card.full-width { grid-column: 1 / -1; }
.result-card ul    { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.result-card li    { padding: 10px 14px; border-radius: 8px; font-size: 14px; line-height: 1.6; transition: transform 0.2s; }
.result-card li:hover { transform: translateX(2px); }
/* position:relative + an out-of-flow canvas so the box is sized only by CSS (aspect-ratio),
   not by the canvas's own pixels — otherwise Chart.js grows it but can't shrink it back. */
.chart-container { position: relative; width: 100%; max-width: 420px; aspect-ratio: 1.2; margin: 0 auto; }
.chart-container canvas { position: absolute; top: 0; left: 0; }

/* ── Dimension breakdown accordion ── */
.dimension-accordion { display: flex; flex-direction: column; gap: 8px; }
.dim-panel {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-panel);
    overflow: hidden;
    transition: border-color 0.2s;
}
.dim-panel summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
}
.dim-panel summary::-webkit-details-marker { display: none; }
.dim-name { display: flex; align-items: center; gap: 8px; }
.dim-chevron {
    display: inline-block;
    font-size: 18px;
    color: var(--text-muted);
    transition: transform 0.2s;
}
.dim-panel[open] .dim-chevron { transform: rotate(90deg); }
.dim-score {
    font-family: var(--font-head);
    font-size: 13px;
    font-weight: 700;
    padding: 2px 12px;
    border-radius: 999px;
    flex-shrink: 0;
}
.dim-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.dim-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 12px;
    border-left: 3px solid var(--border);
    border-radius: 0 6px 6px 0;
}
.dim-row-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}
/* Semantic colour coding for the three breakdown rows, in the same order and
   soft tint as the "Actionable output" callouts on the landing page:
   blue = current state, red = main gap, green = what's needed. */
.dim-row--current { border-left-color: var(--primary);     background: rgba(50,160,254,0.08); }
.dim-row--gap     { border-left-color: var(--danger);      background: rgba(239,68,68,0.10); }
.dim-row--needed  { border-left-color: var(--accent-teal); background: rgba(50,223,157,0.08); }
.dim-row--current .dim-row-label { color: #7cc4ff; }
.dim-row--gap     .dim-row-label { color: #f2a3a3; }
.dim-row--needed  .dim-row-label { color: var(--accent-teal); }
.dim-row p { font-size: 14px; line-height: 1.6; color: var(--text); margin: 0; }
.summary-text    { font-size: 15px; color: var(--text); line-height: 1.7; margin-bottom: 12px; }
.next-steps-text { background: rgba(50,223,157,0.06); padding: 16px; border-radius: 8px; border-left: 4px solid var(--accent-teal); font-size: 14px; color: var(--text); }
.next-steps-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent-teal); margin-bottom: 6px; }
.next-steps-text p { margin: 0; line-height: 1.6; }
/* 1fr | auto | 1fr grid so the middle button (Export PDF) sits at the page centre,
   not the centre of the whole (unequal-width) group. */
.results-actions { margin-top: 32px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.results-actions > *:first-child { justify-self: end; }
.results-actions > *:last-child  { justify-self: start; }
.results-actions .btn { width: auto; min-width: 140px; box-sizing: border-box; height: 46px; line-height: 1; text-decoration: none; margin: 0; }
.results-actions .btn-outline { color: var(--text); border-color: var(--border-bright); }
.results-actions .btn-outline:hover { color: var(--primary); }

/* ── Responsive ── */
@media (max-width: 640px) {
    .contact-card  { padding: 24px; }
    .form-row      { grid-template-columns: 1fr; }
    .results-grid  { grid-template-columns: 1fr; }
    /* Avatars are redundant on mobile (side + bubble colour already distinguish
       sender) and eat ~48px of width, so drop them and let bubbles use the space. */
    .message-avatar { display: none; }
    .message         { max-width: 92%; }
    .coverage-bar  { padding: 8px 12px; }
    /* The pills wrap, so the ⓘ can land anywhere; anchor its tooltip to the full-width
       bar (not the icon) so it spans the row and never runs off / gets clipped. Offset it
       just below the first row, where the ⓘ lives, so it sits near the icon rather than
       below the whole wrapped bar. */
    .coverage-bar .info-icon { position: static; }
    .coverage-bar .info-icon::after {
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
        transform: none;
        top: 34px;
        bottom: auto;
    }
    /* On touch the Enter/Shift hint is just noise; hide it and tighten the input area. */
    .input-hint { display: none; }
    .input-area { padding: 12px 16px; }
    .input-area textarea { min-height: 40px; }
    /* Stack the footer buttons full-width instead of the 3-column centered grid. */
    .results-actions { grid-template-columns: 1fr; }
    .results-actions > *:first-child,
    .results-actions > *:last-child { justify-self: stretch; }
    .results-actions .btn { width: 100%; }
}

/* Wide screens: the chat stays full-bleed like on mobile (no cut-off panels), but its
   content sits in a centred, readable column instead of stretching edge to edge. The
   bars keep their vertical padding; only the inline padding grows to centre the content. */
@media (min-width: 641px) {
    .messages,
    .coverage-bar,
    .input-area,
    .input-hint,
    .report-generating { padding-inline: max(20px, calc((100% - 900px) / 2)); }
}

/* Phones: report cards go edge-to-edge (no side margin or rounding) rather than inset
   rounded panels; their inner padding stays so text isn't flush to the screen. Above
   this width the inset card look is kept. */
@media (max-width: 500px) {
    .results-step { padding-inline: 0; }
    .result-card { border-radius: 0; border-left: 0; border-right: 0; }
    .results-actions { padding-inline: 16px; }
    /* Contact form gets the same edge-to-edge treatment as the report cards. */
    .contact-step { padding-inline: 0; }
    .contact-card { max-width: none; border-radius: 0; border-left: 0; border-right: 0; }
}
