/* =========================================================
   ENTRECOLEGAS - EXÁMENES (NIVELES + DETALLE)
   ========================================================= */

/* ===== MAIN GENERAL ===== */
.exam-main {
  padding: 132px var(--space-3) var(--space-8);
  background:
    radial-gradient(circle at 10% 8%, rgba(59, 130, 246, 0.04), transparent 0 22%),
    linear-gradient(180deg, #f8fbff 0%, #f9fafb 100%);
  min-height: 100vh;
}

.exam-container {
  max-width: 1260px;
  margin: 0 auto;
  padding: 0 var(--space-3);
}

.exam-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  align-items: start;
}

.exam-content,
.exam-sidebar {
  min-width: 0;
}

/* ===== TRANSICIÓN CONTENEDORES ===== */
#contenedor-niveles,
#contenedor-simulacros {
  padding: 0;
  opacity: 0;
  animation: fadeInPage 0.4s ease forwards;
}

#contenedor-niveles.loaded,
#contenedor-simulacros.loaded {
  opacity: 1;
}

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

/* =========================================================
   TÍTULO PRINCIPAL (NIVELES)
   ========================================================= */
.titulo-niveles-principal {
  color: var(--dark-text);
  font-size: clamp(1.85rem, 3vw, 2.35rem);
  font-weight: 800;
  text-align: center;
  margin: 0 0 var(--space-6);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.titulo-niveles-principal span {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitulo-concurso {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-2);
  color: var(--primary-dark);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 800;
  margin: var(--space-7) 0 var(--space-8);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid rgba(129, 179, 240, 0.35);
  line-height: 1.2;
}

.subtitulo-concurso i {
  color: var(--primary);
}

/* =========================================================
   FILTROS TIPO (NIVELES DISPONIBLES)
   ========================================================= */
.filtros-tipo-wrapper {
  margin-bottom: 0;
}

.filtros-tipo-botones {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  justify-content: flex-start;
}

.btn-filtro-tipo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.68rem 1rem;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(209, 213, 219, 0.95);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--medium-text);
  cursor: pointer;
  text-align: center;
  transition: transform 0.18s ease, border-color 0.18s ease,
              color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn-filtro-tipo:hover {
  border-color: rgba(59, 130, 246, 0.45);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.04);
}

.btn-filtro-tipo.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-color: var(--primary);
  color: var(--white);
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.16);
}

.tipo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
}

.btn-filtro-tipo.active .tipo-badge {
  background: rgba(255, 255, 255, 0.2);
}

.tipo-ebr,
.tipo-ebe,
.tipo-eba {
  color: inherit;
}

/* =========================================================
   GRID DE NIVELES (VISTA 1)
   ========================================================= */
.grid-simulacros {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: var(--space-8);
}

/* Tarjeta nivel */
.tarjeta-nivel {
  background: var(--white);
  border: 1px solid rgba(209, 213, 219, 0.88);
  border-radius: 20px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.045);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(12px);
}

.tarjeta-nivel.fade-in {
  animation: cardFadeIn 0.4s ease forwards;
}

@keyframes cardFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tarjeta-nivel:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.065);
  border-color: rgba(59, 130, 246, 0.34);
}

.tarjeta-nivel:active {
  transform: translateY(-1px);
}

.tarjeta-clickeable {
  cursor: pointer;
}

.tarjeta-icono {
  width: 62px;
  height: 62px;
  margin: var(--space-5) auto var(--space-3);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  color: var(--gray-900);
  font-size: 1.6rem;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.06);
  transition: transform 0.22s ease, background 0.22s ease, color 0.22s ease, border-color 0.22s ease;
}

.tarjeta-nivel:hover .tarjeta-icono {
  transform: scale(1.03);
  background: var(--gray-200);
  color: var(--gray-900);
  border-color: var(--gray-300);
}

.tarjeta-contenido {
  padding: 0 var(--space-4);
  flex: 1;
  text-align: center;
}

.badge-cuadernillos {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.68rem;
  margin-bottom: var(--space-3);
  border-radius: 999px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  color: #075985;
  font-size: 0.74rem;
  font-weight: 800;
  border: 1px solid rgba(125, 211, 252, 0.78);
  line-height: 1.1;
}

.badge-cuadernillos i {
  color: #0284c7;
}

