/* =====================================================================
   Almaviva — Estilos de componentes globales
   Header/nav, footer, botón WhatsApp y popup. Namespace `av-` para no
   colisionar con el CSS inline heredado de cada página.
   Fuente de verdad visual: navegación moderna del Home.
   ===================================================================== */

:root {
  --av-navy: #0B1D3A;
  --av-navy-mid: #132C54;
  --av-white: #FFFFFF;
  --av-text-muted: #6B7D8E;
  --av-gold: #C4985A;
  --av-gold-light: #D4AD6E;
  --av-sand: #F5F0E8;
  --av-header-h: 76px;
  --av-font: 'Averta', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Bloqueo de scroll (menú móvil y popup) sin salto de layout */
body.av-noscroll { position: fixed; width: 100%; overflow: hidden; }

/* Compatibilidad con el preloader existente: ocultar componentes globales
   mientras el body tiene la clase .loading */
body.loading .av-header,
body.loading .av-wa-wrap,
body.loading .av-popup-overlay { display: none !important; }

/* =========================== HEADER / NAV =========================== */
.av-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
}
.av-nav {
  background: rgba(11, 29, 58, 0.85);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.av-nav.av-scrolled {
  background: rgba(11, 29, 58, 0.96);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}
.av-nav-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; padding: 0 1.5rem; height: var(--av-header-h);
}
.av-logo { display: inline-flex; align-items: center; flex-shrink: 0; }
.av-logo img {
  height: 58px; width: auto; display: block;
  transition: height 0.3s ease;
}
.av-nav.av-scrolled .av-logo img { height: 48px; }

.av-links {
  list-style: none; margin: 0; padding: 0;
  display: flex; align-items: center; gap: 0.25rem;
}
.av-links > li { position: relative; }
.av-links a,
.av-dd-btn {
  font-family: var(--av-font);
  font-size: 0.9rem; font-weight: 500; color: rgba(255, 255, 255, 0.85);
  text-decoration: none; background: none; border: 0; cursor: pointer;
  padding: 0.55rem 0.85rem; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 0.35rem;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}
.av-links a:hover,
.av-dd-btn:hover,
.av-links a:focus-visible,
.av-dd-btn:focus-visible {
  color: var(--av-white); background: rgba(255, 255, 255, 0.08); outline: none;
}
.av-links a:focus-visible,
.av-dd-btn:focus-visible { outline: 2px solid var(--av-gold-light); outline-offset: 2px; }
.av-links a[aria-current="page"] { color: var(--av-gold-light); }

.av-dd-btn svg { width: 10px; height: 10px; transition: transform 0.2s; }
.av-dd:hover .av-dd-btn svg,
.av-dd.open .av-dd-btn svg { transform: rotate(180deg); }

.av-dd-menu {
  position: absolute; top: calc(100% + 8px); left: 0;
  min-width: 230px; background: var(--av-white); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  padding: 0.5rem; opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}
.av-dd:hover .av-dd-menu,
.av-dd.open .av-dd-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.av-dd-menu a {
  display: block; color: var(--av-navy); font-size: 0.88rem; font-weight: 500;
  padding: 0.6rem 0.75rem; border-radius: 8px; white-space: nowrap;
}
.av-dd-menu a:hover { background: var(--av-sand); color: var(--av-navy); }
.av-dd-menu a[aria-current="page"],
.av-dd-menu a.av-active { color: var(--av-gold); }

.av-nav-hl { color: var(--av-gold-light) !important; }
.av-nav-cta {
  background: var(--av-gold); color: var(--av-white) !important;
  font-weight: 600 !important; padding: 0.6rem 1.2rem !important;
}
.av-nav-cta:hover { background: var(--av-gold-light) !important; transform: translateY(-1px); }

