/* =====================================================
   ISTB — Preregistro de Aspirantes
   Paleta: #0d1f3c (azul marino) · #1a3a6b · #fff · #f0f4ff
   ===================================================== */

:root {
  --istb-dark:    #0d1f3c;
  --istb-mid:     #1a3a6b;
  --istb-light:   #2e5fa3;
  --istb-accent:  #4a90d9;
  --istb-bg:      #f0f4fb;
  --istb-card:    #ffffff;
  --istb-border:  #d0daea;
  --istb-text:    #1c2d45;
  --istb-muted:   #5f7a9a;
  --istb-success: #0f7b4e;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 2px 8px rgba(13,31,60,.08);
  --shadow-md: 0 4px 20px rgba(13,31,60,.12);
  --shadow-lg: 0 8px 40px rgba(13,31,60,.16);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--istb-bg);
  color: var(--istb-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── HEADER ──────────────────────────────────────── */
.istb-header {
  background: linear-gradient(135deg, var(--istb-dark) 0%, var(--istb-mid) 100%);
  padding: 16px 0;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-sello {
  height: 52px;
  width: 52px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: .9;
}

.header-text {
  display: flex;
  flex-direction: column;
}

.inst-nombre {
  color: #fff;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .85;
  line-height: 1.2;
}

.inst-sigla {
  color: #fff;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 1;
}

.header-counter {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  color: #fff;
}

.header-counter .fa-users {
  font-size: 1.4rem;
  opacity: .8;
}

.header-counter > div {
  display: flex;
  flex-direction: column;
}

.counter-label {
  font-size: .72rem;
  opacity: .75;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.counter-value {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
}

/* ─── AVISO NO OFICIAL ───────────────────────────── */
.aviso-no-oficial {
  background: #fff3cd;
  border-bottom: 2px solid #ffc107;
  padding: 10px 0;
  font-size: .83rem;
  color: #664d03;
  text-align: center;
}

.aviso-no-oficial .container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.aviso-no-oficial .fa-triangle-exclamation {
  font-size: 1rem;
  flex-shrink: 0;
}

/* ─── MAIN ───────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 32px 0 48px;
}

.page-title {
  text-align: center;
  margin-bottom: 28px;
}

.page-title h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--istb-dark);
  margin-bottom: 8px;
}

.periodo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--istb-dark);
  color: #fff;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: .83rem;
  margin: 0;
}

/* ─── FORMULARIO INACTIVO ────────────────────────── */
.alert-inactivo {
  text-align: center;
  background: var(--istb-card);
  border: 2px dashed var(--istb-border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  max-width: 520px;
  margin: 0 auto;
  color: var(--istb-muted);
}

/* ─── WIZARD ────────────────────────────────────── */
.wizard-wrapper {
  max-width: 860px;
  margin: 0 auto;
}

/* Indicador pasos */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 28px;
  flex-wrap: nowrap;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.step-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #d0daea;
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .95rem;
  transition: all .3s;
}

.step-item span {
  font-size: .7rem;
  color: var(--istb-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.step-item.active .step-circle {
  background: var(--istb-dark);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(13,31,60,.15);
}

.step-item.active span { color: var(--istb-dark); font-weight: 700; }

.step-item.completado .step-circle {
  background: var(--istb-success);
  color: #fff;
}

.step-divider {
  flex: 1;
  height: 2px;
  background: #d0daea;
  max-width: 80px;
  margin: 0 4px;
  margin-bottom: 20px;
}

/* ─── WIZARD STEP ───────────────────────────────── */
.wizard-step {
  background: var(--istb-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 16px;
  display: none;
}

.wizard-step.active { display: block; }

.step-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--istb-dark) 0%, var(--istb-mid) 100%);
  color: #fff;
}

.step-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.step-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.step-header p {
  margin: 2px 0 0;
  font-size: .82rem;
  opacity: .8;
}

.step-body {
  padding: 24px;
}

/* ─── TIPO DOCUMENTO ─────────────────────────────── */
.doc-type-selector {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.doc-type-opt {
  flex: 1;
  min-width: 160px;
  border: 2px solid var(--istb-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--istb-muted);
  user-select: none;
}

.doc-type-opt input[type="radio"] { display: none; }

.doc-type-opt:hover {
  border-color: var(--istb-accent);
  color: var(--istb-dark);
}

.doc-type-opt.selected {
  border-color: var(--istb-dark);
  background: var(--istb-bg);
  color: var(--istb-dark);
  font-weight: 700;
}

/* ─── INPUT DOCUMENTO ───────────────────────────── */
.input-doc-group .form-control {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-align: center;
}

.doc-feedback {
  font-size: .85rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: none;
}

.doc-feedback.show { display: block; }

.doc-feedback.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.doc-feedback.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.doc-feedback.warning {
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffc107;
}

/* ─── BOTÓN ISTB ─────────────────────────────────── */
.btn-istb {
  background: linear-gradient(135deg, var(--istb-dark) 0%, var(--istb-mid) 100%);
  color: #fff;
  border: none;
  font-weight: 700;
  border-radius: var(--radius-md);
  transition: all .25s;
  letter-spacing: .02em;
}

.btn-istb:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--istb-mid) 0%, var(--istb-light) 100%);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(13,31,60,.25);
}

.btn-istb:disabled {
  background: #b0bdd0;
  cursor: not-allowed;
  color: #fff;
  transform: none;
}

.btn-outline-istb {
  border: 2px solid var(--istb-dark);
  color: var(--istb-dark);
  background: transparent;
  font-weight: 700;
  border-radius: var(--radius-md);
  padding: 10px 24px;
  transition: all .2s;
}

.btn-outline-istb:hover {
  background: var(--istb-dark);
  color: #fff;
}

/* ─── DOC BLOQUEADO ─────────────────────────────── */
.doc-bloqueado {
  background: #f0fff4;
  border: 1px solid #6ee7b7;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  font-size: .9rem;
}

/* ─── FORMULARIO ─────────────────────────────────── */
.form-control, .form-select {
  border: 2px solid var(--istb-border);
  border-radius: var(--radius-sm);
  transition: border-color .2s, box-shadow .2s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--istb-accent);
  box-shadow: 0 0 0 3px rgba(74,144,217,.15);
  outline: none;
}

