/* ===== HEADER & MEGAMENÚ — Runnexia ===== */

/* ── Header ── */
.rl-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease;
}
.rl-header--hidden { transform: translateY(-100%); }

.rl-header__top {
  background: var(--dark);
  height: 64px;
}
.rl-header__top-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
}

/* ── Logo ── */
.rl-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.rl-logo img {
  width: 37px;
  height: 40px;
  display: block;
}
.rl-logo__run {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 24px;
  color: #fff;
  letter-spacing: -0.02em;
}
.rl-logo__lab {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 24px;
  color: var(--color-primary-hl);
  letter-spacing: -0.02em;
}

/* ── Buscador desktop ── */
.rl-header__search-wrap {
  flex: 1;
  max-width: 520px;
  margin: 0 16px;
}
.rl-search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.5);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.rl-search-trigger:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.25);
}
.rl-search-trigger svg { flex-shrink: 0; }
.rl-search-trigger--icon {
  display: none;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  padding: 8px;
  cursor: pointer;
}

/* ── Acciones ── */
.rl-header__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.rl-header__cta { flex-shrink: 0; }

/* ── Hamburguesa ── */
.rl-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-shrink: 0;
}
.rl-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
.rl-hamburger.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.rl-hamburger.is-active span:nth-child(2) { opacity: 0; }
.rl-hamburger.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Barra de navegación ── */
.rl-header__nav {
  background: var(--dark-light);
  border-top: 1px solid rgba(255,255,255,0.06);
}
.rl-nav__list {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}
.rl-nav__item { position: static; }
.rl-nav__item.has-dropdown { position: relative; }

.rl-nav__link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.7);
  border-bottom: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.rl-nav__link:hover,
.rl-nav__item.current-menu-item .rl-nav__link,
.rl-nav__item.current-menu-ancestor .rl-nav__link {
  color: #fff;
  border-bottom-color: #4B8BFF;
}
.rl-nav__arrow { transition: transform 0.2s; flex-shrink: 0; }
.rl-nav__item.is-open .rl-nav__arrow { transform: rotate(180deg); }
.rl-nav__item.is-open .rl-nav__link { color: #fff; }

/* ── Megamenú (ancho completo, position:fixed) ── */
.rl-megamenu {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(64px + 41px);
  background: #fff;
  border-top: 3px solid #1B4FDB;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
  pointer-events: none;
}
.rl-nav__item.is-open .rl-megamenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: all;
}

.rl-megamenu__inner {
  display: grid;
  gap: 32px;
  padding: 28px 0 32px;
}
.rl-megamenu__inner--4 { grid-template-columns: repeat(4, 1fr); }
.rl-megamenu__inner--3 { grid-template-columns: repeat(3, 1fr); }

.rl-megamenu__col { min-width: 0; }

.rl-megamenu__title {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #1B4FDB;
  margin: 0 0 6px;
  padding: 0;
}
.rl-megamenu__col > .rl-megamenu__title:not(:first-child) { margin-top: 4px; }

.rl-megamenu__sep {
  border: none;
  border-top: 1px solid #e2e4ea;
  margin: 12px 0;
}

