/* ================================================================
   NAVBAR V4 - CONFIGURACIÓN GLOBAL & VARIABLES
   ================================================================ */
:root {
  --nav-bg: #ffffff;
  --nav-text: #1a1a1a;
  --nav-accent: #2271b1; /* Azul principal */
  --nav-accent-hover: #1a5a8e;
  --nav-height: 65px;
  --nav-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  --nav-drawer-width: 320px;
}

/* Base del Navbar */
.navbar-v4 {
  background: var(--nav-bg);
  position: sticky;
  top: 0;
  z-index: 100000;
  box-shadow: var(--nav-shadow);
}

/* Helper classes para control de visibilidad */
.desktop-only {
  display: none !important;
}
.mobile-only {
  display: block;
}

/* ================================================================
   VISTA MÓVIL (ESTRUCTURA BASE)
   ================================================================ */

/* Barra Superior Móvil */
.navbar-v4__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  height: var(--nav-height);
}

.navbar-v4__toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px 5px;
}

.navbar-v4__icon-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--nav-text);
  margin: 4px 0;
}

.navbar-v4__logo img {
  max-height: 35px;
  width: auto;
}

/* Acciones (cuenta + carrito) */
.navbar-v4__actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

/* Ícono Mi Cuenta */
.navbar-v4__account {
  position: relative;
  color: var(--nav-text);
  text-decoration: none;
  display: flex;
  align-items: center;
  opacity: 0.85;
  transition: opacity 0.15s, color 0.15s;
}
.navbar-v4__account:hover {
  opacity: 1;
  color: var(--nav-accent);
}

/* Carrito */
.navbar-v4__cart {
  position: relative;
  color: var(--nav-text);
  text-decoration: none;
  display: flex;
  align-items: center;
}

/* Candado "no logueado" junto al icono de cuenta */
.navbar-v4__account {
  position: relative;
}
.navbar-v4__account-lock {
  position: absolute;
  bottom: -3px;
  right: -6px;
  color: var(--nav-accent);
  pointer-events: none;
}
.navbar-v4__cart-count {
  position: absolute;
  top: -8px;
  right: -10px;
  background: var(--nav-accent);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 50%;
}

/* Buscador Móvil (Contenedor gris debajo del logo) */
.navbar-v4__search-container {
  padding: 8px 15px;
  background: #f8f9fa;
}

.navbar-v4__search {
  display: flex;
  position: relative;
}

.navbar-v4__search input {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}

.navbar-v4__search button {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
}

/* ================================================================
   DRAWER LATERAL (COMÚN MÓVIL Y DESKTOP)
   ================================================================ */

.navbar-v4__menu-wrapper {
  position: fixed;
  top: 0;
  left: -110%;
  width: 85%;
  max-width: var(--nav-drawer-width);
  height: 100vh;
  background: var(--nav-bg);
  transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: 5px 0 25px rgba(0, 0, 0, 0.15);
}

.navbar-v4__menu-wrapper.is-active {
  left: 0;
}

.navbar-v4__menu-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
}

.navbar-v4__close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
}

/* Lista de Menú Interna */
.navbar-v4__menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: block;
}
.navbar-v4__menu-list li {
  position: relative;
  border-bottom: 1px solid #f1f1f1;
  display: block;
  width: 100%;
}
.navbar-v4__menu-list li a {
  display: block;
  padding: 15px 20px;
  color: var(--nav-text);
  text-decoration: none;
  font-size: 15px;
}

/* Submenús (Acordeón) */
.navbar-v4__menu-list .sub-menu {
  display: none;
  list-style: none;
  padding: 0;
  background: #f9f9f9;
}

.is-open > .sub-menu {
  display: block !important;
}
.navbar-v4__menu-list .sub-menu li a {
  padding-left: 40px;
}

.navbar-v4__menu-list .sub-menu .sub-menu li a {
  padding-left: 60px;
}

/* Botón de Despliegue (+) independiente */
.navbar-v4__menu-list li.menu-item-has-children > a {
  padding-right: 60px;
}
.navbar-v4__toggle-sub {
  position: absolute;
  right: 0;
  top: 0;
  width: 55px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid #f1f1f1;
  cursor: pointer;
  z-index: 10;
}
.navbar-v4__toggle-sub::after {
  content: "+";
  font-size: 20px;
  color: var(--nav-accent);
  transition: 0.3s;
}
.is-open > .navbar-v4__toggle-sub::after {
  content: "-";
  transform: rotate(180deg);
}

/* Overlay de fondo */
.navbar-v4__overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  visibility: hidden;
  opacity: 0;
  transition: 0.3s;
  z-index: 10000;
}
.navbar-v4__overlay.is-active {
  visibility: visible;
  opacity: 1;
}

/* ================================================================
   VISTA DESKTOP & BUSCADOR HÍBRIDO (anie v4)
   ================================================================ */
