/* ═══════════════════════════════════════════════════════════════
   El Cambio Digital — Módulo de Facturación Pública
   Diseño: premium, oscuro + teal, tipografía Inter
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── Variables de marca ──────────────────────────────────────── */
:root {
  /* Paleta El Cambio Digital */
  --navy:          #0f1b2d;
  --navy-mid:      #162438;
  --navy-light:    #1e3a5f;
  --teal:          #2c9fa8;
  --teal-hover:    #259099;
  --teal-claro:    #e8f8f9;
  --teal-mid:      #b2e5e9;

  /* Superficies */
  --fondo:         #f0f4f8;
  --fondo-card:    #ffffff;
  --fondo-inset:   #f5f7fa;
  --borde:         #e2e8f0;
  --borde-dark:    #cbd5e0;

  /* Texto */
  --texto:         #1c2e3e;
  --texto-suave:   #5a7084;
  --texto-muy-suave: #93a3b1;

  /* Espaciado */
  --sp-1: 4px;  --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px;  --sp-8: 32px;  --sp-10: 40px; --sp-12: 48px;

  /* Tipografía */
  --text-2xs: 0.65rem;
  --text-xs:  0.72rem;
  --text-sm:  0.855rem;
  --text-base:1rem;
  --text-lg:  1.125rem;
  --text-xl:  1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.5rem;
  --text-5xl: 3.25rem;
  --fw-light:   300;
  --fw-normal:  400;
  --fw-medium:  500;
  --fw-semibold:600;
  --fw-bold:    700;
  --fw-extrabold:800;
  --lh-tight:   1.2;
  --lh-snug:    1.4;
  --lh-relaxed: 1.65;

  /* Bordes */
  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-xl:   16px;
  --r-2xl:  20px;
  --r-full: 999px;

  /* Sombras */
  --s-xs: 0 1px 2px rgba(0,0,0,0.05);
  --s-sm: 0 1px 4px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --s-md: 0 4px 12px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
  --s-lg: 0 10px 30px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.05);
  --s-teal: 0 4px 16px rgba(44,159,168,0.25);

  /* Estados */
  --c-exito:       #16a34a;
  --c-exito-fondo: #dcfce7;
  --c-exito-texto: #14532d;
  --c-error:       #dc2626;
  --c-error-fondo: #fee2e2;
  --c-error-texto: #7f1d1d;
  --c-info:        var(--teal);
  --c-info-fondo:  var(--teal-claro);
  --c-info-texto:  #0d6f78;
  --c-warn:        #d97706;
  --c-warn-fondo:  #fef3c7;
  --c-warn-texto:  #78350f;
}

/* ─── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--text-base);
  line-height: var(--lh-relaxed);
  color: var(--texto);
  background: var(--fondo);
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ─── Header ──────────────────────────────────────────────────── */
.site-header {
  background: var(--navy);
  background-image: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  padding: var(--sp-5) 0;
  position: relative;
  overflow: hidden;
}

/* Sutil patrón de puntos decorativo */
.site-header::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(44,159,168,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
}

.header-logo img  { height: 88px; width: auto; }
.header-logo-text {
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  color: #fff;
}

.header-datos {
  text-align: right;
  color: rgba(255,255,255,0.55);
  font-size: var(--text-xs);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.header-datos strong {
  color: rgba(255,255,255,0.9);
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  margin-bottom: 2px;
}

/* Barra de acento teal debajo del header */
.accent-bar {
  height: 3px;
  background: var(--teal);
}

/* ─── Contenido principal ─────────────────────────────────────── */
.main-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-6) var(--sp-12);
}

@media (max-width: 640px) {
  .main-wrap { padding: var(--sp-5) var(--sp-4) var(--sp-10); }
}

/* ─── Hero: tipo + número + monto ────────────────────────────── */
.hero {
  background: var(--navy);
  background-image: linear-gradient(160deg, var(--navy-mid) 0%, var(--navy) 100%);
  border-radius: var(--r-2xl);
  padding: var(--sp-8) var(--sp-10);
  margin-bottom: var(--sp-4);
  color: #fff;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -40px; right: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  border: 40px solid rgba(44,159,168,0.10);
  pointer-events: none;
}

.hero-tipo {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--teal);
  margin-bottom: var(--sp-2);
}

.hero-numero {
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  color: #fff;
  margin-bottom: var(--sp-2);
  font-variant-numeric: tabular-nums;
}

.hero-monto {
  font-size: var(--text-5xl);
  font-weight: var(--fw-extrabold);
  color: #fff;
  line-height: 1;
  margin-bottom: var(--sp-5);
  font-variant-numeric: tabular-nums;
}

.hero-monto .signo {
  font-size: var(--text-4xl);
  font-weight: var(--fw-semibold);
  opacity: 0.85;
  vertical-align: baseline;
  margin-right: 4px;
}

.hero-meta {
  display: flex;
  gap: var(--sp-6);
  flex-wrap: wrap;
}

.hero-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-meta-label {
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.45);
  font-weight: var(--fw-semibold);
}

.hero-meta-value {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.92);
  font-weight: var(--fw-semibold);
  font-family: monospace;
  letter-spacing: 0.02em;
}

/* ─── Barra de acciones ───────────────────────────────────────── */
.acciones-barra {
  background: var(--fondo-card);
  border: 1px solid var(--borde);
  border-radius: var(--r-xl);
  padding: var(--sp-4) var(--sp-6);
  box-shadow: var(--s-sm);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-6);
}

