/* ==========================================================================
   Header v2 — refresh visual de header + desplegables (T-020). Solo diseño:
   no cambia clases, tags GTM (xn-tag-*) ni comportamiento. Se carga desde
   layout/header.php, por eso aplica a todas las páginas desktop.
   ========================================================================== */
:root {
  --hd-primary: #3483fa;
  --hd-primary-600: #1f6fe5;
  --hd-primary-50: #eef4ff;
  --hd-ink: #0f172a;
  --hd-text: #334155;
  --hd-muted: #64748b;
  --hd-line: #e6ebf2;
  --hd-radius: 14px;
  --hd-shadow: 0 18px 48px rgba(15, 23, 42, .16), 0 2px 6px rgba(15, 23, 42, .06);
}

@keyframes hd-pop {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ----- barra ----- */
header {
  box-shadow: 0 1px 0 rgba(15, 23, 42, .06), 0 6px 20px rgba(15, 23, 42, .08);
}
/* aire inferior: el nav y los íconos quedaban pegados al borde de abajo */
@media (min-width: 981px) {
  header {
    height: 76px;
    padding-top: 8px;
    padding-bottom: 10px;
    row-gap: 6px;
    align-items: center;
  }
  header nav, header .menu, header .store-info, header .session, header .cart { align-self: center; }
}

/* buscador: pill */
header .searcher__input-input > input {
  height: 38px;
  box-sizing: border-box;
  width: 100%;
  padding: 0 44px 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: "Poppins", sans-serif;
  font-size: 14px;
  color: var(--hd-ink);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .06);
  transition: box-shadow .2s, border-color .2s;
}
header .searcher__input-input > input:focus {
  outline: none;
  border-color: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .35);
}
header .searcher__input-btn {
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 16px;
  color: var(--hd-primary);
  display: grid;
  place-items: center;
}

/* resultados del buscador */
header .search__content {
  width: 100%;
  box-sizing: border-box;
  top: calc(100% + 8px);
  padding: 18px;
  border-radius: var(--hd-radius);
  border: 1px solid var(--hd-line);
  box-shadow: var(--hd-shadow);
  animation: hd-pop .18s ease-out;
}
header .search__content-title {
  font-family: "Poppins", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--hd-muted);
}
header .search__content-title:before { display: none; }
header .search__content-category { padding: 10px 0 16px; }
header .search__content-category > a {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--hd-primary-50);
  color: var(--hd-primary);
  font-size: 13px;
  align-items: center;
  transition: background .2s, color .2s;
}
header .search__content-category > a:hover { background: var(--hd-primary); color: #fff; }
header .search__content-products { padding: 8px 0 0; }
header .search__products {
  grid-template: 1fr / 64px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: none;
  border-radius: 12px;
  transition: background .15s;
}
header .search__products:hover { background: #f5f7fb; }
header .search__products-img {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--hd-line);
}
header .search__products-img img { object-fit: contain !important; }
header .search__products-description {
  font-family: "Poppins", sans-serif;
  font-size: 13px;
  line-height: 1.4;
  color: var(--hd-ink);
  padding: 0;
}
header .search__products-description small { color: var(--hd-muted); }
header .search__products-price {
  font-family: "Poppins", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--hd-ink);
  padding: 0;
  text-align: right;
  display: flex;
  flex-direction: column;
}
header .search__products-price > span { font-size: 12px; font-weight: 400; color: var(--hd-muted); }

/* íconos de la derecha */
header .store-info__btn > i,
header .session__btn > i,
header .cart__btn > i {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 18px;
  transition: background .2s;
}
header .store-info__btn:hover > i,
header .session__btn:hover > i,
header .cart__btn:hover > i { background: rgba(255, 255, 255, .18); }
header .cart_total-products {
  width: 18px;
  height: 18px;
  line-height: 18px;
  top: 2px;
  right: 0;
  font-weight: 700;
  background: #ef4444;
  box-shadow: 0 0 0 2px var(--hd-primary);
}

/* nav (Envío gratis, Ofertas...) */
header nav > ul > li > a {
  padding: 2px 12px;
  margin-left: 4px;
  border-radius: 999px;  font-family: "Poppins", sans-serif;
  font-size: 13px;
  transition: background .2s;
}
header nav > ul > li > a:hover { background-color: rgba(255, 255, 255, .18); }

/* ----- menú de categorías (mega menú) ----- */
header .menu__btn {
  font-family: "Poppins", sans-serif;
  font-size: 13px;
}
header .menu__btn > i { opacity: .8; transition: transform .2s; }
header .menu:hover .menu__btn > i { transform: rotate(180deg); }

header .menu__content {
  background: #fff;
  padding: 8px;
  border-radius: var(--hd-radius);
  border: 1px solid var(--hd-line);
  box-shadow: var(--hd-shadow);
  overflow: visible;
}
header .menu:hover > .menu__content { animation: hd-pop .18s ease-out; }
header .menu__category-title {
  width: 240px;
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--hd-text);
  font-family: "Poppins", sans-serif;
  font-size: 14px;
  transition: background .15s, color .15s;
}
header .menu__category-title > i {
  width: 22px;
  margin-right: 10px;
  text-align: center;
  color: var(--hd-primary);
}
header .menu__category:hover > .menu__category-title {
  background: var(--hd-primary-50);
  color: var(--hd-primary);
}

