/* ==========================================================================
   LobbyFix · Sección "¿Cómo funciona LobbyFix?" + barra fija mobile
   Todo el CSS está bajo .lf-hiw y .lf-sticky para no chocar con el tema.
   Basado en el módulo aprobado para la landing LobbyFix 2026.
   ========================================================================== */

.lf-hiw,
.lf-sticky {
  --lf-tab-on: #00A6F4;                                   /* dato */
  --lf-tab-off: #F1F5F9;                                  /* dato */
  --lf-cta-gradient: linear-gradient(90deg, #00A6F4 0%, #00618E 100%); /* dato */
  --lf-link: #00ABFD;                                     /* dato */
  --lf-tag-bg: rgba(42, 197, 82, 0.10);                   /* dato: #2AC552 al 10 % */
  --lf-tag-text: #1E293B;                                 /* aprox. */
  --lf-pill-bg: #EAF6FE;                                  /* aprox. */
  --lf-h2: #515151;                                       /* sitio actual */
  --lf-ink: #0F172A;                                      /* aprox. */
  --lf-text: #475569;                                     /* aprox. */
  --lf-muted: #64748B;                                    /* aprox. */
  --lf-border: #E8EDF3;                                   /* aprox. */
  --lf-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-family: var(--lf-font);
  -webkit-font-smoothing: antialiased;
}

.lf-hiw *,
.lf-sticky * { box-sizing: border-box; }

/* ---------- Sección ---------- */
.lf-hiw {
  background: #FFFFFF;
  padding: 80px 24px;                                     /* aprox. */
  color: var(--lf-ink);
  /* Espacio del header fijo al llegar con #como-funciona. Definir --lf-header-offset
     en el tema con la altura real del header (pendiente: desktop y mobile). */
  scroll-margin-top: var(--lf-header-offset, 80px);
}
.lf-hiw__inner { max-width: 1142px; margin: 0 auto; }

.lf-hiw__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.lf-hiw__eyebrow {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--lf-link);
}
.lf-hiw__title {
  margin: 12px 0 0;
  font-size: 36px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--lf-h2);
}
.lf-hiw__subtitle {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin: 16px 0 0;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--lf-pill-bg);
  font-size: 14px;
  font-weight: 600;
  color: var(--lf-ink);
}

/* ---------- Pestañas ---------- */
.lf-hiw__tabs {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 32px 0 0;
}
.lf-hiw__tab {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.lf-hiw__icon {
  width: 64px;
  height: 64px;
  border-radius: 8px;                                     /* dato */
  background: var(--lf-tab-off);
  color: var(--lf-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .2s ease, color .2s ease;
}
.lf-hiw__icon svg { width: 32px; height: 32px; }
.lf-hiw__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--lf-muted);
  white-space: nowrap;
}
.lf-hiw__tab[aria-selected="true"] .lf-hiw__icon { background: var(--lf-tab-on); color: #FFFFFF; }
.lf-hiw__tab[aria-selected="true"] .lf-hiw__label { font-weight: 600; color: var(--lf-ink); }
/* Propuesta (no definida en Figma): hover y foco */
.lf-hiw__tab:hover:not([aria-selected="true"]) .lf-hiw__icon { background: #E2E8F0; }
.lf-hiw__tab:focus-visible { outline: none; }
.lf-hiw__tab:focus-visible .lf-hiw__icon { outline: 2px solid var(--lf-ink); outline-offset: 3px; }

/* Nombre de la pestaña activa: solo mobile */
.lf-hiw__active-label { display: none; }

/* ---------- Tarjeta ---------- */
.lf-hiw__card {
  margin: 32px 0 0;
  padding: 48px;
  background: #FFFFFF;
  border: 1px solid var(--lf-border);
  border-radius: 24px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.08);        /* aprox. */
  display: grid;
  grid-template-columns: minmax(0, 1fr) 498px;
  grid-template-areas: "text media" "cta media";
  grid-template-rows: auto 1fr;
  column-gap: 56px;
  min-height: 536px;
}
.lf-hiw__panels { grid-area: text; }
.lf-hiw__panel[hidden] { display: none; }
.lf-hiw__meta { display: flex; align-items: center; gap: 12px; margin: 0; }
.lf-hiw__step { font-size: 14px; font-weight: 600; color: var(--lf-ink); }
.lf-hiw__badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--lf-pill-bg);
  color: var(--lf-ink);
}
.lf-hiw__step-title {
  margin: 32px 0 0;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--lf-ink);
}
.lf-hiw__text {
  margin: 24px 0 0;
  max-width: 490px;
  font-size: 17px;
  line-height: 24px;
  color: var(--lf-text);
}

/* ---------- CTA (desktop y tablet) ---------- */
.lf-hiw__cta { grid-area: cta; margin-top: 32px; }
.lf-hiw .lf-cta-row { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; }
.lf-hiw .lf-btn-primary, .lf-sticky .lf-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 0 24px;
  border-radius: 6px;                                     /* aprox. */
  background: var(--lf-cta-gradient);
  color: #FFFFFF !important;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none !important;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 166, 244, 0.25);         /* aprox. */
  transition: filter .2s ease, box-shadow .2s ease;
}
.lf-hiw .lf-btn-primary:hover, .lf-sticky .lf-btn-primary:hover { filter: brightness(1.06); box-shadow: 0 10px 24px rgba(0, 166, 244, 0.32); } /* propuesta */
.lf-hiw .lf-btn-primary:focus-visible, .lf-sticky .lf-btn-primary:focus-visible { outline: 2px solid var(--lf-ink); outline-offset: 3px; }
.lf-hiw .lf-link {
  font-size: 16px;
  font-weight: 600;
  color: var(--lf-link) !important;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.lf-hiw .lf-link:focus-visible { outline: 2px solid var(--lf-ink); outline-offset: 3px; border-radius: 2px; }
.lf-hiw .lf-tag, .lf-sticky .lf-tag {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin: 32px 0 0;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--lf-tag-bg);
  color: var(--lf-tag-text);
  font-size: 12px;
  line-height: 1.4;
}