/* ─── Botones ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-5);
  border-radius: var(--r-lg);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primario {
  background: var(--teal);
  color: #fff;
  box-shadow: var(--s-teal);
}
.btn-primario:hover { background: var(--teal-hover); color: #fff; }

.btn-secundario {
  background: var(--fondo-card);
  color: var(--texto);
  border: 1px solid var(--borde-dark);
  box-shadow: var(--s-xs);
}
.btn-secundario:hover { background: var(--fondo); color: var(--texto); }

.btn-ghost {
  background: transparent;
  color: var(--teal);
  border: 1px solid var(--teal-mid);
}
.btn-ghost:hover { background: var(--teal-claro); color: var(--c-info-texto); }

/* ─── Grid principal ──────────────────────────────────────────── */
.grid-detalle {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: var(--sp-4);
  align-items: start;
}

@media (max-width: 680px) {
  .grid-detalle { grid-template-columns: 1fr; }
}

/* ─── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--fondo-card);
  border: 1px solid var(--borde);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  box-shadow: var(--s-sm);
  margin-bottom: var(--sp-4);
  transition: box-shadow 0.2s;
}

.card:hover { box-shadow: var(--s-md); }

.card-teal-accent {
  border-left: 3px solid var(--teal);
}

.card-warn-accent {
  border-left: 3px solid var(--c-warn);
}

/* ─── Sección título ──────────────────────────────────────────── */
.seccion-titulo {
  font-size: var(--text-2xs);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--teal);
  border-bottom: 1px solid var(--teal-mid);
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-4);
  margin-top: var(--sp-5);
}

.seccion-titulo:first-child { margin-top: 0; }

/* ─── Info grid ───────────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.info-grid.single { grid-template-columns: 1fr; }

.info-card {
  background: var(--fondo-inset);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid rgba(0,0,0,0.04);
}

.info-etiqueta {
  font-size: var(--text-2xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--texto-muy-suave);
  margin-bottom: var(--sp-1);
}

.info-valor {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--texto);
}

/* ─── CAE box ─────────────────────────────────────────────────── */
.cae-box {
  background: var(--fondo-inset);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--borde);
  border-left: 4px solid var(--teal);
}

.cae-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-4);
}

.cae-numero {
  font-family: 'Courier New', monospace;
  font-size: var(--text-base);
  font-weight: var(--fw-bold);
  color: var(--texto);
  letter-spacing: 0.04em;
  word-break: break-all;
}

/* ─── Badges de estado ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-full);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
}

.badge::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.badge-grande {
  font-size: var(--text-base);
  padding: var(--sp-2) var(--sp-5);
}

.badge-exito       { background: var(--c-exito-fondo); color: var(--c-exito-texto); }
.badge-error       { background: var(--c-error-fondo); color: var(--c-error-texto); }
.badge-info        { background: var(--c-info-fondo);  color: var(--c-info-texto); }
.badge-advertencia { background: var(--c-warn-fondo);  color: var(--c-warn-texto); }

/* ─── Alertas ─────────────────────────────────────────────────── */
.alerta {
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-5);
  margin-bottom: var(--sp-4);
  font-size: var(--text-sm);
  line-height: var(--lh-relaxed);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
}

.alerta-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.alerta a { font-weight: var(--fw-semibold); }

.alerta-info        { background: var(--c-info-fondo); color: var(--c-info-texto); }
.alerta-advertencia { background: var(--c-warn-fondo); color: var(--c-warn-texto); }
.alerta-error       { background: var(--c-error-fondo); color: var(--c-error-texto); }
.alerta-exito       { background: var(--c-exito-fondo); color: var(--c-exito-texto); }

/* ─── Descripción ─────────────────────────────────────────────── */
.descripcion-texto {
  font-size: var(--text-sm);
  line-height: var(--lh-relaxed);
  color: var(--texto-suave);
}

/* ─── Footer ──────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: var(--sp-8) var(--sp-6) var(--sp-10);
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.45);
  background: var(--navy);
  border-top: 3px solid var(--teal);
  margin-top: var(--sp-10);
}

.site-footer p { margin-bottom: var(--sp-1); }
.site-footer strong { color: rgba(255,255,255,0.85); }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover strong { color: var(--teal); }
.header-logo { display: flex; align-items: center; }
.header-logo a { display: flex; align-items: center; text-decoration: none; line-height: 0; }
.header-datos a { color: inherit; text-decoration: none; }
.header-datos a:hover strong { color: var(--teal); }

.footer-logo { margin: 0 auto var(--sp-4); height: 80px; }

/* ─── Página de error ─────────────────────────────────────────── */
.error-page {
  max-width: 480px;
  margin: 80px auto;
  text-align: center;
}

.error-code {
  font-size: 6rem;
  font-weight: var(--fw-extrabold);
  color: var(--teal);
  opacity: 0.2;
  line-height: 1;
  margin-bottom: var(--sp-4);
}

.error-title {
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  margin-bottom: var(--sp-3);
}

.error-msg { color: var(--texto-suave); }

/* ─── Responsive ajustes ──────────────────────────────────────── */
@media (max-width: 480px) {
  .hero { padding: var(--sp-6); border-radius: var(--r-xl); }
  .hero-monto { font-size: var(--text-4xl); }
  .hero-meta { gap: var(--sp-4); }
  .acciones-barra { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
  .site-header { padding: var(--sp-4); }
  .header-datos { display: none; }
}

/* ─── Print ───────────────────────────────────────────────────── */
@media print {
  .site-header { background: #0f1b2d !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .hero        { background: #0f1b2d !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .accent-bar  { background: #2c9fa8 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .acciones-barra { display: none; }
  .card        { box-shadow: none; }
  .site-footer { margin-top: 16px; }
}