/* Hamburguesa */
.av-burger {
  display: none; width: 44px; height: 44px; position: relative;
  background: none; border: 0; cursor: pointer; z-index: 1001; flex-shrink: 0;
}
.av-burger span {
  display: block; width: 24px; height: 2px; margin: 5px auto;
  background: var(--av-white); border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.av-burger:focus-visible { outline: 2px solid var(--av-gold-light); outline-offset: 2px; border-radius: 8px; }
.av-burger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.av-burger.open span:nth-child(2) { opacity: 0; }
.av-burger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ------- Menú móvil ------- */
@media (max-width: 960px) {
  .av-burger { display: block; }
  .av-links {
    /* height:100dvh explícito: el backdrop-filter del .av-nav crea un
       containing block, por lo que `inset:0` limitaría el panel a la altura
       del header. Con vh/dvh el panel cubre todo el viewport. */
    position: fixed; top: 0; left: 0; right: 0;
    height: 100vh; height: 100dvh;
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    gap: 0.25rem; padding: calc(var(--av-header-h) + 1rem) 1.5rem 2rem;
    background: var(--av-navy);
    transform: translateX(100%); transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto; z-index: 1000;
  }
  .av-links.open { transform: translateX(0); }
  .av-links > li { width: 100%; }
  .av-links a,
  .av-dd-btn {
    width: 100%; justify-content: space-between;
    font-size: 1.05rem; padding: 0.9rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07); border-radius: 0;
  }
  .av-dd-menu {
    position: static; opacity: 1; visibility: visible; transform: none;
    box-shadow: none; background: transparent; padding: 0 0 0.5rem 0.75rem;
    max-height: 0; overflow: hidden; transition: max-height 0.3s ease;
  }
  .av-dd.open .av-dd-menu { max-height: 500px; }
  .av-dd-menu a { color: rgba(255, 255, 255, 0.8); }
  .av-dd-menu a:hover { background: rgba(255, 255, 255, 0.08); color: var(--av-white); }
  .av-nav-cta {
    justify-content: center; margin-top: 0.75rem; border-radius: 10px !important;
  }
}
@media (min-width: 961px) {
  /* asegurar visibilidad del menú en desktop aunque quede alguna clase */
  .av-links { transform: none !important; }
}

