/* ========================================
   TOP BANNER
   ======================================== */

.top-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--banner-height);
  background: var(--color-black);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-align: center;
  padding: 0 16px;
  overflow: hidden;
}

.top-banner__msg {
  position: absolute;
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.top-banner__msg.active {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================
   NAVBAR
   ======================================== */

.navbar {
  position: fixed;
  top: var(--banner-height);
  left: 0;
  right: 0;
  height: var(--navbar-height);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-gray-200);
  z-index: 1000;
  transition: box-shadow var(--transition);
}

.navbar--scrolled {
  box-shadow: var(--shadow-sm);
}

.navbar__container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Logo */
.navbar__logo {
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  display: inline-block;
  animation: logoPulse 6s ease-in-out infinite;
}

.navbar__logo img {
  height: 48px;
  width: auto;
}

.navbar__logo::after {
  content: '';
  position: absolute;
  top: -10%;
  left: -120%;
  width: 60%;
  height: 120%;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255,255,255,0.6) 50%,
    transparent 70%
  );
  animation: logoShine 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes logoShine {
  0%, 60% { left: -60%; }
  90% { left: 180%; }
  100% { left: 180%; }
}
@keyframes logoPulse {
  0%, 60% { transform: scale(1); }
  72% { transform: scale(1.06); }
  84% { transform: scale(1); }
  100% { transform: scale(1); }
}

/* Menu */
.navbar__menu {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.navbar__links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.navbar__item {
  position: relative;
}

.navbar__link {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-gray-800);
  transition: color var(--transition);
  white-space: nowrap;
  position: relative;
}

/* Mega Dropdown */
.mega-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-white);
  border-top: 1px solid var(--color-gray-200);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 100;
}

.mega-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mega-dropdown__inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 28px 24px 32px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0 32px;
}

.mega-dropdown__col {
  min-width: 0;
}

.mega-dropdown__col-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-black);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-gray-200);
}

.mega-dropdown__col a {
  display: block;
  padding: 4px 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--color-gray-600);
  transition: color var(--transition);
}

.mega-dropdown__col a:hover {
  color: var(--color-black);
}

.mega-dropdown__col a.mega-dropdown__otros {
  margin-top: 4px;
  font-weight: 600;
  color: var(--color-gray-800);
}

/* Underline on the "Otros" column title */
.mega-dropdown__col--otros .mega-dropdown__col-title {
  text-decoration: underline;
}

.navbar__link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--color-black);
  transform: scaleX(0);
  transition: transform var(--transition);
}

.navbar__link:hover,
.navbar__link.active {
  color: var(--color-black);
}

.navbar__link:hover::after,
.navbar__link.active::after {
  transform: scaleX(1);
}

/* Actions */
.navbar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.navbar__separator {
  width: 1px;
  height: 24px;
  background: #e0e0e0;
  margin: 0 4px;
}

.navbar__icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--color-gray-800);
  transition: background var(--transition), color var(--transition);
  position: relative;
  flex-shrink: 0;
}

.navbar__icon-btn:hover {
  background: var(--color-gray-100);
  color: var(--color-black);
}

/* Wishlist badge */
.navbar__wishlist-btn {
  position: relative;
}

.navbar__wishlist-count {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  background: var(--color-black);
  color: var(--color-white);
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity var(--transition), transform var(--transition);
}

.navbar__wishlist-count.visible {
  opacity: 1;
  transform: scale(1);
}

/* Cart badge */
.navbar__cart-btn {
  position: relative;
}

.navbar__cart-count {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  background: var(--color-black);
  color: var(--color-white);
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity var(--transition), transform var(--transition);
}

.navbar__cart-count.visible {
  opacity: 1;
  transform: scale(1);
}

/* Mini Cart Hover */
.navbar__cart-wrap {
  position: relative;
}

.mini-cart {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  background: #fff;
  border: 1px solid var(--color-gray-200);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  z-index: 1000;
  padding-top: 8px;
}

.mini-cart::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}

.navbar__cart-wrap:hover .mini-cart {
  display: block;
}

@media (max-width: 1300px) {
  .mini-cart { display: none !important; }
}

.mini-cart__items {
  max-height: 280px;
  overflow-y: auto;
  padding: 8px;
}

.mini-cart__item {
  display: flex;
  gap: 10px;
  padding: 8px;
  border-bottom: 1px solid var(--color-gray-100);
}

.mini-cart__item:last-child { border-bottom: none; }

.mini-cart__item-img {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  object-fit: contain;
  background: var(--color-gray-100);
  flex-shrink: 0;
}

.mini-cart__item-info {
  flex: 1;
  min-width: 0;
}

.mini-cart__item-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-cart__item-meta {
  font-size: 11px;
  color: var(--color-gray-500);
}

.mini-cart__item-price {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.mini-cart__footer {
  padding: 10px 12px;
  border-top: 1px solid var(--color-gray-200);
}

.mini-cart__total {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.mini-cart__view-btn {
  display: block;
  width: 100%;
  padding: 10px;
  background: var(--color-black);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
}

.mini-cart__secondary-btn {
  display: block;
  width: 100%;
  padding: 8px;
  background: transparent;
  color: var(--color-gray-600);
  border: none;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  margin-top: 4px;
}

.mini-cart__secondary-btn:hover {
  color: var(--color-black);
}

.mini-cart__empty {
  padding: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--color-gray-400);
}

/* Hamburger */
.navbar__hamburger {
  display: none;
  width: 40px;
  height: 40px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.navbar__hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-black);
  transition: transform var(--transition), opacity var(--transition);
}

