/**
 * Fijate Tools - Estilos oficiales para el calendario de vacunación infantil
 * Conforme a estándares corporativos Fijate (Inter, Outfit, JetBrains Mono, responsive mobile-first)
 */

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

  /* Colores corporativos y semánticos */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #0ea5e9;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-heading: #0f172a;

  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;

  --success: #16a34a;
  --success-light: #dcfce7;
  --success-text: #166534;

  --warning: #d97706;
  --warning-light: #fef3c7;
  --warning-text: #92400e;

  --info: #0284c7;
  --info-light: #e0f2fe;
  --info-text: #075985;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

/* Modo oscuro */
[data-theme="dark"] {
  --bg-page: #0b0f17;
  --bg-card: #151d2a;
  --bg-card-subtle: #1e293b;
  --border-color: #334155;
  --border-focus: #38bdf8;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-heading: #ffffff;

  --primary: #38bdf8;
  --primary-hover: #7dd3fc;
  --primary-light: rgba(56, 189, 248, 0.15);

  --success: #22c55e;
  --success-light: rgba(34, 197, 94, 0.15);
  --success-text: #86efac;

  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.15);
  --warning-text: #fde68a;

  --info: #38bdf8;
  --info-light: rgba(56, 189, 248, 0.15);
  --info-text: #bae6fd;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.5);
}

/* Base de layout canónico */
body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6,
.brand-title,
.section-title,
.hero-title {
  font-family: var(--font-heading);
  color: var(--text-heading);
  margin-top: 0;
}

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

.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%;
}

/* Tarjeta principal */
.card-main {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.75rem;
  box-sizing: border-box;
  margin-bottom: 2rem;
}

@media (max-width: 640px) {
  .card-main {
    padding: 1.25rem;
    border-radius: var(--radius-md);
  }
}

/* Cabecera de la herramienta dentro de card-main */
.hero-panel {
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.hero-badge-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.badge-official {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-aep-pill {
  background: var(--success-light);
  color: var(--success-text);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
}

.hero-title {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

@media (max-width: 640px) {
  .hero-title {
    font-size: 1.4rem;
  }
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* Formulario de entrada */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  background: var(--bg-card-subtle);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.form-control {
  width: 100%;
  min-height: 44px;
  padding: 0.625rem 0.875rem;
  font-family: var(--font-main);
  font-size: 0.9375rem;
  color: var(--text-main);
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px;
  padding-right: 2.5rem;
}

select.form-control option {
  background: var(--bg-card);
  color: var(--text-main);
}

.form-checkbox-group {
  display: flex;
  align-items: center;
  grid-column: 1 / -1;
  gap: 0.6rem;
  cursor: pointer;
  margin-top: 0.25rem;
}

.form-checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.checkbox-label-text {
  font-size: 0.875rem;
  color: var(--text-main);
  user-select: none;
}

.checkbox-label-text small {
  display: block;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* Rejilla de indicadores KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.kpi-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.125rem;
  display: flex;
  flex-direction: column;
  justifyContent: space-between;
  box-sizing: border-box;
}

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

.kpi-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: none;
  color: var(--text-muted);
}

.kpi-icon {
  color: var(--primary);
}

.kpi-main-val {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
  margin-bottom: 0.25rem;
}

.kpi-sub-val {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

/* Barra de acciones y filtros */
.toolbar-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

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

.filter-btn {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 38px;
}

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

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

.action-buttons-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-main);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 38px;
  text-decoration: none;
  box-sizing: border-box;
}

.btn-primary-action {
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #ffffff;
}

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

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

.btn-secondary-action:hover {
  background: var(--border-color);
}

/* Cronograma / Timeline */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.milestone-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.milestone-card.is-next {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light), var(--shadow-md);
}

.milestone-card.is-past {
  opacity: 0.85;
  background: var(--bg-card-subtle);
}

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

.milestone-title-group {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.milestone-indicator-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(2, 132, 199, 0.2);
}

.milestone-card.is-next .milestone-indicator-circle {
  background: var(--primary);
  color: #ffffff;
}

.milestone-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
}

