/* =========================
   HEADER
========================= */

.top-header {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.045) 1.1px, transparent 1.8px),
    linear-gradient(180deg, rgba(10, 14, 26, 0.86), rgba(6, 10, 18, 0.82));
  background-size:
    22px 22px,
    cover;
  color: #fff;
  position: relative;
  z-index: 40;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: visible;
}

.top-header::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 0%, rgba(225, 27, 34, 0.1), transparent 24%),
    radial-gradient(circle at 85% 0%, rgba(255, 255, 255, 0.045), transparent 18%),
    linear-gradient(
      135deg,
      transparent 0 16%,
      rgba(255, 255, 255, 0.02) 16% 17%,
      transparent 17% 100%
    );
}

/* línea inferior elegante */
.top-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.04) 12%,
    rgba(225, 27, 34, 0.22) 50%,
    rgba(255, 255, 255, 0.04) 88%,
    transparent 100%
  );
}

/* efecto cuando se hace scroll */
.top-header.scrolled {
  position: sticky;
  top: 0;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.04) 1px, transparent 1.7px),
    linear-gradient(180deg, rgba(8, 12, 22, 0.93), rgba(6, 9, 16, 0.91));
  background-size:
    20px 20px,
    cover;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

/* =========================
   CAPAS / Z-INDEX
========================= */

.main-nav {
  z-index: 60;
}

.brand,
.header-actions,
.menu-toggle {
  position: relative;
  z-index: 61;
}

/* =========================
   CONTENEDOR
========================= */

.header-container {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  position: relative;
  z-index: 2;
}

/* =========================
   BRAND
========================= */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
  min-width: 0;
  flex-shrink: 0;
}

.brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 10px 18px rgba(0, 0, 0, 0.16);
  flex-shrink: 0;
}

.brand-icon img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-title {
  font-size: 18px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  font-size: 12px;
  font-weight: 700;
  color: #c6cad6;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 4px;
}

/* =========================
   NAVEGACIÓN
========================= */

.main-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.main-nav ul {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-nav a {
  position: relative;
  font-size: 15px;
  font-weight: 700;
  color: #d7dae4;
  text-decoration: none;
  padding: 6px 4px;
  border-radius: 8px;
  transition:
    color 0.2s ease,
    text-shadow 0.2s ease,
    background-color 0.2s ease;
}

.main-nav a:hover {
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.08);
}

.main-nav a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 0;
  height: 2px;
  background: var(--red, #e11b22);
  transform: translateX(-50%);
  transition:
    width 0.25s ease,
    background 0.25s ease;
}

.main-nav a:hover::after {
  width: 46px;
}

.main-nav a.active {
  color: #ff4d55;
  text-shadow: 0 0 10px rgba(225, 27, 34, 0.18);
}

.main-nav a.active::after {
  width: 46px;
  background: linear-gradient(90deg, #ff2a35, #ff5b63);
}

/* =========================
   HEADER ACTIONS
========================= */

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* =========================
   CARRITO HEADER
========================= */

.header-cart-btn {
  position: relative;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 8px 16px rgba(0, 0, 0, 0.1);
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease,
    color 0.2s ease,
    filter 0.2s ease;
}

.header-cart-btn:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #e11b22, #b81218);
  color: #fff;
  box-shadow:
    0 10px 18px rgba(225, 27, 34, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  filter: brightness(1.04);
}

.header-cart-btn i {
  font-size: 16px;
}

.header-cart-text {
  line-height: 1;
}

.header-cart-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ffffff;
  color: #b81218;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.16);
}

/* =========================
   MENÚ MÓVIL
========================= */

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  color: #fff;
  font-size: 18px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 8px 16px rgba(0, 0, 0, 0.1);
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease,
    color 0.2s ease;
}

.menu-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

/* =========================
   RESPONSIVE TABLET / MÓVIL
========================= */

@media (max-width: 992px) {
  .menu-toggle {
    display: flex;
  }

  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background:
      radial-gradient(circle, rgba(255, 255, 255, 0.035) 1px, transparent 1.7px),
      linear-gradient(180deg, rgba(12, 15, 24, 0.98), rgba(7, 10, 18, 0.98));
    background-size:
      20px 20px,
      cover;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition:
      opacity 0.2s ease,
      transform 0.2s ease,
      visibility 0.2s ease;
  }

  .main-nav.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .main-nav ul {
    flex-direction: column;
    gap: 16px;
    width: 100%;
    align-items: center;
  }

  .main-nav a {
    font-size: 16px;
  }

  .main-nav a:hover::after,
  .main-nav a.active::after {
    width: 42px;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
  }

  .header-cart-btn {
    min-width: 42px;
    width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: 10px;
    gap: 0;
  }

  .header-cart-text {
    display: none;
  }

  .header-cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
  }
}

/* =========================
   MÓVIL PEQUEÑO
========================= */

@media (max-width: 576px) {
  .header-container {
    min-height: 78px;
    gap: 8px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .brand {
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
  }

  .brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .brand-icon img {
    width: 22px;
    height: 22px;
  }

  .brand-title {
    font-size: 16px;
  }

  .brand-subtitle {
    font-size: 11px;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
  }

  .header-cart-btn {
    min-width: 40px;
    width: 40px;
    height: 40px;
    min-height: 40px;
    border-radius: 10px;
    padding: 0;
  }

  .header-cart-btn i {
    font-size: 15px;
  }

  .header-cart-count {
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
  }

  .menu-toggle {
    width: 40px;
    height: 40px;
    font-size: 17px;
    margin-left: 0;
  }

  .main-nav {
    position: absolute;
    top: 100%;
    left: 50%;
    right: auto;
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    transform: translateX(-50%) translateY(-8px);
    padding: 20px 12px;
    border-radius: 0;
    box-sizing: border-box;
  }

  .main-nav.open {
    transform: translateX(-50%) translateY(0);
  }

  .main-nav a:hover::after,
  .main-nav a.active::after {
    width: 36px;
  }
}
