/* =====================================================================
   DASS-21 Screening App — Design Tokens & Shared Styles
   Palet: hijau hangat (warm green) terinspirasi dari logo RSUD Ploso
   Tipografi: Fraunces (display/heading) + Manrope (body/UI) + IBM Plex Mono (data/skor)
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Manrope:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
    /* Warna inti — hijau hangat */
    --forest: #1F4D3A;      /* hijau tua, header/sidebar */
    --sage: #3F7D58;        /* hijau utama, tombol/aksen */
    --leaf: #6FAE8A;        /* hijau muda, hover/highlight */
    --cream: #F8F4EC;       /* latar hangat */
    --tint: #EAF2EA;        /* tint hijau untuk kartu/section */
    --card: #FFFFFF;
    --ink: #223328;         /* teks utama, hijau-hitam hangat */
    --ink-soft: #5B6E62;    /* teks sekunder */
    --orange: #E8934A;      /* aksen hangat dari logo */
    --border: #DDE7DE;

    /* Warna fungsional tingkat severitas (bukan dekorasi — mengkodekan makna) */
    --sev-normal: #3F7D58;
    --sev-ringan: #8CAE4C;
    --sev-sedang: #D9A421;
    --sev-berat: #E07A2E;
    --sev-sangat-berat: #C0503A;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --shadow-sm: 0 1px 3px rgba(31, 77, 58, 0.08);
    --shadow-md: 0 8px 24px rgba(31, 77, 58, 0.10);
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', 'SF Mono', monospace;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--cream);
    color: var(--ink);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--forest);
    line-height: 1.2;
    margin: 0 0 0.5em;
    font-weight: 600;
}

a { color: var(--sage); text-decoration: none; }
a:hover { color: var(--forest); text-decoration: underline; }

img { max-width: 100%; display: block; }

:focus-visible {
    outline: 3px solid var(--orange);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ------------------------------------------------------------------ */
/* Layout dasar — halaman publik                                      */
/* ------------------------------------------------------------------ */

.public-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.public-topbar {
    background: var(--forest);
    color: #fff;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.public-topbar img { height: 38px; width: auto; }

.public-topbar .brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.public-topbar .brand-text strong {
    font-family: var(--font-display);
    font-size: 1.05rem;
    letter-spacing: 0.2px;
}

.public-topbar .brand-text span {
    font-size: 0.78rem;
    color: #CFE3D6;
}

.public-main {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 28px 16px 48px;
}

.public-container {
    width: 100%;
    max-width: 720px;
}

.card {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 28px 26px;
    border: 1px solid var(--border);
}

@media (max-width: 560px) {
    .card { padding: 20px 16px; border-radius: var(--radius-md); }
}

.public-footer {
    text-align: center;
    padding: 16px;
    font-size: 0.78rem;
    color: var(--ink-soft);
}

/* ------------------------------------------------------------------ */
/* Signature element — progress "growth steps" (leaf-node stepper)     */
/* ------------------------------------------------------------------ */

.growth-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 0 26px;
}

.growth-steps .node {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--tint);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ink-soft);
    flex-shrink: 0;
}

.growth-steps .node.active {
    background: var(--sage);
    border-color: var(--sage);
    color: #fff;
}

.growth-steps .node.done {
    background: var(--leaf);
    border-color: var(--leaf);
    color: #fff;
}

.growth-steps .stem {
    flex: 1;
    height: 2px;
    background: var(--border);
    max-width: 46px;
}

.growth-steps .stem.done { background: var(--leaf); }

.step-label {
    text-align: center;
    font-size: 0.82rem;
    color: var(--ink-soft);
    margin-bottom: 22px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* ------------------------------------------------------------------ */
/* Form elements                                                       */
/* ------------------------------------------------------------------ */

.field { margin-bottom: 18px; }

.field label {
    display: block;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--forest);
    margin-bottom: 6px;
}

.field .hint {
    font-size: 0.78rem;
    color: var(--ink-soft);
    margin-top: 4px;
}

input[type=text], input[type=number], select, textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.98rem;
    color: var(--ink);
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--sage);
    box-shadow: 0 0 0 3px rgba(63, 125, 88, 0.15);
    outline: none;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%233F7D58' stroke-width='2' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.required-mark { color: var(--sev-berat); margin-left: 2px; }