@media (min-width: 992px) {
  /* 1. Control de Visibilidad */
  .mobile-only {
    display: none !important;
  }
  .desktop-only {
    display: block !important;
  }
  .navbar-v4__toggle {
    display: none !important;
  }

  /* 2. Estructura del Header (Logo - Buscador - Carrito) */
  .navbar-v4__top {
    display: grid;
    grid-template-columns: 200px 1fr auto;
    gap: 40px;
    height: 85px;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
  }

  /* 3. BUSCADOR HÍBRIDO (Estilo Pro) */
  .navbar-v4__search-container.desktop-only {
    background: transparent;
    padding: 0;
  }

  .search-hybrid {
    display: flex;
    align-items: center;
    background: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 50px; /* píldora */
    padding: 0 20px;
    transition: all 0.3s ease;

    position: relative; /* importante para el dropdown */
    overflow: visible; /* permite que el dropdown salga */
  }

  .search-hybrid:focus-within {
    background: #ffffff;
    border-color: var(--nav-accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }

  .search-category-select {
    border-right: 1px solid #ccc;
    padding-right: 15px;
    margin-right: 15px;
  }

  .cat-dropdown {
    background: transparent;
    border: none;
    font-size: 13px;
    font-weight: 700;
    color: #555;
    cursor: pointer;
    outline: none;
    padding: 12px 0;
  }

  .search-hybrid input {
    background: transparent !important;
    border: none !important;
    padding: 12px 0 !important;
    flex: 1;
    font-size: 14px;
    outline: none;
  }

  .search-hybrid button {
    position: static !important;
    transform: none !important;
    background: none;
    border: none;
    padding-left: 15px;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
  }

  /* 4. Barra de Navegación Inferior (Categorías) */
  /* 4. Barra de Navegación Inferior (anie v4 Premium) */
  .navbar-v4__desktop-nav {
    display: block !important;
    background: #ffffff;
    border-top: 1px solid #eee;
    border-bottom: 2px solid var(--nav-accent); /* Línea azul corporativa */
    box-shadow: 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  }

  .navbar-v4__inner {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0 20px;
  }

  /* Botón de Categorías mejorado */
  .navbar-v4__cat-btn {
    background: var(--nav-accent);
    color: #fff;
    border: none;
    padding: 12px 30px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    text-transform: uppercase;
    transition: background 0.3s ease;
  }

  .navbar-v4__cat-btn:hover {
    background: var(--nav-accent-hover);
  }

  /* Estilos para el Menú Dinámico (menu-secondary) */
  .navbar-v4__nav-links {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
  }

  .navbar-v4__nav-links .menu-secondary {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 0 0 20px !important;
    gap: clamp(12px, 1.8vw, 26px) !important;
    justify-content: flex-start !important;
    align-items: center !important;
  }

  .navbar-v4__nav-links .menu-secondary li {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
  }

  .navbar-v4__nav-links .menu-secondary li a {
    text-decoration: none !important;
    color: #444;
    font-weight: 700;
    font-size: clamp(11px, 1vw, 13px);
    text-transform: uppercase;
    white-space: nowrap;
    padding: 6px 0;
    display: inline-block;
    transition: color 0.3s ease;
  }

  /* Hover con línea animada */
  .navbar-v4__nav-links .menu-secondary li a:hover {
    color: var(--nav-accent);
  }

  .navbar-v4__nav-links .menu-secondary li a::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--nav-accent);
    transition: width 0.3s ease;
  }

  .navbar-v4__nav-links .menu-secondary li a:hover::after {
    width: 100%;
  }

  /* 5. Ajustes del Drawer en Desktop */
  .navbar-v4__menu-wrapper {
    position: fixed !important;
    left: -110% !important;
    width: 400px !important;
    height: 100vh !important;
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-top: none !important;
  }

  .navbar-v4__menu-wrapper.is-active {
    left: 0 !important;
  }

  .navbar-v4__menu-list {
    display: block !important;
    flex-direction: column !important;
  }
  .navbar-v4__toggle-sub {
    display: flex !important;
  }
}

/* ================================================================
   LIMPIEZA DE ELEMENTOS ROTOS EN MÓVIL
   ================================================================ */

/* 1. Ocultar la barra de navegación desktop en móviles por defecto */
.navbar-v4__desktop-nav {
  display: none !important;
}

/* 2. Asegurar que los selectores de "solo desktop" no se vean en móvil */
.desktop-only {
  display: none !important;
}

/* 3. Mostrar la barra solo cuando la pantalla sea grande (min-width: 992px) */
@media (min-width: 992px) {
  .navbar-v4__desktop-nav {
    display: block !important; /* Aquí es donde aparece en Desktop */
  }

  .desktop-only {
    display: block !important;
  }

  /* Ocultar elementos que son puramente móviles si fuera necesario */
  .mobile-only {
    display: none !important;
  }
}

.navbar-v4__search-container {
  position: relative;
  z-index: 100001;
}

/* ================================================================
   DRAWER — SECCIONES DE NAVEGACIÓN Y CATEGORÍAS
   ================================================================ */

