/* ============================================================
   encuesta-v2.css — Wizard del bridge web (12 pantallas)
   Mobile-first. Tipografía Anton + Inter (matchea index.html).
   ============================================================ */

:root {
    /* Aliases locales — referencian design-tokens.css */
    --surface:      var(--bg-elev);
    --surface-2:    var(--bg-elev-2);
    --surface-3:    #1f1f28;
    --border-hover: var(--brand-soft);
    --text-dim:     var(--text-muted);
    --text-mute:    var(--text-subtle);
    --green:        var(--success);
    --yellow:       var(--warn);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ── HEADER ────────────────────────────────────────────────── */

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(10,10,12,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
}

.app-header__inner {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: #fff;
}
.brand em {
    color: var(--red);
    font-style: normal;
}

.step-counter {
    font-size: 12px;
    color: var(--text-mute);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

.progress-track {
    position: relative;
    height: 3px;
    background: rgba(255,255,255,0.06);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 12px;
}
.progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    background: linear-gradient(90deg, var(--red), #ff8b4a);
    border-radius: 999px;
    width: 0%;
    transition: width 350ms cubic-bezier(.4,0,.2,1);
}

/* ── MAIN ──────────────────────────────────────────────────── */

main {
    flex: 1;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 28px 20px 80px;
}

.step {
    display: none;
    animation: fadeIn 320ms cubic-bezier(.4,0,.2,1);
}
.step.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.step__eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--red);
    margin: 0 0 12px;
}

.step__title {
    font-family: 'Anton', sans-serif;
    font-size: clamp(28px, 6vw, 38px);
    line-height: 1.05;
    letter-spacing: -0.01em;
    color: #fff;
    margin: 0 0 14px;
}

.step__sub {
    font-size: 15px;
    line-height: 1.55;
    color: var(--text-dim);
    margin: 0 0 28px;
}
.step__sub strong { color: var(--text); }

/* ── INPUTS ─────────────────────────────────────────────────── */

.text-input,
textarea.text-input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    font-family: inherit;
    font-size: 16px;
    color: var(--text);
    transition: border-color 180ms, background 180ms;
}
.text-input:focus,
textarea.text-input:focus {
    outline: none;
    border-color: var(--border-hover);
    background: var(--surface-3);
}
.text-input::placeholder { color: var(--text-mute); }

textarea.text-input {
    resize: vertical;
    min-height: 100px;
    line-height: 1.55;
}

.input-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-mute);
}
.char-count {
    font-variant-numeric: tabular-nums;
}
.char-count.over { color: var(--red); }

/* ── OPTION CARDS ───────────────────────────────────────────── */

.options {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr;
}
@media (min-width: 540px) {
    .options.cols-2 { grid-template-columns: 1fr 1fr; }
}

.option-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    cursor: pointer;
    transition: all 180ms cubic-bezier(.4,0,.2,1);
}
.option-card:hover {
    border-color: rgba(255,255,255,0.18);
    background: var(--surface-3);
}
.option-card input[type="radio"],
.option-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.option-card .option-radio {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.25);
    background: transparent;
    transition: border-color 180ms;
    position: relative;
}
.option-card .option-radio::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--red);
    opacity: 0;
    transition: opacity 180ms;
}
.option-card input:checked + .option-radio {
    border-color: var(--red);
}
.option-card input:checked + .option-radio::after {
    opacity: 1;
}
.option-card.selected {
    border-color: var(--red);
    background: rgba(255,91,20,0.06);
}
.option-card .option-body {
    flex: 1;
    min-width: 0;
}
.option-card .option-label {
    display: block;
    font-weight: 600;
    color: var(--text);
    font-size: 15px;
    line-height: 1.35;
}
.option-card .option-desc {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-mute);
    line-height: 1.4;
}

