/* Ajustes puntuales que Tailwind (via CDN) no cubre */
table td, table th {
  padding-right: 0.75rem;
}

/* ---------- Navegacion principal del sidebar ---------- */
.nav-view-btn {
  color: #9ca3af; /* gray-400 */
}
.nav-view-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #f3f4f6; /* gray-100 */
}
.nav-view-btn.active {
  background: linear-gradient(to right, #ea580c, #f59e0b); /* orange-600 -> amber-500 */
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
}

/* ---------- Tabs internos (Fisico / Simulacro Teorico) ---------- */
.tab-btn {
  background-color: rgba(17, 24, 39, 0.6); /* gray-900/60 */
  color: #9ca3af; /* gray-400 */
}
.tab-btn:hover {
  color: #e5e7eb; /* gray-200 */
}
.tab-btn.active {
  background: linear-gradient(to right, #ea580c, #f59e0b);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.3);
}

/* ---------- Inputs de formulario ---------- */
.field {
  width: 100%;
  background-color: #111827; /* gray-900 */
  border: 1px solid #374151; /* gray-700 */
  color: #f3f4f6; /* gray-100 */
  border-radius: 0.5rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.925rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field::placeholder {
  color: #6b7280; /* gray-500 */
}
.field:focus {
  outline: none;
  border-color: #f59e0b; /* amber-500 */
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

/* ---------- Boton principal (submit) ---------- */
.btn-primary {
  background: linear-gradient(to right, #ea580c, #f59e0b);
  color: #ffffff;
  font-weight: 600;
  padding: 0.65rem 1rem;
  border-radius: 0.6rem;
  box-shadow: 0 8px 20px rgba(234, 88, 12, 0.25);
  transition: filter 0.15s, transform 0.1s;
}
.btn-primary:hover {
  filter: brightness(1.08);
}
.btn-primary:active {
  transform: translateY(1px);
}

/* ---------- Guia del Opositor ---------- */
.icon-badge {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fbbf24; /* amber-400 */
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.18), rgba(245, 158, 11, 0.18));
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.req-block {
  background-color: rgba(17, 24, 39, 0.5); /* gray-900/50 */
  border: 1px solid #374151; /* gray-700 */
  border-left: 3px solid #f59e0b; /* amber-500 */
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
}
.req-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fbbf24; /* amber-400 */
  margin-bottom: 0.15rem;
}
.req-text {
  font-size: 0.875rem;
  color: #d1d5db; /* gray-300 */
}

.license-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background-color: rgba(17, 24, 39, 0.5);
  border: 1px solid #374151;
  border-radius: 0.5rem;
  padding: 0.75rem;
}
.license-badge {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #ea580c, #f59e0b);
}

.link-boe {
  color: #fbbf24; /* amber-400 */
}
.link-boe:hover {
  text-decoration: underline;
}

/* ---------- Racha de Actividad (Heatmap estilo GitHub, en horizontal) ---------- */
/* Combina actividad fisica (MarcaFisica) y de estudio (SesionEstudio, Modo
   Enfoque) de los ultimos 60 dias. Ver GET /api/actividad/heatmap. */
.heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  grid-auto-flow: column;
  grid-auto-columns: 14px;
  gap: 2px;
  overflow-x: auto;
  padding: 0.25rem 0.1rem 0.6rem;
}
.heatmap-cell {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background-color: #1e293b; /* dia sin actividad */
  transition: transform 0.1s ease;
}
.heatmap-cell:hover {
  transform: scale(1.3);
}
.heatmap-cell.intensity-1 {
  background-color: rgba(249, 115, 22, 0.35); /* naranja tenue: 1 actividad */
}
.heatmap-cell.intensity-2 {
  background-color: #f97316; /* naranja corporativo brillante: 2+ actividades */
}

/* ---------- Toasts ---------- */
#toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: min(90vw, 360px);
}
.toast {
  background-color: #1f2937; /* gray-800 */
  border: 1px solid #374151; /* gray-700 */
  border-left: 4px solid #f59e0b; /* amber-500 */
  color: #f3f4f6;
  font-size: 0.875rem;
  border-radius: 0.6rem;
  padding: 0.85rem 1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateX(1rem);
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show {
  opacity: 1;
  transform: translateX(0);
}
.toast-success {
  border-left-color: #22c55e; /* green-500 */
}
.toast-error {
  border-left-color: #f87171; /* red-400 */
}

/* ---------- Plan Pro: entrenamiento especifico ---------- */
.cientifica-callout {
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.1), rgba(245, 158, 11, 0.04));
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 0.85rem;
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #d1d5db; /* gray-300 */
  margin-bottom: 1.5rem;
}