/* =========================== FOOTER =========================== */
.av-footer { background: var(--av-navy); color: rgba(255, 255, 255, 0.8); }
.av-footer-inner { max-width: 1280px; margin: 0 auto; padding: 3.5rem 1.5rem 1.5rem; }
.av-footer-grid {
  display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.2fr; gap: 2.5rem;
}
.av-footer-logo { height: 56px; width: auto; margin-bottom: 1rem; }
.av-footer-desc { font-size: 0.88rem; line-height: 1.6; color: rgba(255, 255, 255, 0.6); margin: 0 0 1.25rem; }
.av-footer-glr img { height: 40px; width: auto; opacity: 0.85; filter: brightness(0) invert(1); }
.av-footer-title {
  font-size: 0.95rem; font-weight: 600; color: var(--av-white);
  margin: 0 0 1rem;
}
.av-footer-links { list-style: none; margin: 0; padding: 0; }
.av-footer-links li { margin-bottom: 0.6rem; }
.av-footer-links a { color: rgba(255, 255, 255, 0.62); text-decoration: none; font-size: 0.88rem; transition: color 0.2s; }
.av-footer-links a:hover { color: var(--av-gold-light); }
.av-footer-contact {
  display: flex; align-items: flex-start; gap: 0.6rem; margin-bottom: 0.85rem;
  font-size: 0.85rem; color: rgba(255, 255, 255, 0.62);
}
.av-footer-contact svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; color: var(--av-gold); }
.av-footer-contact a { color: inherit; text-decoration: none; }
.av-footer-contact a:hover { color: var(--av-gold-light); }
.av-footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1); margin-top: 2.5rem; padding-top: 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.av-footer-copy { font-size: 0.8rem; color: rgba(255, 255, 255, 0.5); margin: 0; }
.av-footer-legal { display: flex; gap: 1.5rem; }
.av-footer-legal a { font-size: 0.8rem; color: rgba(255, 255, 255, 0.55); text-decoration: none; }
.av-footer-legal a:hover { color: var(--av-gold-light); }
.av-devbar {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  margin-top: 1.25rem; opacity: 0.55; font-size: 0.72rem; color: rgba(255, 255, 255, 0.5);
}
.av-devbar img { height: 22px; width: auto; }
@media (max-width: 860px) {
  .av-footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
}
@media (max-width: 520px) {
  .av-footer-grid { grid-template-columns: 1fr; }
  .av-footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* =========================== WHATSAPP FLOTANTE =========================== */
.av-wa-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 900; }
.av-wa {
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: #25D366; box-shadow: 0 6px 20px rgba(37, 211, 102, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.av-wa:hover { transform: scale(1.08); box-shadow: 0 8px 30px rgba(37, 211, 102, 0.45); }
.av-wa svg { width: 30px; height: 30px; color: #fff; }
.av-wa:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.av-wa-popup {
  position: absolute; right: 70px; bottom: 12px; white-space: nowrap;
  background: var(--av-white); color: var(--av-navy);
  font-size: 0.85rem; font-weight: 600; padding: 0.5rem 0.9rem; border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  display: flex; align-items: center; gap: 0.5rem;
  opacity: 0; transform: translateX(10px); pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}
.av-wa-popup.show { opacity: 1; transform: translateX(0); }
.av-wa-dot { width: 8px; height: 8px; border-radius: 50%; background: #25D366; }

/* =========================== POPUP WEBINAR ===========================
   Port fiel del popup ORIGINAL del Home (clases pv- -> av-). Tarjeta navy,
   video max-height 280px sin aspect-ratio, degradado que se funde al navy,
   botón Play translúcido. Valores idénticos al original. */
.av-popup-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(11, 29, 58, 0.85); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 2rem;
  opacity: 0; visibility: hidden; transition: opacity 0.4s, visibility 0.4s;
}
.av-popup-overlay.active { opacity: 1; visibility: visible; }
.av-popup-wrapper {
  position: relative; display: flex; flex-direction: column; align-items: flex-end;
  gap: 0.75rem; width: 92%; max-width: 640px;
}
.av-popup-close {
  flex-shrink: 0; height: 2.5rem; padding: 0 1rem 0 0.75rem; border-radius: 12px;
  background: rgba(255, 255, 255, 0.95); border: none; display: flex; align-items: center;
  gap: 0.4rem; cursor: pointer; z-index: 10; transition: background 0.2s, transform 0.2s;
  font-family: 'Averta', sans-serif; font-size: 0.85rem; font-weight: 600; color: var(--av-navy);
}
.av-popup-close:hover { background: #fff; transform: scale(1.04); }
.av-popup-close svg { width: 18px; height: 18px; color: var(--av-navy); }
.av-popup {
  background: var(--av-navy); border-radius: 20px; width: 100%;
  display: grid; grid-template-columns: 1fr; overflow: hidden; overflow-y: auto;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5); position: relative; max-height: 90vh;
}
.av-popup-video { position: relative; overflow: hidden; max-height: 280px; }
.av-popup-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.av-popup-video::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 50%, var(--av-navy) 100%);
  pointer-events: none;
}
.av-popup-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 56px; height: 56px; border-radius: 50%; padding: 0;
  background: rgba(255, 255, 255, 0.15); border: 2px solid rgba(255, 255, 255, 0.4);
  display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 2;
  transition: background 0.3s;
}
.av-popup-play:hover { background: rgba(255, 255, 255, 0.25); }
.av-popup-play svg { width: 22px; height: 22px; color: var(--av-white); margin-left: 3px; }
.av-popup-mute {
  position: absolute; bottom: 1rem; left: 1rem; width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 3;
  transition: background 0.2s; padding: 0;
}
.av-popup-mute:hover { background: rgba(0, 0, 0, 0.7); }
.av-popup-mute svg { width: 16px; height: 16px; color: var(--av-white); }
.av-popup-content { padding: 1.5rem 2rem 2rem; display: flex; flex-direction: column; justify-content: center; }
.av-popup-hook {
  font-size: 0.78rem; font-weight: 600; color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.6rem;
}
.av-popup-title {
  font-family: 'Averta', sans-serif; font-size: 1.35rem; font-weight: 600;
  color: var(--av-white); line-height: 1.35; margin-bottom: 0.75rem;
}
.av-popup-title strong { color: var(--av-gold-light); font-weight: 700; }
.av-popup-registro {
  display: inline-block; background: rgba(196, 152, 90, 0.15); border: 1px solid var(--av-gold);
  color: var(--av-gold-light); font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; padding: 0.3rem 0.85rem; border-radius: 100px; margin-bottom: 1rem;
}
.av-webinar-info { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.av-webinar-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px; padding: 0.4rem 0.75rem; font-size: 0.78rem; color: rgba(255, 255, 255, 0.8); font-weight: 500;
}
.av-webinar-badge svg { width: 15px; height: 15px; color: var(--av-gold-light); flex-shrink: 0; }
.av-webinar-badge strong { color: var(--av-gold-light); font-weight: 700; font-size: 0.95rem; }
.av-webinar-speaker {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.75rem 0.85rem;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px; margin-bottom: 1.25rem;
}
.av-webinar-speaker-icon {
  width: 34px; height: 34px; border-radius: 50%; background: var(--av-gold);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.av-webinar-speaker-icon svg { width: 16px; height: 16px; color: var(--av-white); }
.av-webinar-speaker-name { font-size: 0.88rem; font-weight: 600; color: var(--av-white); }
.av-webinar-speaker-role { font-size: 0.68rem; color: rgba(255, 255, 255, 0.5); text-transform: uppercase; letter-spacing: 0.04em; }
.av-webinar-invite {
  display: flex; align-items: center; gap: 0.65rem; margin-bottom: 1.5rem;
  padding-top: 1rem; border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.av-webinar-invite-photo { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; border: 2px solid var(--av-gold); flex-shrink: 0; }
.av-webinar-invite-photo img { width: 100%; height: 100%; object-fit: cover; }
.av-webinar-invite-text { display: flex; flex-direction: column; }
.av-webinar-invite-label { font-size: 0.68rem; color: rgba(255, 255, 255, 0.45); text-transform: uppercase; letter-spacing: 0.06em; }
.av-webinar-invite-name { font-size: 0.82rem; font-weight: 600; color: var(--av-white); }
.av-popup-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: var(--av-gold); color: var(--av-white); font-family: inherit;
  font-size: 0.85rem; font-weight: 600; padding: 0.85rem 2rem; border-radius: 10px;
  border: none; cursor: pointer; text-decoration: none; text-transform: uppercase;
  letter-spacing: 0.06em; transition: background 0.2s, transform 0.15s;
  box-shadow: 0 4px 20px rgba(196, 152, 90, 0.3);
}
.av-popup-cta:hover { background: var(--av-gold-light); transform: translateY(-2px); }
.av-popup-dismiss {
  display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 1.25rem;
  background: none; border: 1px solid rgba(255, 255, 255, 0.15); color: rgba(255, 255, 255, 0.55);
  font-family: 'Averta', sans-serif; font-size: 0.82rem; cursor: pointer; text-align: center;
  transition: color 0.2s, border-color 0.2s; padding: 0.5rem 1.25rem; border-radius: 8px;
}
.av-popup-dismiss:hover { color: rgba(255, 255, 255, 0.85); border-color: rgba(255, 255, 255, 0.3); }

@media (max-width: 900px) {
  .av-popup-wrapper { width: 96%; }
  .av-popup { max-height: 80vh; }
  .av-popup-video { max-height: 180px; }
  .av-popup-content { padding: 1.25rem 1.25rem 1.5rem; }
  .av-popup-hook { font-size: 0.7rem; margin-bottom: 0.75rem; }
  .av-popup-title { font-size: 1.1rem; margin-bottom: 0.75rem; }
  .av-webinar-info { gap: 0.4rem; margin-bottom: 0.85rem; }
  .av-webinar-badge { padding: 0.3rem 0.6rem; font-size: 0.7rem; }
  .av-webinar-badge strong { font-size: 0.82rem; }
  .av-webinar-speaker { padding: 0.55rem 0.7rem; margin-bottom: 0.85rem; gap: 0.5rem; }
  .av-webinar-speaker-icon { width: 28px; height: 28px; }
  .av-webinar-speaker-icon svg { width: 14px; height: 14px; }
  .av-webinar-speaker-name { font-size: 0.78rem; }
  .av-webinar-speaker-role { font-size: 0.62rem; }
  .av-webinar-invite { margin-bottom: 1rem; padding-top: 0.75rem; gap: 0.5rem; }
  .av-webinar-invite-photo { width: 36px; height: 36px; }
  .av-popup-cta { padding: 0.7rem 1.5rem; font-size: 0.78rem; }
  .av-popup-dismiss { margin-top: 0.75rem; font-size: 0.75rem; padding: 0.4rem 1rem; }
  .av-popup-registro { font-size: 0.62rem; padding: 0.25rem 0.7rem; margin-bottom: 0.65rem; }
  .av-popup-close { height: 2.25rem; font-size: 0.8rem; padding: 0 0.85rem 0 0.65rem; }
}

/* =========================== YOUTUBE (facade global) ===========================
   Componente único de video de YouTube. Un clic reproduce el video DENTRO de la
   página (iframe embed, sin navegar a youtube.com ni a /shorts/). Soporta videos
   horizontales (16/9) y verticales/Shorts (9/16) preservando la proporción real
   mediante data-orientation. El iframe solo se crea al hacer clic (facade lazy). */
.av-youtube {
  position: relative; width: 100%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; overflow: hidden;
  background: #0B1D3A center / cover no-repeat;
}
/* La orientación define la proporción — NO hay 16/9 universal. */
.av-youtube[data-orientation="horizontal"] { aspect-ratio: 16 / 9; }
.av-youtube[data-orientation="vertical"]   { aspect-ratio: 9 / 16; max-width: 340px; margin-inline: auto; }
.av-youtube-play {
  border: 0; background: none; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  opacity: 0.9; transition: transform 0.2s ease, opacity 0.2s ease;
}
.av-youtube:hover .av-youtube-play { transform: scale(1.06); opacity: 1; }
.av-youtube-play svg { width: 68px; height: 48px; display: block; }
.av-youtube:focus-visible { outline: 3px solid var(--av-gold-light); outline-offset: 2px; }
.av-youtube iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.av-youtube.av-playing { cursor: default; background: #000; }

@media (prefers-reduced-motion: reduce) {
  .av-links, .av-dd-menu, .av-popup-overlay, .av-wa-popup, .av-wa, .av-youtube-play { transition: none !important; }
}