.navbar__hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.navbar__hamburger.open span:nth-child(2) {
  opacity: 0;
}

.navbar__hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Search bar */
.navbar__search {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-gray-200);
  padding: 16px 24px;
  transform: translateY(-10px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  box-shadow: var(--shadow-md);
}

.navbar__search.open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.navbar__search-inner {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar__search-inner input {
  flex: 1;
  height: 44px;
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius);
  padding: 0 16px;
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition);
}

.navbar__search-inner input:focus {
  border-color: var(--color-black);
}

.navbar__search-inner button {
  color: var(--color-gray-600);
}

.search-results {
  max-width: 700px;
  margin: 0 auto;
  max-height: 300px;
  overflow-y: auto;
}

.search-results__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-gray-100);
  cursor: pointer;
  transition: background var(--transition);
}

.search-results__item:hover {
  background: var(--color-gray-50);
}

.search-results__item img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.search-results__item-info {
  flex: 1;
}

.search-results__item-name {
  font-weight: 600;
  font-size: 13px;
}

.search-results__item-meta {
  font-size: 12px;
  color: var(--color-gray-600);
}

.search-results__badge {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-results__badge--store {
  background: #212121;
  color: #fff;
}

.search-results__badge--marketplace {
  background: #E8F5E9;
  color: #2E7D32;
}

/* Mobile overlay */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.mobile-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* Medium: hamburger + sidebar for links, icons stay in navbar */
@media (max-width: 1300px) {
  .navbar__separator { display: none; }

  .navbar__container {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    justify-content: initial;
  }

  /* Hamburger: first column (left) — appears last in DOM but placed first via grid */
  .navbar__hamburger {
    display: flex;
    grid-column: 1;
    grid-row: 1;
  }

  /* Logo: center column — centers within available space between hamburger and actions */
  .navbar__logo {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    animation: none;
    overflow: visible;
  }

  .navbar__logo img {
    height: 48px;
    width: auto;
  }

  /* Menu: taken out of grid flow (it's a fixed sidebar) */
  .navbar__menu {
    grid-column: 1 / -1;
  }

  /* Actions: third column (right) */
  .navbar__actions {
    grid-column: 3;
    grid-row: 1;
    gap: 2px;
  }

  /* Menu: off-canvas sidebar */
  .navbar__menu {
    position: fixed;
    top: calc(var(--navbar-height) + var(--banner-height));
    left: 0;
    bottom: 0;
    width: 280px;
    background: var(--color-white);
    flex-direction: column;
    justify-content: flex-start;
    padding: 24px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1001;
    overflow-y: auto;
  }

  .navbar__menu.open {
    transform: translateX(0);
  }

  .navbar__links {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    width: 100%;
  }

  .navbar__link {
    display: block;
    width: 100%;
    padding: 20px 0;
    font-size: 14px;
    border-bottom: 1px solid var(--color-gray-200);
    box-sizing: border-box;
  }

  .navbar__link::after {
    display: none;
  }

  .mega-dropdown {
    display: none;
  }

  .navbar__icon-btn {
    width: 36px;
    height: 36px;
  }
}

/* ========================================
   BOTTOM TAB BAR (mobile only)
   ======================================== */

.bottom-tab-bar {
  display: none; /* shown via media query on ≤600px */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-white);
  border-top: 1px solid var(--color-gray-200);
  z-index: 1002;
  justify-content: space-around;
  align-items: stretch;
  padding: 6px 4px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
}

.bottom-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  padding: 8px 0;
  color: var(--color-gray-600);
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.bottom-tab svg {
  width: 22px;
  height: 22px;
}

.bottom-tab span:not(.bottom-tab__badge) {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.bottom-tab.active {
  color: var(--color-black);
}

.bottom-tab__badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  min-width: 16px;
  height: 16px;
  background: var(--color-black);
  color: var(--color-white);
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.bottom-tab__avatar {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-tab__avatar img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.bottom-tab__avatar .auth-initial {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-black);
  color: var(--color-white);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Small: bottom tab bar replaces top navbar icons */
@media (max-width: 600px) {
  .navbar__icon-btn svg {
    width: 20px;
    height: 20px;
  }

  /* Hide all action icons from top navbar — they're in the bottom bar now */
  #searchToggle,
  #notifBtn,
  #profileWrap,
  #wishlistToggle,
  #cartToggle {
    display: none;
  }

  /* Keep mobile-icons in sidebar hidden (bottom bar replaces them) */
  .navbar__menu .navbar__mobile-icons {
    display: none;
  }

  /* Add body padding so content isn't hidden behind the bottom bar */
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  /* Show the bottom tab bar */
  .bottom-tab-bar {
    display: flex;
  }

  /* Cart sidebar needs bottom clearance */
  .cart-sidebar {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
}

/* Mobile icons container — hidden by default, shown in sidebar on small screens */
.navbar__mobile-icons {
  display: none;
}
