/* ============================================================
   Test de Zarit · Módulo Persona Cuidadora
   assets/css/zarit.css
   ============================================================ */

:root {
    --cma-fondo: #0C0B10;
    --cma-fondo2: #141318;
    --cma-p1: #4A206E;
    --cma-p2: #B780CD;
    --cma-p3: #D59CEC;
    --cma-p4: #CB6CE6;
    --cma-blanco: #FFFFFF;
    --cma-texto: #F0EDF5;
    --cma-texto-suave: #B8B3C4;
    --cma-borde: rgba(255,255,255,.06);
    --cma-borde2: rgba(255,255,255,.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
    font-family: 'DM Sans', sans-serif;
    font-size: 16px;
    background: var(--cma-fondo);
    color: var(--cma-texto);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

:focus-visible {
    outline: 2px solid var(--cma-p4);
    outline-offset: 2px;
}

button, input, select, textarea {
    font-family: inherit;
}

/* ── Contenedor raíz ─────────────────────────────── */

.z-root {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* Glows decorativos */
.z-glow-1, .z-glow-2 {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}
.z-glow-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(74,32,110,.22) 0%, transparent 70%);
    top: -150px; right: -100px;
}
.z-glow-2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(203,108,230,.09) 0%, transparent 70%);
    bottom: -120px; left: -80px;
}

/* ── Shell (celular: full screen / desktop: tarjeta) ───── */

.z-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    width: 100%;
}

@media (min-width: 640px) {
    .z-root {
        align-items: center;
        justify-content: center;
        padding: 24px;
    }
    .z-shell {
        max-width: 520px;
        min-height: 760px;
        max-height: calc(100vh - 48px);
        background: var(--cma-fondo2);
        border-radius: 24px;
        border: 1px solid var(--cma-borde);
        box-shadow: 0 40px 100px rgba(0,0,0,.5), 0 0 0 1px rgba(74,32,110,.08);
        overflow: hidden;
    }
}

/* ── Topbar ──────────────────────────────────────── */

.z-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px 14px;
    border-bottom: 1px solid var(--cma-borde);
    background: rgba(20,19,24,.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    flex-shrink: 0;
}
.z-topbar-logo {
    height: 44px;
    width: auto;
    filter: brightness(0) invert(1);
    opacity: .9;
}
.z-topbar-label {
    font-size: .95rem;
    font-weight: 700;
    color: var(--cma-texto);
}

/* ── Progress ────────────────────────────────────── */

.z-progress {
    padding: 10px 20px 0;
    flex-shrink: 0;
}
.z-progress-track {
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,.04);
    overflow: hidden;
}
.z-progress-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--cma-p1), var(--cma-p4));
    transition: width .4s cubic-bezier(.4,0,.2,1);
    width: 0%;
}
.z-progress-meta {
    display: flex;
    justify-content: space-between;
    padding: 10px 0 0;
    font-size: .82rem;
    font-weight: 600;
    color: var(--cma-texto-suave);
}

/* ── Contenido dinámico ──────────────────────────── */

.z-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 20px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Animación de slide entre preguntas */
.z-slide {
    animation: zIn .22s ease-out;
    display: flex;
    flex-direction: column;
}
.z-slide-out-l { animation: zOutL .22s ease-in forwards; }
.z-slide-out-r { animation: zOutR .22s ease-in forwards; }

@keyframes zIn   { from { opacity:0; transform:translateX(24px); } to { opacity:1; transform:translateX(0); } }
@keyframes zOutL { to { opacity:0; transform:translateX(-24px); } }
@keyframes zOutR { to { opacity:0; transform:translateX(24px); } }

/* ── Acciones (botones) ──────────────────────────── */

.z-actions {
    padding: 16px 22px calc(env(safe-area-inset-bottom, 16px) + 16px);
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.z-btn-back {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 16px;
    border: 1.5px solid var(--cma-borde2);
    background: rgba(255,255,255,.02);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--cma-texto);
    transition: all .12s;
}
.z-btn-back svg { width: 22px; height: 22px; }
.z-btn-back:hover:not(:disabled) {
    border-color: rgba(255,255,255,.2);
    background: rgba(255,255,255,.05);
}
.z-btn-back:disabled { opacity: .3; cursor: default; }

.z-btn-next {
    flex: 1;
    height: 60px;
    border-radius: 16px;
    border: none;
    background: linear-gradient(135deg, var(--cma-p1), var(--cma-p4));
    color: var(--cma-blanco);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    box-shadow: 0 8px 24px rgba(74,32,110,.3);
    letter-spacing: .3px;
}
.z-btn-next:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 32px rgba(74,32,110,.45);
}
.z-btn-next:active:not(:disabled) { transform: scale(.98); }
.z-btn-next:disabled {
    background: rgba(255,255,255,.06);
    color: var(--cma-texto-suave);
    box-shadow: none;
    cursor: default;
    transform: none;
}

/* ── Botón WhatsApp ──────────────────────────────── */

