/**
 * Fijate Tools - Evaluador de Lenguaje Corporal Canino y Felino
 * Hoja de estilos canónica, responsiva y accesible.
 * 
 * Cumplimiento estricto:
 * - Tipografías Inter, Outfit, JetBrains Mono
 * - Sincronización universal de tema claro / oscuro (data-theme="dark" / data-theme="light")
 * - Cero colisión con common/ads.css
 * - Contención estricta con minmax(0, 1fr) y min-width: 0
 * - Altura táctil mínima de 40 px en botones y controles interactivos
 */

/* ==========================================================================
   1. Variables de tema y tipografía
   ========================================================================== */
:root,
[data-theme="dark"],
body.dark-mode {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Superficies y fondo corporativo Fijate Tools (Midnight Slate) */
  --bg-page: #0b0f17;
  --bg-card: #111827;
  --bg-surface: #1e293b;
  --bg-surface-hover: #283548;
  --bg-input: #0f172a;

  /* Bordes */
  --border-color: #334155;
  --border-subtle: #1e293b;

  /* Textos con contraste verificado WCAG AA */
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --text-subtle: #94a3b8;

  /* Paleta semafórica etológica de estrés */
  --accent-green: #10b981;
  --accent-green-bg: rgba(16, 185, 129, 0.12);
  --accent-yellow: #f59e0b;
  --accent-yellow-bg: rgba(245, 158, 11, 0.12);
  --accent-orange: #f97316;
  --accent-orange-bg: rgba(249, 115, 22, 0.15);
  --accent-red: #ef4444;
  --accent-red-bg: rgba(239, 68, 68, 0.18);
  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-primary-bg: rgba(59, 130, 246, 0.12);

  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.55);
}

[data-theme="light"],
body.light-mode,
body.light-theme {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-surface: #f1f5f9;
  --bg-surface-hover: #e2e8f0;
  --bg-input: #ffffff;

  --border-color: #cbd5e1;
  --border-subtle: #e2e8f0;

  --text-main: #0f172a;
  --text-muted: #334155;
  --text-subtle: #64748b;

  --accent-green: #059669;
  --accent-green-bg: rgba(5, 150, 105, 0.1);
  --accent-yellow: #d97706;
  --accent-yellow-bg: rgba(217, 119, 6, 0.1);
  --accent-orange: #ea580c;
  --accent-orange-bg: rgba(234, 88, 12, 0.12);
  --accent-red: #dc2626;
  --accent-red-bg: rgba(220, 38, 38, 0.12);
  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-primary-bg: rgba(37, 99, 235, 0.08);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   2. Reset y contención canónica
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.brand-title,
.hero-title,
.section-lead-title,
.part-title,
.stage-heading,
.faq-section-title,
.modal-title {
  font-family: var(--font-heading);
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 0;
}

.mono, code, .gauge-score-val, .risk-val {
  font-family: var(--font-mono);
}

.main-wrapper.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
  box-sizing: border-box;
  flex: 1 0 auto;
}

/* En resoluciones ultra-anchas (>= 1536px), layout canónico con sidebar */
@media (min-width: 1536px) {
  .tool-with-sidebar {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
  }
  .tool-main-content {
    flex: 1 1 0%;
    min-width: 0;
  }
  .tool-ad-sidebar {
    width: 300px;
    flex-shrink: 0;
  }
}

/* ==========================================================================
   3. Tarjeta Hero de presentación
   ========================================================================== */
.hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.75rem 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--accent-primary-bg);
  color: var(--accent-primary);
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: clamp(1.4rem, 2.5vw, 1.85rem);
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.hero-desc {
  font-size: 0.96rem;
  color: var(--text-muted);
  max-width: 950px;
  margin: 0;
  line-height: 1.6;
}

/* ==========================================================================
   4. Pestañas de navegación táctil (.nav-tabs)
   ========================================================================== */
.nav-tabs-wrapper {
  margin-bottom: 1.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.nav-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0.25rem 0.125rem;
  border-bottom: 1px solid var(--border-color);
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-subtle);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  min-height: 42px;
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

