/*
 * CSS NO CRÍTICO (Deferred)
 * Este archivo debe ser cargado de forma asíncrona (diferida)
 * usando el método <link rel="preload">.
 */

.main-header_container::before {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  opacity: 1;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 992;
}

.js-submenu.active {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.c-submenu {
  position: absolute;
  background-color: var(--white);
  right: 0;
  min-width: 400px;
  min-width: 25rem;
  padding: 24px;
  padding: 1.5rem;
  color: #50535a;
  box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
  transform: translatex(0);
  top: 36px;
  border-radius: 8px;
  z-index: 100;
  display: none;
}

.c-submenu .c-submenu__link-new:hover {
  color: var(--blue);
}

.c-menu-top__link-new.is-active {
  color: var(--blue);
}

.arrow-info::before {
  display: inline-block;
  transition: transform 0.3s ease;
  margin-left: 6px;
  color: var(--white);
}

.arrow-info.rotate::before {
  transform: rotate(180deg);
}

.c-main-menu__search {
  padding: 0;
  z-index: 0;
}

.menu-panel {
  position: fixed;
  top: 75px;
  right: 0;
  width: 80%;
  min-width: 314px;
  max-width: 440px;
  height: auto;
  max-height: calc(100vh - 82px);
  background: #F5F5F5;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.5rem 1.5rem 2rem;
  overflow-y: auto;
  border-radius: 0 0 0 10px;
  z-index: 996;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.menu-panel.active {
  transform: translateX(0);
}

.menu-overlay {
  position: fixed;
  left: 0;
  width: 100vw;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 995;
  display: block;
}

.menu-overlay.full {
  top: 76px;
  height: 100vh;
}

.menu-overlay.partial {
  top: 8rem;
  height: calc(100vh - 8rem);
}

.menu-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.menu-list {
  display: none;
}

.menu-list.active {
  display: block;
}

.menu-item {
  padding: 0.7rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
}

.menu-item--near {
  justify-content: flex-start;
}

.menu-item span {
  background-color: var(--yellow);
  color: var(--darkBlue);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
  margin-right: 10px;
}

.menu-item.padding-add {
  padding-bottom: 2rem;
}

.menu-item-person {
  background-color: #d3d4d3;
  width: 100%;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: left;
  position: absolute;
  left: 0;
  padding: 6px 0;
  padding-left: 2rem;
  gap: 4px;
  font-weight: bold;
}

.menu-item_title {
  padding: 0.8rem 0;
  font-size: 1.1rem;
  font-weight: bold;
  font-weight: 700;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--darkBlue);
}

.menu-item_title i,
.submenu-title i {
  font-size: 1.3rem;
}

.menu-item_btns {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  margin-top: 60px;
  position: relative;
}

.menu-item_btn {
  color: var(--orange);
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 4px;
  padding: 0.6rem 0.4rem;
  border: 1px solid var(--yellow);
  text-decoration: none !important;
}

.menu-item_btn:hover {
  color: var(--darkBlue);
  border: 1px solid var(--yellow);
  background-color: var(--yellow);
}

.menu-item_btn.mi-movistar {
  color: var(--blue);
  border: 1px solid var(--blue);
}

.menu-item_btn.pagar-factura {
  color: var(--blue);
  border: 1px solid var(--blue);
}

.menu-item_btn.pagar-factura:hover,
.menu-item_btn.mi-movistar:hover,
.menu-item_btn.mi-movistar.active {
  color: var(--white);
  border: 1px solid var(--blue);
  background-color: var(--blue);
}

.submenu-title .icn-chevron-left-regular {
  font-size: 1rem;
}

.submenu-list,
.menu-header {
  display: none;
}

.submenu-list.active {
  display: flex;
  flex-direction: column;
}

.submenu-title {
  background-color: var(--blue-light);
  height: 50px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--blue);
  font-weight: 700;
  line-height: 1.3;
  padding: 6px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 14px;
}

.submenu-title span {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.paquetes-btn {
  margin-top: 1rem;
  padding: 0.5rem;
  background-color: #d4fdd4;
  border: 1px solid #5cc15c;
  border-radius: 5px;
  color: #2d7f2d;
  font-weight: bold;
}

.header-links-slider {
  background-color: var(--blue-light);
  display: block;
}

.header-links-slider .header-link-mob {
  display: inline-block;
  padding: 10px 16px;
  font-size: 14px;
  white-space: nowrap;
  color: var(--darkBlue);
}

.header-links-slider .slick-arrow {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue-light);
  z-index: 99;
}

