/* ==========================================================================
   Healthy Home - ankiety walidacyjne (/ankiety, /ankieta/…)
   Ten sam szklany panel i tokeny co dashboard; węższa kolumna do czytania.
   ========================================================================== */
body {
    --hh-survey-error: oklch(0.84 0.11 25);
}

html[data-theme="light"] body {
    --hh-survey-error: oklch(0.48 0.18 25);
}

.hh-panel--survey { max-width: 920px; }

.hh-survey {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    padding-top: var(--space-8);
    padding-bottom: var(--space-8);
}

/* --- nagłówek ankiety --- */
.hh-survey-head {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.hh-survey-h1 {
    font-size: clamp(24px, 3.4vw, 32px);
    line-height: 1.18;
    margin: 0;
    text-wrap: balance;
}

.hh-survey-lead {
    margin: 0;
    font-size: 15.5px;
    line-height: 1.6;
}

.hh-survey-meta,
.hh-survey-foot {
    margin: 0;
    font-size: 12.5px;
}

.hh-survey-foot a { color: inherit; }

/* --- postęp --- */
.hh-survey-progress {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.hh-survey-progress-text {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    font-size: 13px;
}

.hh-survey-progress-text span { color: color-mix(in srgb, var(--color-text) 80%, transparent); }

.hh-survey-bar {
    height: 6px;
    border-radius: 999px;
    background: var(--hh-tile);
    overflow: hidden;
}

.hh-survey-bar-fill {
    height: 100%;
    min-width: 6px;
    border-radius: 999px;
    background: var(--hh-gold);
}

/* --- komunikaty --- */
.hh-survey-alert {
    margin: 0;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13.5px;
    background: var(--hh-tile);
    border: 1px solid color-mix(in srgb, var(--color-text) 30%, transparent);
}

.hh-survey-alert--error { border-color: var(--hh-alert-line); }
.hh-survey-notice { line-height: 1.5; }

/* --- formularz --- */
.hh-survey-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.hh-survey-form [hidden] { display: none; }

.hh-q {
    gap: var(--space-4);
    padding: var(--space-6);
    box-shadow: 0 6px 18px rgba(0,0,0,0.14);
}

.hh-q.has-error { box-shadow: 0 0 0 1.5px var(--hh-alert-line), 0 6px 18px rgba(0,0,0,0.14); }

/* przewinięcie do pytania z błędem zostawia nad nim trochę miejsca */
.hh-q { scroll-margin-top: 16px; }

.hh-q-label {
    display: flex;
    gap: 12px;
    align-items: baseline;
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 16px;
    line-height: 1.4;
}

.hh-q-num {
    flex: none;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    color: color-mix(in srgb, var(--color-text) 62%, transparent);
}

.hh-q-hint {
    font-weight: 400;
    font-size: 13px;
    white-space: nowrap;
    color: color-mix(in srgb, var(--color-text) 72%, transparent);
}

.hh-q-error {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--hh-survey-error);
}

/* --- odpowiedzi do zaznaczenia --- */
.hh-q-options {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hh-opt {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14.5px;
    line-height: 1.45;
    cursor: pointer;
}

.hh-opt:hover { background: var(--hh-tile-hover); }
.hh-opt:has(input:checked) { background: var(--hh-tile-active); }
.hh-opt:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.hh-opt.is-disabled { opacity: 0.45; cursor: not-allowed; }

.hh-opt input,
.hh-scale-opt input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.hh-opt-mark {
    flex: none;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border: 1.5px solid color-mix(in srgb, var(--color-text) 55%, transparent);
    border-radius: 5px;
    display: grid;
    place-items: center;
}

.hh-opt-mark--single { border-radius: 50%; }

.hh-opt input:checked + .hh-opt-mark {
    border-color: var(--hh-gold);
    background: var(--hh-gold);
}

/* ptaszek (checkbox) i kropka (radio) rysowane w CSS */
.hh-opt input:checked + .hh-opt-mark--multi::after {
    content: "";
    width: 9px;
    height: 5px;
    margin-top: -2px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg);
}

.hh-opt input:checked + .hh-opt-mark--single::after {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
}

.hh-opt-other {
    margin: 2px 0 6px 42px;
    width: min(420px, calc(100% - 42px));
}

/* --- skala 1–5 --- */
.hh-scale {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
}

.hh-scale-end {
    font-size: 12.5px;
    color: color-mix(in srgb, var(--color-text) 80%, transparent);
}

.hh-scale-opts {
    display: flex;
    gap: 6px;
}

.hh-scale-opt {
    position: relative;
    cursor: pointer;
}

.hh-scale-opt span {
    display: grid;
    place-items: center;
    width: 46px;
    height: 44px;
    border-radius: 12px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    border: 1.5px solid color-mix(in srgb, var(--color-text) 30%, transparent);
}

.hh-scale-opt:hover span { background: var(--hh-tile-hover); }
.hh-scale-opt input:checked + span { background: var(--hh-gold); border-color: var(--hh-gold); color: #fff; }
.hh-scale-opt input:focus-visible + span { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* --- pola tekstowe --- */
.hh-survey .input {
    min-height: 44px;
    padding: 9px 12px;
    font-size: 15px;
    border-radius: 12px;
}

.hh-survey textarea.input { min-height: 96px; }

.hh-money {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hh-money .input {
    max-width: 200px;
    font-variant-numeric: tabular-nums;
}

.hh-money-unit {
    font-size: 13.5px;
    color: color-mix(in srgb, var(--color-text) 80%, transparent);
}

/* --- karta informacyjna: opis rozwiązania, pakiety --- */
.hh-brief {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-6);
    border-radius: 18px;
    border: 1px solid color-mix(in srgb, var(--hh-gold) 70%, transparent);
    font-size: 14.5px;
    line-height: 1.6;
}

/* teksty na pełną szerokość karty - panel ankiety sam jest już wąski (920 px) */
.hh-brief p { margin: 0; }

.hh-brief-title {
    margin: 0;
    font-size: 19px;
    line-height: 1.25;
}

.hh-brief-list {
    margin: 0;
    display: grid;
    gap: 10px;
}

.hh-brief-item {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 4px 16px;
}

.hh-brief-item dt { font-weight: 600; }
.hh-brief-item dd { margin: 0; }

.hh-brief-note {
    font-size: 13px;
    color: color-mix(in srgb, var(--color-text) 82%, transparent);
}

.hh-brief-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4);
}

.hh-pkg {
    gap: var(--space-3);
    padding: var(--space-6) var(--space-4);
    box-shadow: none;
}

.hh-pkg-title {
    margin: 0;
    font-size: 19px;
}

.hh-pkg-list {
    margin: 0;
    padding-left: 18px;
    font-size: 13.5px;
    line-height: 1.5;
    flex: 1;
}

.hh-pkg-list li + li { margin-top: 4px; }

.hh-pkg-limit {
    font-size: 12.5px;
    line-height: 1.5;
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-divider);
}