.tarjeta-titulo {
  font-size: clamp(1.32rem, 1.9vw, 1.64rem);
  font-weight: 800;
  color: var(--dark-text);
  margin-bottom: var(--space-2);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.tarjeta-descripcion {
  font-size: 0.92rem;
  color: var(--medium-text);
  line-height: 1.55;
  margin-bottom: var(--space-4);
}

.tarjeta-descripcion strong {
  color: var(--primary);
  font-weight: 700;
}

.tarjeta-detalles {
  list-style: none;
  padding: var(--space-4);
  margin: 0 0 var(--space-4);
  background: #f8fbff;
  border: 1px solid rgba(226, 232, 240, 0.94);
  border-radius: 16px;
  text-align: left;
}

.tarjeta-detalles li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.89rem;
  color: var(--medium-text);
  margin-bottom: 0.62rem;
  line-height: 1.4;
}

.tarjeta-detalles li:last-child {
  margin-bottom: 0;
}

.tarjeta-detalles i {
  width: 16px;
  flex-shrink: 0;
  color: var(--primary);
  font-size: 0.92rem;
}

.tarjeta-detalles strong {
  color: var(--dark-text);
  font-weight: 700;
}

.tarjeta-footer {
  padding: 0 var(--space-4) var(--space-4);
}

.btn-ver-simulacros {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0.82rem 1rem;
  border-radius: 999px;
  background: var(--gray-800);
  border: 1px solid var(--gray-800);
  color: var(--white);
  font-weight: 700;
  font-size: 0.93rem;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease,
              background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn-ver-simulacros:hover {
  transform: translateY(-2px);
  background: var(--gray-900);
  border-color: var(--gray-900);
  color: var(--primary);
  box-shadow: 0 11px 20px rgba(17, 24, 39, 0.22);
}

.btn-ver-simulacros span,
.btn-ver-simulacros i {
  color: inherit;
  transition: transform 0.18s ease, color 0.18s ease;
}

.btn-ver-simulacros:hover i {
  transform: translateX(4px);
}

/* =========================================================
   HERO / DETALLE (VISTA 2)
   ========================================================= */
.banner-hero {
  margin-bottom: var(--space-5);
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,251,255,0.98) 100%);
  border: 1px solid rgba(209, 213, 219, 0.88);
  border-radius: 20px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.banner-hero-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.banner-header-with-back {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 0.58rem 0.9rem;
  background: #f8fbff;
  border: 1px solid rgba(129, 179, 240, 0.35);
  border-radius: 999px;
  color: var(--primary-dark);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.btn-back:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.45);
  background: #eef6ff;
}

.banner-hero-title {
  margin: 0;
  color: var(--dark-text);
  font-size: clamp(1.38rem, 2.2vw, 1.82rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.badge-tipo-banner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.42rem;
  padding: 0.26rem 0.56rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  vertical-align: middle;
}

.banner-hero-subtitle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  color: var(--medium-text);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
}

.banner-hero-subtitle i {
  color: var(--primary);
}

/* =========================================================
   FILTROS DETALLE (por año/área)
   ========================================================= */
.filtros-examenes {
  background: var(--white);
  border: 1px solid rgba(209, 213, 219, 0.88);
  border-radius: 18px;
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.filtro-grupo {
  margin-bottom: var(--space-4);
}

.filtro-grupo:last-child {
  margin-bottom: 0;
}

.filtro-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 0.55rem;
  color: var(--dark-text);
  font-size: 0.92rem;
  font-weight: 700;
}

.filtro-label i {
  color: var(--primary);
}

.input-buscar {
  width: 100%;
  min-height: 42px;
  padding: 0.75rem 0.95rem;
  border: 1px solid rgba(209, 213, 219, 0.95);
  border-radius: 14px;
  font-size: 0.94rem;
  font-weight: 600;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-buscar:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.58);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.08);
}

.botones-filtro {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  justify-content: center;
}

.btn-filtro {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.68rem 1rem;
  background: var(--gray-100);
  border: 1px solid rgba(209, 213, 219, 0.88);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--medium-text);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease,
              background 0.18s ease, color 0.18s ease;
}

.btn-filtro:hover {
  background: var(--white);
  border-color: rgba(129, 179, 240, 0.85);
  transform: translateY(-1px);
}

.btn-filtro.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-color: var(--primary);
  color: var(--white);
}

/* =========================================================
   SECCIONES POR AÑO (DETALLE)
   ========================================================= */
.seccion-anio {
  margin-bottom: var(--space-5);
}

.anio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 0.86rem 0.95rem;
  margin-bottom: var(--space-3);
  background: var(--white);
  border: 1px solid rgba(209, 213, 219, 0.88);
  border-radius: 16px;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04);
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.anio-header:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.34);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.05);
}

.anio-header.expandido {
  border-color: rgba(59, 130, 246, 0.34);
}