.form-control.is-invalid, .form-select.is-invalid {
  border-color: #dc3545;
}

.input-group-text {
  background: var(--istb-bg);
  border: 2px solid var(--istb-border);
  color: var(--istb-muted);
}

.invalid-feedback {
  display: block;
  font-size: .8rem;
  color: #dc3545;
  margin-top: 4px;
}

/* ─── SEDE SECCIÓN ───────────────────────────────── */
.sede-seccion {}

.sede-titulo {
  color: var(--istb-dark);
  font-weight: 800;
  padding: 12px 0 8px;
  border-bottom: 2px solid var(--istb-border);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
}

/* ─── CARRERAS GRID ──────────────────────────────── */
.carreras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.carrera-card {
  border: 2px solid var(--istb-border);
  border-radius: var(--radius-md);
  padding: 14px;
  transition: border-color .2s, box-shadow .2s;
  background: var(--istb-card);
}

.carrera-card.seleccionada {
  border-color: var(--istb-dark);
  box-shadow: 0 0 0 3px rgba(13,31,60,.1);
}

.carrera-card:hover {
  border-color: var(--istb-accent);
}

.carrera-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--istb-dark), var(--istb-mid));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.carrera-nombre {
  font-weight: 700;
  color: var(--istb-dark);
  font-size: .92rem;
  margin-bottom: 6px;
  line-height: 1.3;
}

.carrera-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.badge-modalidad {
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge-modalidad.presencial {
  background: #dbeafe;
  color: #1e40af;
}

.badge-modalidad.dual {
  background: #fef3c7;
  color: #92400e;
}

.badge-ext {
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: #ede9fe;
  color: #5b21b6;
  text-transform: uppercase;
}

/* ─── JORNADAS ───────────────────────────────────── */
.jornadas-opciones {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.jornada-opt {
  display: block;
  cursor: pointer;
}

.jornada-opt input[type="radio"] { display: none; }

.jornada-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1.5px solid var(--istb-border);
  border-radius: var(--radius-sm);
  transition: all .2s;
  background: var(--istb-bg);
}

.jornada-opt:hover .jornada-inner {
  border-color: var(--istb-accent);
}

.jornada-opt input:checked + .jornada-inner {
  border-color: var(--istb-dark);
  background: #e8eef8;
}

.jornada-nombre {
  font-size: .82rem;
  font-weight: 600;
  color: var(--istb-dark);
  flex: 1;
}

.jornada-horario {
  font-size: .72rem;
  color: var(--istb-muted);
  white-space: nowrap;
}

/* ─── CUPOS BADGE ────────────────────────────────── */
.cupos-badge {
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: #d1fae5;
  color: #065f46;
  white-space: nowrap;
  min-width: 64px;
  text-align: center;
}

.cupos-badge.sin-cupos {
  background: #fee2e2;
  color: #991b1b;
}

.cupos-badge.pocos-cupos {
  background: #fef3c7;
  color: #92400e;
}

/* ─── CONFIRMACIÓN ───────────────────────────────── */
.confirmacion-wrapper {
  text-align: center;
  padding: 40px 32px;
}

.confirmacion-icono {
  font-size: 4rem;
  color: var(--istb-success);
  margin-bottom: 16px;
  animation: popIn .5s cubic-bezier(.175,.885,.32,1.275);
}

@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.confirmacion-titulo {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--istb-dark);
  margin-bottom: 8px;
}