.fase-timeline {
  display: flex;
  flex-direction: column;
}
.fase-item {
  display: flex;
  gap: 1rem;
}
.fase-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}
.fase-numero {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #ea580c, #f59e0b);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.35);
}
.fase-linea {
  flex: 1;
  width: 2px;
  min-height: 1.25rem;
  margin-top: 0.35rem;
  background: linear-gradient(to bottom, rgba(245, 158, 11, 0.45), rgba(245, 158, 11, 0.05));
}
.fase-contenido {
  flex: 1;
  padding-bottom: 1.5rem;
}
.fase-titulo {
  font-weight: 600;
  color: #ffffff;
  font-size: 0.925rem;
  margin-bottom: 0.5rem;
}
.fase-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.badge-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  border: 1px solid;
  white-space: nowrap;
}
.badge-intensidad {
  background-color: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24; /* amber-400 */
}
.badge-volumen {
  background-color: rgba(255, 255, 255, 0.04);
  border-color: #374151; /* gray-700 */
  color: #d1d5db; /* gray-300 */
}
.fase-detalle {
  font-size: 0.85rem;
  color: #9ca3af; /* gray-400 */
  line-height: 1.55;
}

.biblio-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.75rem;
  color: #9ca3af; /* gray-400 */
  background-color: rgba(17, 24, 39, 0.4);
  border: 1px solid #374151;
  border-radius: 0.5rem;
  padding: 0.6rem 0.75rem;
}

/* Bloque "Por que funciona" bajo cada fase fisica */
.fundamento-box {
  margin-top: 0.65rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background-color: rgba(30, 58, 138, 0.2); /* blue-900/20 */
  border: 1px solid rgba(59, 130, 246, 0.25); /* blue-500/25 */
  border-radius: 0.5rem;
  padding: 0.55rem 0.8rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #bfdbfe; /* blue-200 */
}
.fundamento-box strong {
  color: #eff6ff; /* blue-50 */
}

/* ---------- Plan Pro: subsecciones numeradas ---------- */
.seccion-numero {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #ffffff;
  background: linear-gradient(135deg, #ea580c, #f59e0b);
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.35);
}

/* ---------- Plan Pro: tecnicas de estudio ---------- */
.tecnica-card {
  background-color: rgba(31, 41, 55, 0.6); /* gray-800/60 */
  border: 1px solid #374151; /* gray-700 */
  border-radius: 1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  padding: 1.5rem;
}
.ejemplo-destacado {
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.22), rgba(245, 158, 11, 0.1));
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 0.75rem;
  padding: 1rem 1.15rem;
}

/* ---------- Plan Pro: Tablon de Plazas en Tiempo Real ---------- */
.convocatoria-card {
  background-color: rgba(30, 41, 59, 0.6); /* slate-800/60 */
  border: 1px solid #334155; /* slate-700 */
  border-radius: 1rem;
  padding: 1.1rem 1.25rem;
}
.convocatoria-titulo {
  font-weight: 600;
  color: #ffffff;
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}
.convocatoria-meta {
  font-size: 0.8rem;
  color: #94a3b8; /* slate-400 */
  margin-bottom: 0.6rem;
}
.convocatoria-plazo {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fdba74; /* orange-300 */
  background-color: rgba(249, 115, 22, 0.12);
  border: 1px solid rgba(249, 115, 22, 0.35);
  border-radius: 9999px;
  padding: 0.2rem 0.6rem;
  margin-bottom: 0.6rem;
}
.convocatoria-requisitos {
  font-size: 0.78rem;
  color: #cbd5e1; /* slate-300 */
  line-height: 1.5;
}

/* Boton secundario "Generar Plan de Estudio IA": tactico pero distinto del
   boton de pago (btn-primary) - borde naranja, fondo transparente. */