.tab-btn.active {
  color: var(--accent-primary);
  background: var(--bg-card);
  border-color: var(--border-color);
  border-bottom-color: var(--accent-primary);
}

.tab-panel {
  display: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.tab-panel.active {
  display: block;
}

/* ==========================================================================
   5. Módulo 1: Evaluador anatómico
   ========================================================================== */
.species-selector-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.species-switch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.btn-species {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 60px;
  text-align: left;
}

.btn-species:hover {
  border-color: var(--accent-primary);
  background: var(--bg-surface-hover);
}

.btn-species.active {
  background: var(--accent-primary-bg);
  border-color: var(--accent-primary);
}

.species-emoji {
  font-size: 1.75rem;
  line-height: 1;
  margin-bottom: 0.4rem;
}

.species-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
}

.species-sub {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Cuadrícula principal del evaluador */
.evaluator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
  gap: 1.5rem;
  align-items: start;
}

.evaluator-controls {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.anatomy-block {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease;
}

.anatomy-block:hover {
  border-color: var(--border-color);
}

.anatomy-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.part-indicator {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.part-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.part-title {
  font-size: 1.05rem;
  margin: 0;
}

.part-weight {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-subtle);
}

/* Lista de opciones anatómicas */
.anatomy-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.option-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1.5px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-surface);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 48px;
  text-align: left;
  width: 100%;
}

.option-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-color);
}

.option-card.selected {
  border-color: var(--accent-primary);
  background: var(--accent-primary-bg);
}

.option-card.selected.lvl-green {
  border-color: var(--accent-green);
  background: var(--accent-green-bg);
}

.option-card.selected.lvl-yellow {
  border-color: var(--accent-yellow);
  background: var(--accent-yellow-bg);
}

.option-card.selected.lvl-orange {
  border-color: var(--accent-orange);
  background: var(--accent-orange-bg);
}

.option-card.selected.lvl-red {
  border-color: var(--accent-red);
  background: var(--accent-red-bg);
}

.option-radio-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  margin-top: 0.2rem;
  flex-shrink: 0;
  position: relative;
  background: var(--bg-input);
}

.option-card.selected .option-radio-dot {
  border-color: currentColor;
}

.option-card.selected .option-radio-dot::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.option-info {
  flex: 1 1 0%;
  min-width: 0;
}

.option-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  display: block;
  margin-bottom: 0.15rem;
}

.option-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: block;
  line-height: 1.4;
}

.option-risk-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 0.2rem;
}

.badge-green { background: var(--accent-green-bg); color: var(--accent-green); }
.badge-yellow { background: var(--accent-yellow-bg); color: var(--accent-yellow); }
.badge-orange { background: var(--accent-orange-bg); color: var(--accent-orange); }
.badge-red { background: var(--accent-red-bg); color: var(--accent-red); }

/* ==========================================================================
   6. Tacómetro y panel sticky de diagnóstico en vivo
   ========================================================================== */
.evaluator-summary {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.summary-card-sticky {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 1.5rem;
}

.summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.summary-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-heading);
}

.species-current-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  background: var(--bg-surface);
  color: var(--text-muted);
}

/* Tacómetro SVG */
.gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.25rem;
  width: 100%;
}

.gauge-svg-wrap {
  width: 100%;
  max-width: 220px;
  position: relative;
}

.stress-gauge-svg {
  width: 100%;
  height: auto;
  display: block;
}

#gauge-needle {
  transform-origin: 100px 100px;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gauge-center-text {
  position: absolute;
  bottom: 5px;
  left: 0;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gauge-score-val {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-main);
}

