/* =========================================================
   EVALUACIÓN INTEGRAL DEL BIENESTAR - INCyT
   styles.css  ·  v3 (estilo INCyT)
   ========================================================= */

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

:root {
  --blue:         #5b9bd5;
  --blue-dk:      #3a7ebf;
  --blue-lt:      #eef4fb;
  --text:         #333333;
  --text-mid:     #555555;
  --text-muted:   #888888;
  --border:       #e0e0e0;
  --bg:           #e8e8e8;
  --card-bg:      #ffffff;
  --danger:       #c0392b;
  --radius-sm:    4px;
  --radius:       6px;
  --shadow:       0 1px 6px rgba(0,0,0,.07);
}

body {
  font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── BARRA DE PROGRESO (tira fina, top of page) ──────────── */
.progress-strip {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: #e8e8e8;
  z-index: 200;
}
.progress-fill {
  height: 100%;
  background: var(--blue);
  transition: width .5s ease;
  width: 0%;
}

.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 10px 0;
}

.logo-container img {
  max-height: 80px;
  max-width: 100%;
  height: auto;
  width: auto;
  object-fit: contain;
}

/* ── MAIN LAYOUT ─────────────────────────────────────────── */
.survey-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* ── SECTIONS ────────────────────────────────────────────── */
.section { display: none; }
.section.active { display: block; }

/* ── CARD BASE ───────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 28px 36px 22px;
  border-bottom: 1px solid var(--border);
}
.card-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.card-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.scale-ref     { font-size: 12px; color: var(--text-muted); font-style: italic; margin-top: 2px; }
.section-subtitle { font-size: 14px; color: var(--text-mid); margin-top: 6px; line-height: 1.55; }

.card-body { padding: 20px 36px; }
.card-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 36px;
  border-top: 1px solid var(--border);
  background: #fafafa;
}

/* ── WELCOME PAGE (consentimiento) ───────────────────────── */
.welcome-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
}
.welcome-body {
  color: var(--text-mid);
  font-size: 15px;
  line-height: 1.8;
  text-align: justify;
}
.welcome-body p + p { margin-top: 14px; }

.welcome-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

.consent-checks {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── INTRO TEXT BOX ──────────────────────────────────────── */
.intro-text {
  background: #f8f9fa;
  border: none;
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 32px;
  font-size: 15px;
  line-height: 1.7;
  color: #495057;
}
.intro-text p + p { margin-top: 10px; }
.intro-text strong { font-weight: 600; color: #212529; }

/* ── QUESTION GROUPS ─────────────────────────────────────── */
.question-group { margin-bottom: 28px; }
.question-group.conditional { display: none; }
.question-group.conditional.visible { display: block !important; }

.question-label {
  display: block;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.55;
}
.question-label .required { color: var(--danger); margin-left: 2px; }
.question-label .hint {
  display: block;
  font-weight: 400;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}
.todo { color: #b85c00; font-size: 12px; font-weight: 400; }

.options-vertical { display: flex; flex-direction: column; gap: 8px; }

/* ── INPUTS ──────────────────────────────────────────────── */
.input-number, .input-select, .input-days, .input-time {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  transition: border-color .25s ease, box-shadow .25s ease, transform .2s ease;
  appearance: none;
  -webkit-appearance: none;
}
.input-number:focus, .input-select:focus,
.input-days:focus, .input-time:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(91,155,213,.15);
  transform: translateY(-1px);
}
.input-number, .input-select { width: 100%; max-width: 420px; display: block; }
.days-select { max-width: 200px; }
.input-days  { width: 70px; text-align: center; }
.input-time  { width: 70px; text-align: center; }

/* ── CUSTOM SELECT ───────────────────────────────────────── */
.custom-select {
  position: relative;
  max-width: 420px;
  user-select: none;
}
.custom-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  text-align: left;
  transition: border-color .25s, box-shadow .25s;
}
.custom-select-trigger:hover { border-color: var(--blue); }
.custom-select.open .custom-select-trigger {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(91,155,213,.15);
  border-radius: 8px 8px 0 0;
}
.custom-select-arrow {
  width: 18px; height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform .25s ease;
}
.custom-select.open .custom-select-arrow { transform: rotate(180deg); }

.custom-select-list {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--blue);
  border-top: none;
  border-radius: 0 0 8px 8px;
  list-style: none;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height .3s ease, opacity .2s ease;
  z-index: 50;
  box-shadow: 0 6px 16px rgba(0,0,0,.1);
}
.custom-select.open .custom-select-list {
  max-height: 320px;
  opacity: 1;
  overflow-y: auto;
}
.custom-select-list li {
  padding: 11px 14px;
  font-size: 14.5px;
  cursor: pointer;
  color: var(--text);
  transition: background .15s;
  border-bottom: 1px solid var(--border);
}
.custom-select-list li:last-child { border-bottom: none; }
.custom-select-list li:hover { background: var(--blue-lt); color: var(--blue-dk); }
.custom-select-list li.selected { background: var(--blue-lt); font-weight: 600; color: var(--blue-dk); }

