/* ===========================================================================
   Sanatorio Santa Rita — Encuesta de Satisfacción
   Mobile-first. Paleta tomada del logotipo institucional.
   =========================================================================== */

:root {
	--indigo:      #3F3F95;
	--indigo-700:  #35357E;
	--indigo-900:  #262657;
	--azul:        #5C97CF;
	--azul-300:    #A9CBE8;
	--azul-100:    #E7F0F9;
	--azul-050:    #F3F8FC;

	--ink:         #1C2033;
	--muted:       #626883;
	--line:        #E3E9F2;
	--white:       #FFFFFF;

	--exc:         #3F3F95;
	--bue:         #5C97CF;
	--reg:         #DE9A2E;
	--mal:         #CE4E4A;
	--ok:          #2E9E6B;

	--radius:      18px;
	--radius-sm:   12px;
	--shadow:      0 1px 2px rgba(28,32,51,.04), 0 10px 28px rgba(28,32,51,.07);
	--shadow-sm:   0 1px 2px rgba(28,32,51,.05), 0 4px 12px rgba(28,32,51,.05);

	--sans: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--serif: "Playfair Display", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	font-family: var(--sans);
	font-size: 16px;
	line-height: 1.55;
	color: var(--ink);
	background: var(--azul-050);
	-webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--indigo); }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.18; margin: 0; letter-spacing: -.01em; }

.wrap { width: 100%; max-width: 620px; margin: 0 auto; padding: 0 16px; }

