/* =====================================================================
   analyzer.css - resultado del analizador de la home (bloque inline de
   estado + modal del informe). Extraido de landing.css y del <style> inline
   de la front-page vieja, re-tokenizado al design system.

   Depende de wpr.css (tokens y .btn). Se carga solo en is_front_page().
   Los ids y las clases NO se pueden renombrar: assets/js/landing.js los
   busca por nombre (analyzerLoading, analyzerStatus, analyzerError, report*).
   ===================================================================== */

/* ---------------------------------------------------------------------
   Bloque de resultado bajo la tarjeta del analizador del hero.
   #analyzerResult es un contenedor sin caja: lo que se muestra u oculta
   son sus hijos, igual que en la home vieja.
   --------------------------------------------------------------------- */
.analyzer-result {
  max-width: 820px;
  margin: 0 auto;
  text-align: center;
}
.analyzer-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 24px auto 0;
  max-width: 420px;
  font-size: var(--fs-text-3);
  color: var(--gray-600);
  animation: fadeInUp .3s ease;
}
.analyzer-error {
  margin: 24px auto 0;
  max-width: 520px;
  padding: 20px 24px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  font-size: var(--fs-text-3);
  line-height: 1.6;
  color: var(--gray-600);
  animation: fadeInUp .3s ease;
}
.analyzer-error p { margin: 0 0 14px; }

/* ---------------------------------------------------------------------
   Variantes de boton que usa el pie del modal. La base .btn vive en wpr.css.
   --------------------------------------------------------------------- */
.btn--primary { background: var(--blue-500); color: var(--white); }
.btn--outline {
  background: transparent;
  color: var(--blue-500);
  border: 1px solid var(--blue-500);
}
.btn--outline:hover { background: var(--blue-500); color: var(--white); }
.btn--sm { height: 38px; padding: 0 16px; font-size: var(--fs-sm); }

/* ===== REPORT MODAL ===== */
.report-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  overflow-y: auto;
  padding: 24px;
}
.report-overlay.open {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity:0 } to { opacity:1 } }

.report-modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  max-width: 720px;
  width: 100%;
  margin: 20px auto;
  box-shadow: 0 25px 60px rgba(0,0,0,.3);
  position: relative;
  overflow: hidden;
}
.report-modal__close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  z-index: 2;
  line-height: 1;
}
.report-modal__close:hover { color: var(--white); }