/* ── RADIO / CHECKBOX OPTIONS ────────────────────────────── */
.option-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14.5px;
  line-height: 1.5;
  background: #fff;
  transition: border-color 75ms, background 75ms;
  will-change: border-color, background;
}
.option-label:hover { border-color: var(--blue); background: var(--blue-lt); }
.option-label input[type="radio"],
.option-label input[type="checkbox"] {
  accent-color: var(--blue);
  width: 16px; height: 16px;
  flex-shrink: 0;
}
.option-label:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-lt);
  font-weight: 600;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-mid);
}
.checkbox-label input[type="checkbox"] {
  accent-color: var(--blue);
  width: 17px; height: 17px;
  flex-shrink: 0;
  margin-top: 3px;
}
.inline-check { margin-top: 8px; color: var(--text-muted); font-size: 13.5px; }

/* ── DAYS / TIME INPUTS ──────────────────────────────────── */
.days-input, .time-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  color: var(--text-mid);
}

/* ── MATRIX TABLE ────────────────────────────────────────── */
.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 8px;
}
.matrix-table th {
  background: #f0f4f8;
  color: var(--text-mid);
  padding: 9px 8px;
  font-weight: 600;
  text-align: center;
  font-size: 12px;
  border-bottom: 2px solid var(--border);
}
.matrix-table th:first-child { text-align: left; padding-left: 12px; }
.matrix-table td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  vertical-align: middle;
}
.matrix-table td:first-child { text-align: left; padding-left: 12px; min-width: 200px; line-height: 1.5; }
.matrix-table tr:hover td { background: #f8fbff; }
.matrix-table input[type="radio"] { accent-color: var(--blue); width: 16px; height: 16px; cursor: pointer; }

/* ── SÍ/NO CARDS ─────────────────────────────────────────── */
.yn-options {
  display: flex;
  gap: 8px;
}
.yn-options .option-label {
  flex: 1;
  justify-content: center;
  font-weight: 600;
}

/* ── LIKERT SCALE ────────────────────────────────────────── */
.likert-options {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 8px;
  justify-content: center;
}
.likert-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 35px;
  max-width: 55px;
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  font-size: 8.5px;
  line-height: 1.1;
  background: #fff;
  transition: border-color 75ms, background 75ms;
  will-change: border-color, background;
  overflow: hidden;
  word-wrap: break-word;
}
.likert-option span {
  word-break: break-word;
  overflow-wrap: break-word;
}
.likert-option:hover { border-color: var(--blue); background: var(--blue-lt); }
.likert-option input[type="radio"] { accent-color: var(--blue); width: 16px; height: 16px; }
.likert-option:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-lt);
}

/* ── DIVIDER ─────────────────────────────────────────────── */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ── ERROR MESSAGES ──────────────────────────────────────── */
.error-msg {
  color: var(--danger);
  font-size: 12.5px;
  margin-top: 6px;
  min-height: 16px;
  font-weight: 500;
}

