/* ═══════════════════════════════════════════════
   DIAGNÓSTICO CIUDADANO — ENCUESTA WIZARD STYLES
   ═══════════════════════════════════════════════ */
:root {
  --bg:          #121212;
  --card:        #1e1e1e;
  --card2:       #272727;
  --border:      #333333;
  --border2:     #444444;
  --green:       #5AC451;
  --green-dim:   rgba(90, 196, 81, 0.14);
  --green-dark:  #46a03d;
  --red:         #E53935;
  --red-dim:     rgba(229, 57, 53, 0.12);
  --text:        #ffffff;
  --text2:       #aaaaaa;
  --text3:       #666666;
  --radius:      12px;
  --radius-sm:   8px;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── HEADER ─────────────────────────────────────────── */
.enc-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(18, 18, 18, 0.97);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px 10px;
}

.enc-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.enc-logo {
  width: 30px;
  height: 30px;
  background: var(--green);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #000;
  flex-shrink: 0;
  line-height: 1;
}

.enc-brand-text { flex: 1; min-width: 0; }

.enc-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.enc-subtitle {
  font-size: 11px;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── PROGRESS ────────────────────────────────────────── */
.progress-wrap {}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 6px;
}

.progress-pct { font-weight: 600; color: var(--green); }

.progress-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.35s ease;
  width: 12.5%; /* 1/8 */
}

.progress-dots {
  display: flex;
  gap: 4px;
  margin-top: 7px;
}

.pdot {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  transition: background 0.25s;
}

.pdot.done   { background: var(--green); }
.pdot.active { background: var(--green); opacity: 0.45; }

/* ── MAIN ────────────────────────────────────────────── */
.enc-main {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

/* ── BLOCK ───────────────────────────────────────────── */
.enc-block {
  display: none;
}

.enc-block.active {
  display: block;
  animation: blockIn 0.28s ease;
}

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

.block-header { margin-bottom: 28px; }

.block-icon { font-size: 36px; display: block; margin-bottom: 8px; line-height: 1; }

.block-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
  letter-spacing: -0.3px;
}

.block-subtitle {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
}

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

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 11px;
  line-height: 1.45;
}

.req { color: var(--red); margin-left: 2px; font-weight: 400; }

.field-hint {
  font-size: 12px;
  color: var(--text3);
  margin-top: 7px;
  line-height: 1.4;
}

.field-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 7px;
  display: none;
}

.field.has-error .field-error { display: block; }

/* ── TEXT INPUT / SELECT / TEXTAREA ──────────────────── */
.enc-input,
.enc-select,
.enc-textarea {
  width: 100%;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 13px 15px;
  transition: border-color 0.2s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.enc-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}

.enc-textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

.enc-input:focus,
.enc-select:focus,
.enc-textarea:focus { border-color: var(--green); }

.enc-input::placeholder,
.enc-textarea::placeholder { color: var(--text3); }

.field.has-error .enc-input,
.field.has-error .enc-select,
.field.has-error .enc-textarea { border-color: var(--red); }

/* ── SCALE (1-10 / 0-10) ─────────────────────────────── */
.scale-row {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
}

.scale-row.nps {
  grid-template-columns: repeat(11, 1fr);
}

.scale-btn {
  aspect-ratio: 1;
  min-height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.scale-btn:hover {
  border-color: var(--border2);
  color: var(--text);
}

.scale-btn.selected {
  background: var(--green);
  border-color: var(--green);
  color: #000;
  font-weight: 700;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text3);
  margin-top: 6px;
  padding: 0 2px;
}

/* ── OPTION BUTTONS ──────────────────────────────────── */
.opts-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
}

.opts-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.opts-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.opts-grid.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.opt-btn {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 11px 13px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  line-height: 1.35;
  word-break: break-word;
}

.opt-btn:hover {
  border-color: var(--border2);
  background: var(--card2);
}

.opt-btn.selected {
  border-color: var(--green);
  background: var(--green-dim);
  color: var(--text);
}

.field.has-error .opts-grid .opt-btn:not(.selected) {
  border-color: var(--red);
}

/* ── TAG BUTTONS (multi-select) ──────────────────────── */
.tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-btn {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  color: var(--text2);
  font-family: inherit;
  font-size: 13px;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  white-space: nowrap;
}

.tag-btn:hover {
  border-color: var(--border2);
  color: var(--text);
}

.tag-btn.selected {
  border-color: var(--green);
  background: var(--green-dim);
  color: var(--text);
}

/* ── CONDITIONAL FIELD ───────────────────────────────── */
.cond-field {
  display: none;
  margin-bottom: 28px;
}

.cond-field.visible { display: block; }

/* ── INFO BOX ────────────────────────────────────────── */
.info-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
  margin-bottom: 20px;
}

/* ── CHECKBOX ────────────────────────────────────────── */
.checkbox-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.checkbox-wrap:has(input:checked) {
  border-color: var(--green);
  background: var(--green-dim);
}

.field.has-error .checkbox-wrap { border-color: var(--red); }

.checkbox-wrap input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: var(--green);
  cursor: pointer;
  margin-top: 1px;
}