.z-btn-wa {
    flex: 1;
    height: 60px;
    border-radius: 16px;
    border: none;
    background: #25D366;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    box-shadow: 0 8px 24px rgba(37,211,102,.3);
    letter-spacing: .3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
}
.z-btn-wa:hover {
    background: #1ebe5a;
    transform: translateY(-1px);
    box-shadow: 0 12px 32px rgba(37,211,102,.45);
}
.z-btn-wa:active { transform: scale(.98); }

/* ── Intro ───────────────────────────────────────── */

.z-intro {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px 4px;
}
.z-intro-logo {
    width: 96px;
    height: 96px;
    margin-bottom: 24px;
    filter: drop-shadow(0 16px 30px rgba(74,32,110,.4));
    animation: zFloat 4s ease-in-out infinite;
}
@keyframes zFloat { 0%,100% { transform:translateY(0); } 50% { transform:translateY(-10px); } }

.z-intro h1 {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.15;
    margin-bottom: 8px;
}
.z-intro h1 span {
    background: linear-gradient(135deg, var(--cma-p4), var(--cma-p3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.z-intro-sub {
    font-size: 1rem;
    color: var(--cma-texto-suave);
    margin-bottom: 28px;
    font-weight: 500;
}
.z-intro-card {
    background: rgba(255,255,255,.02);
    border: 1px solid var(--cma-borde);
    border-radius: 18px;
    padding: 22px;
    text-align: left;
    font-size: 1rem;
    color: var(--cma-texto-suave);
    line-height: 1.65;
    max-width: 420px;
}
.z-intro-time {
    margin-top: 24px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--cma-texto);
    display: flex;
    align-items: center;
    gap: 6px;
}
.z-intro-conf {
    margin-top: 10px;
    font-size: .78rem;
    color: var(--cma-texto-suave);
    opacity: .65;
}

/* ── Pregunta ────────────────────────────────────── */

.z-qnum {
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--cma-p1) 30%, var(--cma-p4));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 12px;
}
.z-qtext {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--cma-texto);
    line-height: 1.45;
    margin-bottom: 28px;
}
@media (min-width: 640px) {
    .z-qtext { font-size: 1.3rem; }
}

.z-opts {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.z-opt {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 18px;
    border-radius: 14px;
    border: 1.5px solid var(--cma-borde2);
    background: rgba(255,255,255,.02);
    cursor: pointer;
    transition: all .15s;
    -webkit-tap-highlight-color: transparent;
}
.z-opt:hover {
    border-color: rgba(203,108,230,.25);
    background: rgba(203,108,230,.04);
}
.z-opt.active {
    border-color: var(--cma-p4);
    background: rgba(203,108,230,.08);
    box-shadow: 0 0 0 3px rgba(203,108,230,.1);
}
.z-opt-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--cma-borde2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all .15s;
    position: relative;
}
.z-opt.active .z-opt-dot {
    border-color: var(--cma-p4);
    background: var(--cma-p4);
    box-shadow: 0 0 8px rgba(203,108,230,.4);
}
.z-opt.active .z-opt-dot::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
}
.z-opt-label {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--cma-texto);
    flex: 1;
}
.z-opt-val {
    font-size: .8rem;
    font-weight: 700;
    color: var(--cma-texto-suave);
    background: rgba(255,255,255,.04);
    padding: 4px 12px;
    border-radius: 8px;
}
.z-opt.active .z-opt-val {
    background: var(--cma-p4);
    color: #fff;
}

/* ── Registro ────────────────────────────────────── */