/* --- przyciski --- */
.hh-survey-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.hh-survey-actions .btn {
    min-height: 44px;
    padding: 10px 22px;
    font-size: 15px;
    border-radius: 999px;
}

.hh-survey-submit,
.hh-survey-actions a.btn-primary,
.hh-survey-pick-btn {
    background: var(--hh-gold);
    border-color: var(--hh-gold);
    color: #fff;
}

.hh-survey-submit { margin-left: auto; }

.hh-survey-submit:hover,
.hh-survey-actions a.btn-primary:hover,
.hh-survey-pick:hover .hh-survey-pick-btn {
    background: color-mix(in srgb, var(--hh-gold) 86%, #fff);
}

/* stan wciśnięcia: bez tego wygrałoby przezroczyste tło z .btn-primary:active */
.hh-survey-submit:active,
.hh-survey-actions a.btn-primary:active,
.hh-survey-pick:active .hh-survey-pick-btn {
    background: color-mix(in srgb, var(--hh-gold) 88%, #000);
}

/* pułapka na boty - poza ekranem, bez display:none (część botów pomija pola ukryte) */
.hh-survey-trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* --- strona wyboru ankiety --- */
.hh-survey-choice {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-6);
}

.hh-survey-pick {
    gap: var(--space-3);
    padding: var(--space-8);
    text-decoration: none;
    color: inherit;
    transition: background .15s;
}

.hh-survey-pick:hover { background: var(--hh-tile-active); }

.hh-survey-pick-title {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 22px;
    line-height: 1.2;
}

.hh-survey-pick-text {
    font-size: 14.5px;
    line-height: 1.55;
    flex: 1;
}

.hh-survey-pick-meta {
    font-size: 12.5px;
    color: color-mix(in srgb, var(--color-text) 78%, transparent);
}

.hh-survey-pick-btn {
    align-self: flex-start;
    margin-top: var(--space-2);
    min-height: 44px;
    padding: 10px 20px;
    border-radius: 999px;
}

.hh-survey-card { padding: var(--space-8); }
.hh-survey-thanks { gap: var(--space-4); }

/* --- link do ankiet w stopce dashboardu --- */
.hh-footer-survey {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.hh-footer-survey:hover { color: var(--color-text); }

@media (prefers-reduced-motion: reduce) {
    .hh-survey-pick { transition: none; }
}

@media (max-width: 760px) {
    .hh-brief-cards { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .hh-survey { gap: var(--space-4); }
    .hh-survey-choice { grid-template-columns: 1fr; }
    .hh-q,
    .hh-brief { padding: var(--space-4); }
    .hh-survey-pick,
    .hh-survey-card { padding: var(--space-6); }
    .hh-brief-item { grid-template-columns: 1fr; }
    .hh-opt-other { margin-left: 12px; width: calc(100% - 12px); }
    .hh-scale-opt span { width: 42px; }
    .hh-survey-submit { flex: 1; }
}

/* --- uzupełnienia po uwagach HHNS: podpowiedź pod pytaniem, grupy odpowiedzi, tabela, odpowiedź zastępcza --- */
.hh-q-note {
    margin: calc(-1 * var(--space-2)) 0 0;
    font-size: 13px;
}

.hh-q-group {
    margin: 10px 12px 2px;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--color-text) 70%, transparent);
}

.hh-q-group:first-child { margin-top: 0; }

.hh-q-alts { display: flex; flex-wrap: wrap; gap: 2px 8px; }
.hh-opt--alt { min-height: 40px; padding: 8px 12px; font-size: 14px; }
.hh-survey .input:disabled { opacity: 0.45; }

.hh-matrix {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.hh-matrix-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hh-matrix-row + .hh-matrix-row {
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-divider);
}

.hh-matrix-label { font-size: 14.5px; line-height: 1.45; }

.hh-matrix-opts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hh-chip {
    position: relative;
    cursor: pointer;
}

.hh-chip input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.hh-chip span {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13.5px;
    line-height: 1.3;
    border: 1.5px solid color-mix(in srgb, var(--color-text) 30%, transparent);
}

.hh-chip:hover span { background: var(--hh-tile-hover); }
.hh-chip input:checked + span { background: var(--hh-gold); border-color: var(--hh-gold); color: #fff; }
.hh-chip input:focus-visible + span { outline: 2px solid var(--color-accent); outline-offset: 2px; }
