/* ============================================================
   cuestionario-qbs · estilos
   Identidad Más Que Barrios: fondo negro, logo rojo+cyan+blanco,
   tipografía outlined.
   ============================================================ */

:root {
  --bg:           #000000;
  --surface:      #0E0E0E;
  --surface-2:    #161616;
  --border:       #2A2A2A;
  --border-hi:    #404040;
  --text:         #FFFFFF;
  --text-dim:     #B8B8B8;
  --text-muted:   #6B6B6B;
  --accent-red:   #ED1B2D;
  --accent-red-h: #FF2C3F;
  --accent-cyan:  #2BC0EF;
  --accent-cyan-h:#5CD2F4;
  --error:        #FF6B6B;
  --max-w:        640px;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ----- Topbar ----- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.logo {
  height: 140px;
  width: auto;
  max-width: 100%;
  align-self: center;
  display: block;
  /* Compensar el desbalance optico: el "i" pequeno tira del bbox a la izquierda
     pero el peso visual de las letras esta a la derecha. */
  transform: translateX(-5%);
}

.progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
}

.progress__label {
  font-family: 'Inter', system-ui;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.progress__bar {
  height: 3px;
  background: var(--surface-2);
  position: relative;
}

.progress__fill {
  height: 100%;
  width: 0%;
  background: var(--accent-red);
  transition: width 220ms ease;
}

/* ----- Main ----- */
main {
  flex: 1;
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px 96px;
}

.screen {
  animation: fadeIn 240ms ease;
}

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

/* ----- Tipografía ----- */
.eyebrow {
  font-family: 'Bebas Neue', system-ui;
  font-size: 22px;
  letter-spacing: 0.14em;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.display {
  font-family: 'Bebas Neue', system-ui;
  font-size: clamp(56px, 12vw, 92px);
  line-height: 0.92;
  letter-spacing: 0.005em;
  color: var(--text);
  margin-bottom: 36px;
}

.section-title {
  font-family: 'Bebas Neue', system-ui;
  font-size: clamp(44px, 9vw, 68px);
  line-height: 0.94;
  margin-bottom: 8px;
}

.section-sub {
  color: var(--text-dim);
  font-size: 15px;
  margin-bottom: 36px;
}

.intro {
  margin-bottom: 32px;
}
.intro--inline {
  margin-top: 8px;
  margin-bottom: 36px;
}

.intro p {
  margin-bottom: 18px;
  color: var(--text-dim);
}

.signature {
  font-family: 'Bebas Neue', system-ui;
  font-size: 22px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-red);
  margin-bottom: 44px;
}

/* ----- Fields ----- */
.field {
  margin-bottom: 28px;
}

.field label,
.field legend {
  display: block;
  font-family: 'Inter', system-ui;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.4;
}

.field .optional {
  color: var(--text-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
}

.field-help,
.scale-help {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  margin-top: -4px;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="number"],
.field textarea,
.field select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  padding: 14px 16px;
  min-height: 56px;
  outline: none;
  transition: border-color 180ms;
  appearance: none;
  border-radius: 0;
}

.field textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.55;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-muted);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent-cyan);
}

.field input:user-invalid,
.field textarea:user-invalid {
  border-color: var(--error);
}

/* ----- Choice (radio sí/no) ----- */
.field--choice fieldset,
fieldset.field--choice {
  border: none;
  padding: 0;
}

.field--choice legend {
  letter-spacing: 0.01em;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.45;
}

.choice {
  display: flex;
  gap: 12px;
}

.choice input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice label {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  font-family: 'Bebas Neue', system-ui;
  font-size: 24px;
  letter-spacing: 0.08em;
  text-transform: none;
  margin: 0;
  transition: border-color 180ms, background 180ms, color 180ms;
}

.choice label:hover {
  border-color: var(--border-hi);
}

