/* assets/css/layout/header.css */

/* ---------- Contenedor global reutilizable ---------- */
.container { 
  width: min(1200px, 92%); 
  margin-inline: auto; 
  max-width: 100%;
  overflow-x: hidden;
}

/* ---------- Línea superior muy sutil ---------- */
.lm-header__topline {
  height: 4px;
  background: linear-gradient(90deg, #f4eae3, #f7f2ee);
}

/* ---------- Barra principal ---------- */
.lm-header__bar {
  position: sticky; 
  top: 0; 
  z-index: 1000;
  display: grid; 
  grid-template-columns: 160px 1fr auto;
  align-items: center; 
  gap: 24px;
  background: #ffffff;
  padding: 14px 0;
  border-bottom: 1px solid #efefef;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* ---------- Logo ---------- */
.lm-logo { 
  display: inline-flex; 
  align-items: center; 
  gap: 10px; 
  text-decoration: none; 
  max-width: 100%;
}
.lm-logo img { 
  height: 80px; 
  width: auto; 
  display: block; 
  max-width: 100%;
}

/* ---------- NAV (desktop) ---------- */
.lm-nav { 
  justify-self: center; 
  max-width: 100%;
  overflow-x: hidden;
}
.lm-nav__list { 
  display: flex; 
  gap: 34px; 
  list-style: none; 
  margin: 0; 
  padding: 0; 
  flex-wrap: wrap;
}
.lm-nav__link {
  text-decoration: none; 
  color: #202020;
  font-family: "Oswald", Arial, sans-serif; 
  font-size: 16px; 
  letter-spacing: .02em;
  white-space: nowrap;
}
.lm-nav__link:hover { text-decoration: underline; }
.lm-nav__link.is-active { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Acciones derecha ---------- */
.lm-actions { 
  display: flex; 
  align-items: center; 
  gap: 14px; 
  max-width: 100%;
  flex-wrap: wrap;
}

/* ---------- Carrito ---------- */
.lm-cart {
  display: inline-flex; 
  align-items: center; 
  gap: 10px;
  text-decoration: none; 
  color: #7b7b7b;
  border: 1px solid #e3e3e3; 
  border-radius: 8px;
  padding: 8px 12px; 
  background: #f7f7f7;
  white-space: nowrap;
}
.lm-cart:hover { background: #f2f2f2; }
.lm-cart__icon { width: 18px; height: 18px; position: relative; display: inline-block; }
.lm-cart__icon::before, .lm-cart__icon::after {
  content: ""; 
  position: absolute; 
  border: 2px solid #c9c9c9; 
  border-radius: 2px;
}
.lm-cart__icon::before { /* cubo */
  width: 16px; height: 10px; left: 1px; top: 6px; border-top: none;
}
.lm-cart__icon::after { /* asa */
  width: 10px; height: 6px; left: 4px; top: 0; border-bottom: none;
}
.lm-cart__text { font-weight: 600; font-size: 13px; }
.lm-cart__badge {
  background: #111; color: #fff; font-size: 11px; line-height: 1;
  padding: 2px 6px; border-radius: 999px; margin-left: 2px;
}

/* ---------- Pill "Übersetzen" ---------- */
.lm-pill {
  display: inline-flex; 
  align-items: center; 
  gap: 8px;
  border: 1px solid #e8e8e8; 
  background: #fff; 
  padding: 8px 12px;
  border-radius: 999px; 
  cursor: pointer; 
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
  white-space: nowrap;
}
.lm-pill:hover { background: #fafafa; }
.lm-pill__icon { width: 16px; height: 16px; position: relative; display: inline-block; }
.lm-pill__icon::before, .lm-pill__icon::after {
  content: ""; 
  position: absolute; 
  border: 1.6px solid #222; 
  border-radius: 50%;
}
.lm-pill__icon::before { width: 16px; height: 16px; left: 0; top: 0; }
.lm-pill__icon::after { width: 12px; height: 12px; left: 2px; top: 2px; border-left: none; border-right: none; }
.lm-pill__text { font-weight: 600; font-size: 13px; color: #222; }

/* ---------- Hamburguesa móvil ---------- */
.lm-burger {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid #e8e8e8;
  background: #fff;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
}
.lm-burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #222;
  margin: 4px auto;
  transition: transform .2s ease, opacity .2s ease;
}

/* Estado abierto: animación a "X" */
.lm-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.lm-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.lm-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Drawer móvil (deslizante) ---------- */
.lm-drawer[hidden] { display: none !important; }
.lm-drawer.is-open[hidden] { display: block !important; }

.lm-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 86vw;
  max-width: 420px;
  background: #fff;
  border-left: 1px solid #efefef;
  box-shadow: -2px 0 16px rgba(0,0,0,.18);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateX(100%);
  transition: transform .25s ease;
  z-index: 2000;
}

.lm-drawer.is-open { transform: translateX(0); }

.lm-drawer__list { list-style: none; margin: 0; padding: 12px 16px 16px; }
.lm-drawer__list li { margin: 10px 0; }
.lm-drawer__list a {
  color: #202020; text-decoration: none;
  font-family: "Oswald", Arial, sans-serif;
}
.lm-drawer__list a.is-active { text-decoration: underline; }

.lm-drawer__sep { height:1px; background:#333; margin:.5rem 0; }
.lm-drawer__hello { display:block; padding:.6rem .2rem; opacity:.85; }

.no-scroll { overflow: hidden; touch-action: none; }

/* ---------- Avatar + menú usuario ---------- */
.lm-user { position: relative; margin-left: 12px; }
.lm-user__btn {
  display:flex; align-items:center; gap:.5rem;
  background:transparent; border:1px solid var(--border, #2a2a2a);
  padding:.5rem .75rem; border-radius:999px; color:inherit; cursor:pointer;
}
.lm-user__avatar {
  width:28px; height:28px; border-radius:50%;
  display:grid; place-items:center; font-weight:700; font-size:.85rem;
  background:#111; color:#fff;
}
.lm-user__name { font-weight:600; font-size:.95rem; }
.lm-user__chev { opacity:.75; transition:transform .2s ease; }
.lm-user__btn[aria-expanded="true"] .lm-user__chev { transform: rotate(180deg); }

.lm-user__menu {
  position:absolute; right:0; top:calc(100% + .5rem);
  background:#fff; color:#111; min-width:200px; border-radius:12px;
  box-shadow:0 12px 30px rgba(0,0,0,.18); padding:.5rem;
  border:1px solid #e5e7eb; z-index:2100;
}
.lm-user__menu a {
  display:block; padding:.6rem .8rem; border-radius:8px; text-decoration:none; color:inherit;
}
.lm-user__menu a:hover { background:#f5f5f5; }

.btn.btn--ghost {
  border:1px solid var(--border, #2a2a2a);
  padding:.55rem .9rem; border-radius:999px; color:inherit; text-decoration:none;
}

@media (prefers-reduced-motion: reduce) {
  .lm-drawer { transition: none; }
  .lm-burger span { transition: none; }
}

/* ---------- RESPONSIVE MEJORADO PARA PORTRAIT ---------- */
@media (max-width: 1024px) {
  .lm-header__bar { 
    grid-template-columns: 120px 1fr auto; 
    gap: 16px;
  }
  .lm-logo img { height: 70px; }
  .lm-nav__list { gap: 24px; }
}

@media (max-width: 950px) {
  .lm-header__bar { 
    grid-template-columns: 100px 1fr auto; 
    gap: 12px;
  }
  .lm-nav { display: none; }
  .lm-burger { display: inline-flex; }
  .lm-logo img { height: 60px; }
  .lm-actions { gap: 8px; }
}

/* ---------- MÓVILES PORTRAIT (CRÍTICO) ---------- */
@media (max-width: 768px) {
  .lm-header__bar { 
    grid-template-columns: 60px 1fr auto; 
    gap: 6px;
    padding: 8px 0;
  }
  .lm-logo img { height: 45px; }
  .lm-actions { 
    gap: 4px;
    flex-wrap: nowrap;
  }
  .lm-pill, .lm-cart {
    padding: 6px 8px;
    min-width: 36px;
  }
  .lm-pill__text, .lm-cart__text {
    display: none;
  }
  .lm-burger {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 480px) {
  .lm-header__bar { 
    grid-template-columns: 50px 1fr auto; 
    gap: 4px;
    padding: 6px 0;
  }
  .lm-logo img { height: 35px; }
  .lm-actions { 
    gap: 2px;
  }
  .lm-pill, .lm-cart {
    padding: 4px 6px;
    min-width: 32px;
  }
  .lm-burger {
    width: 32px;
    height: 32px;
  }
  .lm-burger span {
    width: 18px;
    height: 2px;
  }
}

/* ---------- MÓVILES MUY PEQUEÑOS ---------- */
@media (max-width: 360px) {
  .lm-header__bar { 
    grid-template-columns: 40px 1fr auto; 
    gap: 2px;
    padding: 4px 0;
  }
  .lm-logo img { height: 30px; }
  .lm-actions { 
    gap: 1px;
  }
  .lm-pill, .lm-cart {
    padding: 3px 4px;
    min-width: 28px;
  }
  .lm-burger {
    width: 28px;
    height: 28px;
  }
  .lm-burger span {
    width: 16px;
    height: 1px;
  }
}

@media (min-width: 951px) {
  .lm-drawer { display: none !important; }
  .lm-collapsible > .lm-cart + .lm-collapsible__panel { display: none !important; }
}

/* ---------- Collapsibles base ---------- */
.lm-collapsible { position: relative; }

.lm-collapsible__panel {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height .28s ease, opacity .22s ease;
  border: 1px solid #efefef;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0,0,0,.08);
  background: #fff;
  margin-top: .5rem;
}

.lm-collapsible.is-open .lm-collapsible__panel[hidden] { display: block !important; }

.lm-collapsible__inner {
  padding: .75rem;
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.lm-collapsible.is-open .lm-collapsible__panel {
  opacity: 1;
  max-height: 360px;
}

/* ---------- Solo en móvil: botones compactos + texto oculto ---------- */
@media (max-width: 950px) {
  .lm-actions { gap: 10px; }
  .lm-pill, .lm-cart {
    padding: 10px 12px;
  }
  .lm-pill .lm-pill__text,
  .lm-cart .lm-cart__text {
    display: none;
  }
  .lm-collapsible.is-open .lm-pill .lm-pill__text,
  .lm-collapsible.is-open .lm-cart .lm-cart__text {
    display: inline;
    margin-left: 2px;
  }
  .lm-cart__badge { transform: translateY(-1px); }
  .lm-collapsible__panel {
    position: static;
    width: 100%;
  }
}

.lm-burger {
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lm-burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #222;
  margin: 3px 0;
  transition: transform .2s ease, opacity .2s ease;
}

.lm-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.lm-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.lm-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 950px) {
  .lm-burger { display: inline-flex; }
}