/* Cabecera de la Tienda Barveo (prefijo tb-), igual en todas sus pantallas: /tienda/ (catálogo, carrito, ficha y
   vuelta del pago) y /condiciones-de-venta/. Barra oscura de las públicas (bl-land-bar.css) con la marca Store, que
   lleva al inicio de la tienda, y el carrito; debajo, el menú de la tienda, fijo y siempre visible (en el móvil se
   desliza en horizontal). */
.tb-con-menu {
  padding-top: calc(56px + 46px + env(safe-area-inset-top, 0px));
}

/* Las condiciones de venta no cargan tienda-publica.css (que pone border-box a todo). */
.tb-cab *, .tb-menu, .tb-menu * { box-sizing: border-box; }

/* --- Marca: logo de Barveo + «Store» --------------------------------------------------------------------------- */
.tb-cab .tb-cab__marca {
  gap: 10px;
  line-height: 1;
}
.tb-cab__store {
  padding: 4px 8px 3px;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  color: #fff;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* --- Carrito con contador --------------------------------------------------------------------------------------- */
.bl-land-bar .tb-carrito-btn {
  position: relative;
  cursor: pointer;
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
}
/* La barra recorta lo que sobresale (overflow: hidden): el contador cabe dentro del botón. */
.tb-cab { overflow: visible; }
.tb-contador {
  position: absolute;
  top: -5px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--barveo-palette-01, #c8463d);
  color: #fff;
  -webkit-text-fill-color: #fff;
  border: 2px solid var(--barveo-chrome-ink, #1e272f);
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}
.tb-contador[hidden],
.tb-contador.tb-oculto { display: none !important; }

/* --- Lo de la cabecera que vivía en tienda-publica.css --------------------------------------------------------- */
/* Las condiciones de venta no cargan esa hoja: sin esto, la etiqueta del buscador («Buscar productos», solo para
   lectores de pantalla) salía suelta encima del buscador y lo bajaba, y la foto de quien ha entrado se pintaba sin
   recortar. Una sola definición, aquí, para las dos páginas. */
.tb-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* Botón de cuenta: foto o inicial de quien ha entrado (pintarAvatarCabecera, en tienda-publica.js, también fuera de la tienda). */
.tb-cuenta-btn { position: relative; overflow: hidden; }
.tb-cuenta-btn--con-sesion > svg { display: none; }
.tb-cuenta-btn__foto { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.tb-cuenta-btn__letra { font-weight: 800; font-size: 1rem; line-height: 1; color: #fff; }

/* --- Menú de la tienda ------------------------------------------------------------------------------------------ */
.tb-menu {
  position: fixed;
  top: calc(56px + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  z-index: 49;
  height: 46px;
  background: #fff;
  border-bottom: 1px solid rgba(38, 49, 58, 0.14);
  box-shadow: 0 6px 18px rgba(38, 49, 58, 0.05);
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
.tb-menu__lista {
  display: flex;
  align-items: stretch;
  gap: 4px;
  max-width: 1120px;
  height: 100%;
  margin: 0 auto;
  padding: 0 8px;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tb-menu__lista::-webkit-scrollbar { display: none; }
.tb-menu__lista li { flex: 0 0 auto; display: flex; }
.tb-menu a:not(.tb-sugerencia):not(.tb-sugerencias__todos) {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border-bottom: 3px solid transparent;
  border-top: 3px solid transparent;
  color: #26313a;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}
/* Solo con ratón: en el móvil el «hover» se queda pegado tras el toque y parecían dos opciones marcadas. */
@media (hover: hover) {
  .tb-menu a:not(.tb-sugerencia):not(.tb-sugerencias__todos):hover { color: #000; border-bottom-color: rgba(38, 49, 58, 0.22); }
}
.tb-menu a:not(.tb-sugerencia):not(.tb-sugerencias__todos)[aria-current='page'] { border-bottom-color: var(--barveo-palette-01, #c8463d); font-weight: 800; }
.tb-menu a:not(.tb-sugerencia):not(.tb-sugerencias__todos):focus-visible { outline: 3px solid rgba(38, 49, 58, 0.45); outline-offset: -3px; }
.tb-menu svg { flex: 0 0 auto; width: 17px; height: 17px; }
/* El buscador va en la fila del menú, tras «Ayuda» (en el móvil, un botón de la cabecera lo despliega). */
.tb-menu__busca { align-items: center; margin-left: 12px; }
.tb-menu__busca .tb-busca { width: 300px; max-width: 34vw; margin: 0; flex: 0 1 auto; }
.tb-menu__busca .tb-busca__lupa { left: 12px; width: 16px; height: 16px; margin-top: -8px; color: #5b6670; }
.tb-menu__busca .tb-busca__campo {
  height: 34px;
  padding: 0 12px 0 36px;
  border: 1.5px solid rgba(38, 49, 58, 0.22);
  background: #f4f2ed;
  color: #26313a;
  -webkit-text-fill-color: #26313a;
  font-size: 0.9rem;
}
.tb-menu__busca .tb-busca__campo::placeholder { color: #5b6670; -webkit-text-fill-color: #5b6670; }
.tb-menu__busca .tb-busca__campo:focus { border-color: #26313a; background: #fff; }
.tb-menu__busca .tb-sugerencias { top: calc(100% + 6px); min-width: 320px; }
@media (min-width: 721px) {
  /* Las sugerencias cuelgan fuera de la fila: sin recorte (a esta anchura el menú cabe entero). */
  .tb-menu__lista { overflow: visible; }
}
/* La salida a barveo.app, al final y separada: no es parte de la tienda. */
.tb-menu__fuera { margin-left: auto; }
.tb-menu__fuera a { color: #5b6670; font-weight: 500; }

/* --- Menús colgantes de «Productos» (sus categorías) y «Ayuda» (preguntas, envíos, devoluciones y condiciones) -------
   Solo con ratón y en pantallas anchas: en el móvil y con el dedo, la pestaña lleva a su pantalla, donde está todo. Se abren
   con el ratón encima o el foco dentro, y js/tienda-publica.js los cierra con Esc y al elegir. */
.tb-colgante { display: none; }
@media (hover: hover) and (min-width: 721px) {
  .tb-menu__lista { overflow: visible; }
  .tb-menu__item { position: relative; }
  .tb-colgante {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 3;
    min-width: 232px;
    padding: 8px;
    border: 1px solid rgba(38, 49, 58, 0.14);
    border-top: 0;
    border-radius: 0 0 16px 16px;
    background: #fff;
    box-shadow: 0 22px 44px rgba(38, 49, 58, 0.18);
  }
  .tb-menu__item--colgante:not(.tb-menu__item--cerrado):hover > .tb-colgante:not(.tb-oculto),
  .tb-menu__item--colgante:not(.tb-menu__item--cerrado):focus-within > .tb-colgante:not(.tb-oculto) { display: block; }
  .tb-colgante ul { margin: 0; padding: 0; list-style: none; }
  .tb-menu .tb-colgante li { display: block; flex: none; }
  .tb-menu .tb-colgante a {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
  }
  .tb-menu .tb-colgante a:hover { background: #f4f2ed; color: #000; }
  .tb-menu .tb-colgante a:focus-visible { outline-offset: -3px; }
}

/* --- Buscador de la cabecera (en el móvil, un botón que despliega el campo bajo el menú) ------------------------------ */
.tb-busca {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 440px;
  margin: 0 auto;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
.tb-busca__lupa {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  color: rgba(255, 255, 255, 0.85);
  pointer-events: none;
}
.tb-busca__campo {
  display: block;
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0 14px 0 42px;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  -webkit-text-fill-color: #fff;
  font: inherit;
  font-size: 0.95rem;
  -webkit-appearance: none;
  appearance: none;
}
.tb-busca__campo::placeholder { color: rgba(255, 255, 255, 0.78); -webkit-text-fill-color: rgba(255, 255, 255, 0.78); opacity: 1; }
.tb-busca__campo::-webkit-search-decoration,
.tb-busca__campo::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.tb-busca__campo:focus {
  outline: none;
  border-color: #fff;
  background: #fff;
  color: #26313a;
  -webkit-text-fill-color: #26313a;
}
.tb-busca__campo:focus::placeholder { color: #5b6670; -webkit-text-fill-color: #5b6670; }
.tb-busca:focus-within .tb-busca__lupa { color: #26313a; }
.tb-busca__cerrar { display: none; }
.tb-busca-btn { display: none !important; }

.tb-sugerencias {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding: 6px;
  border-radius: 16px;
  background: #fff;
  color: #26313a;
  box-shadow: 0 22px 54px rgba(38, 49, 58, 0.28);
}
.tb-sugerencias.tb-oculto { display: none; }
.tb-sugerencias__lista { margin: 0; padding: 0; list-style: none; }
.tb-sugerencia {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  color: #26313a;
  text-decoration: none;
}
.tb-sugerencia:hover, .tb-sugerencia:focus-visible { background: #f4f2ed; }
.tb-sugerencia:focus-visible, .tb-sugerencias__todos:focus-visible { outline: 3px solid rgba(38, 49, 58, 0.45); outline-offset: -3px; }
.tb-sugerencia__foto {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: #f4f2ed;
  overflow: hidden;
}
.tb-sugerencia__foto img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tb-sugerencia__foto svg { width: 22px; height: 22px; color: #5b6670; }
.tb-sugerencia__nombre { flex: 1 1 auto; min-width: 0; font-size: 0.92rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.tb-sugerencia__precio { flex: 0 0 auto; font-size: 0.92rem; font-weight: 800; white-space: nowrap; }
.tb-sugerencias__todos {
  display: block;
  margin-top: 4px;
  padding: 11px 12px;
  border-top: 1px solid rgba(38, 49, 58, 0.1);
  border-radius: 0 0 10px 10px;
  color: #26313a;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}
.tb-sugerencias__todos:hover { background: #f4f2ed; }
.tb-sugerencias__vacio { margin: 0; padding: 14px 12px; color: #5b6670; font-size: 0.92rem; }

@media (max-width: 720px) {
  .tb-menu__busca { display: none; }
  .tb-menu__busca:has(.tb-busca--abierta) { display: flex; margin: 0; }
  .tb-busca { display: none; }
  .tb-busca-btn { display: inline-flex !important; }
  .tb-busca.tb-busca--abierta {
    display: block;
    position: fixed;
    top: calc(56px + 46px + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    max-width: none;
    margin: 0;
    padding: 10px 12px;
    background: #fff;
    box-shadow: 0 14px 30px rgba(38, 49, 58, 0.16);
  }
  .tb-busca--abierta .tb-busca__lupa { left: 26px; color: #26313a; }
  .tb-busca--abierta .tb-busca__campo {
    padding-right: 44px;
    border-color: rgba(38, 49, 58, 0.22);
    background: #f4f2ed;
    color: #26313a;
    -webkit-text-fill-color: #26313a;
    /* 16 px: con menos, Safari del iPhone acerca la página al tocar el campo. */
    font-size: 1rem;
  }
  .tb-busca--abierta .tb-busca__campo::placeholder { color: #5b6670; -webkit-text-fill-color: #5b6670; }
  .tb-busca--abierta .tb-busca__cerrar {
    position: absolute;
    top: 10px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #26313a;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
  }
  .tb-busca--abierta .tb-sugerencias { left: 12px; right: 12px; top: calc(100% - 2px); max-height: calc(100vh - 170px); }
}

/* --- Ayuda y lo que cuelga de ella: preguntas, envíos, devoluciones y condiciones de venta ---------------------------- */
.tb-subnav { margin: 28px 0 0; font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; }
.tb-subnav ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tb-subnav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid rgba(38, 49, 58, 0.14);
  border-radius: 999px;
  background: #fff;
  color: #26313a;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.tb-subnav a:hover { border-color: rgba(38, 49, 58, 0.28); }
.tb-subnav a[aria-current='page'] { border-color: #26313a; background: #26313a; color: #fff; }
.tb-subnav a:focus-visible { outline: 3px solid rgba(38, 49, 58, 0.45); outline-offset: 2px; }
.bl-legal-doc > .tb-subnav { margin: 0 0 24px; }

/* Las anclas no se quedan debajo de las dos barras fijas. */
.tb-con-menu [id] { scroll-margin-top: calc(56px + 46px + 16px + env(safe-area-inset-top, 0px)); }

@media (max-width: 560px) {
  .tb-cab__store { font-size: 10px; padding: 3px 6px 2px; }
  .tb-menu a { padding: 0 8px; font-size: 0.86rem; }
  .tb-menu svg { display: none; }
}

/* Móviles estrechos: con sesión la barra lleva cuatro botones (buscar, Mi almacén, cuenta y carrito); la etiqueta «Store»
   se quita y, en los más pequeños, los botones y su separación se encogen para que nada se pise. */
@media (max-width: 400px) {
  .tb-cab__store { display: none; }
}
@media (max-width: 340px) {
  .tb-cab .bl-land-bar__actions { gap: 4px; }
  .tb-cab .bl-land-bar__btn:not(.tb-descontar-btn) { width: 36px; height: 36px; }
}

/* El buscador dentro de la fila del menú: sus listas y su lupa no son opciones del menú. */
.tb-menu__busca .tb-sugerencias li { display: block; flex: none; }
.tb-menu__busca .tb-busca__lupa { display: block; }