.milestone-date-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.milestone-status-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.625rem;
  border-radius: 9999px;
  text-transform: none;
  white-space: nowrap;
}

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

.badge-past {
  background: var(--border-color);
  color: var(--text-muted);
}

.badge-future {
  background: var(--info-light);
  color: var(--info-text);
}

.milestone-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0.25rem 0 1rem 0;
  line-height: 1.4;
}

/* Lista de vacunas dentro de cada hito */
.milestone-vaccines-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.vaccine-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.vaccine-row.is-administered {
  background: var(--success-light);
  border-color: rgba(22, 163, 74, 0.3);
}

.vaccine-row.is-administered .vaccine-name {
  text-decoration: line-through;
  color: var(--success-text);
}

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

.vaccine-header-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.vaccine-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-heading);
}

.vaccine-dose-badge {
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.vaccine-funding-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.badge-funded {
  background: var(--success-light);
  color: var(--success-text);
}

.badge-funded-ccaa {
  background: var(--success-light);
  color: var(--success-text);
  border: 1px dashed rgba(22, 163, 74, 0.4);
}

.badge-aep-unfunded {
  background: var(--warning-light);
  color: var(--warning-text);
}

.badge-seasonal {
  background: var(--info-light);
  color: var(--info-text);
}

.vaccine-diseases {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.vaccine-note {
  font-size: 0.8125rem;
  color: var(--primary);
  margin-top: 0.25rem;
  font-style: italic;
}

.vaccine-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.btn-vaccine-detail {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
  transition: all 0.15s ease;
}

.btn-vaccine-detail:hover {
  background: var(--border-color);
}

.vaccine-check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
  min-height: 36px;
}

.vaccine-check-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--success);
  cursor: pointer;
}

@media (max-width: 640px) {
  .vaccine-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .vaccine-actions {
    width: 100%;
    justify-content: space-between;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
  }
}

/* Modales accesibles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-sizing: border-box;
  transform: translateY(15px);
  transition: transform 0.2s ease;
}

.modal-overlay.is-open .modal-content {
  transform: translateY(0);
}

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

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
}

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

.modal-body {
  padding: 1.5rem;
}

.vaccine-modal-meta {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.modal-meta-item strong {
  color: var(--text-heading);
}

.modal-section {
  margin-bottom: 1.25rem;
}

.modal-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

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

.modal-alert-box {
  background: var(--warning-light);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--warning-text);
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-size: 0.84rem;
  line-height: 1.45;
  margin-top: 0.75rem;
}

.modal-alert-box svg {
  flex-shrink: 0;
  margin-top: 2px;
}

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

/* Guía SEO y preguntas frecuentes FAQ */
.seo-guide-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.faq-container {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin-top: 1.25rem;
}

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

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

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

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

.faq-question::after {
  content: "+";
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.faq-item[open] .faq-question::after {
  content: "−";
  transform: rotate(180deg);
}

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

.faq-answer p {
  margin: 0 0 0.75rem 0;
}

.faq-answer ul {
  margin: 0.5rem 0 0.75rem 1.25rem;
  padding: 0;
}

.faq-answer li {
  margin-bottom: 0.35rem;
}

/* Estilos de impresión de alta fidelidad (@media print) */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .app-header,
  .tools-ad-banner-section,
  .tool-ad-sidebar,
  .fijate-footer,
  .toolbar-container,
  .btn-vaccine-detail,
  .btn-action,
  .hero-panel,
  .form-grid,
  .seo-guide-section,
  .affiliate-showcase-section,
  .related-tools-section {
    display: none !important;
  }

  .tool-layout,
  .tool-with-sidebar,
  .tool-main-content,
  .card-main {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
    display: block !important;
  }

  .print-only-header {
    display: block !important;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #000000;
  }

  .milestone-card {
    border: 1px solid #999999 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-bottom: 1rem !important;
    padding: 0.75rem !important;
  }

  .vaccine-row {
    border: 1px solid #cccccc !important;
    page-break-inside: avoid;
  }

  .vaccine-check-label {
    font-size: 0.75rem !important;
  }
}

.print-only-header {
  display: none;
}
