/**
 * Estilos canónicos para la Cronología interactiva de la historia y derechos LGTBI
 * Fijate Tools
 */

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

  /* Colores base - Modo oscuro por defecto (Midnight Slate) */
  --bg-app: #0b0f17;
  --bg-surface: #141b26;
  --bg-surface-elevated: #1d2636;
  --bg-surface-subtle: #182232;
  --border-subtle: #243247;
  --border-focus: #3b82f6;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.2);

  /* Categorías */
  --cat-legal: #3b82f6;
  --cat-memoria: #ef4444;
  --cat-salud: #10b981;
  --cat-movimiento: #a855f7;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 8px 28px rgba(0, 0, 0, 0.45);
}

[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-subtle: #f8fafc;
  --border-subtle: #e2e8f0;
  --border-focus: #2563eb;

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

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-glow: rgba(37, 99, 235, 0.15);

  --shadow-card: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 8px 24px rgba(15, 23, 42, 0.14);
}

/* Base y contención */
* {
  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.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 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

/* Layout canónico */
.tool-layout {
  max-width: 1240px;
  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%;
}

/* Hero y cabecera de sección */
.hero-header {
  margin-bottom: 2rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 1rem;
}

.hero-title {
  font-size: 2.1rem;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  line-height: 1.25;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 820px;
}

/* Filtros interactivos y panel de control */
.timeline-controls-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Buscador */
.timeline-search-bar {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
}

.search-icon-left {
  position: absolute;
  left: 1rem;
  color: var(--text-subtle);
  pointer-events: none;
}

.timeline-search-input {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 2.75rem 0.75rem 2.85rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

.timeline-search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-clear-search {
  position: absolute;
  right: 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 0.35rem;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

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

/* Grupos de botones de filtro */
.filter-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.filter-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 38px;
}

.filter-pill-btn:hover {
  color: var(--text-main);
  border-color: var(--primary);
}

.filter-pill-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Barra de estado y conmutador de vista */
.timeline-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.view-mode-switch {
  display: flex;
  gap: 0.35rem;
  background: var(--bg-surface-elevated);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.view-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.view-toggle-btn.active {
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* --- VISTA VERTICAL DEL TIMELINE --- */
.timeline-vertical-spine {
  position: relative;
  padding-left: 2.5rem;
  margin-bottom: 3rem;
}

.timeline-vertical-spine::before {
  content: '';
  position: absolute;
  top: 1rem;
  bottom: 1rem;
  left: 17px;
  width: 2px;
  background: linear-gradient(180deg, var(--primary) 0%, rgba(59, 130, 246, 0.3) 100%);
}

.timeline-node {
  position: relative;
  margin-bottom: 2rem;
}

.timeline-node:last-child {
  margin-bottom: 0;
}

.timeline-marker-dot {
  position: absolute;
  left: -2.5rem;
  top: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.timeline-year-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.55rem;
  background: var(--bg-surface-elevated);
  border: 2px solid var(--primary);
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.timeline-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: all 0.2s ease;
}

.timeline-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.timeline-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.timeline-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Badges */
.badge-scope {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-scope-espana {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-scope-internacional {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-cat {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-cat-legal {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.badge-cat-memoria {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.badge-cat-salud {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.badge-cat-movimiento {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

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

.btn-bookmark:hover {
  color: #eab308;
}

.btn-bookmark.active {
  color: #eab308;
}

.timeline-card-date {
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.timeline-card-title {
  font-size: 1.25rem;
  color: var(--text-main);
  margin-bottom: 0.6rem;
  line-height: 1.35;
}

.timeline-card-summary {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.timeline-card-legal-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.timeline-card-legal-pill svg {
  color: var(--primary);
  flex-shrink: 0;
}

.timeline-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.btn-card-details {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--primary);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-card-details:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* --- VISTA COMPACTA --- */
.timeline-compact-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 3rem;
}

.compact-item {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  transition: all 0.2s ease;
}

.compact-item:hover {
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateX(4px);
}

.compact-col-year {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 55px;
  flex-shrink: 0;
}

.compact-col-main {
  flex: 1;
}

.compact-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.compact-date {
  font-size: 0.8rem;
  color: var(--text-subtle);
  margin-left: 0.25rem;
}

.compact-title {
  font-size: 1.05rem;
  color: var(--text-main);
  margin-bottom: 0.3rem;
}

.compact-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.compact-col-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
}

.btn-compact-action {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* Estado vacío */
.timeline-empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-xl);
  margin-bottom: 3rem;
}

.timeline-empty-state svg {
  color: var(--text-subtle);
  margin-bottom: 1rem;
}

.timeline-empty-state h3 {
  font-size: 1.25rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.timeline-empty-state p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.btn-reset-filters {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.2rem;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

/* Modal de detalle accesible */
.milestone-modal-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.milestone-modal-wrapper.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-dialog-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  z-index: 10;
}

.btn-close-modal {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-close-modal:hover {
  color: var(--text-main);
  border-color: var(--primary);
}

.modal-date-line {
  font-size: 0.9rem;
  color: var(--text-subtle);
  margin-bottom: 0.35rem;
}

.modal-title {
  font-size: 1.6rem;
  color: var(--text-main);
  margin-bottom: 0.85rem;
  line-height: 1.3;
  padding-right: 2.5rem;
}

.modal-badges-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.modal-summary-box {
  background: var(--bg-surface-elevated);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.modal-details-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.modal-legal-box {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.modal-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-pill {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  color: var(--text-subtle);
}

/* Acordeón FAQ SEO */
.faq-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-card);
}

.faq-title {
  font-size: 1.5rem;
  color: var(--text-main);
  margin-bottom: 1.5rem;
}

.faq-item {
  border-bottom: 1px solid var(--border-subtle);
  padding: 1.25rem 0;
}

.faq-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.faq-question {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.6rem;
}

.faq-answer {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* Toast de notificación accesible */
.app-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 99999;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: all 0.25s ease;
}

.app-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
  .hero-title {
    font-size: 1.6rem;
  }

  .timeline-vertical-spine {
    padding-left: 1.5rem;
  }

  .timeline-vertical-spine::before {
    left: 8px;
  }

  .timeline-marker-dot {
    left: -1.5rem;
  }

  .timeline-year-badge {
    font-size: 0.72rem;
    padding: 0.2rem 0.4rem;
  }

  .timeline-card {
    padding: 1.2rem;
  }

  .timeline-card-title {
    font-size: 1.1rem;
  }

  .compact-item {
    flex-direction: column;
    gap: 0.75rem;
  }

  .compact-col-actions {
    flex-direction: row;
  }

  .modal-dialog-card {
    padding: 1.5rem;
  }

  .modal-title {
    font-size: 1.3rem;
  }

  .app-toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    text-align: center;
  }
}