.anio-titulo {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.58rem;
  min-width: 0;
  color: var(--dark-text);
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.2;
}

.anio-titulo i {
  color: var(--primary);
  font-size: 0.92rem;
}

.anio-contador {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  background: #eef6ff;
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

.anio-toggle {
  color: var(--primary);
  font-size: 0.88rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.anio-header.expandido .anio-toggle {
  transform: rotate(180deg);
}

.examenes-lista {
  display: none;
}

.examenes-lista.expandido {
  display: block;
}

/* =========================================================
   GRID DE EXÁMENES (DETALLE)
   ========================================================= */
.examenes-lista .grid-simulacros {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.tarjeta-simulacro {
  background: var(--white);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid rgba(229, 231, 235, 0.94);
  opacity: 0;
  transform: translateY(14px);
}

.tarjeta-simulacro.fade-in {
  animation: cardFadeIn 0.4s ease forwards;
}

.tarjeta-simulacro:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.07);
  border-color: rgba(59, 130, 246, 0.35);
}

.tarjeta-imagen-wrapper {
  position: relative;
  width: 100%;
  height: 190px;
  overflow: hidden;
  background: var(--gray-100);
}

.imagen-simulacro {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tarjeta-overlay {
  display: none;
}

.info-simulacro {
  padding: var(--space-4);
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.simulacro-titulo {
  color: var(--dark-text);
  margin: 0 0 var(--space-2);
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.22;
}

.simulacro-descripcion {
  color: var(--medium-text);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.52;
  margin: 0 0 var(--space-4);
  flex-grow: 1;
}

.simulacro-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--space-4);
  padding: 0.75rem 0.82rem;
  background: #f8fbff;
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: 14px;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--medium-text);
  line-height: 1.2;
}

.meta-item i {
  color: var(--primary);
  font-size: 0.88rem;
}

.tarjeta-acciones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: var(--space-4);
}

.tarjeta-simulacro .btn-tarjeta {
  flex: 1;
  min-height: 42px;
  padding: 0.78rem 0.88rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  transition: transform 0.18s ease, box-shadow 0.18s ease,
              border-color 0.18s ease, background 0.18s ease;
}

.tarjeta-simulacro .btn-tarjeta span,
.tarjeta-simulacro .btn-tarjeta i {
  color: inherit;
  transition: color 0.18s ease, transform 0.18s ease;
}

.tarjeta-simulacro .btn-descargar {
  background: var(--white);
  color: var(--gray-900);
  border-color: var(--gray-300);
}

.tarjeta-simulacro .btn-descargar:hover {
  transform: translateY(-1px);
  background: var(--gray-100);
  border-color: var(--gray-400);
  color: var(--gray-900);
}

.tarjeta-simulacro .btn-ver {
  background: var(--gray-800);
  color: var(--white);
  border-color: var(--gray-800);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.18);
}

.tarjeta-simulacro .btn-ver:hover {
  transform: translateY(-2px);
  background: var(--gray-900);
  border-color: var(--gray-900);
  color: var(--primary);
  box-shadow: 0 11px 20px rgba(17, 24, 39, 0.22);
}



/* =========================================================
   SKELETON + MENSAJES
   ========================================================= */
.skeleton-card {
  pointer-events: none;
  border-color: transparent;
}

.skeleton-header,
.skeleton-text,
.skeleton-button {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s infinite;
  border-radius: var(--radius-lg);
}

@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-header {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  margin: var(--space-5) auto var(--space-3);
}

.skeleton-text {
  height: 14px;
  margin: 0 var(--space-4) var(--space-3);
}

.skeleton-text.short {
  width: 60%;
  margin-left: auto;
  margin-right: auto;
}

.skeleton-button {
  height: 44px;
  margin: var(--space-4);
  border-radius: 999px;
}

.mensaje-estado {
  max-width: 640px;
  margin: var(--space-7) auto;
  padding: var(--space-7);
  text-align: center;
  border-radius: 20px;
  background: var(--white);
  border: 1px solid rgba(229, 231, 235, 0.9);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.mensaje-estado i {
  display: block;
  margin-bottom: var(--space-3);
  font-size: 2rem;
}

.mensaje-estado.mensaje-info i {
  color: var(--info);
}

.mensaje-estado.mensaje-error i {
  color: var(--error);
}

.mensaje-estado p {
  margin: 0;
  font-size: 0.98rem;
  color: var(--medium-text);
  line-height: 1.5;
}

/* =========================================================
   SWEETALERT
   ========================================================= */
.btn-modal-descargar,
.btn-modal-practicar {
  font-size: 14px !important;
  padding: 12px 24px !important;
  font-weight: 700 !important;
  border-radius: 10px !important;
  transition: all 0.3s ease !important;
}

.btn-modal-descargar:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 18px rgba(113, 128, 150, 0.28) !important;
}