header .menu__category-content {
  left: calc(100% + 8px);
  top: -8px;
  height: auto;
  min-height: 420px;
  max-height: calc(100vh - 110px);
  border-radius: var(--hd-radius);
  border: 1px solid var(--hd-line);
  box-shadow: var(--hd-shadow);
  overflow: hidden;
  animation: hd-pop .18s ease-out;
}
header .menu__category-content-title {
  padding: 0 24px;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--hd-ink);
  border-bottom: 1px solid var(--hd-line);
}
header .menu__category-content-title:before { display: none; }
header .menu__sub-category > div { padding: 20px 24px; gap: 18px; width: auto; }
header .menu__sub-category-item .category-item__title {
  font-family: "Poppins", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--hd-ink);
  margin-bottom: 6px;
}
header .menu__sub-category-item > li:not(:first-child) { margin: 0 0 2px; }
header .menu__sub-category-item a {
  display: inline-block;
  padding: 3px 0;
  font-size: 14px;
  color: var(--hd-muted);
  transition: color .15s, transform .15s;
}
header .menu__sub-category-item a:hover { color: var(--hd-primary); transform: translateX(3px); }
header .menu__category-promotions { gap: 8px; padding: 8px; box-sizing: border-box; }
header .menu__category-promotions > a { border-radius: 12px; overflow: hidden; background-size: cover; background-position: center; }

/* ----- desplegables "Más info" y sesión ----- */
header .store-info__content,
header .session__content {
  width: 300px;
  padding: 18px;
  box-sizing: border-box;
  top: calc(100% + 10px);
  border-radius: var(--hd-radius);
  border: 1px solid var(--hd-line);
  box-shadow: var(--hd-shadow);
}
header [data-dropdown2="1"] .dp__content { animation: hd-pop .18s ease-out; }

header .store-info__title,
header .session__title {
  width: 100%;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hd-line);
}
header .store-info__title:before,
header .session__title:before { display: none; }
header .store-info__title h2,
header .session__title h2 {
  font-family: "Poppins", sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--hd-ink);
}

header .store-info__link { padding: 0; border: none; }
header .store-info__link > a,
header .session__link-loggedIn > a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--hd-text);
  transition: background .15s, color .15s;
}
header .store-info__link > a:hover,
header .session__link-loggedIn > a:hover { background: var(--hd-primary-50); color: var(--hd-primary); }
header .session__link-loggedIn { padding: 0; border: none; }
header .session__link-loggedIn > a > i { width: 18px; text-align: center; color: var(--hd-primary); margin: 0; }

/* formulario de login */
header .session__form { padding: 4px 0; }
header .session__form-label {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: var(--hd-ink);
}
header .session__form-input {
  width: 100%;
  box-sizing: border-box;
  height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--hd-line);
  background: #f8fafc;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
header .session__form-input:focus {
  outline: none;
  background: #fff;
  border-color: var(--hd-primary);
  box-shadow: 0 0 0 4px rgba(52, 131, 250, .15);
}
header .session__form-input-error,
header .session__form-input-success { right: 14px; bottom: 16px; }
header .session__link { padding: 2px 0; }
header .session__link > a { font-size: 13px; color: var(--hd-primary); }
header .session__link > a:hover { text-decoration: underline; }
header .session__alert { margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
header .session__form-btn { padding: 0; margin-top: 14px; }
header .session__form-btn > button {
  height: 44px;
  border-radius: 10px;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  transition: background .2s, box-shadow .2s;
}
header .session__form-btn > .btn__success { background: var(--hd-primary); }
header .session__form-btn > .btn__success:hover { background: var(--hd-primary-600); box-shadow: 0 6px 16px rgba(52, 131, 250, .35); }
header .session__form-btn > .btn__danger { background: #fff; color: #dc2626; border: 1px solid #fecaca; }
header .session__form-btn > .btn__danger:hover { background: #fef2f2; }

/* carrito (el contenido ya tiene su estilo en cart-mini.css, T-011) */
header .cart__content { animation: hd-pop .18s ease-out; }

/* ----- móvil (≤800px; las páginas de movil/ usan este mismo header) -----
   Las reglas de arriba son de escritorio. En móvil main.css pone los resultados del buscador en
   position:fixed: con top:100% quedaban DEBAJO de la pantalla (no se veían). Y el submenú flotante a la
   derecha salía fuera de la pantalla: en iPhone el primer toque abre ese submenú (hover) en vez de navegar. */
@media (max-width: 800px) {
  header .searcher { position: static; }
  header .searcher__input-input > input { padding: 0 42px 0 14px; font-size: 16px; } /* 16px: iOS no hace zoom */
  header .searcher__input-btn { right: 6px !important; left: auto !important; }
  header .search__content {
    position: absolute;
    top: calc(100% + 6px);
    left: 8px;
    right: 8px;
    width: auto;
    max-height: calc(100vh - 150px);
    padding: 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  header .search__content-category { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)) !important; }
  header .search__products { grid-template: 1fr / 52px 1fr auto; gap: 10px; }
  header .search__products-img { width: 52px; height: 52px; }
  header .search__products-description { font-size: 12px; }
  header .search__products-price { font-size: 13px; }

  header .menu__content {
    left: 8px;
    right: 8px;
    width: auto;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  header .menu__category-title { width: auto; display: flex; padding: 12px 14px; font-size: 15px; }
  /* Sin submenú flotante: la categoría navega al primer toque (sus subcategorías están en esa página). */
  header .menu__category-content,
  header .menu__category:hover > .menu__category-content { display: none !important; }

  header .store-info__content, header .session__content { max-width: calc(100vw - 16px); }
}

@media (prefers-reduced-motion: reduce) {
  header *, header *::before { animation: none !important; transition: none !important; }
}