.sr-only {
	position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- Encabezado ---------------------------------------------------------- */
.site-header {
	background: var(--white);
	border-bottom: 1px solid var(--line);
	padding: 14px 0;
	position: sticky;
	top: 0;
	z-index: 30;
}
.site-header .wrap { display: flex; align-items: center; justify-content: center; }
.site-header img { height: 38px; width: auto; }

/* --- Portada / intro ----------------------------------------------------- */
.hero {
	background: radial-gradient(120% 90% at 50% 0%, #FFFFFF 0%, var(--azul-100) 55%, var(--azul-050) 100%);
	padding: 34px 0 40px;
	text-align: center;
}
.hero .eyebrow {
	display: inline-block;
	font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
	color: var(--azul); background: rgba(255,255,255,.85);
	padding: 6px 14px; border-radius: 999px; margin-bottom: 14px;
	border: 1px solid rgba(92,151,207,.28);
}
.hero h1 { font-size: 30px; color: var(--indigo-900); margin-bottom: 12px; }
.hero p { color: var(--muted); font-size: 15px; margin: 0 auto; max-width: 46ch; }

.intro-card {
	background: var(--white);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 22px 20px;
	margin: -24px auto 26px;
	position: relative;
	z-index: 2;
}
.intro-list { list-style: none; margin: 0 0 20px; padding: 0; }
.intro-list li {
	display: flex; gap: 12px; align-items: flex-start;
	padding: 11px 0; border-bottom: 1px solid var(--line);
	font-size: 14.5px; color: var(--muted);
}
.intro-list li:last-child { border-bottom: 0; }
.intro-list svg { flex: 0 0 20px; margin-top: 2px; color: var(--azul); }
.intro-list strong { color: var(--ink); font-weight: 600; }

/* --- Progreso ------------------------------------------------------------ */
.progress-wrap {
	position: sticky; top: 67px; z-index: 25;
	background: var(--azul-050);
	padding: 14px 0 12px;
	border-bottom: 1px solid var(--line);
}
.progress-head {
	display: flex; justify-content: space-between; align-items: baseline;
	margin-bottom: 9px; gap: 12px;
}
.progress-head .step-name { font-size: 13.5px; font-weight: 600; color: var(--indigo-900); }
.progress-head .step-count { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.progress-bar { height: 6px; background: var(--azul-100); border-radius: 999px; overflow: hidden; }
.progress-bar span {
	display: block; height: 100%; width: 0;
	background: linear-gradient(90deg, var(--azul), var(--indigo));
	border-radius: 999px; transition: width .35s cubic-bezier(.4,0,.2,1);
}

/* --- Tarjetas y preguntas ------------------------------------------------ */
.step { display: none; }
.step.is-active { display: block; animation: fade .28s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
	background: var(--white);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
	padding: 20px 18px;
	margin: 18px 0;
}
.card > h2 { font-size: 20px; color: var(--indigo-900); margin-bottom: 4px; }
.card > .card-sub { font-size: 14px; color: var(--muted); margin: 0 0 18px; }

.q { padding: 16px 0; border-top: 1px solid var(--line); }
.q:first-of-type { border-top: 0; padding-top: 4px; }
.q > label, .q > .q-label {
	display: block; font-size: 15px; font-weight: 600; color: var(--ink);
	margin-bottom: 12px; line-height: 1.4;
}
.q .hint { display: block; font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 3px; }

.q.has-error { background: #FEF6F6; border-radius: var(--radius-sm); padding: 14px 12px; margin: 4px -12px; border-top-color: transparent; }
.q.has-error > label, .q.has-error > .q-label { color: var(--mal); }
.err-msg { display: none; font-size: 13px; color: var(--mal); font-weight: 600; margin-top: 10px; }
.q.has-error .err-msg { display: block; }

/* --- Escala de 4 niveles -------------------------------------------------- */
.opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.opts input { position: absolute; opacity: 0; pointer-events: none; }
.opts label {
	display: flex; align-items: center; justify-content: center; text-align: center;
	min-height: 52px; padding: 8px 3px;
	border: 1.5px solid var(--line); border-radius: var(--radius-sm);
	font-size: 12.5px; font-weight: 600; color: var(--muted);
	background: var(--white); cursor: pointer;
	transition: transform .12s ease, background .16s ease, color .16s ease, border-color .16s ease;
	-webkit-tap-highlight-color: transparent;
}
.opts label:active { transform: scale(.96); }
.opts input:focus-visible + label { outline: 3px solid var(--azul-300); outline-offset: 2px; }
.opts input:checked + label { color: var(--white); border-color: transparent; }
.opts input:checked + label[data-v="exc"] { background: var(--exc); }
.opts input:checked + label[data-v="bue"] { background: var(--bue); }
.opts input:checked + label[data-v="reg"] { background: var(--reg); }
.opts input:checked + label[data-v="mal"] { background: var(--mal); }

/* --- Opciones apiladas ---------------------------------------------------- */
.opts-stack { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.opts-stack.cols-1 { grid-template-columns: 1fr; }
.opts-stack input { position: absolute; opacity: 0; pointer-events: none; }
.opts-stack label {
	display: flex; align-items: center; justify-content: center; text-align: center;
	min-height: 52px; padding: 12px 12px;
	border: 1.5px solid var(--line); border-radius: var(--radius-sm);
	font-size: 14.5px; font-weight: 600; color: var(--ink); background: var(--white);
	cursor: pointer; transition: background .16s ease, border-color .16s ease, color .16s ease;
	-webkit-tap-highlight-color: transparent;
}
.opts-stack input:focus-visible + label { outline: 3px solid var(--azul-300); outline-offset: 2px; }
.opts-stack input:checked + label { background: var(--indigo); border-color: var(--indigo); color: var(--white); }

/* --- NPS 0-10 ------------------------------------------------------------- */
.nps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.nps input { position: absolute; opacity: 0; pointer-events: none; }
.nps label {
	display: flex; align-items: center; justify-content: center;
	min-height: 50px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
	font-size: 16px; font-weight: 700; color: var(--muted); background: var(--white);
	cursor: pointer; transition: transform .12s ease, background .16s ease, color .16s ease;
	-webkit-tap-highlight-color: transparent;
}
.nps label:active { transform: scale(.94); }
.nps input:focus-visible + label { outline: 3px solid var(--azul-300); outline-offset: 2px; }
.nps input:checked + label { color: var(--white); border-color: transparent; }
.nps input:checked + label[data-g="det"] { background: var(--mal); }
.nps input:checked + label[data-g="pas"] { background: var(--reg); }
.nps input:checked + label[data-g="pro"] { background: var(--ok); }
.nps-legend {
	display: flex; justify-content: space-between; margin-top: 10px;
	font-size: 11.5px; color: var(--muted); font-weight: 500;
}

/* --- Campos de texto ------------------------------------------------------ */
input[type="text"], input[type="tel"], input[type="email"], input[type="date"], textarea {
	width: 100%; font-family: var(--sans); font-size: 16px; color: var(--ink);
	background: var(--white); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
	padding: 13px 14px; -webkit-appearance: none; appearance: none;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px rgba(92,151,207,.18); }
::placeholder { color: #9AA1B5; }

.field + .field { margin-top: 14px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }

/* --- Consentimiento ------------------------------------------------------- */
.consent {
	display: flex; gap: 12px; align-items: flex-start;
	background: var(--azul-050); border: 1.5px solid var(--line);
	border-radius: var(--radius-sm); padding: 14px; margin-top: 6px;
}
.consent.has-error { border-color: var(--mal); background: #FEF6F6; }
.consent input { width: 22px; height: 22px; flex: 0 0 22px; margin: 1px 0 0; accent-color: var(--indigo); }
.consent label { font-size: 13.5px; color: var(--muted); line-height: 1.5; font-weight: 400; }
.consent a { font-weight: 600; }

/* --- Botones -------------------------------------------------------------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 9px;
	font-family: var(--sans); font-size: 15.5px; font-weight: 700;
	padding: 15px 22px; border-radius: 999px; border: 1.5px solid transparent;
	cursor: pointer; text-decoration: none; min-height: 52px;
	transition: background .16s ease, transform .12s ease, opacity .16s ease;
	-webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--indigo); color: var(--white); width: 100%; }
.btn-primary:hover { background: var(--indigo-700); }
.btn-primary[disabled] { opacity: .65; cursor: default; }
.btn-ghost { background: var(--white); color: var(--indigo); border-color: var(--line); }
.btn-wide { width: 100%; }

.navbar {
	position: sticky; bottom: 0; z-index: 26;
	background: rgba(255,255,255,.94);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	border-top: 1px solid var(--line);
	padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
	margin-top: 8px;
}
.navbar .wrap { display: flex; gap: 10px; }
.navbar .btn-ghost { flex: 0 0 auto; padding-left: 20px; padding-right: 20px; }
.navbar .btn-primary { flex: 1; }

/* --- Pie ------------------------------------------------------------------ */
.site-footer {
	background: var(--indigo-900); color: rgba(255,255,255,.72);
	padding: 30px 0 34px; margin-top: 30px; font-size: 13.5px;
}
.site-footer .name {
	font-family: var(--serif); font-size: 19px; color: var(--white);
	margin-bottom: 14px; font-weight: 700;
}
.site-footer ul { list-style: none; margin: 0 0 18px; padding: 0; }
.site-footer li { display: flex; gap: 11px; align-items: flex-start; padding: 7px 0; }
.site-footer a { color: var(--white); text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.28); }
.site-footer svg { flex: 0 0 18px; margin-top: 2px; opacity: .75; }
.site-footer .legal { border-top: 1px solid rgba(255,255,255,.14); padding-top: 16px; font-size: 12px; opacity: .8; }
.site-footer .legal a { border: 0; text-decoration: underline; }

/* --- Página de gracias ---------------------------------------------------- */
.thanks { text-align: center; padding: 40px 0 10px; }
.thanks-icon {
	width: 84px; height: 84px; margin: 0 auto 22px; border-radius: 50%;
	background: linear-gradient(140deg, var(--azul), var(--indigo));
	display: flex; align-items: center; justify-content: center; color: var(--white);
	box-shadow: 0 14px 30px rgba(63,63,149,.28);
	animation: pop .45s cubic-bezier(.2,.9,.3,1.4);
}
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.thanks h1 { font-size: 29px; color: var(--indigo-900); margin-bottom: 12px; }
.thanks p.lead { font-size: 16px; color: var(--muted); max-width: 44ch; margin: 0 auto 8px; }
.thanks .card { text-align: left; margin-top: 26px; }
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.contact-list li:first-child { border-top: 0; }
.contact-list svg { flex: 0 0 20px; margin-top: 2px; color: var(--azul); }
.contact-list a { text-decoration: none; font-weight: 600; }
.contact-list span.muted { color: var(--muted); font-weight: 400; display: block; font-size: 13px; }

/* --- Contenido editorial -------------------------------------------------- */
.page-body { padding-top: 26px; padding-bottom: 10px; }
.page-body h1 { font-size: 27px; color: var(--indigo-900); margin-bottom: 18px; }
.page-body .card h2 { font-family: var(--serif); font-size: 19px; color: var(--indigo-900); margin: 26px 0 8px; }
.page-body .card h2:first-child { margin-top: 0; }
.page-body .card p, .page-body .card li { font-size: 14.5px; color: var(--muted); }
.page-body .card ul { padding-left: 20px; }
.page-body .card li { margin-bottom: 6px; }

/* --- Estado de envío ------------------------------------------------------ */
.sending-note { font-size: 13px; color: var(--muted); text-align: center; margin-top: 10px; display: none; }
.is-sending .sending-note { display: block; }
.spinner {
	width: 18px; height: 18px; border-radius: 50%;
	border: 2.5px solid rgba(255,255,255,.35); border-top-color: var(--white);
	animation: spin .7s linear infinite; display: none;
}
.is-sending .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Pantallas grandes ---------------------------------------------------- */
@media (min-width: 600px) {
	.hero { padding: 46px 0 48px; }
	.hero h1 { font-size: 38px; }
	.card { padding: 26px 24px; }
	.site-header img { height: 44px; }
	.navbar { border-radius: var(--radius) var(--radius) 0 0; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
