/* HuellaSafe — Estilos globales */

:root {
  --escudo-red: #A32D2D;
  --escudo-red-dark: #8B2525;
  --escudo-red-light: #C44A4A;
  --escudo-red-muted: #FDF2F2;

  /* Niveles de riesgo del score */
  --risk-bajo: #1D9E75;
  --risk-moderado: #D4A017;
  --risk-alto: #E07B30;
  --risk-critico: #C0392B;
  --risk-severo: #7B241C;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Títulos display en serif (Playfair Display). Clase aplicada a mano solo a heroes
   y h2 de sección grandes; el cuerpo y la UI siguen en Inter. letter-spacing:normal
   neutraliza cualquier tracking heredado. No requiere override en html.dark — la
   fuente no cambia con el tema. */
.hs-display {
  font-family: 'Playfair Display', serif;
  letter-spacing: normal;
}

/* Inputs con foco en color de marca */
input:focus,
textarea:focus,
select:focus {
  outline: none;
}

/* Botón deshabilitado */
.btn-scan:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

/* Animación sutil para tarjetas */
.card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -8px rgba(163, 45, 45, 0.15);
}

/* Escudo logo pulse sutil en hero */
@keyframes shield-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

.shield-icon {
  animation: shield-pulse 3s ease-in-out infinite;
}

/* ── Dashboard ── */

.sidebar-link.active {
  background-color: var(--escudo-red-muted);
  color: var(--escudo-red);
}

.threat-filter.active {
  background-color: var(--escudo-red);
  border-color: var(--escudo-red);
  color: #fff;
}

.exposure-bar {
  transition: width 1s ease-out;
}

.risk-ring-progress {
  transition: stroke-dashoffset 1.2s ease-out, stroke 0.4s ease;
}

#dash-score-value,
#dash-risk-label,
#dash-risk-desc {
  transition: color 0.4s ease;
}

.sidebar.open {
  transform: translateX(0);
}

/* ── Academia: guías expandibles ── */

.guia-card summary {
  list-style: none;
}

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

.guia-card .guia-chevron {
  transition: transform 0.2s ease;
}

.guia-card[open] .guia-chevron {
  transform: rotate(180deg);
}

.guia-block-title {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--escudo-red);
}

.guia-steps {
  list-style: decimal;
  padding-left: 1.25rem;
}

.guia-steps li {
  margin-top: 0.5rem;
  padding-left: 0.25rem;
}

/* ── Academia: radar de amenazas ── */

.radar-card summary {
  list-style: none;
}

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

.radar-card .radar-chevron {
  transition: transform 0.2s ease;
}

.radar-card[open] .radar-chevron {
  transform: rotate(180deg);
}

.radar-badge-critico {
  background-color: #fee2e2;
  color: #991b1b;
}

.radar-badge-alto {
  background-color: #ffedd5;
  color: #9a3412;
}

.radar-badge-medio {
  background-color: #fef9c3;
  color: #854d0e;
}

.radar-archivo-modal:not(.hidden) {
  display: flex;
}

.radar-archivo-year summary,
.radar-archivo-month summary {
  list-style: none;
}

.radar-archivo-year summary::-webkit-details-marker,
.radar-archivo-month summary::-webkit-details-marker {
  display: none;
}

.scan-progress-bar {
  transition: width 0.35s ease-out;
}

.badge-verificado {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background-color: #d1fae5;
  color: var(--risk-bajo);
}

.badge-estimado {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background-color: #f3f4f6;
  color: #6b7280;
}

.badge-informativo {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background-color: #f3f4f6;
  color: #6b7280;
}

.badge-proceso {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background-color: #fef3c7;
  color: #b45309;
}

.badge-resuelto {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background-color: #d1fae5;
  color: #065f46;
}

.badge-severidad {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  text-transform: capitalize;
}

.badge-severidad-critico {
  background-color: #fde8e6;
  color: var(--risk-critico);
}