.navbar-v4__drawer-nav {
  border-bottom: 1px solid #eee;
}

/* En desktop el drawer es solo de categorías — se oculta la sección de navegación */
@media (min-width: 992px) {
  .navbar-v4__drawer-nav,
  .navbar-v4__drawer-section-title:not(.navbar-v4__drawer-section-title--cats) {
    display: none !important;
  }
}

.navbar-v4__drawer-section-title {
  padding: 12px 20px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888;
  background: #f8f9fa;
}

.navbar-v4__drawer-section-title--cats {
  border-top: 1px solid #eee;
}

/* Nav links en el drawer (secondary menu) */
.navbar-v4__menu-list--nav li a {
  font-weight: 600;
  color: var(--nav-accent) !important;
}

.navbar-v4__menu-list--nav li a:hover {
  background: #f0f6ff;
  color: var(--nav-accent-hover) !important;
}

/* ================================================================
   SUPERBAR — TELÉFONOS, EMAIL Y RRSS
   ================================================================ */

.gx-superbar {
  background: #16549D;
  color: #fff;
}

.gx-superbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  height: 32px;
}

.gx-superbar__left {
  display: flex;
  align-items: center;
  gap: 2px;
}

.gx-superbar__item {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  padding: 0 6px;
  transition: color 0.2s;
}

.gx-superbar__item:hover {
  color: #fff;
}

.gx-superbar__sep {
  color: rgba(255, 255, 255, 0.28);
  font-size: 13px;
  user-select: none;
}

/* Email: oculto en mobile */
.gx-superbar__item--email {
  display: none;
}

.gx-superbar__right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gx-superbar__follow {
  display: none;
}

.gx-superbar__social {
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.2s, transform 0.15s;
  padding: 4px 3px;
}

.gx-superbar__social:hover {
  color: #fff;
  transform: translateY(-1px);
}

@media (min-width: 992px) {
  .gx-superbar__inner {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
    height: 36px;
  }

  .gx-superbar__left {
    gap: 4px;
  }

  .gx-superbar__item {
    font-size: 12px;
    padding: 0 8px;
  }

  .gx-superbar__item--email {
    display: flex;
  }

  .gx-superbar__right {
    gap: 10px;
  }

  .gx-superbar__follow {
    display: inline;
    color: rgba(255, 255, 255, 0.65);
    font-size: 11px;
    white-space: nowrap;
    margin-right: 2px;
  }
}

/* ================================================================
   CONTACTO INLINE EN NAVBAR (reemplaza superbar)
   Visible solo en desktop (≥992px), oculto en móvil (drawer ya lo tiene)
   Estructura: [teléfonos apilados] | [email] | [rrss 2×2]
   ================================================================ */
.gx-navbar-contact {
  display: none;
}

@media (min-width: 992px) {
  .gx-navbar-contact {
    display: flex;
    align-items: center;
    gap: 8px;
  }
}

/* Columna vertical: teléfonos o email */
.gx-navbar-contact__group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gx-navbar-contact__link {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--nav-text);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 3px;
  line-height: 1.25;
  opacity: 0.7;
  transition: color 0.2s, opacity 0.15s;
}
.gx-navbar-contact__link:hover {
  color: var(--nav-accent);
  opacity: 1;
}

/* Solo íconos en desktop pequeño; texto en ≥1100px */
.gx-navbar-contact__text {
  display: none;
}
@media (min-width: 1100px) {
  .gx-navbar-contact__text {
    display: inline;
  }
}

/* Separador vertical fino */
.gx-navbar-contact__sep {
  display: block;
  width: 1px;
  height: 34px;
  background: rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  margin: 0 2px;
}

/* Cuadrícula 2×2 para RRSS */
.gx-navbar-contact__social-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}

.gx-navbar-contact__social {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--nav-text);
  text-decoration: none;
  padding: 3px 4px;
  border-radius: 3px;
  opacity: 0.5;
  transition: color 0.2s, opacity 0.15s, transform 0.15s;
}
.gx-navbar-contact__social:hover {
  color: var(--nav-accent);
  opacity: 1;
  transform: translateY(-1px);
}

/* Sección contacto en drawer móvil */
.gx-superbar__drawer {
  padding: 16px 20px 20px;
  border-top: none;
  background: var(--nav-accent);
}

.gx-superbar__drawer-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 10px;
}

.gx-superbar__drawer-item {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  transition: opacity 0.2s;
}

.gx-superbar__drawer-item:last-of-type {
  border-bottom: none;
}

.gx-superbar__drawer-item:hover {
  opacity: 0.8;
  color: #fff;
}

.gx-superbar__drawer-social {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.gx-superbar__drawer-follow {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.gx-superbar__drawer-social a {
  display: flex;
  align-items: center;
  color: #fff;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s;
  padding: 4px;
  opacity: 0.8;
}

.gx-superbar__drawer-social a:hover {
  opacity: 1;
  transform: translateY(-1px);
}