.header-links-slider .slick-arrow.slick-disabled {
  opacity: 0;
}

.header-links-slider .slick-arrow::before {
  content: " ";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border-top: 2px solid var(--blue);
  border-right: 2px solid var(--blue);
  transform: translate(-70%, -50%) rotate(45deg);
}

.header-links-slider .slick-next {
  right: 0px;
}

.header-links-slider .slick-prev {
  left: 0px;
}

.header-links-slider .slick-prev::before {
  transform: translate(-30%, -50%) rotate(-135deg);
}

.header-link.active,
.header-link-mob.active {
  color: var(--blue);
}

.menudrop-miMovistar {
  display: none;
  width: 100%;
  max-width: 330px;
}

.menudrop-miMovistar.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.mi-btn-primary {
  display: block;
  padding: 6px;
  font-size: 14px;
  text-decoration: none;
  text-align: center;
  border: 2px solid var(--blue);
  border-radius: 26px;
  color: var(--blue);
  transition: background 0.3s, color 0.3s;
}

.mi-btn-primary:hover {
  background: var(--blue);
  color: var(--white);
}

.mi-service-list {
  background-color: #e9e9e9;
  padding: 12px;
  border-radius: 10px;
}

.mi-service-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  color: #000;
  text-decoration: none;
  font-size: 14px;
}

.mi-service-item.line-top {
  border-top: 1px solid var(--white);
}

.mi-qr-box {
  display: none;
}

.mi-qr-img {
  width: 96px;
  height: 96px;
}

.mi-qr-description {
  flex: 1;
}

.mi-qr-title {
  color: var(--blue);
  font-size: 13px;
  margin-bottom: 4px;
}

.mi-qr-subtitle {
  font-size: 12px;
  color: #333;
  width: 64%;
  line-height: 1.2;
}

.menu-list__posmenu {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 16px;
  margin-top: 30px;
}

.menu-list__reg {
  font-size: 1rem;
  line-height: normal;
}

@media screen and (max-width: 768px) {
  .main-header_container--notMenu {
    height: 4.7rem !important;
  }

  .main-header_container--notMenu .menu-overlay.partial {
    top: 4.7rem;
    height: calc(100vh - 4.7rem);
  }
}

/* Media Queries No Críticas (Desktop y Tablet) */
@media screen and (min-width: 768px) {
  .header-links-slider {
    display: none;
  }

  .header-link {
    transition: color 0.3s ease;
  }

  .header-link:hover,
  .header-link:focus-visible {
    color: var(--blue);
  }

  .menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
  }

  .header-icons .js-menu-toggle::before {
    display: inline-block;
    transform: rotate(180deg);
  }

  .menu-overlay.full {
    top: 0;
  }

  .menu-overlay.partial {
    top: 6.7rem;
    height: calc(100vh - 6.7rem);
  }

  .mi-qr-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }

  .menu-item {
    padding: 0.5rem 0;
  }

  .menu-item_btn {
    width: 100%;
  }

  .menu-item_btns {
    flex-direction: column;
    margin-top: 10px;
  }
}

@media screen and (min-width: 1024px) {
  .menu-panel {
    left: 0;
    right: auto;
    padding: 3rem 2rem 2rem 3.4rem;
    top: 0;
    height: 100vh;
    max-height: none;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .menu-panel.active {
    transform: translateX(0);
  }
}

/* ===== Header Empresas (new-header-business.php) ===== */
.hb-header {
  --hb-text: #212f40;
}

.hb-no-scroll {
  overflow: hidden;
}

.hb-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.hb-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  margin: 0;
  background: none;
  border: 0;
  cursor: pointer;
  color: #50535a;
  font-size: 1.6rem;
  line-height: 1;
}

/* La lupa-toggle solo existe en desktop (debe ir después de .hb-icon-btn) */
.hb-search__toggle {
  display: none;
}

/* ---- Panel móvil (hamburguesa) ---- */
.hb-nav.is-open {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  background: var(--white);
  overflow-y: auto;
  padding: 0 1.5rem 2rem;
}

