/**
 * style.css
 * Estilos canónicos y diseño visual del Simulador de Enfermedades Oculares y Nistagmo
 * Fijate Tools - Suite de Salud Ocular
 */

:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Paleta Oscura Midnight */
  --bg-app: #080c14;
  --bg-card: #0f172a;
  --bg-card-secondary: #1e293b;
  --bg-card-hover: #24344d;
  --border-card: #334155;
  --border-focus: #38bdf8;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --primary: #0284c7;
  --primary-light: #38bdf8;
  --primary-glow: rgba(56, 189, 248, 0.25);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
}

[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-secondary: #f1f5f9;
  --bg-card-hover: #e2e8f0;
  --border-card: #cbd5e1;
  --border-focus: #0284c7;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --primary: #0284c7;
  --primary-light: #0369a1;
  --primary-glow: rgba(2, 132, 199, 0.15);
}

/* Reset y base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Contención y Layout Canónico */
.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
  width: 100%;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* Tipografía de títulos */
h1, h2, h3, h4, .brand-title {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.text-mono {
  font-family: var(--font-mono);
}

/* Tarjeta contenedora de la herramienta */
.sim-app-container {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  margin-bottom: 2rem;
}

/* Barra superior de pestañas de patología */
.condition-tabs-header {
  margin-bottom: 1.25rem;
}

.condition-tabs-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: block;
}

.condition-tabs-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-condition-tab {
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.55rem 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
  min-height: 40px;
}

.btn-condition-tab:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--primary-light);
}

.btn-condition-tab.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary-light);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.badge-featured {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid rgba(239, 68, 68, 0.4);
  font-family: var(--font-mono);
}

.btn-condition-tab.active .badge-featured {
  background: #ffffff;
  color: #dc2626;
  border-color: #ffffff;
}

/* Barra superior del visor con controles rápidos */
.viewport-top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-card);
  border-radius: 12px 12px 0 0;
  padding: 0.75rem 1rem;
}

.bar-group-left, .bar-group-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.bar-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 600;
}

/* Selector de severidad */
.severity-pills {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 2px;
}

.btn-severity {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 32px;
}

.btn-severity:hover {
  color: var(--text-main);
}

.btn-severity.active {
  background: var(--bg-card-secondary);
  color: var(--primary-light);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Botón Split-view y utilidades */
.btn-sim-action {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 36px;
  transition: all 0.15s ease;
}

.btn-sim-action:hover {
  color: var(--text-main);
  border-color: var(--border-focus);
}

.btn-sim-action.active {
  background: rgba(56, 189, 248, 0.12);
  color: var(--primary-light);
  border-color: var(--primary-light);
}

.fps-badge {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-card);
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Contenedor del lienzo de simulación */
.canvas-viewport-wrap {
  position: relative;
  width: 100%;
  background: #000000;
  border-left: 1px solid var(--border-card);
  border-right: 1px solid var(--border-card);
  overflow: hidden;
  user-select: none;
  touch-action: pan-y;
}

#simulator-canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: col-resize;
}

/* Barra inferior del visor: selector de escenas */
.viewport-bottom-bar {
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-card);
  border-radius: 0 0 12px 12px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.scenes-scroll-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 2px;
}

.btn-scene-thumb {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
  transition: all 0.15s ease;
}

.btn-scene-thumb:hover {
  color: var(--text-main);
  border-color: var(--border-focus);
}

.btn-scene-thumb.active {
  background: var(--bg-card-hover);
  color: var(--primary-light);
  border-color: var(--primary-light);
  font-weight: 600;
}

/* Panel interactivo de 2 columnas: Controles clínicos y Monitor Ocular */
.sim-grid-panels {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .sim-grid-panels {
    grid-template-columns: 1fr;
  }
}

/* Panel de controles específicos de nistagmo */
.control-deck-card {
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 1.25rem;
}

.deck-title {
  font-size: 1.05rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

.deck-row {
  margin-bottom: 1rem;
}

.deck-row:last-child {
  margin-bottom: 0;
}

.deck-label-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.deck-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.deck-val-badge {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  color: var(--primary-light);
}

.button-pills-row {
  display: flex;
  gap: 0.4rem;
}

.btn-deck-pill {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  min-height: 38px;
  transition: all 0.15s ease;
}

.btn-deck-pill:hover {
  color: var(--text-main);
}

.btn-deck-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary-light);
}

/* Deslizadores ergonómicos */
.sim-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  outline: none;
  border: 1px solid var(--border-card);
}

.sim-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-light);
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.sim-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-light);
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Monitor anatómico de motilidad ocular */
.eye-monitor-card {
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.eye-monitor-header {
  margin-bottom: 0.75rem;
}

.eye-monitor-title {
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.eye-monitor-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

.eye-canvas-box {
  background: #0b0f17;
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

#eye-canvas {
  width: 100%;
  max-width: 280px;
  height: 110px;
  display: block;
}

.eye-legend-box {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Ficha clínica interactiva */
.clinical-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.clinical-header {
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-card);
  padding-bottom: 0.85rem;
}

.clinical-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--primary-light);
  background: rgba(56, 189, 248, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 0.4rem;
}

.clinical-title {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.clinical-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.clinical-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.clinical-item {
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 1rem;
}

.clinical-item-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary-light);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.clinical-item-p {
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.55;
}

/* Modales accesibles */
.app-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 20, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.app-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-card);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  min-width: 36px;
}

.modal-close-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-secondary);
}

.modal-body {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.modal-body p {
  margin-bottom: 0.85rem;
}

.modal-body ul {
  margin-left: 1.25rem;
  margin-bottom: 1rem;
}

.modal-body li {
  margin-bottom: 0.4rem;
}

/* Guía editorial SEO y acordeón FAQ */
.seo-guide-section {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.seo-guide-header {
  margin-bottom: 1.5rem;
}

.seo-guide-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--primary-light);
  background: rgba(56, 189, 248, 0.12);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.seo-guide-title {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

.seo-guide-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.seo-guide-article {
  margin-bottom: 2rem;
}

.seo-guide-article h3 {
  font-size: 1.2rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.seo-guide-article p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1rem;
}

/* Acordeón FAQ nativo en HTML */
.seo-faq-section {
  border-top: 1px solid var(--border-card);
  padding-top: 1.5rem;
}

.seo-faq-title {
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.seo-faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.seo-faq-item {
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.seo-faq-question {
  padding: 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  user-select: none;
}

.seo-faq-question::-webkit-details-marker {
  display: none;
}

.seo-faq-icon {
  transition: transform 0.2s ease;
}

.seo-faq-item[open] .seo-faq-icon {
  transform: rotate(180deg);
}

.seo-faq-answer {
  padding: 0 1rem 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Adaptabilidad móvil */
@media (max-width: 768px) {
  .tool-layout {
    margin: 1rem auto 2rem;
    padding: 0 0.75rem;
  }

  .sim-app-container {
    padding: 1rem 0.75rem;
  }

  .viewport-top-bar, .viewport-bottom-bar {
    padding: 0.6rem 0.75rem;
  }

  .clinical-card {
    padding: 1.25rem 1rem;
  }

  .clinical-title {
    font-size: 1.2rem;
  }
}