.checkbox-label {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
}

/* ── NAVIGATION ──────────────────────────────────────── */
.enc-nav {
  display: flex;
  gap: 10px;
  margin-top: 36px;
}

.btn-prev {
  flex: 0 0 auto;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 14px 18px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-prev:hover { border-color: var(--border2); color: var(--text); }

.btn-next,
.btn-submit {
  flex: 1;
  background: var(--green);
  border: none;
  border-radius: var(--radius-sm);
  color: #000;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 14px 20px;
  cursor: pointer;
  transition: background 0.15s, transform 0.08s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-next:hover,
.btn-submit:hover { background: var(--green-dark); }

.btn-next:active,
.btn-submit:active { transform: scale(0.98); }

.btn-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* ── THANK YOU ───────────────────────────────────────── */
#enc-thankyou {
  display: none;
  text-align: center;
  padding: 48px 20px 64px;
}

#enc-thankyou.visible {
  display: block;
  animation: blockIn 0.35s ease;
}

.ty-icon { font-size: 72px; display: block; margin-bottom: 20px; line-height: 1; }

.ty-title {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.3px;
}

.ty-text {
  font-size: 15px;
  color: var(--text2);
  max-width: 380px;
  margin: 0 auto 32px;
  line-height: 1.65;
}

.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #25D366;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 14px 26px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.08s;
}

.btn-whatsapp:hover { background: #1db954; }
.btn-whatsapp:active { transform: scale(0.98); }

.ty-back {
  display: block;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text3);
  text-decoration: none;
}

.ty-back:hover { color: var(--text2); }

/* ── SPINNER ─────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0,0,0,0.25);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 380px) {
  .block-title { font-size: 19px; }

  .scale-row { gap: 3px; }
  .scale-btn  { font-size: 11px; min-height: 30px; }

  .opts-grid.cols-3 { grid-template-columns: 1fr 1fr; }
  .opts-grid.cols-4 { grid-template-columns: 1fr 1fr; }

  .opt-btn { font-size: 12px; padding: 10px 11px; }
}

@media (min-width: 480px) {
  .enc-main { padding: 28px 24px 64px; }
  .enc-header { padding: 14px 24px 12px; }
  .scale-btn { font-size: 14px; min-height: 42px; }
}

/* ── LANDING ─────────────────────────────────────────── */
.enc-landing {
  padding: 48px 8px 24px;
  text-align: center;
}

.landing-icon {
  font-size: 56px;
  display: block;
  margin-bottom: 16px;
  line-height: 1;
}

.landing-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 18px;
  line-height: 1.2;
}

.landing-lead {
  font-size: 15px;
  color: var(--text2);
  line-height: 1.65;
  max-width: 400px;
  margin: 0 auto 24px;
}

.landing-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 auto 32px;
  max-width: 240px;
  text-align: left;
}

.landing-bullet {
  font-size: 13px;
  color: var(--text2);
  padding-left: 22px;
  position: relative;
}

.landing-bullet::before {
  content: '✓';
  color: var(--green);
  font-weight: 700;
  position: absolute;
  left: 0;
}

.btn-start {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--green);
  border: none;
  border-radius: var(--radius-sm);
  color: #000;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  padding: 16px 40px;
  cursor: pointer;
  transition: background 0.15s, transform 0.08s;
}

.btn-start:hover  { background: var(--green-dark); }
.btn-start:active { transform: scale(0.98); }

/* ── ENTRY MODE: hide progress for landing/municipio/barrio ── */
.enc-header.entry-mode .progress-wrap { display: none; }

/* ── SELECT LARGE ─────────────────────────────────────── */
.enc-select--large {
  font-size: 16px;
  padding: 16px 38px 16px 15px;
}

/* ── PROGRESS STEP NAME ──────────────────────────────── */
.progress-step-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}

@media (min-width: 480px) {
  .landing-title { font-size: 28px; }
}

/* ── TIEMPO RESTANTE ─────────────────────────────────── */
#tiempo-restante {
  display: block;
  font-size: 11px;
  color: var(--text3);
  text-align: right;
  margin-top: 5px;
}

/* ── ERROR FLASH ─────────────────────────────────────── */
.has-error { animation: errorFlash 0.5s ease; }

@keyframes errorFlash {
  0%, 100% { background: transparent; }
  50%       { background: rgba(229, 57, 53, 0.1); }
}

/* ── SKIP TOAST ──────────────────────────────────────── */
#skip-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  border: 1px solid var(--green);
  color: var(--text);
  font-size: 13px;
  padding: 11px 20px;
  border-radius: var(--radius);
  z-index: 9999;
  white-space: nowrap;
  display: none;
  animation: toastIn 0.3s ease;
}

#skip-toast.visible { display: block; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── RESUMEN RESPUESTAS ───────────────────────────────── */
#resumen-respuestas {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--text2);
  line-height: 1.7;
}

#resumen-respuestas strong {
  color: var(--text);
  font-weight: 600;
}

.resumen-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.resumen-row:last-child { border-bottom: none; }

.resumen-label { color: var(--text3); }
.resumen-val   { color: var(--text); font-weight: 600; text-align: right; }