.rl-megamenu__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rl-megamenu__link {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 4px 0;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: #525c6e;
  text-decoration: none;
  transition: color 0.12s;
  line-height: 1.4;
}
.rl-megamenu__link:hover { color: #0f1823; }
.rl-megamenu__link--cal { font-weight: 600; color: #1B4FDB; }
.rl-megamenu__link--cal:hover { color: #0f3ab3; }

/* ── Dropdown simple (Ofertas / Revista) ── */
.rl-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border-top: 3px solid #1B4FDB;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
  pointer-events: none;
  border-radius: 0 0 6px 6px;
  min-width: 320px;
}
.rl-nav__item.is-open .rl-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: all;
}
/* Alinear a la derecha los últimos ítems para no salir del viewport */
.rl-nav__item:nth-last-child(-n+2) .rl-dropdown {
  left: auto;
  right: 0;
}
.rl-dropdown__inner {
  display: grid;
  gap: 20px;
  padding: 20px 24px;
}
.rl-dropdown--2 .rl-dropdown__inner { grid-template-columns: repeat(2, 1fr); }
.rl-dropdown--3 .rl-dropdown__inner { grid-template-columns: repeat(3, 1fr); min-width: 520px; }

/* ── Badges ── */
.rl-badge {
  display: inline-block;
  font-weight: 700;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 2px;
  text-transform: uppercase;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1.6;
  letter-spacing: 0.03em;
}
.rl-badge--nicho { background: #1B4FDB; color: #fff; }
.rl-badge--top   { background: #1C1C1E; color: #fff; }
.rl-badge--hot   { background: #C0392B; color: #fff; }
.rl-badge--nuevo { background: #00A650; color: #fff; }

/* ── Overlay oscuro ── */
.rl-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 900;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.rl-overlay.is-active { opacity: 1; visibility: visible; }

/* ── Panel móvil ── */
.rl-mobile-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 85vw);
  background: #fff;
  z-index: 1100;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}
.rl-mobile-panel.is-open { transform: translateX(0); }

.rl-mobile-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--dark);
  flex-shrink: 0;
}
.rl-mobile-close {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

/* ── Tabs móvil ── */
.rl-mobile-tabs {
  display: flex;
  border-bottom: 2px solid #e2e4ea;
  flex-shrink: 0;
}
.rl-mobile-tab {
  flex: 1;
  padding: 11px 8px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  color: #525c6e;
  transition: color 0.15s, border-color 0.15s;
}
.rl-mobile-tab.is-active {
  color: #1B4FDB;
  border-bottom-color: #1B4FDB;
}
.rl-mobile-tab-panel { display: none; }
.rl-mobile-tab-panel.is-active { display: block; }

.rl-mobile-panel__body { flex: 1; overflow-y: auto; }

/* ── Acordeón móvil ── */
.rl-mobile-accordion { border-bottom: 1px solid #e2e4ea; }
.rl-mobile-accordion__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 20px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: #0f1823;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  gap: 8px;
}
.rl-mobile-accordion__icon {
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
  color: #888;
  flex-shrink: 0;
  transition: transform 0.2s;
  font-style: normal;
}
.rl-mobile-accordion.is-open .rl-mobile-accordion__icon {
  transform: rotate(45deg);
}
.rl-mobile-accordion__body { display: block; }
.rl-mobile-accordion__body[hidden] { display: none; }

.rl-mobile-subnav { list-style: none; padding: 0; margin: 0; background: #f7f8fa; }
.rl-mobile-subnav li a {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 20px 10px 28px;
  font-family: var(--font-body);
  font-size: 13px;
  color: #525c6e;
  border-bottom: 1px solid #e2e4ea;
  text-decoration: none;
  transition: color 0.12s;
}
.rl-mobile-subnav li:last-child a { border-bottom: none; }
.rl-mobile-subnav li a:hover { color: #0f1823; }

/* ── Links directos móvil ── */
.rl-mobile-direct { list-style: none; padding: 0; margin: 0; }
.rl-mobile-direct li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: #0f1823;
  border-bottom: 1px solid #e2e4ea;
  text-decoration: none;
  transition: color 0.12s;
}
.rl-mobile-direct li a::after { content: '›'; font-size: 18px; color: #aaa; }
.rl-mobile-direct li a:hover { color: #1B4FDB; }

/* ── Footer ── */
.rl-footer { background: #111113; color: rgba(255,255,255,0.65); padding: 56px 0 0; }
.rl-footer__top { display: grid; grid-template-columns: 280px 1fr; gap: 48px; padding-bottom: 48px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.rl-logo--footer .rl-logo__run,
.rl-logo--footer .rl-logo__lab { font-size: 28px; }
.rl-footer__claim { margin-top: 12px; font-size: 14px; line-height: 1.6; color: rgba(255,255,255,0.45); }
.rl-footer__cols { display: grid; grid-template-columns: repeat(4,1fr); gap: 24px; }
.rl-footer__col h4 { font-family: var(--font-heading); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #fff; margin-bottom: 12px; }
.rl-footer__col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.rl-footer__col a { font-size: 14px; color: rgba(255,255,255,0.55); transition: color 0.15s; }
.rl-footer__col a:hover { color: #fff; }
.rl-footer__bottom { padding: 20px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.rl-footer__legal { font-size: 12px; color: rgba(255,255,255,0.35); }
.rl-footer__menu { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; }
.rl-footer__menu a { font-size: 12px; color: rgba(255,255,255,0.45); }
.rl-footer__menu a:hover { color: #fff; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .rl-hamburger { display: flex; }
  .rl-header__search-wrap { display: none; }
  .rl-search-trigger--icon { display: flex; }
  .rl-header__nav { display: none; }
  .rl-footer__top { grid-template-columns: 1fr; gap: 32px; }
  .rl-footer__cols { grid-template-columns: repeat(2,1fr); }
  .rl-header__cta span { display: none; }
}
@media (max-width: 600px) {
  .rl-header__top-inner { gap: 10px; }
  .rl-footer__cols { grid-template-columns: 1fr 1fr; }
}

/* ── WP Admin bar offset ── */
@media screen and (min-width: 783px) {
  .admin-bar .rl-header        { top: 32px; }
  .admin-bar .rl-megamenu      { top: calc(32px + 64px + 41px); }
  .admin-bar .rl-mobile-panel  { top: 32px; }
}
@media screen and (max-width: 782px) {
  .admin-bar .rl-header        { top: 46px; }
  .admin-bar .rl-mobile-panel  { top: 46px; }
}

/* ── Reset elementos de Astra que se pueden colar ── */
#ast-desktop-header,
.ast-primary-header-bar,
.ast-above-header-bar,
.ast-below-header-bar,
.ast-builder-header-section,
#ast-hfb-header,
.site-header:not(.rl-header),
.ast-breadcrumbs-wrapper,
.astra-breadcrumbs,
#ast-above-header,
#ast-footer-overlay,
.ast-footer-overlay,
.ast-main-footer { display: none !important; }

/* Ancho completo: evitar que Astra restrinja el layout */
#page,
.site,
.ast-container-widget { max-width: none !important; width: 100% !important; }
.entry-content,
.ast-plain-container,
.ast-container { max-width: var(--max-width) !important; margin-inline: auto !important; }

/* Evitar padding lateral extra de Astra en el body */
body.ast-page-builder-template .hentry,
body .ast-page-builder-template .entry-content-wrap { padding: 0 !important; margin: 0 !important; }

/* Ocultar breadcrumb de Astra también por clase rank math / yoast si se filtran */
.rank-math-breadcrumb p,
.ast-breadcrumb-list { display: none !important; }
