/* ═══════════════════════════════════════
   SURVEY APP — styles.css
   Mobile-first, warm minimal aesthetic
═══════════════════════════════════════ */

/* ── Tokens ── */
:root {
    --bg:         #F5F0E8;   /* page background */
    --surface:    #FEFCF7;   /* card background */
    --accent:     #2D5016;   /* main green color (buttons, highlights) */
    --accent-lt:  #4A7C2F;   /* lighter green (hover states) */
    --accent-bg:  #EAF2E3;   /* very light green background tint */
    --danger:     #C0392B;   /* red (No button) */
    --text:       #1A1A1A;   /* main text color */
    --muted:      #6B6560;   /* grey helper text */
    --border:     #DDD8CF;
    --radius:     18px;
    --radius-sm:  10px;
    --shadow:     0 4px 24px rgba(0,0,0,.08);
    --trans:      .22s cubic-bezier(.4,0,.2,1);
    --font-head:  'DM Serif Display', Georgia, serif; /* ← headings font */
    --font-body:  'DM Sans', system-ui, sans-serif; /* ← body font */
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    height: 100%;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ── Progress bar (top) ── */
.progress-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--border);
    z-index: 100;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width .5s cubic-bezier(.4,0,.2,1);
}

/* ── Page system ── */
.page {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px 40px;
    opacity: 0;
    pointer-events: none;
    transform: translateX(40px);
    transition: opacity .35s var(--trans), transform .35s var(--trans);
    overflow-y: auto;
}
.page.active {
    opacity: 1;
    pointer-events: all;
    transform: translateX(0);
}
.page.exit {
    opacity: 0;
    transform: translateX(-40px);
}

.page-inner {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 36px 28px 32px;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Typography ── */
h1 {
    font-family: var(--font-head);
    font-size: clamp(1.7rem, 6vw, 2.2rem);
    line-height: 1.15;
    font-weight: 400;
}
h2 {
    font-family: var(--font-head);
    font-size: clamp(1.35rem, 5vw, 1.7rem);
    line-height: 1.2;
    font-weight: 400;
}
p { line-height: 1.65; color: var(--muted); font-size: .95rem; }

.question-label {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent-lt);
}

/* ── Consent page ── */
.consent-icon { font-size: 2.4rem; }
.consent-lead { color: var(--muted); font-size: 1rem; line-height: 1.6; }
.consent-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--accent-bg);
    border-radius: var(--radius-sm);
    padding: 18px 20px;
}
.consent-list li {
    font-size: .9rem;
    color: var(--accent);
    font-weight: 500;
    line-height: 1.4;
}
.consent-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: .9rem;
    cursor: pointer;
    color: var(--text);
}
.consent-check input { margin-top: 3px; width: 18px; height: 18px; }

/* ── Buttons ── */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 100px;
    padding: 16px 28px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--trans), transform var(--trans), opacity var(--trans);
    width: 100%;
    margin-top: 8px;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-lt); transform: translateY(-1px); }
.btn-primary:active:not(:disabled) { transform: scale(.97); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-arrow { font-size: 1.1rem; transition: transform var(--trans); }
.btn-primary:hover:not(:disabled) .btn-arrow { transform: translateX(4px); }

/* ── Text input ── */
.text-input {
    width: 100%;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    font-family: var(--font-body);
    font-size: 1.05rem;
    color: var(--text);
    outline: none;
    transition: border-color var(--trans), box-shadow var(--trans);
}
.text-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(45,80,22,.12);
}
.text-input::placeholder { color: var(--muted); }

/* ── Choice grid (multi-option) ── */
.choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.choice-btn {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 12px;
    font-family: var(--font-body);
    font-size: .9rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all var(--trans);
    text-align: center;
    line-height: 1.3;
}
.choice-btn:hover {
    border-color: var(--accent-lt);
    background: var(--accent-bg);
    transform: translateY(-2px);
}
.choice-btn.selected {
    border-color: var(--accent);
    background: var(--accent-bg);
    color: var(--accent);
    font-weight: 600;
}

/* ── Yes / No ── */
.yesno-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.yesno-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    border: 2.5px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 16px;
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--trans);
    background: var(--bg);
    color: var(--text);
}
.yesno-btn:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.yesno-icon { font-size: 2rem; }
.yesno-btn.yes:hover,
.yesno-btn.yes.selected { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.yesno-btn.no:hover,
.yesno-btn.no.selected  { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }

/* ── Audio recorder ── */
.recorder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.recorder-ring {
    width: 72px; height: 72px;
    border-radius: 50%;
    border: 3px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color var(--trans);
}
.recorder-ring.recording {
    border-color: #e74c3c;
    animation: pulse-ring 1.2s ease-in-out infinite;
}
.recorder-dot {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--border);
    transition: background var(--trans), transform var(--trans);
}
.recorder-ring.recording .recorder-dot {
    background: #e74c3c;
    transform: scale(1.15);
}
@keyframes pulse-ring {
    0%, 100% { box-shadow: 0 0 0 0 rgba(231,76,60,.35); }
    50%       { box-shadow: 0 0 0 10px rgba(231,76,60,0); }
}

.recorder-status {
    font-size: .85rem;
    color: var(--muted);
    font-weight: 500;
    text-align: center;
}

.recorder-controls {
    display: flex;
    gap: 10px;
    width: 100%;
}
.btn-record {
    flex: 1;
    border: none;
    border-radius: 100px;
    padding: 13px 10px;
    font-family: var(--font-body);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--trans);
}
.btn-record.start { background: var(--accent); color: #fff; }
.btn-record.start:hover:not(:disabled) { background: var(--accent-lt); }
.btn-record.stop  { background: #e74c3c; color: #fff; }
.btn-record.stop:hover:not(:disabled)  { background: #c0392b; }
.btn-record:disabled { opacity: .4; cursor: not-allowed; }

.audio-playback { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
audio { width: 100%; border-radius: var(--radius-sm); }
.audio-hint { font-size: .78rem; color: var(--muted); }

/* ── Quote ── */
.quote-text {
    font-family: var(--font-head);
    font-size: 1.15rem;
    font-style: italic;
    color: var(--text);
    border-left: 3px solid var(--accent);
    padding: 10px 16px;
    background: var(--accent-bg);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    line-height: 1.5;
}

/* ── Thank you page ── */
.center-all { align-items: center; text-align: center; }
.thankyou-icon { font-size: 3rem; }

/* ── Responsive tweaks ── */
@media (max-width: 360px) {
    .page-inner { padding: 28px 20px 26px; gap: 16px; }
    .choice-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .yesno-btn { padding: 22px 10px; }
}

/* ── Record-required hint ── */
.record-required {
    text-align: center;
    font-size: .82rem;
    font-weight: 500;
    color: #b85c00;
    background: #fff4e5;
    border: 1.5px solid #f5c97a;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-top: -8px;
}

/* ── Pre-recorded audio fragment ── */
.prerecorded-audio {
    background: var(--accent-bg);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.audio-label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--accent);
    margin: 0;
}

/* ── TTS loading page ── */
.tts-icon { font-size: 2.6rem; }
.tts-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: .9rem;
}
.tts-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.tts-ready-msg {
    font-size: .95rem;
    font-weight: 600;
    color: var(--accent);
    text-align: center;
}