.gauge-score-unit {
  font-size: 0.75rem;
  color: var(--text-subtle);
  margin-top: 0.15rem;
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 240px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.lbl-green { color: var(--accent-green); }
.lbl-yellow { color: var(--accent-yellow); }
.lbl-orange { color: var(--accent-orange); }
.lbl-red { color: var(--accent-red); }

/* Tarjeta del estadio de la escalera */
.stage-result-card {
  padding: 1.15rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  margin-bottom: 1rem;
  transition: all 0.3s ease;
}

.stage-pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.stage-heading {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
}

.stage-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
}

/* Semáforo de riesgo */
.risk-bar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.85rem;
  margin-bottom: 1rem;
}

.risk-bar-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  margin-bottom: 0.45rem;
}

.risk-title {
  font-weight: 600;
  color: var(--text-muted);
}

.risk-val {
  font-weight: 700;
}

.risk-track {
  width: 100%;
  height: 8px;
  background: var(--border-subtle);
  border-radius: 4px;
  overflow: hidden;
}

.risk-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease, background-color 0.4s ease;
}

/* Lista de señales detectadas */
.signals-breakdown-card {
  margin-bottom: 1rem;
}

.breakdown-title {
  font-size: 0.8125rem;
  color: var(--text-subtle);
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}

.breakdown-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.825rem;
  color: var(--text-muted);
}

.breakdown-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dot-ok {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  flex-shrink: 0;
}

.dot-warn {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-yellow);
  flex-shrink: 0;
}

.dot-danger {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-red);
  flex-shrink: 0;
}

/* Protocolo de desescalada */
.protocol-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.protocol-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  margin: 0 0 0.65rem 0;
  color: var(--text-main);
}

.protocol-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.8125rem;
}

.action-item {
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  line-height: 1.4;
}

.action-do {
  background: var(--accent-green-bg);
  border-left: 3px solid var(--accent-green);
  color: var(--text-main);
}

.action-dont {
  background: var(--accent-red-bg);
  border-left: 3px solid var(--accent-red);
  color: var(--text-main);
}

/* Botón de acción principal */
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.8rem 1.25rem;
  font-family: var(--font-main);
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
}

.btn-primary {
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

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

/* ==========================================================================
   7. Módulo 2: Simulador de casos reales
   ========================================================================== */
.section-lead-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.section-lead-title {
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
}

.section-lead-desc {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.55;
}

.scenarios-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.scenario-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.scenario-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.scenario-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--accent-primary);
}

.scenario-risk {
  font-size: 0.75rem;
  font-weight: 600;
}

.scenario-title {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.scenario-context {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.scenario-postures-box {
  background: var(--bg-surface);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.8125rem;
}

.scenario-postures-title {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
  display: block;
}

.scenario-options-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: auto;
}

.scenario-btn-opt {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  min-height: 42px;
}

.scenario-btn-opt:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-color);
}

.scenario-btn-opt.is-correct {
  background: var(--accent-green-bg);
  border-color: var(--accent-green);
  color: var(--accent-green);
  font-weight: 600;
}

.scenario-btn-opt.is-wrong {
  background: var(--accent-red-bg);
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.scenario-feedback {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  line-height: 1.45;
  display: none;
}

.scenario-feedback.visible {
  display: block;
}

/* ==========================================================================
   8. Módulo 3: Diccionario de señales de calma
   ========================================================================== */
.author-badge, .safety-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: var(--accent-primary-bg);
  color: var(--accent-primary);
  margin-bottom: 0.5rem;
}

.dictionary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.15rem;
}

.signal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.signal-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 0.85rem;
}

.signal-species-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-bottom: 0.4rem;
  display: inline-block;
}

.tag-dog { background: rgba(59, 130, 246, 0.15); color: var(--accent-primary); }
.tag-cat { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.tag-both { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }

.signal-name {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

.signal-meaning {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 0.75rem;
}

.signal-advice {
  margin-top: auto;
  font-size: 0.78rem;
  background: var(--bg-surface);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  color: var(--text-subtle);
}

.signal-advice strong {
  color: var(--text-main);
}

/* ==========================================================================
   9. Módulo 4: Protocolo infantil y familiar
   ========================================================================== */
.kids-rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kid-rule-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 1rem;
}

.rule-icon-box {
  font-size: 2.2rem;
  flex-shrink: 0;
  line-height: 1;
}

.rule-content {
  flex: 1 1 0%;
  min-width: 0;
}

.rule-title {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
}

.rule-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.rule-checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.825rem;
  color: var(--text-muted);
}

