/* Reflect: trainee-facing pages (entry screen, questionnaire form, results). Ported from the original
   standalone audit/styles.css, recoloured to the shared TrainerTech palette (../../assets/style.css,
   loaded first — its :root colour variables and generic body/link/.btn/.notice/.hint rules are reused
   here rather than redefined) but otherwise left as it was: this layout (statement rows, score boxes,
   tooltips, results bars) works well and wasn't asked to be redesigned. */

.reflect-entry,
.reflect-form,
.reflect-results {
    max-width: 720px;
    margin: 24px auto;
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    border-top: 5px solid var(--blue);
    box-shadow: 0 4px 24px rgba(1, 0, 48, 0.1);
}

.reflect-entry { max-width: 420px; text-align: center; }
.reflect-entry form { display: flex; gap: 0.5rem; margin-top: 1rem; }
.reflect-entry input[type="text"] { flex: 1; }
.reflect-entry .hint { margin-top: 1.25rem; margin-bottom: 0.5rem; }

/* .btn.secondary (Clear answers, Show answers, a digital-copy download...) has no style of its own any more: it is the standard white button with a blue outline, as everywhere else. */
.btn.standalone { margin-top: 1.5rem; }

.instructions { white-space: pre-line; color: #444; margin-bottom: 2rem; }
.privacy-note { font-size: 0.8rem; color: var(--muted); margin-top: 0.75rem; }

/* ---------- Questionnaire form ---------- */

.statement { border-top: 1px solid var(--line); padding: 1rem 0 1.75rem; }
.statement:last-of-type { padding-bottom: 0.5rem; }
.statement-text { display: flex; font-weight: 600; margin: 0 0 0.6rem; }
.statement-number { flex-shrink: 0; width: 1.75em; color: var(--muted); font-weight: 600; }

.score-options { display: flex; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; }
.score-option { position: relative; display: inline-block; cursor: pointer; }
.score-option input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

.score-box {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 2px solid #ccc;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    background: #fff;
    user-select: none;
    transition: background 0.15s, border-color 0.15s;
}
.score-option input:checked + .score-box { background: var(--score-highlight-color, #90ee90); border-color: var(--score-highlight-color, #90ee90); }
.score-option input:focus-visible + .score-box { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Delayed hover tooltip for score meanings scraped from the instructions text */
.has-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background: #333;
    color: #fff;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: normal;
    white-space: nowrap;
    text-align: center;
    line-height: 1.3;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease 0s;
    z-index: 20;
}
.has-tooltip:hover::after { opacity: 1; transition: opacity 0.15s ease 1s; }

.reflect-form .btn[type="submit"] { margin-top: 1.5rem; }
#clear-answers { margin-top: 1.5rem; margin-left: 0.75rem; }
.demo-reveal-password { margin-top: 1rem; font-size: 1.4rem; font-weight: 600; }

/* ---------- Results page ---------- */

.reveal-box { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.reveal-box label { width: 100%; font-size: 0.9rem; color: #555; }
.reveal-box .reveal-error { width: 100%; }
.reveal-box input { width: auto; flex: 1; min-width: 10em; }

.table-scroll { overflow-x: auto; }
.results-table { width: 100%; border-collapse: collapse; }
.results-table tr { border-bottom: 1px solid var(--line); }
.results-table td { padding: 1rem 0.5rem; vertical-align: middle; }

.category-cell { font-size: 1.4rem; font-weight: 600; white-space: nowrap; }
.category-name.masked { letter-spacing: 2px; color: #999; }
.range-text { font-size: 0.7rem; color: var(--muted); font-weight: normal; margin-top: 0.15rem; }
.score-cell { font-size: 1.6rem; font-weight: 700; text-align: center; width: 4rem; }

#demo-panel { margin-top: 2rem; padding-top: 1.5rem; border-top: 2px dashed #ccc; }
#demo-table .score-cell { width: auto; white-space: nowrap; padding: 1rem 1.25rem; }

.bar-cell { width: 100%; }
.bar-track { background: #e8e8e8; border-radius: 6px; height: 1.75rem; overflow: hidden; }
.bar-fill { background: var(--blue); height: 100%; border-radius: 6px 0 0 6px; }

.results-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

.answers-list { margin-top: 1rem; }
.answer-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 0; border-top: 1px solid var(--line); }
.answer-text { flex: 1; display: flex; }
.answers-list .score-box { flex-shrink: 0; width: 2.5rem; height: 2.5rem; cursor: default; }
.score-box.filled { background: var(--score-highlight-color, #90ee90); border-color: var(--score-highlight-color, #90ee90); }

/* Small screens */
@media (max-width: 600px) {
    .reflect-entry, .reflect-form, .reflect-results { padding: 1.25rem 1rem; border-radius: 0; margin: 0; }
    .score-box { width: 2.35rem; height: 2.35rem; font-size: 1rem; }
    .score-options { gap: 0.35rem; }
    .category-cell { font-size: 1.1rem; white-space: normal; }
    .score-cell { font-size: 1.3rem; width: 3rem; }
    .bar-track { height: 1.4rem; }
}
