/**
 * Estilos canónicos para el Asistente de derechos y trámites LGTBI en España
 * Fijate Tools
 */

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

  /* Modo oscuro por defecto */
  --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);

  --accent-legal: #10b981;
  --accent-urgente: #ef4444;
  --accent-alta: #f59e0b;
  --accent-media: #3b82f6;

  --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 24px 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;
  line-height: 1.25;
  color: var(--text-main);
}

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

/* 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%;
}

/* Hero de la herramienta */
.tool-hero-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.tool-hero-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #10b981 0%, #3b82f6 50%, #8b5cf6 100%);
}

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

.hero-main-title {
  font-size: clamp(1.75rem, 3.5vw, 2.35rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

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

/* Barra de pestañas */
.tabs-navigation-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-subtle);
  -webkit-overflow-scrolling: touch;
}

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

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

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

/* Paneles de contenido */
.tab-content-panel {
  display: none;
}

.tab-content-panel.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

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

/* Selectores de edad */
.age-selectors-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.age-selector-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
}

.age-selector-btn:hover {
  border-color: var(--primary);
  background: var(--bg-surface-elevated);
}

.age-selector-btn.active {
  border-color: var(--primary);
  background: var(--bg-surface-elevated);
  box-shadow: 0 0 0 2px var(--primary);
}

.age-btn-title {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.age-btn-sub {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Tarjeta informativa del tramo de edad */
.age-info-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-card);
}

.age-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.age-card-title {
  font-size: 1.35rem;
  margin-bottom: 0.2rem;
}

.age-card-subtitle {
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
}

.legal-ref-badge {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.775rem;
  font-family: var(--font-mono);
  color: var(--text-subtle);
  white-space: nowrap;
}

.age-card-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1.25rem;
}

.age-requirements-box {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.box-heading {
  font-size: 0.95rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.requirements-list {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Timeline de fases */
.fases-section {
  margin-bottom: 3rem;
}

.fases-section-title {
  font-size: 1.45rem;
  margin-bottom: 1.25rem;
}

.fases-timeline-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.fase-timeline-card {
  display: flex;
  gap: 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.fase-step-badge {
  background: var(--primary);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  height: fit-content;
  white-space: nowrap;
}

.fase-body {
  flex: 1;
}

.fase-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.fase-title {
  font-size: 1.15rem;
}

.fase-duration {
  font-size: 0.825rem;
  color: var(--text-subtle);
  background: var(--bg-surface-elevated);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}

.fase-desc {
  font-size: 0.925rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.fase-sub-block {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.fase-sub-block strong {
  display: block;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.fase-docs-list,
.fase-actions-list {
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Trámites posteriores */
.post-tramites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 3rem;
}

.post-tramite-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
}

.post-tramite-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.priority-pill {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}

.priority-urgente {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.priority-alta {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.priority-media {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.cost-badge {
  font-size: 0.75rem;
  color: var(--accent-legal);
  font-weight: 600;
}

.post-tramite-title {
  font-size: 1.15rem;
  margin-bottom: 0.25rem;
}

.post-tramite-institution {
  font-size: 0.8rem;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.post-tramite-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 1rem;
  flex: 1;
}

.post-tramite-docs {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  font-size: 0.825rem;
}

.docs-label {
  display: block;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.docs-ul {
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--text-muted);
}

/* Filiación y Empresas */
.filiacion-hero-card,
.empresas-hero-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 3rem;
  box-shadow: var(--shadow-card);
}

.filiacion-header,
.empresas-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

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

.key-point-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.kp-heading {
  font-size: 1.05rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.kp-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Generador de checklist interactiva */
.checklist-builder-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-card);
}

.builder-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.form-group-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-select-field {
  width: 100%;
  height: 42px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 0 0.85rem;
  font-family: var(--font-main);
}

.form-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.9rem;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}

.form-checkbox-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* Resultados de la checklist */
.checklist-results-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 3rem;
  box-shadow: var(--shadow-card);
}

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

.progress-container {
  margin-bottom: 1.5rem;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-surface-subtle);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.checklist-tasks-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.checklist-task-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  transition: all 0.2s ease;
}

.checklist-task-card.completed {
  border-color: var(--accent-legal);
  background: rgba(16, 185, 129, 0.05);
}

.checklist-task-card.completed .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.checklist-task-label {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  cursor: pointer;
}

.checklist-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-legal);
  margin-top: 0.2rem;
  flex-shrink: 0;
  cursor: pointer;
}

.checklist-task-text {
  flex: 1;
}

.task-category-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
}

.task-category-pill {
  font-size: 0.725rem;
  font-weight: 700;
  background: var(--bg-surface-elevated);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  color: var(--primary);
}

.task-deadline {
  font-size: 0.775rem;
  color: var(--text-subtle);
}

.task-title {
  display: block;
  font-size: 1rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
  line-height: 1.35;
}

.task-detail {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-main);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 42px;
  text-decoration: none;
  border: none;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
}

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

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

/* Acordeón FAQ */
.faq-accordion-section {
  margin-bottom: 3rem;
}

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

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

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

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

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

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

.faq-summary::after {
  content: "+";
  font-size: 1.25rem;
  color: var(--primary);
  font-family: var(--font-mono);
  font-weight: bold;
}

.faq-item[open] .faq-summary::after {
  content: "−";
}

.faq-content {
  padding: 0 1.25rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.925rem;
  line-height: 1.65;
  border-top: 1px solid var(--border-subtle);
  margin-top: 0.25rem;
  padding-top: 1rem;
}

/* Toast de notificaciones */
.app-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #334155;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  z-index: 2000;
}

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

/* Reglas de impresión limpias para la checklist */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .app-header,
  .fijate-footer,
  .tool-ad-sidebar,
  .tools-ad-banner-section,
  .tabs-navigation-bar,
  .checklist-builder-card,
  .amazon-affiliate-showcase,
  .related-tools-section,
  .faq-accordion-section,
  .btn,
  .app-toast {
    display: none !important;
  }

  .tool-layout,
  .tool-with-sidebar,
  .tool-main-content {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .checklist-results-card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .checklist-task-card {
    border: 1px solid #cccccc !important;
    background: #ffffff !important;
    page-break-inside: avoid;
    margin-bottom: 0.5rem;
  }

  .task-title,
  .task-detail {
    color: #000000 !important;
  }
}

/* Responsive */
@media (max-width: 640px) {
  .tool-hero-card {
    padding: 1.5rem;
  }

  .checklist-header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .btn {
    width: 100%;
  }
}