/* Chip variant para multiselect */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.chip {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    transition: all 160ms;
    user-select: none;
    line-height: 1.4;
}
.chip:hover {
    border-color: rgba(255,255,255,0.2);
}
.chip.selected {
    background: rgba(255,91,20,0.12);
    border-color: var(--red);
    color: #fff;
}
.chip input { display: none; }

/* ── SLIDER ─────────────────────────────────────────────────── */

.slider-wrap {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px 22px 18px;
}
.slider-wrap + .slider-wrap { margin-top: 12px; }

.slider-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
}
.slider-label {
    font-size: 13px;
    color: var(--text-dim);
    font-weight: 500;
}
.slider-value {
    font-family: 'Anton', sans-serif;
    font-size: 32px;
    color: var(--red);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.slider-value small {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: var(--text-mute);
    margin-left: 4px;
    font-weight: 500;
}

.slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(to right, var(--red) var(--val,50%), rgba(255,255,255,0.1) var(--val,50%));
    outline: none;
    cursor: pointer;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--red);
    cursor: grab;
    box-shadow: 0 4px 12px rgba(255,91,20,0.3);
}
.slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--red);
    cursor: grab;
    box-shadow: 0 4px 12px rgba(255,91,20,0.3);
}
.slider:active::-webkit-slider-thumb { cursor: grabbing; }

.slider-scale {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-mute);
    margin-top: 10px;
}

/* ── FOOTER NAV ─────────────────────────────────────────────── */

.nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background: rgba(10,10,12,0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
}
.nav-bar__inner {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn {
    appearance: none;
    border: none;
    font-family: inherit;
    font-weight: 700;
    font-size: 15px;
    padding: 14px 24px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 160ms;
    line-height: 1;
    letter-spacing: 0.01em;
}

.btn--primary {
    background: var(--red);
    color: #fff;
    flex: 1;
    box-shadow: 0 4px 16px rgba(255,91,20,0.3);
}
.btn--primary:hover {
    background: #ff7237;
    transform: translateY(-1px);
}
.btn--primary:disabled {
    background: var(--surface-3);
    color: var(--text-mute);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn--ghost {
    background: transparent;
    color: var(--text-dim);
    padding: 14px 18px;
}
.btn--ghost:hover {
    color: var(--text);
    background: var(--surface-2);
}

/* ── ERROR BANNER ───────────────────────────────────────────── */

.error-banner {
    display: none;
    background: rgba(220,38,38,0.12);
    border: 1px solid rgba(220,38,38,0.4);
    border-radius: 10px;
    padding: 12px 16px;
    margin: 0 0 20px;
    color: #fca5a5;
    font-size: 14px;
}
.error-banner.visible { display: block; }

/* ── LOADING OVERLAY ────────────────────────────────────────── */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,10,12,0.9);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.loading-overlay.visible { display: flex; }

.loading-overlay__inner {
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255,91,20,0.2);
    border-top-color: var(--red);
    border-radius: 50%;
    animation: spin 800ms linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay__text {
    color: var(--text);
    font-size: 14px;
    letter-spacing: 0.02em;
}

/* ── HELPERS ────────────────────────────────────────────────── */

.help-text {
    font-size: 13px;
    color: var(--text-mute);
    margin-top: 12px;
    line-height: 1.5;
}

.privacy-note {
    margin-top: 24px;
    padding: 14px 16px;
    background: var(--surface-2);
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-mute);
    line-height: 1.5;
}
.privacy-note strong { color: var(--text-dim); }

.lesion-detail {
    margin-top: 14px;
    display: none;
}
.lesion-detail.visible { display: block; }

/* ── RESPONSIVE TWEAKS ──────────────────────────────────────── */

@media (max-width: 480px) {
    main { padding: 22px 16px 100px; }
    .app-header { padding: 12px 16px; }
    .nav-bar { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
    .step__title { font-size: 26px; }
    .option-card { padding: 14px 16px; }
    .slider-wrap { padding: 20px 18px 14px; }
}