.badge-severidad-alto {
  background-color: #fdede4;
  color: var(--risk-alto);
}

.badge-severidad-medio {
  background-color: #fef9e7;
  color: var(--risk-moderado);
}

.badge-severidad-bajo {
  background-color: #d1fae5;
  color: var(--risk-bajo);
}

.auth-tab-active {
  background-color: #fff;
  color: #A32D2D;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.auth-tab:not(.auth-tab-active):hover {
  color: #374151;
}

.rutificador-confirm-btn:active {
  transform: scale(0.98);
}

.rutificador-btn-si {
  background-color: #C0392B;
  border-color: #C0392B;
}

.rutificador-btn-si:hover {
  background-color: #a93226;
  border-color: #a93226;
}

.rutificador-btn-no {
  background-color: #1D9E75;
  border-color: #1D9E75;
}

.rutificador-btn-no:hover {
  background-color: #178364;
  border-color: #178364;
}

.rutificador-btn-antigua {
  background-color: #fef9e7;
  border-color: #D4A017;
  color: #92400e;
}

.rutificador-btn-antigua:hover {
  background-color: #fde68a;
  border-color: #b8860b;
}

.rutificador-btn-no-indicar {
  background-color: #f3f4f6;
  border-color: #d1d5db;
  color: #4b5563;
}

.rutificador-btn-no-indicar:hover {
  background-color: #e5e7eb;
  border-color: #9ca3af;
}

.riesgo-contextual-card {
  background-color: #f8f9fa;
}

.riesgo-contextual-block + .riesgo-contextual-block {
  padding-top: 0.25rem;
}

/* ── Sección de alias (#alias en index.html) ──
   La estructura 2-col y las SUPERFICIES van en utilidades Tailwind y heredan el
   modo oscuro existente. La columna izquierda usa el eyebrow y los ticks de marca;
   la columna derecha es una imagen (.alias-img). Cada clase con color tiene su par
   html.dark al final del bloque de modo oscuro. */
.alias-mock-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #A32D2D;
  background: rgba(163, 45, 45, 0.08);
  padding: 6px 13px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.alias-mock-eyebrow span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #A32D2D;
}
.alias-mock-tick {
  flex-shrink: 0;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  margin-top: 1px;
  background: rgba(163, 45, 45, 0.1);
  color: #A32D2D;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
}

/* ── "Cómo funciona" — tarjetas pasado/presente/futuro (#como-funciona) ──
   Hover en desktop levanta .cf-detail; en touch lo togglea la clase .open (JS).
   Las clases con color de marca/superficie tienen su par html.dark más abajo.
   Las que viven sobre la imagen (base/eyebrow/título/brief/detalle) usan blanco
   y overlays oscuros: son iguales en ambos temas (van sobre la imagen). */
.cf-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}
.cf-card {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 16px 40px -24px rgba(80, 20, 20, 0.25);
  min-height: 30rem;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}