.confirmacion-sub {
  color: var(--istb-muted);
  font-size: 1rem;
  margin-bottom: 20px;
}

.confirmacion-detalle {
  background: var(--istb-bg);
  border: 1px solid var(--istb-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  text-align: left;
  font-size: .9rem;
  margin-bottom: 8px;
}

.confirmacion-detalle table {
  width: 100%;
}

.confirmacion-detalle td:first-child {
  font-weight: 700;
  color: var(--istb-dark);
  width: 140px;
  padding: 3px 0;
}

.confirmacion-detalle td:last-child {
  color: var(--istb-text);
  padding: 3px 0;
}

/* ─── FOOTER ─────────────────────────────────────── */
.istb-footer {
  background: var(--istb-dark);
  color: rgba(255,255,255,.7);
  padding: 24px 0;
  font-size: .82rem;
  margin-top: auto;
}

/* ─── UTILITIES ──────────────────────────────────── */
.form-label { color: var(--istb-text); font-size: .88rem; }

/* ─── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 576px) {
  .inst-nombre { display: none; }
  .inst-sigla  { font-size: 1.3rem; }
  .logo-sello  { height: 42px; width: 42px; }
  .header-counter { padding: 8px 12px; }
  .counter-value { font-size: 1.2rem; }
  .step-body { padding: 16px; }
  .step-header { padding: 16px; }
  .carreras-grid { grid-template-columns: 1fr; }
  .wizard-wrapper { max-width: 100%; }
  .step-indicator { gap: 0; }
  .step-divider { max-width: 32px; }
  .step-item span { font-size: .6rem; }
  .confirmacion-wrapper { padding: 24px 16px; }
}

@media (max-width: 768px) {
  .page-title h1 { font-size: 1.35rem; }
  .carreras-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* ── ACORDEÓN v2 ──────────────────────────────────────── */
.acordeon-wrapper { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }

.acord-item {
  background: var(--istb-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--istb-border);
  overflow: hidden;
  transition: border-color .25s;
}
.acord-item.current  { border-color: var(--istb-accent); box-shadow: 0 0 0 3px rgba(74,144,217,.12), var(--shadow-md); }
.acord-item.done     { border-color: #6ee7b7; }
.acord-item.locked   { opacity: .55; pointer-events: none; }

.acord-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--istb-card);
  cursor: default;
  user-select: none;
}
.acord-item.done .acord-header { background: #f0fff8; }
.acord-item.current .acord-header { background: linear-gradient(135deg, var(--istb-dark) 0%, var(--istb-mid) 100%); }
.acord-item.current .acord-title  { color: #fff; }
.acord-item.current .acord-chevron{ color: rgba(255,255,255,.7); }

.num-circle {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--istb-border); color: var(--istb-muted);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .88rem; flex-shrink: 0;
  transition: all .3s;
}
.acord-item.current .num-circle { background: rgba(255,255,255,.25); color: #fff; }
.acord-item.done    .num-circle { background: #0f7b4e; color: #fff; }

.acord-title { flex: 1; font-weight: 700; font-size: .95rem; color: var(--istb-dark); display: flex; align-items: center; }
.acord-status { font-size: .78rem; color: #0f7b4e; font-weight: 600; }
.acord-chevron { color: var(--istb-muted); transition: transform .3s; font-size: .8rem; }
.acord-chevron.rotated { transform: rotate(180deg); }

/* Cuerpo del acordeón */
.acord-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .4s cubic-bezier(.4,0,.2,1);
}
.acord-body.open { max-height: 2400px; }
.acord-body-inner { padding: 20px 24px 24px; }

/* Grupos de campos */
.campos-grupo { }
.campos-grupo-label {
  font-size: .82rem;
  font-weight: 700;
  color: var(--istb-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── BOTONES FINALES ──────────────────────────────────── */
.botones-finales {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── CARRERA SELECCIONADA — resaltado fuerte ──────────── */
.jornada-opt input:checked + .jornada-inner {
  border-color: var(--istb-dark) !important;
  background: var(--istb-dark) !important;
}
.jornada-opt input:checked + .jornada-inner .jornada-nombre,
.jornada-opt input:checked + .jornada-inner .jornada-horario {
  color: #fff !important;
}
.jornada-opt input:checked + .jornada-inner .cupos-badge {
  background: rgba(255,255,255,.2);
  color: #fff;
}

.carrera-card.seleccionada {
  border-color: var(--istb-dark) !important;
  background: #e8eef8 !important;
  box-shadow: 0 0 0 3px rgba(13,31,60,.15), var(--shadow-md);
}
.carrera-card.seleccionada .carrera-nombre { color: var(--istb-dark); }

/* ── CONFIRMACIÓN ─────────────────────────────────────── */
.confirmacion-wrapper { max-width: 680px; margin: 0 auto; text-align: center; padding: 40px 24px; }