.btn-modal-practicar:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 18px rgba(52, 152, 219, 0.28) !important;
}

.swal2-popup {
  border-radius: 18px !important;
}

.swal2-title {
  font-size: 22px !important;
  font-weight: 800 !important;
}

.swal2-html-container ul {
  list-style: none !important;
  padding-left: 0 !important;
}

.swal2-html-container ul li {
  position: relative !important;
  padding-left: 24px !important;
}

.swal2-html-container ul li:before {
  content: '•' !important;
  position: absolute !important;
  left: 8px !important;
  font-weight: bold !important;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
* {
  -webkit-tap-highlight-color: transparent;
}

.tarjeta-nivel,
.btn-ver-simulacros {
  -webkit-touch-callout: none;
  user-select: none;
}

@media (min-width: 640px) {
  .grid-simulacros {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  .examenes-lista .grid-simulacros {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .exam-main {
    padding-top: 136px;
  }

  .exam-container {
    padding: 0 var(--space-4);
  }

  .exam-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: var(--space-8);
  }

  .grid-simulacros {
    grid-template-columns: repeat(2, minmax(320px, 420px));
    gap: 22px;
    justify-content: start;
  }

  .examenes-lista .grid-simulacros {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
  }

  .banner-header-with-back {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .filtros-tipo-botones {
    justify-content: center;
  }

  .btn-filtro-tipo {
    justify-content: center;
    text-align: center;
  }
}

@media (min-width: 1280px) {
  .exam-layout {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: var(--space-10);
  }
}

@media (max-width: 768px) {
  .exam-main {
    padding-top: 116px;
  }

  .titulo-niveles-principal {
    font-size: 2rem;
    margin-bottom: var(--space-5);
  }

  .subtitulo-concurso {
    font-size: 1.22rem;
    margin: var(--space-6) 0 var(--space-6);
    padding-bottom: var(--space-3);
  }

  .filtros-tipo-botones,
  .botones-filtro {
    gap: 8px 10px;
  }

  .tarjeta-acciones {
    flex-direction: column;
  }

  .tarjeta-simulacro .btn-tarjeta {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .exam-main {
    padding-inline: var(--space-2);
  }

  .exam-container {
    padding: 0 var(--space-2);
  }

  .titulo-niveles-principal {
    font-size: 1.8rem;
  }

  .filtros-tipo-botones {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    justify-content: stretch;
  }

  .btn-filtro-tipo {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .tarjeta-icono {
    width: 56px;
    height: 56px;
    font-size: 1.45rem;
  }

  .tarjeta-titulo {
    font-size: 1.28rem;
  }

  .tarjeta-descripcion {
    font-size: 0.88rem;
  }

  .tarjeta-imagen-wrapper {
    height: 165px;
  }

  .simulacro-titulo {
    font-size: 1.02rem;
  }

  .simulacro-descripcion {
    font-size: 0.86rem;
    margin-bottom: var(--space-3);
  }

  .simulacro-meta {
    flex-direction: column;
    gap: 7px;
    margin-bottom: var(--space-3);
  }

  .btn-back {
    width: 100%;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tarjeta-nivel,
  .tarjeta-simulacro,
  .btn-ver-simulacros,
  .btn-filtro,
  .btn-filtro-tipo,
  .btn-back,
  .anio-header {
    transition: none !important;
    animation: none !important;
  }
}


/* ===== FIX ESPACIO DE LA RAYA + CENTRADO REAL ===== */

/* 1) Más aire debajo del subtítulo con raya */
.subtitulo-concurso {
  margin: var(--space-7) 0 var(--space-8);
  padding-bottom: var(--space-4);
}

/* 2) Que el grid de niveles no se pegue al subtítulo */
.subtitulo-concurso + .grid-simulacros,
.subtitulo-concurso + #contenedor-niveles,
.subtitulo-concurso + section,
.subtitulo-concurso + div {
  margin-top: var(--space-3);
}

/* 3) Centrar filtros de niveles */
.filtros-tipo-botones {
  justify-content: center;
}

/* 4) Centrar filtros de detalle */
.botones-filtro {
  justify-content: center;
}

/* 5) En desktop, centrar también el bloque del banner detalle mejor */
@media (min-width: 1024px) {
  .banner-header-with-back {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: var(--space-4);
  }

  .banner-hero-title {
    text-align: center;
  }

  .banner-hero-subtitle {
    justify-content: flex-start;
  }

  .botones-filtro {
    justify-content: center;
  }

  .filtros-tipo-botones {
    justify-content: center;
  }
}

/* 6) En móvil: filtros de niveles en columna completa */
@media (max-width: 480px) {
  .subtitulo-concurso {
    margin: var(--space-6) 0 var(--space-7);
    padding-bottom: var(--space-4);
  }

  .filtros-tipo-botones {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    justify-content: stretch;
  }

  .btn-filtro-tipo {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .botones-filtro {
    justify-content: center;
  }
}

/* =========================================================
   FIX REAL — CENTRADO DEL BANNER DETALLE
   ========================================================= */

/* contenedor general */
.banner-hero {
  padding: var(--space-4) var(--space-5);
}

/* el header ya no compite por columnas raras */
.banner-header-with-back {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 72px;
}

/* botón */
.btn-back {
  align-self: flex-start;
  justify-content: center;
}

/* bloque de texto centrado de verdad */
.banner-hero-text {
  width: 100%;
  text-align: center;
}

/* si no tienes wrapper de texto en HTML, igual forzamos centrado */
.banner-hero-title {
  width: 100%;
  margin: 0;
  text-align: center;
}

.banner-hero-subtitle {
  width: 100%;
  justify-content: center;
  text-align: center;
}

/* badge dentro del título, que no rompa el centrado */
.badge-tipo-banner {
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* DESKTOP: botón flotando a la izquierda, título centrado en todo el banner */
@media (min-width: 1024px) {
  .banner-header-with-back {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    padding-inline: 160px;
  }

  .btn-back {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    align-self: auto;
    z-index: 2;
  }

  .btn-back:hover {
    transform: translateY(-50%);
  }

  .banner-hero-title {
    width: 100%;
    text-align: center;
  }

  .banner-hero-subtitle {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}

/* MOBILE: botón arriba y texto perfectamente centrado */
@media (max-width: 768px) {
  .banner-hero {
    padding: var(--space-4);
  }

  .banner-header-with-back {
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
  }

  .btn-back {
    align-self: stretch;
    width: 100%;
    min-height: 42px;
  }

  .banner-hero-title {
    font-size: clamp(1.28rem, 5vw, 1.7rem);
    text-align: center;
    line-height: 1.15;
  }

  .banner-hero-subtitle {
    justify-content: center;
    text-align: center;
  }
}

/* MOBILE CHICO */
@media (max-width: 480px) {
  .banner-hero {
    padding: var(--space-3);
  }

  .banner-header-with-back {
    gap: var(--space-2);
    min-height: auto;
  }

  .btn-back {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .banner-hero-title {
    width: 100%;
    text-align: center;
    font-size: 1.05rem;
    line-height: 1.18;
  }

  .badge-tipo-banner {
    margin-right: 0.35rem;
    margin-bottom: 0.2rem;
  }

  .banner-hero-subtitle {
    width: 100%;
    justify-content: center;
    text-align: center;
    font-size: 0.84rem;
  }
}


/* =========================================================
   CABECERAS AGRUPADAS
   ========================================================= */
.simulacros-topbar,
.simulacros-detalle-topbar {
  margin-bottom: var(--space-6);
  padding: var(--space-4);
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,251,255,0.98) 100%);
  border: 1px solid rgba(209, 213, 219, 0.88);
  border-radius: 22px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

/* versión de niveles: título + filtros en un solo bloque */
.simulacros-topbar .titulo-niveles-principal {
  margin: 0 0 var(--space-5);
}

.simulacros-topbar .filtros-tipo-wrapper {
  margin-bottom: 0;
}

/* versión detalle: banner + filtros dentro del mismo bloque */
.simulacros-detalle-topbar .banner-hero {
  margin-bottom: var(--space-4);
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.simulacros-detalle-topbar .filtros-examenes {
  margin-bottom: 0;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(209, 213, 219, 0.76);
  box-shadow: none;
}

.simulacros-intro {
  margin: 0 auto var(--space-4);
  max-width: 760px;
  color: var(--medium-text);
  font-size: var(--text-sm);
  line-height: 1.65;
  text-align: center;
  text-wrap: pretty;
}

@media (max-width: 768px) {
  .simulacros-intro {
    margin-bottom: var(--space-3);
    max-width: 100%;
    font-size: 0.92rem;
    line-height: 1.6;
    padding-inline: var(--space-2);
  }
}