/* Report Header with screenshot */
.report-header {
  background: linear-gradient(135deg, var(--navy-900) 0%, #2c3c66 100%);
  color: var(--white);
  padding: 28px 32px;
}
.report-header__top {
  display: flex;
  align-items: center;
  gap: 24px;
}
.report-header__info { flex: 1; }
.report-header__brand {
  font-size: 0.85rem;
  opacity: .7;
  margin-bottom: 8px;
}
.report-header__icon { margin-right: 4px; vertical-align: -2px; }
.report-header__title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.report-header__url {
  font-size: 1rem;
  color: #7b93ff;
  font-weight: 600;
}
.report-header__date {
  font-size: 0.8rem;
  opacity: .5;
  margin-top: 4px;
}
.report-header__screenshot {
  width: 180px;
  height: 120px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid rgba(255,255,255,.15);
  flex-shrink: 0;
  background: #0f172a;
}
.report-header__screenshot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

/* Grade cards */
.report-grades {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 28px 32px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.report-grade-card {
  text-align: center;
  padding: 16px 32px;
  border-radius: var(--radius-lg);
  background: var(--white);
  border: 1px solid var(--gray-200);
  min-width: 160px;
}
.report-grade-card__letter {
  font-size: 2.8rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 2px;
}
.report-grade-card__score {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.report-grade-card__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-caption);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
}
.report-grade-card__context {
  font-size: 0.72rem;
  color: var(--gray-400);
  line-height: 1.4;
}
.report-grade-card--na {
  opacity: .5;
}

/* Page stats bar */
.report-stats {
  display: flex;
  justify-content: space-around;
  padding: 16px 32px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  flex-wrap: wrap;
  gap: 8px;
}
.report-stat {
  text-align: center;
  padding: 4px 8px;
}
.report-stat__value {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  color: var(--gray-900);
}
.report-stat__label {
  display: block;
  font-size: 0.65rem;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.report-stat--bad .report-stat__value { color: var(--score-poor); }

/* Filmstrip */
.report-filmstrip {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 0;
}
.report-filmstrip__frame {
  flex-shrink: 0;
  text-align: center;
}
.report-filmstrip__frame img {
  width: 90px;
  height: 160px;
  object-fit: cover;
  object-position: top;
  border-radius: var(--radius-xs);
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.report-filmstrip__time {
  display: block;
  font-size: 0.65rem;
  color: var(--gray-400);
  margin-top: 4px;
  font-weight: 600;
}

/* Report sections */
.report-section {
  padding: 24px 32px;
  border-bottom: 1px solid var(--gray-200);
}
.report-section__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.report-section__title::before {
  content: '';
  width: 4px;
  height: 18px;
  background: var(--blue-500);
  border-radius: 2px;
}

/* Metrics table (mobile vs desktop side by side) */
.report-metrics-table {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
.report-metrics-row {
  display: grid;
  grid-template-columns: 100px 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.85rem;
  align-items: center;
}
.report-metrics-row--header {
  font-weight: 700;
  color: var(--text-caption);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gray-200);
}
.report-metrics-cell {
  padding: 10px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.report-metrics-cell__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.report-metrics-cell__label {
  font-weight: 600;
  color: #374151;
}
.report-metrics-cell__value {
  font-weight: 700;
}

/* WP Stack in report */
.report-stack {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.report-stack__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  font-size: 0.82rem;
}
.report-stack__item--bad {
  border-color: #fca5a5;
  background: #fef2f2;
}
.report-stack__label { color: var(--text-caption); }
.report-stack__value { font-weight: 700; color: var(--gray-900); }
.report-stack__item--bad .report-stack__value { color: #dc2626; }

.report-plugins {
  margin-top: 12px;
  font-size: 0.8rem;
  line-height: 2;
}
.report-plugin-tag {
  display: inline-block;
  padding: 2px 10px;
  background: var(--gray-200);
  border-radius: var(--radius-xs);
  border: 1px solid #e2e8f0;
  margin: 2px;
  font-size: 0.75rem;
}
.report-plugin-tag--heavy {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #dc2626;
}

/* Report issues (shared for WP issues, opps, diags) */
.report-issues { display: flex; flex-direction: column; gap: 8px; }
.report-issue {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.report-issue__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 0.85rem;
}
.report-issue__severity {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--white);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  flex-shrink: 0;
}
.report-issue__label { flex: 1; color: var(--gray-900); font-weight: 500; }
.report-issue__savings {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--score-poor);
  white-space: nowrap;
}
.report-issue__body {
  padding: 0 14px 12px;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-caption);
}
.report-issue__solution { color: var(--gray-400); }
.report-issue__solution strong { color: var(--score-good); }

/* Not WordPress */
.report-not-wp {
  text-align: center;
  padding: 32px;
  color: #92400e;
  background: #fefce8;
  font-size: 0.9rem;
}
.report-not-wp a { color: var(--blue-500); font-weight: 600; }

/* Report footer */
.report-footer {
  padding: 24px 32px;
  text-align: center;
  background: var(--gray-50);
}
.report-footer__msg {
  color: #374151;
  font-size: 0.95rem;
  margin-bottom: 16px;
  font-weight: 500;
}
.report-footer__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin-bottom: 16px;
}
.report-email-form {
  display: flex;
  gap: 8px;
}
.report-email-input {
  padding: 8px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  width: 200px;
}
.btn--sm { padding: 8px 16px; font-size: 0.82rem; }
.report-share {
  margin: 12px 0 4px;
  text-align: left;
}
.report-share__label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-caption);
  font-weight: 600;
  margin-bottom: 6px;
}
.report-share__row {
  display: flex;
  gap: 8px;
}
.report-share__url {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  color: #374151;
  background: var(--white);
  outline: none;
  cursor: text;
}
.report-share__url:focus {
  border-color: var(--blue-500);
}
.report-share__copy {
  padding: 8px 16px;
  border: 1px solid var(--blue-500);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--blue-500);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.report-share__copy:hover {
  background: var(--blue-500);
  color: var(--white);
}
.report-footer__brand {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 8px;
}

/* Impact cards */
.report-impact__cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.report-impact__card {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.report-impact__icon { font-size: 1.5rem; margin-bottom: 4px; }
.report-impact__value { font-size: 1.4rem; font-weight: 800; color: #dc2626; }
.report-impact__label { font-size: 0.8rem; color: #991b1b; font-weight: 600; margin-bottom: 8px; }
.report-impact__detail { font-size: 0.75rem; color: var(--text-caption); line-height: 1.5; }

/* Action plan */
.report-plan__step {
  display: flex;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-200);
}
.report-plan__step:last-child { border-bottom: none; }
.report-plan__num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue-500);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.report-plan__content { flex: 1; }
.report-plan__header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.report-plan__title { font-weight: 600; font-size: 0.9rem; color: var(--gray-900); }
.report-plan__badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--white);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
}
.report-plan__detail { font-size: 0.82rem; color: var(--text-caption); line-height: 1.5; }

/* Responsive modal */
@media (max-width: 600px) {
  .report-overlay { padding: 8px; }
  .report-modal { border-radius: var(--radius-lg); }
  .report-header { padding: 20px; }
  .report-header__top { flex-direction: column; text-align: center; }
  .report-header__screenshot { width: 140px; height: 90px; }
  .report-section { padding: 20px; }
  .report-grades { gap: 12px; padding: 20px; flex-wrap: wrap; }
  .report-grade-card { min-width: 120px; padding: 12px 20px; }
  .report-grade-card__letter { font-size: 2rem; }
  .report-stats { padding: 12px 16px; }
  .report-stat__value { font-size: 0.85rem; }
  .report-footer { padding: 20px; }
  .report-metrics-row { grid-template-columns: 60px 1fr 1fr; font-size: 0.78rem; }
  .report-stack { grid-template-columns: 1fr; }
  .report-email-form { flex-direction: column; width: 100%; }
  .report-email-input { width: 100%; }
  .report-share__row { flex-direction: column; }
  .report-share__copy { width: 100%; }
  .report-filmstrip__frame img { width: 60px; height: 107px; }
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--blue-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