/* ── PLACEHOLDER NSE ─────────────────────────────────────── */
.placeholder-notice {
  background: #fffbf0;
  border: 1px dashed #e0a800;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #856404;
}

/* ── CORTE SCREENS ───────────────────────────────────────── */
.cut-screen { padding: 40px 16px; }
.cut-screen h2 { font-size: 22px; color: var(--text); margin-bottom: 14px; font-weight: 700; text-align: center; }
.cut-screen p  { color: var(--text-muted); font-size: 15px; margin: 0 0 10px; line-height: 1.7; text-align: justify; }
.cut-buttons   { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-top: 28px; }

/* ── FINAL SCREEN ────────────────────────────────────────── */
.final-screen { padding: 44px 16px; }
.final-screen h2 { font-size: 24px; color: var(--text); margin-bottom: 14px; font-weight: 700; text-align: center; }
.final-screen p  { color: var(--text-muted); font-size: 15px; margin: 0 0 10px; line-height: 1.75; text-align: justify; }
.dashboard-link { margin-top: 28px; padding: 20px 24px; background: var(--blue-lt); border: 1px solid #c0d8ef; border-radius: var(--radius); text-align: left; }
.dashboard-link p { color: var(--text); font-size: 15px; margin-bottom: 14px; }
.dashboard-link a { display: inline-block; background: var(--blue-dk); color: #fff; padding: 10px 20px; border-radius: var(--radius); font-size: 14px; font-weight: 600; text-decoration: none; }
.dashboard-link a:hover { opacity: 0.88; }

.results-box {
  background: var(--blue-lt);
  border: 1px solid #c0d8ef;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 28px auto;
  max-width: 480px;
  text-align: left;
}
.results-box h3  { color: var(--blue-dk); font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 14px; }
.result-item     { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.result-item:last-child { border-bottom: none; }
.result-score    { font-weight: 700; font-size: 20px; color: var(--blue-dk); }
.result-score small { font-size: 12px; color: var(--text-muted); }
.result-cat      { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── BOTONES ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 28px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { background: #dcdcdc !important; color: #888 !important; opacity: 1; cursor: not-allowed; transition: background 0.3s ease; }


.btn-primary   { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-dk); }
.btn-secondary { background: #eeeeee; color: #555; }
.btn-secondary:hover:not(:disabled) { background: #e0e0e0; }
.btn-success   { background: #3a7ebf; color: #fff; }
.btn-success:hover:not(:disabled) { background: #2c6098; }

/* ── MODAL CONSENTIMIENTO ────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  padding: 20px;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal-box {
  background: #fff;
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,.2);
  transform: translateY(12px);
  transition: transform .25s ease;
}
.modal-overlay.open .modal-box { transform: translateY(0); }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-mid);
}
.modal-body p + p { margin-top: 12px; }
.modal-body ul { padding-left: 22px; margin-top: 10px; }
.modal-body ul li { margin-bottom: 10px; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}
.consent-modal-link {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 620px) {
  .survey-main { padding: 16px 8px 80px; }
  .card-body { padding: 20px 16px; }
  .card-nav { padding: 16px; flex-direction: column-reverse; gap: 12px; }
  .card-nav .btn { width: 100%; justify-content: center; padding: 14px 20px; font-size: 16px; }
  .card-header { padding: 22px 16px 18px; }
  .matrix-table { font-size: 12px; }
  .matrix-table td:first-child { min-width: 100px; }
  .welcome-title { font-size: 26px; }
  
  /* Mejoras táctiles (Touch Targets) para Celular */
  .option-label { padding: 14px 16px; font-size: 15px; margin-bottom: 4px; }
  .option-label input[type="radio"], .option-label input[type="checkbox"] { width: 22px; height: 22px; }
  .checkbox-label { font-size: 15px; }
  .checkbox-label input[type="checkbox"] { width: 22px; height: 22px; }
  
  /* Evitar auto-zoom en iOS al tocar inputs */
  .input-number, .input-select, .input-days, .input-time, .custom-select-trigger, .custom-select-list li { font-size: 16px; }
  .input-number, .input-select { padding: 12px 14px; }
}
