/* ============================================================
   AFRISTREAM THEME (afristream-za-v4) — portal CLARO.
   Valores medidos sobre el legacy (www.afristream.co.za):
   body bg rgb(249,249,249), texto negro, títulos rgb(77,77,77),
   barra de footer #da1376, chips PREMIUM #b8d434 / FREE #f5a134.
   ============================================================ */
:root,
.theme-afristream {
  --background: #f9f9f9;
  --foreground: #000000;
  --color-bg-base: #f9f9f9;
  --color-bg-card: #ffffff;
  --color-text-base: #000000;
  --color-text-heading: #4d4d4d;
  --color-text-muted: #6b6b6b;
  --color-border: #e2e2e2;
  --color-input-bg: #ffffff;
  --color-input-border: #cfcfcf;
  --color-error: #c0262d;

  --primary-400: #da1376;
  --primary-500: #da1376;
  --primary-600: #b50f63;
  --primary: #da1376;
  --primary-foreground: #ffffff;
  --secondary: #ffffff;
  --secondary-foreground: #000000;
  --secondary-600: #f5a134;
  --muted: #efefef;
  --muted-foreground: #6b6b6b;
  --accent: #f1e7f5;
  --accent-foreground: #000000;
  --card: #ffffff;
  --card-foreground: #000000;
  --popover: #ffffff;
  --popover-foreground: #000000;
  --border: #e2e2e2;
  --input: #cfcfcf;
  --ring: #da1376;

  --chip-premium: #b8d434;
  --chip-free: #f5a134;
  --gradient-primary: linear-gradient(112deg, #da1376 0%, #b50f63 100%);

  /* Header claro sobre fondo de página; footer = barra magenta del legacy */
  --header-bg: #f9f9f9;
  --header-shadow: none;
  --footer-bg: #da1376;
  --footer-border: transparent;
  --footer-text: #ffffff;

  --radius-card: 16px;
  /* Braah One (Google Fonts) como cuerpo. Los títulos del legacy usan CircularStd-Bold
     (fuente comercial): pendiente de decisión del usuario, ver docs/FONTS.md */
  --font-family-base: var(--font-braah-one), "Braah One", system-ui, sans-serif;
  --font-family-display: var(--font-varela-round), "Varela Round", var(--font-braah-one), system-ui, sans-serif;
}

/* El template fija el body oscuro: forzar el esquema claro del legacy */
body.theme-afristream {
  background-color: #f9f9f9 !important;
  color: #000000 !important;
  font-family: var(--font-family-base);
}

.pr-page { background-color: var(--color-bg-base); color: var(--color-text-base); }
.pr-card { background-color: var(--color-bg-card); border-color: var(--color-border); border-radius: var(--radius-card); max-width: 480px; }
.pr-title { color: var(--color-text-heading); font-size: 28px; font-weight: 700; }
.pr-subtitle { color: var(--color-text-muted); }
.pr-label { color: var(--color-text-base); font-size: 18px; }
.pr-input { background-color: var(--color-input-bg); border-color: var(--color-input-border); color: var(--color-text-base); border-radius: 999px; }
.pr-input:focus { border-color: var(--primary); outline: none; }
.pr-btn { background-color: var(--primary) !important; color: #fff !important; border-radius: 999px; font-weight: 700; font-size: 18px; }
.pr-btn:hover:not(:disabled) { opacity: 0.9; }
.pr-error-msg { color: var(--color-error); }
.pr-success-text { color: var(--color-text-base); }
.pr-rule { font-size: 14px; }
.pr-logo { max-height: 56px; }

/* El template mezcla primario→secundario en CTAs: en Afristream el CTA es el rosa de marca */
:root,
.theme-afristream {
  --gradient-primary-secondary: linear-gradient(112deg, #da1376 0%, #b50f63 100%);
  --color-surface-base: #da1376;
  --color-text-inverse: #ffffff;
}

/* El header ya lleva el logo (paridad con el legacy): sin logo grande sobre el login */
.login-logo-center { display: none; }

/* Mayor especificidad que :root de globals.css (que repinta los neutros oscuros del template) */
body.theme-afristream {
  --background: #f9f9f9;
  --foreground: #000000;
  --card: #ffffff;
  --card-foreground: #000000;
  --popover: #ffffff;
  --popover-foreground: #000000;
  --secondary: #ffffff;
  --secondary-foreground: #000000;
  --muted: #efefef;
  --muted-foreground: #6b6b6b;
  --accent: #f1e7f5;
  --accent-foreground: #000000;
  --border: #e2e2e2;
  --input: #cfcfcf;
  --primary-300: #f08cba; /* estado disabled del CTA: rosa claro, no el naranja del template */
  --color-text-base-op-64: rgba(255, 255, 255, 0.85);
}
body.theme-afristream .btn-tertiary { color: #ffffff; }
body.theme-afristream .login-input svg { color: #6b6b6b !important; }
body.theme-afristream [class*="border-input"] { background-color: #ffffff !important; }

/* Títulos, chips y títulos de card usan la fuente de display (Varela Round) */
body.theme-afristream h1,
body.theme-afristream h2,
body.theme-afristream h3,
body.theme-afristream .afri-display { font-family: var(--font-family-display); }

body.theme-afristream main { padding-bottom: 0 !important; }

body.theme-afristream { display: flex; flex-direction: column; min-height: 100vh; }
body.theme-afristream > main { flex: 1 0 auto; }

/* ── Páginas legales (legacy): sin título, ancho completo con 12px de margen, texto negro y enlaces amarillos ── */
body.theme-afristream .legal-page-container h1 { display: none; }
body.theme-afristream .legal-page-container .max-w-5xl { max-width: none; }
body.theme-afristream .legal-page-container .px-4 { padding-left: 5.78%; padding-right: 5.7%; }
body.theme-afristream .legal-page-container .legal-content,
body.theme-afristream .legal-page-container .legal-content * { color: #000000 !important; }
body.theme-afristream .legal-page-container .legal-content a,
body.theme-afristream .legal-page-container .legal-content a * { color: #f6b93b !important; }
body.theme-afristream .legal-page-container { padding-top: 49px; }
body.theme-afristream .legal-page-container .legal-content p { margin: 0 0 15px !important; }

/* ── Login: el template lo pinta en un overlay `fixed` a pantalla completa que tapaba el footer.
   En el legacy el login es una página normal con header y footer visibles. ── */
body.theme-afristream .signup-desktop-overlay { display: none !important; }
body.theme-afristream .signup-container {
  position: static !important;
  inset: auto !important;
  z-index: auto !important;
  display: block !important;
  min-height: 0 !important;
  background: transparent !important;
}
body.theme-afristream .login-content {
  padding: 0 16px !important;
  gap: 0 !important;
  justify-content: flex-start !important;
}

/* ── Interacción del legacy ────────────────────────────────────────────────────────────────
   Medido en el CSS del legacy: botones/enlaces con cursor pointer; botón "link_button" con ledge de
   8px (box-shadow -3px 8px) que al hover se hunde (translateY(8px), sin sombra, transition .1s);
   nav: hover rosa (#f94593, .5s); footer: hover rgba(255,255,255,.5); enlace básico: rgba(77,77,77,.5). */
body.theme-afristream :is(button, [role="button"], a[href], summary, select, label[for], input[type="submit"], input[type="checkbox"], input[type="radio"]) { cursor: pointer; }
body.theme-afristream :is(button:disabled, [aria-disabled="true"]) { cursor: not-allowed; }

body.theme-afristream .afri-btn {
  display: inline-block;
  background: #f94593;
  color: #fff;
  border-radius: 30px;
  box-shadow: -3px 8px 0 0 rgba(0, 0, 0, 0.5), -3px 8px 0 0 #f94593;
  cursor: pointer;
  transition: 0.1s;
}
body.theme-afristream .afri-btn:hover,
body.theme-afristream .afri-btn:active {
  transform: translateY(8px);
  box-shadow: none;
}
body.theme-afristream .afri-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

body.theme-afristream .afri-nav-link { transition: color 0.5s; }
body.theme-afristream .afri-nav-link:hover { color: #f94593 !important; }

body.theme-afristream nav[aria-label="Legal"] :is(a, button):hover { color: rgba(255, 255, 255, 0.5) !important; }
body.theme-afristream .afri-link:hover { color: rgba(77, 77, 77, 0.5) !important; }

/* Rejilla del catálogo (escritorio): 4 columnas dentro del contenedor de 1278px, inset de 18px a la izquierda;
   columna = 27.86% − 63px y hueco = 2.86% del ancho útil (249/32 a 1282px, 288/36 a 1885px). */
@media (min-width: 992px) {
  body.theme-afristream .afri-grid {
    grid-template-columns: repeat(4, calc(27.86% - 63px));
    column-gap: 2.86%;
    padding-left: 18px;
    justify-content: start;
  }
}

/* Rejilla del catálogo del detalle de contenido suelto (hoja): márgenes de 48px, inset de 18px, 4 columnas con hueco de 36px */
@media (min-width: 992px) {
  body.theme-afristream .afri-grid-leaf {
    grid-template-columns: repeat(4, calc((100% - 144px) / 4));
    column-gap: 36px;
    padding-left: 18px;
    padding-right: 18px;
  }
}

/* Legales en móvil: sin desbordamiento horizontal (URLs largas, tablas, imágenes del HTML legal) */
body.theme-afristream .legal-page-container .legal-content { overflow-wrap: anywhere; word-break: break-word; max-width: 100%; }
body.theme-afristream .legal-page-container .legal-content :is(img, table, pre, iframe) { max-width: 100% !important; }
body.theme-afristream .legal-page-container .legal-content :is(p, span, a, li, td, th) { max-width: 100%; }