/* Consent box */
.consent-text {
    background: var(--tint);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    font-size: 0.92rem;
    color: var(--ink);
    max-height: 340px;
    overflow-y: auto;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.consent-text ul { padding-left: 20px; margin: 8px 0; }
.consent-text li { margin-bottom: 8px; }

.radio-option, .checkbox-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 15px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.radio-option:hover, .checkbox-option:hover { border-color: var(--leaf); background: var(--tint); }

.radio-option input, .checkbox-option input { margin-top: 3px; accent-color: var(--sage); width: 18px; height: 18px; flex-shrink: 0; }

.radio-option.checked, .checkbox-option.checked { border-color: var(--sage); background: var(--tint); }

/* Likert scale for DASS-21 questions */
.question-block {
    border-bottom: 1px solid var(--border);
    padding: 18px 0;
}

.question-block:first-child { padding-top: 0; }
.question-block:last-child { border-bottom: none; }

.question-block .q-number {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--sage);
    font-weight: 600;
}

.question-block p.q-text {
    font-size: 0.98rem;
    margin: 4px 0 12px;
    color: var(--ink);
}

.likert-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

@media (max-width: 480px) {
    .likert-options { grid-template-columns: repeat(2, 1fr); }
}

.likert-options label {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 10px 6px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.76rem;
    color: var(--ink-soft);
    transition: all .15s ease;
}

.likert-options input { accent-color: var(--sage); }

.likert-options label span.score {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--forest);
}

.likert-options input:checked + span,
.likert-options label:has(input:checked) {
    border-color: var(--sage);
    background: var(--tint);
    color: var(--forest);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 4px;
}

.section-title .dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--orange);
}

.section-desc { color: var(--ink-soft); font-size: 0.88rem; margin-bottom: 18px; }

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--sage); color: #fff; }
.btn-primary:hover { background: var(--forest); color: #fff; }

.btn-outline { background: transparent; color: var(--sage); border: 1.5px solid var(--sage); }
.btn-outline:hover { background: var(--tint); color: var(--forest); }

.btn-orange { background: var(--orange); color: #fff; }
.btn-orange:hover { background: #cf7a34; color: #fff; }

.btn-danger { background: var(--sev-sangat-berat); color: #fff; }
.btn-danger:hover { background: #a3402d; }

.btn-block { width: 100%; }
.btn-sm { padding: 7px 13px; font-size: 0.8rem; border-radius: 7px; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }

/* ------------------------------------------------------------------ */
/* Badges severitas — warna mengkodekan makna, bukan dekorasi          */
/* ------------------------------------------------------------------ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: 0.2px;
    color: #fff;
    white-space: nowrap;
}

.badge-normal { background: var(--sev-normal); }
.badge-ringan { background: var(--sev-ringan); }
.badge-sedang { background: var(--sev-sedang); color: #3a2c05; }
.badge-berat { background: var(--sev-berat); }
.badge-sangat-berat { background: var(--sev-sangat-berat); }

/* ------------------------------------------------------------------ */
/* Alerts                                                              */
/* ------------------------------------------------------------------ */

.alert {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 18px;
    border: 1.5px solid transparent;
}

.alert-error { background: #FBEAE6; border-color: #E8B4A5; color: #8A3521; }
.alert-success { background: var(--tint); border-color: var(--leaf); color: var(--forest); }
.alert-info { background: #EAF1FB; border-color: #B7CFEF; color: #2A4A72; }

/* ------------------------------------------------------------------ */
/* Confirmation / result page                                          */
/* ------------------------------------------------------------------ */

.result-icon {
    width: 66px; height: 66px; border-radius: 50%;
    background: var(--tint);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 18px;
}

.result-icon svg { width: 32px; height: 32px; }

.hotline-box {
    background: var(--forest);
    color: #fff;
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin-top: 20px;
}

.hotline-box h4 { color: #fff; margin-bottom: 8px; font-size: 1rem; }
.hotline-box p { margin: 4px 0; font-size: 0.9rem; color: #DCEAE0; }

/* ------------------------------------------------------------------ */
/* Utility                                                             */
/* ------------------------------------------------------------------ */

.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.small { font-size: 0.8rem; color: var(--ink-soft); }