/* ---------- Video ---------- */
.lf-hiw__media {
  grid-area: media;
  position: relative;
  width: 498px;
  height: 440px;
  border-radius: 16px;
  overflow: hidden;
  background: #E6F6FF;
}
.lf-hiw__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .25s ease;
}
.lf-hiw__video.is-active { opacity: 1; }

/* ---------- Tablet (pendiente de diseño): una columna, CTA dentro ---------- */
@media (max-width: 1023px) {
  .lf-hiw__card {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "media" "text" "cta";
    grid-template-rows: auto;
    row-gap: 32px;
    min-height: 0;
  }
  .lf-hiw__media { width: 100%; height: auto; aspect-ratio: 498 / 440; max-width: 560px; justify-self: center; }
  .lf-hiw__cta { margin-top: 0; }
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
  .lf-hiw { padding: 48px 16px; }                         /* aprox. */
  .lf-hiw__eyebrow { font-size: 13px; }
  .lf-hiw__title { font-size: 24px; }
  .lf-hiw__subtitle { font-size: 12px; min-height: 30px; }
  .lf-hiw__tabs { gap: 24px; margin-top: 24px; }
  .lf-hiw__icon { width: 48px; height: 48px; }
  .lf-hiw__icon svg { width: 24px; height: 24px; }
  .lf-hiw__label { display: none; }
  .lf-hiw__active-label {
    display: block;
    margin: 10px 0 0;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--lf-ink);
  }
  .lf-hiw__card { margin-top: 24px; padding: 20px; border-radius: 20px; row-gap: 20px; grid-template-areas: "media" "text" "demo"; }
  .lf-hiw__media { aspect-ratio: 313 / 440; max-width: none; border-radius: 12px; }
  .lf-hiw__cta { display: none; }                         /* En mobile el botón primario vive en la barra fija */
  .lf-hiw__step { font-size: 12px; }
  .lf-hiw__step-title { margin-top: 16px; font-size: 20px; }
  .lf-hiw__text { margin-top: 12px; font-size: 14px; line-height: 22px; }
}

/* ---------- Barra fija inferior (solo mobile) ---------- */
.lf-sticky {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;                                           /* Mantener compatible con el menú del tema */
  display: none;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: #FFFFFF;
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);         /* aprox. */
  transform: translateY(110%);
  transition: transform .25s ease-out;
}
.lf-sticky.is-visible { transform: translateY(0); }
.lf-sticky .lf-btn-primary { display: flex; width: 100%; height: 48px; border-radius: 8px; font-size: 16px; }

@media (max-width: 767px) {
  .lf-sticky { display: block; }
  /* Reserva el alto de la barra al final de la página para que no tape contenido */
  body.lf-has-sticky { padding-bottom: var(--lf-sticky-h, 112px); }
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  .lf-hiw__icon, .lf-hiw__video, .lf-sticky, .lf-hiw .lf-btn-primary, .lf-sticky .lf-btn-primary { transition: none; }
}

/* En mobile, el enlace de demo y el beneficio van dentro de la tarjeta. */
.lf-hiw__mobile-demo { display: none; }
@media (max-width: 767px) {
  .lf-hiw__mobile-demo {
    display: block;
    grid-area: demo;
    margin: 0;
    text-align: center;
  }
  .lf-hiw__mobile-demo .lf-tag {
    display: inline-flex;
    justify-content: center;
    max-width: 100%;
    margin: 24px auto 0;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
  }
}

/* Corrección de estilos de botones de Elementor */

.lf-hiw .lf-hiw__tabs button.lf-hiw__tab,
.lf-hiw .lf-hiw__tabs button.lf-hiw__tab:hover,
.lf-hiw .lf-hiw__tabs button.lf-hiw__tab:focus,
.lf-hiw .lf-hiw__tabs button.lf-hiw__tab:active {
    background: transparent !important;
    background-image: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: 0 !important;
    width: auto !important;
    color: inherit !important;
    text-transform: none !important;
}

/* Desactivar decoraciones adicionales del tema */

.lf-hiw .lf-hiw__tabs button.lf-hiw__tab::before,
.lf-hiw .lf-hiw__tabs button.lf-hiw__tab::after {
    display: none !important;
}

/* Colores correctos de las etiquetas */

.lf-hiw .lf-hiw__tabs .lf-hiw__tab .lf-hiw__label {
    color: #64748B !important;
}

.lf-hiw .lf-hiw__tabs .lf-hiw__tab[aria-selected="true"] .lf-hiw__label {
    color: #0F172A !important;
    font-weight: 600;
}

/* LobbyFix: ajustar Volver arriba cuando aparece el CTA móvil */

@media (max-width: 767px) {

  body:has(.lf-sticky.is-visible) #scrollUp {
    transform: translateY(
      calc(-1 * (var(--lf-sticky-h, 112px) - 6px))
    ) !important;
  }

}

/* LobbyFix: posición de Crisp con CTA móvil visible */

@media (max-width: 767px) {
  body:has(> .lf-sticky.is-visible)
  .crisp-client div:has(> span > span[data-id="chat_closed"]) {
    bottom: calc(var(--lf-sticky-h, 112px) + 12px) !important;
  }
}