.btn-plan-ia {
  width: 100%;
  margin-top: 0.85rem;
  background-color: transparent;
  color: #fdba74; /* orange-300 */
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid rgba(249, 115, 22, 0.5); /* orange-500/50 */
  border-radius: 0.6rem;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn-plan-ia:hover:not(:disabled) {
  background-color: rgba(249, 115, 22, 0.1);
  border-color: rgba(249, 115, 22, 0.8);
  color: #fed7aa; /* orange-200 */
}
.btn-plan-ia:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Contenedor del plan de estudio generado por IA: se expande justo debajo
   del boton, dentro de la misma tarjeta. El plan viene en Markdown (via
   marked.js + DOMPurify, ver main.js), asi que necesita las mismas reglas
   tipograficas que .chat-texto para que Tailwind preflight no le quite el
   formato a listas/parrafos/negrita. */
.plan-ia-contenido {
  margin-top: 0.85rem;
  padding: 0.9rem 1rem;
  background-color: rgba(15, 23, 42, 0.6); /* slate-900/60 */
  border: 1px solid #334155; /* slate-700 */
  border-radius: 0.75rem;
  font-size: 0.82rem;
  line-height: 1.6;
  color: #e2e8f0; /* slate-200 */
}
.plan-ia-contenido p {
  margin: 0 0 0.6rem;
}
.plan-ia-contenido p:last-child {
  margin-bottom: 0;
}
.plan-ia-contenido ul,
.plan-ia-contenido ol {
  margin: 0.3rem 0 0.6rem;
  padding-left: 1.25rem;
}
.plan-ia-contenido ul {
  list-style: disc;
}
.plan-ia-contenido ol {
  list-style: decimal;
}
.plan-ia-contenido li {
  margin-bottom: 0.25rem;
}
.plan-ia-contenido strong {
  color: #fdba74; /* orange-300 */
  font-weight: 700;
}
.plan-ia-contenido h1,
.plan-ia-contenido h2,
.plan-ia-contenido h3 {
  color: #ffffff;
  font-weight: 700;
  margin: 0.9rem 0 0.4rem;
}
.plan-ia-contenido h1:first-child,
.plan-ia-contenido h2:first-child,
.plan-ia-contenido h3:first-child {
  margin-top: 0;
}

/* ---------- Plan Pro: Simulacros IA (examen tipo test) ---------- */
.simulacro-pregunta {
  background-color: rgba(15, 23, 42, 0.5); /* slate-900/50 */
  border: 1px solid #334155; /* slate-700 */
  border-radius: 0.85rem;
  padding: 1.1rem 1.25rem;
}
.simulacro-enunciado {
  font-weight: 600;
  color: #ffffff;
  font-size: 0.925rem;
  margin-bottom: 0.85rem;
  line-height: 1.5;
}
.simulacro-opciones {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.simulacro-opcion {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid #374151; /* gray-700 */
  border-radius: 0.6rem;
  padding: 0.6rem 0.85rem;
  font-size: 0.875rem;
  color: #d1d5db; /* gray-300 */
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.simulacro-opcion:hover {
  border-color: rgba(245, 158, 11, 0.5);
}
.simulacro-opcion input[type="radio"] {
  accent-color: #f97316;
  flex-shrink: 0;
}
/* Tras corregir: acertada en verde tenue, fallada en rojo tenue */
.simulacro-opcion.opcion-correcta {
  background-color: rgba(34, 197, 94, 0.12); /* green-500/12 */
  border-color: rgba(34, 197, 94, 0.5);
  color: #bbf7d0; /* green-200 */
}
.simulacro-opcion.opcion-incorrecta {
  background-color: rgba(239, 68, 68, 0.12); /* red-500/12 */
  border-color: rgba(239, 68, 68, 0.5);
  color: #fecaca; /* red-200 */
}
.simulacro-explicacion {
  margin-top: 0.75rem;
  background-color: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b; /* amber-500 */
  border-radius: 0.5rem;
  padding: 0.6rem 0.85rem;
  font-size: 0.82rem;
  color: #d1d5db;
  line-height: 1.5;
}

/* ---------- Plan Pro: Tutor Inteligente (chat RAG) ---------- */
.chat-mensajes {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: 420px;
  overflow-y: auto;
  padding: 0.25rem 0.25rem 1rem;
  margin-bottom: 0.75rem;
}
.chat-bubble {
  display: flex;
  gap: 0.6rem;
  max-width: 85%;
}
.chat-bubble-ia {
  align-self: flex-start;
}
.chat-bubble-usuario {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chat-avatar {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  background-color: rgba(17, 24, 39, 0.6);
  border: 1px solid #374151;
}
.chat-texto {
  font-size: 0.85rem;
  line-height: 1.5;
  border-radius: 0.85rem;
  padding: 0.6rem 0.9rem;
  white-space: pre-wrap; /* respeta saltos de linea sueltos (texto plano, errores) */
}
/* El tutor responde en Markdown (convertido a HTML real via marked.js, ver
   main.js). Tailwind CDN resetea el estilo por defecto de listas/parrafos
   (preflight), asi que hay que devolvérselo aqui dentro de la burbuja. */
.chat-texto p {
  margin: 0 0 0.5rem;
}
.chat-texto p:last-child {
  margin-bottom: 0;
}
.chat-texto ul,
.chat-texto ol {
  margin: 0.3rem 0 0.5rem;
  padding-left: 1.25rem;
}
.chat-texto ul {
  list-style: disc;
}
.chat-texto ol {
  list-style: decimal;
}
.chat-texto li {
  margin-bottom: 0.2rem;
}
.chat-texto strong {
  color: #fde68a; /* amber-200, para que la negrita destaque sobre el fondo oscuro */
  font-weight: 700;
}
.chat-bubble-usuario .chat-texto strong {
  color: #ffffff;
}
.chat-bubble-ia .chat-texto {
  background-color: rgba(17, 24, 39, 0.6);
  border: 1px solid #374151;
  color: #e5e7eb; /* gray-200 */
  border-top-left-radius: 0.2rem;
}
.chat-bubble-usuario .chat-texto {
  background: linear-gradient(135deg, #ea580c, #f59e0b);
  color: #ffffff;
  border-top-right-radius: 0.2rem;
}
.chat-input-row {
  display: flex;
  gap: 0.6rem;
}
.chat-enviar {
  width: auto;
  flex-shrink: 0;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.chat-escribiendo-dots {
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
  padding: 0.2rem 0;
}
.chat-escribiendo-dots span {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 9999px;
  background-color: #9ca3af;
  animation: chat-dot-pulso 1.2s infinite ease-in-out;
}
.chat-escribiendo-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.chat-escribiendo-dots span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes chat-dot-pulso {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

/* ---------- Tour Guiado (onboarding de la Zona Premium) ---------- */
/* Overlay oscuro a pantalla completa. z-index por encima de todo lo demas
   (toasts incluidos, #toast-container esta en 100) salvo del propio tooltip
   y del elemento resaltado, que deben quedar por delante de el. */
.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background-color: rgba(0, 0, 0, 0.75);
}

/* Se aplica al contenedor de la seccion activa del tour: lo saca por encima
   del overlay y le da un resplandor naranja para que destaque sobre el fondo
   oscurecido. Ninguno de sus ancestros tiene position/transform/opacity, asi
   que el z-index escala hasta el contexto de apilamiento raiz sin quedar
   atrapado por un ancestro intermedio. */
.tour-highlight {
  position: relative;
  z-index: 301;
  border-radius: 1rem;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.55), 0 0 40px rgba(249, 115, 22, 0.35);
}

/* Globo de texto explicativo, posicionado junto al elemento resaltado
   (top/left calculados en JS a partir de su getBoundingClientRect). */
.tour-tooltip {
  position: absolute;
  z-index: 302;
  max-width: 22rem;
  background-color: #1e293b;
  color: #ffffff;
  border: 1px solid #f97316;
  border-radius: 0.85rem;
  padding: 1.1rem 1.25rem;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.5);
  font-size: 0.875rem;
  line-height: 1.55;
}
.tour-tooltip-paso {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fdba74; /* orange-300 */
  margin-bottom: 0.45rem;
}
.tour-tooltip-texto {
  color: #e2e8f0; /* slate-200 */
  margin-bottom: 1rem;
}
.tour-tooltip-acciones {
  display: flex;
  justify-content: flex-end;
}

/* ---------- Modo Enfoque (Pomodoro a pantalla completa) ---------- */

/* Boton de la sidebar que activa el modo. Distinto del resto de nav-view-btn
   a proposito, para que se lea como una accion especial, no como otra vista. */
.btn-tactico {
  color: #fbbf24; /* amber-400 */
  border: 1px solid rgba(245, 158, 11, 0.3);
  background-color: rgba(245, 158, 11, 0.06);
}
.btn-tactico:hover {
  background-color: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fde68a; /* amber-200 */
}

/* Estado oculto general (reforzado con !important: el modo enfoque debe
   ganar siempre, sin depender del orden de las utilidades de Tailwind CDN). */
.hidden {
  display: none !important;
}

/* Cuando el modo enfoque esta activo, limpiamos el fondo */
body.modo-enfoque-activo {
  background-color: #000000 !important;
  color: #ffffff !important;
  overflow: hidden; /* Evita scrolls innecesarios */
}

/* Ocultar el resto de la aplicacion (barras laterales, menus, etc.) */
body.modo-enfoque-activo > *:not(#pantalla-enfoque) {
  display: none !important;
}

/* Contenedor principal de enfoque centrado */
#pantalla-enfoque {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100vw;
  background-color: #000000;
}

.contenedor-pomodoro {
  text-align: center;
}

/* Reloj gigante y limpio */
#timer-display {
  font-size: 8rem;
  font-weight: 300;
  font-family: monospace;
  letter-spacing: -2px;
  margin-bottom: 3rem;
  color: #ffffff;
}

/* Botones discretos que no distraigan */
.controles-timer button, .btn-salir {
  background: none;
  border: 1px solid #333333;
  color: #888888;
  padding: 0.8rem 2rem;
  margin: 0 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.controles-timer button:hover, .btn-salir:hover {
  border-color: #ffffff;
  color: #ffffff;
  background-color: #111111;
}

.btn-salir {
  margin-top: 5rem;
  display: block;
  width: 100%;
  font-size: 0.9rem;
  border-color: #222222;
}

@media (max-width: 480px) {
  #timer-display {
    font-size: 4.5rem;
  }
}