.hb-nav__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-sizing: border-box;
  min-height: 4.7rem;
  padding: 0.5rem 1rem;
  background: var(--white);
  box-shadow: rgba(0, 0, 0, 0.1) 0px 2px 4px;
  margin: 0 -1.5rem 0.5rem;
  position: sticky;
  top: 0;
  z-index: 1;
}

.hb-nav__bar-icons {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.hb-switch {
  position: relative;
}

.hb-switch__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1.1rem;
  background: var(--white);
  border: 2px solid var(--darkBlue);
  border-radius: 999px;
  color: var(--hb-text);
  font-size: 1rem;
  cursor: pointer;
}

.hb-switch__btn i {
  transition: transform 0.3s ease;
}

.hb-switch.is-open .hb-switch__btn i {
  transform: rotate(180deg);
}

.hb-switch__list {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 12rem;
  padding: 0.4rem 1rem;
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 3;
}

.hb-switch.is-open .hb-switch__list {
  display: block;
}

.hb-switch__list a {
  display: block;
  padding: 0.7rem 0;
  color: var(--hb-text);
}

.hb-switch__list a + a {
  border-top: 1px solid #e5e5e5;
}

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

.hb-item {
  border-bottom: 1px solid #e5e5e5;
}

.hb-item--plain {
  border-bottom: 0;
}

.hb-item__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1.5rem 0.2rem;
  background: none;
  border: 0;
  color: var(--hb-text);
  font-size: 1.25rem;
  text-align: left;
  cursor: pointer;
}

.hb-item__arrow {
  color: var(--blue);
  transform: rotate(-90deg);
}

/* Segundo nivel móvil: panel que cubre el menú */
.hb-item.is-open > .hb-drop {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: block;
  overflow-y: auto;
  padding: 0 1.5rem 2rem;
  background: var(--white);
}

.hb-drop__back {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-sizing: border-box;
  width: calc(100% + 3rem);
  min-height: 4.7rem;
  margin: 0 -1.5rem 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--white);
  border: 0;
  box-shadow: rgba(0, 0, 0, 0.1) 0px 2px 4px;
  color: var(--hb-text);
  font-weight: 700;
  font-size: 1.2rem;
  text-align: left;
  cursor: pointer;
}

.hb-drop__back i {
  color: var(--blue);
}

.hb-big__col + .hb-big__col {
  margin-top: 1rem;
}

.hb-big__title {
  display: block;
  padding: 1rem 0 0.4rem;
  color: var(--hb-text);
  font-weight: 700;
  font-size: 1.15rem;
}

.hb-big__list,
.hb-simple,
.hb-brands {
  margin: 0;
  padding: 0;
  list-style: none;
}

.hb-big__link,
.hb-simple__link {
  display: block;
  padding: 0.9rem 0;
  color: var(--hb-text);
  font-size: 1.05rem;
}

.hb-brands {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
}

.hb-brands__link {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 3.8rem;
  padding: 0.4rem;
  background: var(--white);
  border: 1px solid #d4d4d4;
  border-radius: 6px;
}

.hb-brands__link img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.hb-cta {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2.5rem;
}

.hb-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.4rem;
  border: 2px solid var(--darkBlue);
  border-radius: 999px;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  text-align: center;
  white-space: nowrap;
  transition: background 0.3s, color 0.3s;
}

.hb-btn--outline {
  background: var(--white);
  color: var(--darkBlue);
}

.hb-btn--solid {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
}

.hb-btn--outline:hover {
  background: var(--darkBlue);
  color: var(--white);
}

.hb-btn--solid:hover {
  background: var(--darkBlue);
  border-color: var(--darkBlue);
}

/* ---- Buscador ---- */
.hb-search__box .content_searcher {
  width: 100%;
}

