.header {
  width: 100%;
  height: calc(var(--real-vh, 1vh) * 15);
  background: #000;
  transition: background 0.4s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

/* === Main Header === */
.main_header {
  padding: 0 10vw;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  position: relative;
}
.logo {
  display: inline-flex; /* caja ajustada al contenido */
  align-items: center;
  height: 100%; /* ❌ no uses height:100% */
  line-height: 0; /* evita caja de línea extra alrededor del img */
  position: relative;
}

.logo img {
  height: 100%;
  width: auto;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.menu_btn {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  position: absolute;
  right: 10%;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
}

.main_nav {
  display: none;
}

/* === Side Menu (Mobile) === */
.side_menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: 250px;
  height: 100dvh;
  background: #fff;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* mantiene parte superior e inferior separadas */
  transition: right 0.3s ease;
  z-index: 10000;
}

.side_menu.active {
  right: 0;
}

.close_btn {
  background: none;
  border: none;
  font-size: 24px;
  align-self: flex-end;
  cursor: pointer;
  margin-bottom: 20px;
}

.menu_links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 0;
  margin: 0;
}

.menu_links a,
.js_open_order_info {
  font-size: 1.2rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #000;
  text-decoration: none;
}
.js_open_order_info {
  background: none;
  border: none;
  text-align: start;
}
.menu_social {
  display: flex;
  justify-content: center;
  gap: 15px;
  font-size: 24px;
  margin-top: auto;
  padding-top: 30px;
  border-top: 1px solid #ddd;
}
.menu_content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.menu_header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 10px 0;
}
.menu_logo {
  height: 40px;
  object-fit: contain;
}
.menu_title {
  font-weight: 600;
  font-size: 1rem;
  color: #000;
}
/* === Barra de búsqueda === */
.search_bar {
  display: none;
  align-items: center;
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 4px 10px;
  background: none;
  margin: 0 20px;
  flex: 1;
  max-width: 300px;
}

.search_bar input {
  border: none;
  outline: none;
  padding: 6px 8px;
  flex: 1;
  font-size: 0.9rem;
  background: transparent;
}
.main_header .search_bar input {
  color: #fff;
}
.search_bar button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: #555;
  user-select: none; /* 👈 esto evita que se seleccione el ícono por error */
}

/* === Search bar en mobile === */
.search_bar.mobile {
  margin: 10px 0 20px 0;
  width: 100%;
  height: fit-content;
  max-width: unset;
  display: flex;
  flex: unset;
}

/* Badge para "MI PEDIDO" */
.cart-badge {
  position: absolute;
  top: -50%;
  right: -20%;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(56, 56, 56, 1);
  color: #fff;
  font: 600 11px/18px system-ui, -apple-system, Segoe UI, Roboto, Arial;
  text-align: center;
  box-shadow: 0 0 0 2px #fff; /* aro blanco para contraste */
  display: flex;
  align-items: center;
  justify-content: center;
}
a[href="/pedido"] {
  position: relative;
} /* para posicionar el badge */
/* === Cuenta / Avatar === */
.account_btn {
  width: 30px;
  height: 30px;
  border-radius: 999px;

  background: #000; /* negro NUBA de fondo para iniciales */
  border: 1px solid #ddd;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;

  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;

  position: static; /* mobile lo reposiciona */
  z-index: 3;
}
.account_btn:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.account_btn:active {
  transform: translateY(1px);
}

/* Contenidos: por defecto ocultos; activamos según state */
.account_btn .avatar_img,
.account_btn .avatar_initials {
  display: none;
}

.account_btn .avatar_img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 999px;
  background: none;
  max-width: 20px;
  transition: all 0.3s ease;
  filter: invert();
}

.account_btn .avatar_initials {
  font: 700 0.85rem/1 system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: #fff;
  letter-spacing: 0.3px;
}

/* Estado: guest → imagen genérica visible */
.account_btn[data-user-state="guest"] .avatar_img {
  display: block;
}
.account_btn[data-user-state="guest"] {
  background: none;
  box-shadow: none;
  border: none;
}
/* Estado: auth → iniciales visibles */
.account_btn[data-user-state="auth"] .avatar_initials {
  display: block;
}

/* === Posicionamiento responsive === */
/* Mobile / tablet: el avatar va a la izquierda, a la altura del menú */
@media (max-width: 1023px) {
  .account_btn {
    position: static;
  }
}

/* Desktop: inline, a la derecha de la barra de búsqueda */
@media (min-width: 1024px) {
  .account_btn {
    position: static;
    margin-left: 12px; /* separación con la search bar */
    flex-shrink: 0;
    width: 40px;
    height: 40px;
  }
}

/* Desktop: inline, a la derecha de la barra de búsqueda */
@media (min-width: 1024px) {
  .account_btn {
    position: static; /* vuelve al flujo */
    margin-left: 12px; /* separadito de la search bar */
    flex-shrink: 0; /* que no se achique */
  }

  /* Alineación general del header en desktop ya está:
     .main_header { justify-content: space-between; } */
}

/* === Desktop View === */
@media (min-width: 768px) {
  .logo {
    width: 10%;
    max-width: 100px;
  }
}
@media (min-width: 1024px) {
  .menu_btn,
  .side_menu {
    display: none;
  }

  .main_nav {
    display: flex;
    gap: 40px;
  }

  .main_nav a {
    text-decoration: none;
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
  }
  .top_bar_track {
    animation: scrollTags 60s linear infinite;
  }
  .search_bar {
    display: flex;
  }
  .main_header {
    justify-content: space-between; /* cambiado */
    padding: 0 2.5vw;
  }
  .nav_link .cart-badge {
    top: -85%;
    right: 5%;
  }
  .cart-badge {
    top: 0;
    right: 50%;
  }
}
@media (min-width: 1500px) {
  .main_header {
    padding: 0 7.5vw;
  }
}
/* ====== Account wrap / dropdown ====== */
.account_wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 1001; /* encima del header */
}