.z-reg {
    display: flex;
    flex-direction: column;
    padding: 4px 0 0;
}
.z-reg h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 6px;
}
.z-reg-sub {
    font-size: .95rem;
    color: var(--cma-texto-suave);
    margin-bottom: 24px;
    line-height: 1.55;
}
.z-field { margin-bottom: 18px; }
.z-field label {
    display: block;
    font-size: .8rem;
    font-weight: 700;
    color: var(--cma-texto-suave);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.z-field input {
    width: 100%;
    padding: 16px 16px;
    border-radius: 12px;
    border: 1.5px solid var(--cma-borde2);
    background: rgba(255,255,255,.02);
    color: var(--cma-texto);
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    transition: border-color .15s;
}
.z-field input::placeholder {
    color: var(--cma-texto-suave);
    opacity: .5;
}
.z-field input:focus {
    border-color: var(--cma-p4);
    box-shadow: 0 0 0 3px rgba(203,108,230,.12);
}

/* Estado de error: input con borde rojo + fondo sutil */
.z-field input.z-err {
    border-color: #FF4D6D;
    background: rgba(255,77,109,.05);
}

/* Mensaje de error — MUY visible, con ícono y color vivo */
.z-err-msg {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .88rem;
    font-weight: 600;
    color: #FF8095;
    margin-top: 8px;
}
.z-err-msg::before {
    content: '⚠';
    font-size: 1rem;
    flex-shrink: 0;
}

.z-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.z-chip {
    padding: 12px 18px;
    border-radius: 12px;
    border: 1.5px solid var(--cma-borde2);
    background: transparent;
    font-size: .92rem;
    font-weight: 600;
    color: var(--cma-texto-suave);
    cursor: pointer;
    transition: all .12s;
    -webkit-tap-highlight-color: transparent;
}
.z-chip:hover {
    border-color: rgba(255,255,255,.2);
    background: rgba(255,255,255,.04);
    color: var(--cma-texto);
}
.z-chip.active {
    border-color: var(--cma-p4);
    background: rgba(203,108,230,.12);
    color: var(--cma-p3);
}

/* Aviso de privacidad */
.z-privacy {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px 18px;
    border-radius: 14px;
    background: rgba(255,255,255,.02);
    border: 1.5px solid var(--cma-borde2);
    cursor: pointer;
    margin-top: 24px;
    transition: all .15s;
    -webkit-tap-highlight-color: transparent;
}
.z-privacy:hover { border-color: rgba(203,108,230,.25); }
.z-privacy.z-privacy-err {
    border-color: #FF4D6D;
    background: rgba(255,77,109,.05);
}

.z-privacy-check {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    border: 2px solid var(--cma-borde2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    transition: all .15s;
    color: #fff;
}
.z-privacy-check.checked {
    background: var(--cma-p4);
    border-color: var(--cma-p4);
}
.z-privacy-check svg { width: 14px; height: 14px; }

.z-privacy-text {
    font-size: .88rem;
    line-height: 1.55;
    color: var(--cma-texto-suave);
}
.z-privacy-text strong {
    color: var(--cma-texto);
    font-weight: 700;
}

/* Error del servidor — aún más prominente */
.z-server-err {
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 14px;
    background: rgba(255,77,109,.1);
    border: 1.5px solid rgba(255,77,109,.4);
    color: #FFB0BF;
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.z-server-err::before {
    content: '⚠';
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* ── Test reciente (menos de 7 días) ────────────── */

.z-reciente {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 8px;
}
.z-reciente-icon {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: rgba(249,178,0,.12);
    border: 2px solid rgba(249,178,0,.4);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    color: #F9B200;
}
.z-reciente-icon svg {
    width: 44px;
    height: 44px;
}
.z-reciente h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--cma-texto);
    margin-bottom: 10px;
    line-height: 1.25;
}
.z-reciente-msg {
    font-size: 1rem;
    color: var(--cma-texto-suave);
    margin-bottom: 20px;
    line-height: 1.55;
}
.z-reciente-msg strong {
    color: var(--cma-texto);
    font-weight: 700;
}
.z-reciente-card {
    background: rgba(255,255,255,.03);
    border: 1.5px solid var(--cma-borde2);
    border-radius: 16px;
    padding: 20px;
    text-align: left;
    width: 100%;
    max-width: 420px;
    margin-bottom: 18px;
}
.z-reciente-card p {
    font-size: .95rem;
    color: var(--cma-texto-suave);
    line-height: 1.6;
    margin: 0;
}
.z-reciente-card p + p {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--cma-borde);
}
.z-reciente-dias {
    color: var(--cma-p3) !important;
    font-weight: 600;
}
.z-reciente-dias strong {
    color: var(--cma-p4);
    font-weight: 800;
}
.z-reciente-nota {
    font-size: .88rem;
    color: var(--cma-texto-suave);
    opacity: .75;
    line-height: 1.5;
    max-width: 380px;
}

/* ── Resultado ───────────────────────────────────── */

.z-result {
    display: flex;
    flex-direction: column;
    padding: 4px 0 0;
}
.z-result-head {
    text-align: center;
    margin-bottom: 20px;
}
.z-result-greeting {
    font-size: 1rem;
    color: var(--cma-texto-suave);
    margin-bottom: 20px;
}
.z-result-greeting strong {
    color: var(--cma-texto);
    font-weight: 700;
}
.z-result-ring {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    border-width: 4px;
    border-style: solid;
}
.z-result-num {
    font-size: 3.2rem;
    font-weight: 900;
    line-height: 1;
}
.z-result-of {
    font-size: .85rem;
    font-weight: 600;
    opacity: .6;
    margin-top: 2px;
}
.z-result-label {
    font-size: 1.5rem;
    font-weight: 800;
}
.z-result-scale {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
}
.z-result-scale-item {
    flex: 1;
    text-align: center;
    padding: 10px 4px;
    border-radius: 10px;
    font-size: .65rem;
    font-weight: 700;
    line-height: 1.3;
    border: 1.5px solid transparent;
}
.z-result-scale-item.active {
    border-color: currentColor;
}
.z-result-card {
    border-radius: 18px;
    padding: 22px;
    border-width: 1.5px;
    border-style: solid;
}
.z-result-card p {
    font-size: 1rem;
    line-height: 1.65;
    margin: 0;
}

/* ── Accesibilidad: reduced motion ───────────────── */

@media (prefers-reduced-motion: reduce) {
    .z-intro-logo { animation: none; }
    .z-slide, .z-slide-out-l, .z-slide-out-r { animation: none; }
    .z-progress-fill { transition: none; }
}