/* ---- Desktop ---- */
@media screen and (min-width: 1024px) {
  .hb-overlay.is-active {
    display: block;
  }

  .hb-nav {
    gap: 1rem;
  }

  .hb-nav__bar {
    display: none;
  }

  .hb-item {
    border-bottom: 0;
  }

  .hb-item:not(.hb-item--big) {
    position: relative;
  }

  .hb-item__btn {
    gap: 0.4rem;
    width: auto;
    padding: 0.6rem 0;
    font-family: inherit;
    font-size: clamp(0.75rem, 1.15vw, .92rem);
    white-space: nowrap;
  }

  .hb-item__arrow {
    color: var(--hb-text);
    transform: none;
    transition: transform 0.3s ease;
  }

  .hb-item.is-open .hb-item__arrow {
    transform: rotate(180deg);
  }

  .hb-drop__back {
    display: none;
  }

  .hb-item.is-open > .hb-drop {
    position: absolute;
    inset: auto;
    overflow: visible;
    background: var(--white);
    z-index: 10;
  }

  /* Menú sencillo */
  .hb-item.is-open > .hb-drop--simple {
    top: calc(100% + 1.05rem);
    left: 0;
    min-width: 18rem;
    padding: 0.6rem 1.8rem;
    border-radius: 0 0 8px 8px;
  }

  .hb-drop--simple .hb-simple__link {
    padding: 0.5rem 0;
    white-space: nowrap;
  }

  /* Menú big: tarjeta ancha bajo la barra */
  .hb-item.is-open > .hb-drop--big {
    top: 100%;
    left: 0;
    right: 0;
    padding: 2.4rem 0 2.6rem;
    border-radius: 0 0 12px 12px;
  }

  .hb-big {
    display: grid;
    grid-template-columns: 1.35fr 1fr 1fr;
    max-width: 1200px;
    margin: 0 auto;
  }

  .hb-big__col {
    padding: 0 2rem;
  }

  .hb-big__col + .hb-big__col {
    margin-top: 0;
    border-left: 1px solid #d4d4d4;
  }

  .hb-big__title {
    padding: 0 0 1rem;
    font-size: 1.15rem;
    font-weight: 600;
    font-family: inherit;
  }

  .hb-big__link {
    padding: 0.5rem 0;
    font-size: 1.05rem;
  }

  .hb-big__link:hover,
  .hb-simple__link:hover {
    color: #001eb4;
  }

  .hb-item__btn {
    transition: color 0.3s ease;
  }

  .hb-item__btn:hover,
  .hb-item__btn:focus-visible,
  .hb-item.is-open > .hb-item__btn {
    color: #001eb4;
  }

  .hb-item__btn:hover .hb-item__arrow,
  .hb-item__btn:focus-visible .hb-item__arrow,
  .hb-item.is-open > .hb-item__btn .hb-item__arrow {
    color: #001eb4;
  }

  .hb-brands {
    grid-template-columns: repeat(5, 4.2rem);
    gap: 0.5rem;
    margin-top: 1rem;
  }

  .hb-brands__link {
    height: 3.2rem;
    padding: 0.35rem;
  }

  .hb-brands__link img {
    max-width: 80%;
    max-height: 80%;
  }

  .hb-brands__link img {
    filter: grayscale(1);
    opacity: 0.6;
    transition: filter 0.3s ease, opacity 0.3s ease;
  }

  .hb-brands__link:hover img,
  .hb-brands__link:focus-visible img {
    filter: none;
    opacity: 1;
  }

  .hb-cta {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0;
  }

  .hb-btn {
    padding: 0.4rem 0.8rem;
    border-width: 1.5px;
    font-size: clamp(0.68rem, 0.95vw, 0.85rem);
    letter-spacing: 0;
  }

  /* Buscador: icono que abre la caja */
  .hb-search__toggle {
    display: inline-flex;
    color: #6a6e76;
  }

  .hb-search__box.is-open {
    display: block;
    position: absolute;
    top: calc(100% + 1.9rem);
    right: 0;
    width: min(550px, 90vw);
    z-index: 10;
  }

  .hb-search__box .input-wrapper {
    height: 2.8rem;
    background: var(--white);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  }

  /* Resultados alineados al ancho del input; el overlay propio reemplaza al blur del buscador */
  .header-top .hb-search__box .container_input.active2 .autocom_box {
    left: 0;
    right: 0;
    width: 100%;
    margin-top: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  }

  .hb-search__box #search-blur-bg {
    display: none;
  }
}

.hb-big__link.active,
.hb-simple__link.active {
  color: var(--blue);
}

/* ===== Header Pymes (new-header-pymes.php): más compacto en desktop para que quepa todo ===== */
@media screen and (min-width: 1024px) {
  .main-header_container--pymes .hb-nav {
    gap: 0.6rem;
  }

  .main-header_container--pymes .hb-list {
    gap: clamp(0.75rem, 1vw, 1rem);
  }

  .main-header_container--pymes .hb-item__btn {
    gap: 0.25rem;
    font-size: clamp(0.75rem, 0.85vw, 0.9rem);
  }
}