.cf-card:focus-visible {
  outline: 2px solid #A32D2D;
  outline-offset: 2px;
}
.cf-card-img {
  position: relative;
  aspect-ratio: 3 / 4;
  width: 100%;
  overflow: hidden;
  background: #e5e7eb;
  flex-shrink: 0;
}
/* La imagen real, cuando se reemplace el placeholder, cubre toda la zona. */
.cf-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cf-num {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #A32D2D;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.cf-base {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 22px 20px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.6) 55%, rgba(0, 0, 0, 0) 100%);
  color: #fff;
  transition: transform .35s ease, opacity .35s ease;
}
.cf-eyebrow {
  /* Badge: banda de vidrio esmerilado SOLO bajo el texto del eyebrow (inline-flex
     para ajustarse al ancho del texto). El blur + fondo oscuro semitransparente
     refuerzan el rosado sobre zonas claras de la foto; el text-shadow suma contraste.
     Es mode-agnostic (va sobre la imagen): no necesita par html.dark. */
  display: inline-flex;
  align-items: center;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #f0a8a6;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.5);
}
.cf-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.15;
  /* Sombra más sutil: el blanco ya tiene buen contraste por el gradiente,
     pero en fotos muy claras el título (justo bajo el eyebrow) puede quedar justo. */
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.cf-brief {
  font-size: 0.86rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.cf-hint {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  opacity: 0.85;
}
.cf-plus {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  line-height: 1;
}
.cf-detail {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: rgba(17, 24, 39, 0.86);
  backdrop-filter: blur(2px);
  color: #fff;
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .35s ease, transform .35s ease;
  pointer-events: none;
}
.cf-detail h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 14px;
  line-height: 1.15;
}
.cf-detail p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
}
@media (hover: hover) {
  .cf-card:hover .cf-detail { opacity: 1; transform: translateY(0); pointer-events: auto; }
  .cf-card:hover .cf-base { opacity: 0; transform: translateY(10px); }
}
.cf-card.open .cf-detail { opacity: 1; transform: translateY(0); pointer-events: auto; }
.cf-card.open .cf-base { opacity: 0; }
@media (max-width: 880px) {
  .cf-grid { grid-template-columns: 1fr; gap: 22px; max-width: 26rem; margin-left: auto; margin-right: auto; }
  .cf-card { min-height: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .cf-base, .cf-detail { transition: none !important; }
}

/* ════════════════════════════════════════════════════════════
   MODO OSCURO — controlado por la clase .dark en <html>.
   js/theme-init.js aplica la clase (preferencia guardada > sistema)
   antes del primer paint. Si agregas superficies nuevas, replica
   el patrón aquí prefijando el selector con "html.dark".
   ════════════════════════════════════════════════════════════ */

/* Tokens de marca/riesgo recalibrados para fondo oscuro.
   Las clases que usan var(...) se voltean solas. */
html.dark {
  --escudo-red: #D05757;
  --escudo-red-muted: #241619;
  --risk-bajo: #34D399;
  --risk-moderado: #FBBF24;
  --risk-alto: #FB923C;
  --risk-critico: #F87171;
  --risk-severo: #EF4444;
}

/* ── Superficies base ── */
html.dark body { background-color: #0F1217 !important; color: #E6E8EC !important; }
html.dark .bg-gray-50 { background-color: #0F1217 !important; }
html.dark .bg-white { background-color: #181C23 !important; }
html.dark .bg-gray-100 { background-color: #22272F !important; }
html.dark .hover\:bg-gray-50:hover { background-color: #22272F !important; }
html.dark .hover\:bg-gray-100:hover { background-color: #2A303A !important; }

/* ── Bordes ── */
html.dark .border-gray-100 { border-color: #232831 !important; }
html.dark .border-gray-200 { border-color: #2A2F3A !important; }
html.dark .border-gray-300 { border-color: #353C48 !important; }

/* ── Texto ── */
html.dark .text-gray-900 { color: #E6E8EC !important; }
html.dark .text-gray-800 { color: #DADDE3 !important; }
html.dark .text-gray-700 { color: #C2C7D0 !important; }
html.dark .text-gray-600 { color: #A8AEB9 !important; }
html.dark .text-gray-500 { color: #8B919C !important; }
html.dark .text-gray-400 { color: #6B7280 !important; }

/* ── Marca (utilidades Tailwind) ── */
html.dark .text-escudo { color: #D05757 !important; }
html.dark .bg-escudo-muted { background-color: #241619 !important; }
html.dark .hover\:bg-escudo-dark:hover { background-color: #B83C3C !important; }
/* bg-escudo (CTA) se mantiene: rojo con texto blanco lee bien sobre oscuro */

/* ── Inputs ── */
html.dark input, html.dark textarea, html.dark select {
  background-color: #1C2129 !important;
  color: #E6E8EC !important;
  border-color: #2A2F3A !important;
}
html.dark ::placeholder { color: #6B7280 !important; }

/* ── Anillo de score (atributo inline en el SVG) ── */
html.dark circle[stroke="#F3F4F6"] { stroke: #2A2F3A !important; }

/* ── Overlays de modales ── */
html.dark .bg-gray-900\/40, html.dark .bg-gray-900\/50 { background-color: rgba(0, 0, 0, 0.65) !important; }

/* ── Badges (fondos claros hardcodeados → oscuros) ── */
html.dark .badge-estimado, html.dark .badge-informativo { background-color: #262B34 !important; color: #9AA3AF !important; }
html.dark .badge-verificado, html.dark .badge-severidad-bajo { background-color: #0E2A20 !important; }
html.dark .badge-resuelto { background-color: #0E2A20 !important; color: #34D399 !important; }
html.dark .badge-proceso { background-color: #2C2412 !important; color: #E0B34D !important; }
html.dark .badge-severidad-critico { background-color: #2C1517 !important; }
html.dark .badge-severidad-alto { background-color: #2C1D12 !important; }
html.dark .badge-severidad-medio { background-color: #2C2713 !important; }
html.dark .radar-badge-critico { background-color: #2C1517 !important; color: #F2A6A2 !important; }
html.dark .radar-badge-alto { background-color: #2C1D12 !important; color: #F2BC93 !important; }
html.dark .radar-badge-medio { background-color: #2C2713 !important; color: #EAD68C !important; }

/* ── Componentes ── */
html.dark .riesgo-contextual-card { background-color: #1C2129 !important; }
html.dark .auth-tab-active { background-color: #181C23 !important; color: #D05757 !important; }
html.dark .auth-tab:not(.auth-tab-active):hover { color: #C2C7D0 !important; }
html.dark .card-hover:hover { box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.5) !important; }

/* Logo del login: versión con texto oscuro en claro, versión blanca en oscuro */
.logo-login-oscuro { display: none; }
html.dark .logo-login-claro { display: none !important; }
html.dark .logo-login-oscuro { display: block !important; }

/* ── Fondos translúcidos y gradientes (no capturados por overrides sólidos) ── */
html.dark .bg-white\/90 { background-color: rgba(24, 28, 35, 0.92) !important; }
html.dark .bg-white\/80 { background-color: rgba(24, 28, 35, 0.85) !important; }
html.dark .bg-gradient-to-b.from-escudo-muted\/60 {
  background-image: linear-gradient(to bottom, #1A1316, #0F1217) !important;
}
html.dark .bg-gradient-to-br.from-escudo-muted {
  background-image: linear-gradient(to bottom right, #241619, #181C23) !important;
}

/* ── Barra Dark Web (relleno gris oscuro que se fundía con el fondo) ── */
html.dark .bg-gray-800.rounded-full { background-color: #64748B !important; }

/* ── Sección empresas (teaser + panel expandible) ── */
html.dark .text-\[\#1a1a1a\] { color: #E6E8EC !important; }                 /* título teaser, antes negro sobre oscuro */
html.dark #modulo-empresas > article { border-color: #2A2F3A !important; }   /* borde rosado inline del teaser */
html.dark .bg-escudo-muted\/60 { background-color: #1E1619 !important; }     /* tarjetas de incidentes */
html.dark .bg-escudo-muted\/40 { background-color: #1A1316 !important; }     /* tarjetas "Para quién es" / hover */
html.dark .bg-gray-50\/80 { background-color: rgba(34, 39, 47, 0.8) !important; }  /* grid de riesgos */
html.dark .text-red-600\/80 { color: #EF9A98 !important; }                  /* descripción contextual de incidentes */

/* ── Tarjetas de riesgo contextual + badges pastel (Crítico/Alto/Medio) ── */
html.dark .bg-red-50 { background-color: #1F1416 !important; }
html.dark .bg-orange-50 { background-color: #1F1812 !important; }
html.dark .bg-yellow-50 { background-color: #1E1B11 !important; }
html.dark .border-red-200 { border-color: #3A1F22 !important; }
html.dark .border-orange-200 { border-color: #3A2A1A !important; }
html.dark .border-yellow-200 { border-color: #3A331A !important; }

/* ── Bloque azul de atestación (RUT) ── */
html.dark .bg-blue-50 { background-color: #141B26 !important; }
html.dark .border-blue-200 { border-color: #26374F !important; }
html.dark .bg-red-100 { background-color: #2C1517 !important; }
html.dark .bg-orange-100 { background-color: #2C1D12 !important; }
html.dark .bg-yellow-100 { background-color: #2A2613 !important; }
html.dark .text-red-700 { color: #F0908C !important; }
html.dark .text-orange-700 { color: #F0B473 !important; }
html.dark .text-yellow-700 { color: #E6C84F !important; }
html.dark .border-black\/5 { border-color: rgba(255, 255, 255, 0.08) !important; }

/* ── Sección de alias (#alias): pares oscuros. El eyebrow y los ticks de marca de
   la columna izquierda mantienen su color en oscuro; la imagen de la derecha se
   suaviza un poco para que su fondo claro/cálido no destaque demasiado. */
html.dark .alias-mock-eyebrow { color: #e0716f !important; background: rgba(224, 113, 111, 0.12) !important; }
html.dark .alias-mock-eyebrow span { background: #e0716f !important; }
html.dark .alias-mock-tick { color: #e0716f !important; background: rgba(224, 113, 111, 0.15) !important; }
html.dark .alias-img { filter: brightness(0.9); border: 1px solid #2A2F3A; }

/* ── "Cómo funciona" (#como-funciona): pares oscuros. Solo las superficies y el
   badge de marca cambian; el resto vive sobre la imagen (blanco/overlay) y es igual. */
html.dark .cf-card { background: #181C23 !important; border-color: #2A2F3A !important; }
html.dark .cf-card-img { background: #2A2F3A !important; }
html.dark .cf-num { background: #e0716f !important; }
html.dark .cf-detail { background: rgba(0, 0, 0, 0.82) !important; }
html.dark .cf-card:focus-visible { outline-color: #e0716f; }

/* ===================================================================
   Toggle Mensual/Anual — sección #planes
   (clases nuevas, sin colisión. Solo .billing-toggle__pill necesita
    par dark; el resto hereda los overrides globales de utilidades.)
   =================================================================== */

.billing-toggle { position: relative; }

.billing-toggle__pill {
  position: absolute;
  top: 4px; left: 4px; bottom: 4px;
  width: calc(50% - 4px);
  border-radius: 9999px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
  z-index: 0;
}
.billing-toggle[data-ciclo="anual"] .billing-toggle__pill { transform: translateX(100%); }

.billing-toggle__btn { position: relative; z-index: 1; transition: color .2s ease; }

/* Número de precio: tabular para que no salte el ancho al animar */
.precio-num { font-variant-numeric: tabular-nums; }

/* Nota "facturado anual": aparece/desaparece sin reflow brusco */
.anual-nota {
  max-height: 0; opacity: 0; overflow: hidden;
  transition: max-height .3s ease, opacity .3s ease, margin .3s ease;
}
article[data-ciclo-aware][data-mostrar-nota="1"] .anual-nota {
  max-height: 40px; opacity: 1; margin-top: .35rem;
}

.ahorro-badge { transition: opacity .25s ease, transform .25s ease; }

/* ── Modo oscuro: única regla nueva necesaria (la pastilla sobre fondo claro).
      El riel (bg-gray-100), texto (text-gray-500) y badge (bg-escudo) ya los
      cubren los overrides globales existentes de styles.css. ── */
html.dark .billing-toggle__pill { background: #181C23 !important; }

/* Hero video: en reduced-motion no autoreproduce; el poster queda visible */
@media (prefers-reduced-motion: reduce) {
  .hero-video { animation: none; }
}