.choice input[type="radio"]:focus-visible + label {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

.choice input[type="radio"]:checked + label {
  border-color: var(--accent-cyan);
  background: rgba(43, 192, 239, 0.12);
  color: var(--accent-cyan);
}

/* ----- Conditional block (sección 4) ----- */
.conditional {
  padding-top: 8px;
  padding-bottom: 12px;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  margin-bottom: 28px;
  margin-top: -8px;
}

.conditional .field:last-child {
  margin-bottom: 4px;
}

/* ----- Scale 1–10 ----- */
.field--scale {
  margin-bottom: 36px;
}

.scale {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 8px 0;
}

.scale__num {
  font-family: 'Bebas Neue', system-ui;
  font-size: 22px;
  color: var(--text-dim);
}

.scale__value {
  display: block;
  font-family: 'Bebas Neue', system-ui;
  font-size: 64px;
  line-height: 1;
  text-align: center;
  color: var(--accent-red);
  margin-top: 12px;
}

.scale input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  height: 32px;
  cursor: pointer;
}

.scale input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--border-hi);
}
.scale input[type="range"]::-moz-range-track {
  height: 4px;
  background: var(--border-hi);
  border: none;
}

.scale input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  margin-top: -14px;
  width: 32px;
  height: 32px;
  background: var(--accent-red);
  border: 3px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4);
}
.scale input[type="range"]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  background: var(--accent-red);
  border: 3px solid #fff;
  border-radius: 50%;
  cursor: pointer;
}

.scale input[type="range"]:focus-visible::-webkit-slider-thumb {
  outline: 3px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* ----- Buttons ----- */
.btn {
  font-family: 'Bebas Neue', system-ui;
  font-size: 24px;
  letter-spacing: 0.08em;
  padding: 14px 28px;
  min-height: 56px;
  border: 1px solid;
  background: transparent;
  cursor: pointer;
  transition: background 180ms, border-color 180ms, color 180ms;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-transform: uppercase;
  appearance: none;
}

.btn:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--accent-red);
  border-color: var(--accent-red);
  color: #fff;
}
.btn--primary:hover:not([disabled]) {
  background: var(--accent-red-h);
  border-color: var(--accent-red-h);
}

.btn--ghost {
  background: transparent;
  border-color: var(--border-hi);
  color: var(--text);
}
.btn--ghost:hover {
  border-color: var(--text);
}

.btn--block {
  width: 100%;
}

.btn--small {
  font-size: 16px;
  padding: 8px 16px;
  min-height: 40px;
  letter-spacing: 0.06em;
}

.nav {
  display: flex;
  gap: 12px;
  margin-top: 44px;
}

.nav .btn--ghost { flex: 0 0 auto; min-width: 120px; }
.nav .btn--primary { flex: 1; }

/* ----- Repaso ----- */
.review { margin-bottom: 16px; }

.review-section {
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 16px;
  padding: 20px 22px 18px;
}

.review-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.review-section__title {
  font-family: 'Bebas Neue', system-ui;
  font-size: 28px;
  letter-spacing: 0.06em;
  color: var(--text);
}

.review-section__edit {
  font-family: 'Inter', system-ui;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  background: transparent;
  border: 1px solid var(--accent-cyan);
  padding: 6px 12px;
  cursor: pointer;
  transition: background 180ms, color 180ms;
}
.review-section__edit:hover {
  background: var(--accent-cyan);
  color: var(--bg);
}

.review-item {
  margin-bottom: 14px;
}
.review-item:last-child { margin-bottom: 0; }

.review-item__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.review-item__value {
  font-size: 16px;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.review-item__value--empty {
  color: var(--text-muted);
  font-style: italic;
}

.submit-error {
  border: 1px solid var(--error);
  background: rgba(255, 107, 107, 0.08);
  color: var(--error);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 15px;
  line-height: 1.5;
}

/* ----- Save toast ----- */
.save-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--accent-cyan);
  color: #000;
  font-family: 'Inter', system-ui;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 14px;
  z-index: 20;
  animation: toastIn 200ms ease;
}

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

/* ----- Responsive ----- */
@media (max-width: 480px) {
  .topbar { padding: 8px 16px 10px; }
  .logo { height: 116px; }
  main { padding: 32px 20px 80px; }
  .display { font-size: clamp(44px, 12vw, 64px); }
  .signature { letter-spacing: 0.14em; font-size: 19px; }
  .btn { font-size: 22px; }
  .save-toast { bottom: 16px; right: 16px; }
  .scale__value { font-size: 54px; }
  .review-section { padding: 18px 18px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