.rule-checklist li {
  position: relative;
  padding-left: 1.25rem;
  line-height: 1.4;
}

.rule-checklist li::before {
  content: "•";
  position: absolute;
  left: 0.25rem;
  color: var(--accent-primary);
  font-size: 1.1rem;
  line-height: 1;
}

/* Semáforo anatómico de caricias */
.petting-map-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.petting-map-title {
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
}

.petting-map-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.petting-column {
  border-radius: 10px;
  padding: 1.15rem;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.petting-column ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.zone-green { border-color: var(--accent-green); }
.zone-green .zone-badge { background: var(--accent-green-bg); color: var(--accent-green); }

.zone-yellow { border-color: var(--accent-yellow); }
.zone-yellow .zone-badge { background: var(--accent-yellow-bg); color: var(--accent-yellow); }

.zone-red { border-color: var(--accent-red); }
.zone-red .zone-badge { background: var(--accent-red-bg); color: var(--accent-red); }

.zone-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  margin-bottom: 0.85rem;
}

/* ==========================================================================
   10. Acordeón FAQ y Guía SEO
   ========================================================================== */
.faq-accordion-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  margin-top: 2.5rem;
  box-shadow: var(--shadow-sm);
}

.faq-section-title {
  font-size: 1.35rem;
  margin-bottom: 1.25rem;
}

.faq-items-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-surface);
  transition: all 0.2s ease;
}

.faq-item[open] {
  border-color: var(--border-color);
}

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

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

.faq-question svg {
  transition: transform 0.2s ease;
  color: var(--text-subtle);
  flex-shrink: 0;
  margin-left: 0.5rem;
}

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

.faq-answer {
  padding: 0 1.25rem 1.15rem;
  font-size: 0.8875rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.faq-answer p {
  margin: 0;
}

/* ==========================================================================
   11. Modal canónico de informe pericial
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.modal-title {
  font-size: 1.2rem;
  margin: 0;
}

.modal-subtitle {
  font-size: 0.8125rem;
  color: var(--text-subtle);
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

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

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1 1 auto;
  font-size: 0.9rem;
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  justify-content: flex-end;
}

.modal-footer .btn-secondary {
  width: auto;
  min-width: 110px;
}

.modal-footer .btn-primary {
  width: auto;
}

/* ==========================================================================
   12. Modo de impresión pericial (@media print)
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .app-header,
  .tools-ad-banner-section,
  .tool-ad-sidebar,
  .nav-tabs-wrapper,
  .controls-actions,
  .report-actions,
  .amazon-affiliate-showcase,
  .faq-accordion-section,
  .fijate-footer,
  .btn-close-modal,
  .modal-footer {
    display: none !important;
  }
  .modal-backdrop {
    position: static !important;
    background: none !important;
    padding: 0 !important;
    display: block !important;
  }
  .modal-card {
    border: none !important;
    box-shadow: none !important;
    max-width: 100% !important;
  }
  .modal-body {
    padding: 0 !important;
  }
}

/* ==========================================================================
   13. Adaptación responsive a dispositivos móviles
   ========================================================================== */
@media (max-width: 900px) {
  .evaluator-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .summary-card-sticky {
    position: static;
  }
  .scenarios-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .dictionary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kids-rules-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .petting-map-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .species-switch-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .dictionary-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .kid-rule-card {
    flex-direction: column;
    gap: 0.5rem;
  }
  .rule-icon-box {
    margin-bottom: 0.25rem;
  }
  .hero-card {
    padding: 1.25rem;
  }
  .modal-footer {
    flex-direction: column;
  }
  .modal-footer .btn-primary,
  .modal-footer .btn-secondary {
    width: 100%;
  }
}