/* Tu .account_btn ya existe; sacamos el posicionamiento absoluto de ahí y lo
   aplicamos al wrap en mobile para que el menú se posicione relativo al avatar */
@media (max-width: 1023px) {
  .account_wrap {
    position: absolute;
    left: 10%;
    top: 50%;
    transform: translateY(-50%);
  }
  /* Anclamos el popup al borde izquierdo del avatar */
  .account_wrap[data-user-state="auth"] .account_menu {
    left: 0; /* ⬅️ clave: ancla a la izquierda */
    right: auto; /* ⬅️ soltar anclaje derecho */
    transform-origin: top left;
    max-width: min(320px, calc(100vw - 24px)); /* evita overflow del viewport */
  }

  /* Flechita alineada al lado izquierdo */
  .account_wrap[data-user-state="auth"] .account_menu::before {
    left: 18px; /* ⬅️ en vez de right:14px */
    right: auto;
  }

  /* Mantener animación suave desde ese origen */
  .account_wrap[data-user-state="auth"] .account_menu {
    transform: translateY(8px);
  }
  .account_wrap[data-user-state="auth"] .account_menu.open,
  .account_wrap[data-user-state="auth"]:hover .account_menu,
  .account_wrap[data-user-state="auth"]:focus-within .account_menu {
    transform: translateY(0);
  }
}

/* Menú popup */
.account_menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  padding: 6px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

/* Flechita */
.account_menu::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 14px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-left: 1px solid #e5e7eb;
  border-top: 1px solid #e5e7eb;
  transform: rotate(45deg);
}

/* Desktop: abrir con hover/focus */
@media (hover: hover) and (pointer: fine) {
  .account_wrap:hover .account_menu,
  .account_wrap:focus-within .account_menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
}

/* Mobile/touch: abrir con clase .open */
@media (hover: none) {
  .account_wrap[data-user-state="auth"] .account_menu.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
}

/* Ítems del menú */
.account_menu .menu_item {
  width: 100%;
  padding: 10px 10px;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  font: 500 0.95rem/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: #111;
  cursor: pointer;
}
.account_menu .menu_item:hover,
.account_menu .menu_item:focus {
  /* background: #f3f4f6; */
  outline: none;
}
.account_menu {
  top: 100%; /* antes: calc(100% + 8px) */
  margin-top: 0; /* evitá margin para no crear gap real */
  /* animación suave como ya tenías */
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

/* Buffer invisible que “extiende” el hit-area hacia arriba */
.account_menu::after {
  content: "";
  position: absolute;
  top: -10px; /* puente de 10px entre avatar y menú */
  left: 0;
  right: 0;
  height: 10px;
  /* transparente, no cambia el look */
}

/* Abrir (desktop: hover/focus; mobile: clase .open como ya tenías) */
@media (hover: hover) and (pointer: fine) {
  .account_wrap[data-user-state="auth"]:hover .account_menu,
  .account_wrap[data-user-state="auth"]:focus-within .account_menu,
  .account_wrap[data-user-state="auth"].is-open .account_menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
}
/* Si es guest, que no aparezca JAMÁS el menú (ni por hover) */
.account_wrap[data-user-state="guest"] .account_menu {
  display: none;
}

/* EN EL INDEX */
.is_home .header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  background: #000;
}
.is_home .header.is_at_top {
  background: none;
  border-bottom: none;
}
.is_home .header .logo img {
  transition: opacity 0.2s ease;
}

/* .is_home .header.is_at_top .main_nav a {
  color: #fff;
} */
.is_home .header.is_at_top .search_bar {
  background: none;
}

.is_home .header.is_at_top .main_header .search_bar > input {
  color: #fff;
}
.is_home .header.is_at_top .main_header .search_bar > input::placeholder {
  color: #efefef;
}

.is_home .header.is_at_top .main_header .search_bar > button {
  color: #fff;
}
.is_home .header.is_at_top .avatar_img {
}
.is_home .header.is_at_top .black_logo {
  opacity: 0;
}
.is_home .header.is_at_top .white_logo {
  opacity: 1;
}
/* .is_home .header .black_logo {
  opacity: 1;
}
.is_home .header .white_logo {
  opacity: 0;
} */

.bx-menu {
  color: #fff;
}

.is_home .header.is_at_top .account_btn {
  background: none;
}
.nav_dropdown {
  position: relative;
}
.nav_link.has_caret {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav_link .caret {
  display: inline-block;
  cursor: pointer;
}

.nav_menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 220px;
  padding: 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 10001;
}
.nav_menu::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 20px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-left: 1px solid #e5e7eb;
  border-top: 1px solid #e5e7eb;
  transform: rotate(45deg);
}
/* abierto por clase */
.nav_dropdown.is-open .nav_menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
/* opcional: evita seleccionar el caret al clickearlo */
.nav_link .caret {
  user-select: none;
  cursor: pointer;
}
.nav_menu a,
.nav_menu .link_like {
  display: block;
  width: 100%;
  padding: 10px 10px;
  border-radius: 8px;
  background: transparent;
  color: #111;
  text-decoration: none;
  border: 0;
  text-align: left;
  cursor: pointer;
  font: 500 0.95rem/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial;
}
.nav_menu a:hover,
.nav_menu .link_like:hover {
  background: #f7f7f7;
}

/* Hover/focus abre en desktop */
@media (hover: hover) and (pointer: fine) {
  .nav_dropdown:hover .nav_menu,
  .nav_dropdown:focus-within .nav_menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
}
