:root {
  --negro: #000;
  --dorado: #FFD700;
  --plateado: #C0C0C0;
  --fondo-negro-1: #000000;
  --fondo-negro-2: #050505;
  --fondo-negro-3: #121212;
  --header-height: 6rem;
  --content-gap: 0.2rem;
}

html,
body {
  margin: 0 !important;
  padding: 0;
  border: 0 !important;
}

body {
  padding-top: calc(var(--header-height) + var(--content-gap));
}

body:not(.sin-fondo-dinamico) {
  background:
    radial-gradient(1350px 700px at 0% 0%, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0.98) 24%, rgba(4, 4, 4, 0.95) 44%, rgba(10, 10, 10, 0.85) 66%, rgba(18, 18, 18, 0.25) 100%),
    radial-gradient(980px 520px at 92% -8%, rgba(255, 215, 0, 0.08), transparent 62%),
    linear-gradient(160deg, var(--fondo-negro-1) 0%, var(--fondo-negro-2) 46%, var(--fondo-negro-3) 100%);
  background-attachment: fixed;
  position: relative;
  min-height: 100vh;
  isolation: isolate;
}

body:not(.sin-fondo-dinamico)::before,
body:not(.sin-fondo-dinamico)::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

body:not(.sin-fondo-dinamico)::before {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 110px 110px;
  opacity: 0.3;
  animation: fondo-grid-flux 26s ease-in-out infinite alternate;
}

body:not(.sin-fondo-dinamico)::after {
  background:
    radial-gradient(460px 250px at 18% 24%, rgba(255, 255, 255, 0.055), transparent 72%),
    radial-gradient(420px 220px at 84% 76%, rgba(255, 215, 0, 0.095), transparent 72%);
  filter: blur(22px);
  opacity: 0.68;
  animation: fondo-aurora-shift 20s ease-in-out infinite alternate;
}

@keyframes fondo-grid-flux {
  0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.26; }
  50% { transform: translate3d(-18px, 12px, 0) scale(1.02); opacity: 0.36; }
  100% { transform: translate3d(14px, -10px, 0) scale(1.01); opacity: 0.3; }
}

@keyframes fondo-aurora-shift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(8px, -12px, 0) scale(1.04); }
}

header {
  background-color: var(--negro);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0 0.85rem;
  margin: 0 !important;
  margin-top: 0 !important;
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 10;
  box-sizing: border-box;
  height: var(--header-height);
  min-height: var(--header-height);
}

header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    rgba(255, 215, 0, 0) 0%,
    rgba(255, 215, 0, 0.16) 36%,
    rgba(255, 215, 0, 0.92) 50%,
    rgba(255, 215, 0, 0.16) 64%,
    rgba(255, 215, 0, 0) 100%
  );
  background-size: 220% 100%;
  animation: brillo 2.8s linear infinite;
}

@keyframes brillo {
  0% { background-position: -220% 0; }
  100% { background-position: 220% 0; }
}

header img {
  width: 14rem;
  height: 5.2rem;
  max-height: 5.2rem;
  max-width: min(42vw, 14rem);
  object-fit: cover;
  object-position: center;
  display: block;
}

nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.2rem 0.56rem;
  margin-left: auto;
  margin-right: 1.9rem;
}

.header-search {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0.2rem;
}

.header-search input {
  width: 200px;
  max-width: 38vw;
  border: 1px solid rgba(255, 215, 0, 0.5);
  background: rgba(18, 18, 18, 0.95);
  color: #f5f5f5;
  border-radius: 999px;
  padding: 0.36rem 0.7rem;
  font-size: 0.88rem;
}

.header-search input::placeholder {
  color: #a3a3a3;
}

.header-search button {
  border: 1px solid rgba(255, 215, 0, 0.55);
  background: #111;
  color: #ffd700;
  border-radius: 999px;
  padding: 0.34rem 0.6rem;
  cursor: pointer;
}

.header-search button:hover {
  background: #1b1b1b;
}

nav a {
  color: var(--plateado);
  margin: 0;
  padding: 0.2rem 0.32rem;
  text-decoration: none;
  font-weight: bold;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  transition: color 0.4s ease, transform 0.3s ease;
}

nav a.usuario {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
}

nav a.usuario-badge,
nav a.usuario.usuario-badge {
  border-radius: 999px;
  padding: 0.32rem 0.8rem;
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
  line-height: 1;
  gap: 0;
  min-width: 104px;
  max-width: 280px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow:
    0 5px 14px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  text-decoration: none;
  overflow: hidden;
  backdrop-filter: blur(2px);
  isolation: isolate;
}

nav a.usuario-badge::after {
  display: none;
}

nav a.usuario-badge::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.08) 55%);
  pointer-events: none;
  z-index: 0;
}

nav a.usuario-badge .usuario-nombre {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  position: relative;
  z-index: 1;
}

nav a.usuario-badge.membresia-basico {
  background: transparent !important;
  color: #e5e7eb !important;
  border-color: rgba(192, 192, 192, 0.45);
  box-shadow: none;
  backdrop-filter: none;
}

nav a.usuario-badge.membresia-basico::before {
  display: none;
}

nav a.usuario-badge.membresia-plata {
  background: linear-gradient(135deg, #ffffff 0%, #e6f8ff 36%, #c8ebff 100%) !important;
  color: #0f172a !important;
  border-color: rgba(240, 250, 255, 0.95);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.35),
    0 0 18px rgba(143, 222, 255, 0.82),
    0 6px 16px rgba(0, 0, 0, 0.35);
}

nav a.usuario-badge.membresia-oro {
  background: linear-gradient(135deg, #fff0a3 0%, #ffd83a 44%, #ffb703 100%) !important;
  color: #1f2937 !important;
  border-color: rgba(255, 236, 155, 0.95);
  box-shadow:
    0 0 0 1px rgba(255, 243, 179, 0.45),
    0 0 18px rgba(255, 198, 24, 0.84),
    0 6px 16px rgba(0, 0, 0, 0.35);
}

nav a.usuario-badge.membresia-diamante {
  background: linear-gradient(135deg, #d8fcff 0%, #67e8f9 40%, #22d3ee 78%, #a5f3fc 100%) !important;
  color: #083344 !important;
  border-color: rgba(170, 247, 255, 0.95);
  box-shadow:
    0 0 0 1px rgba(198, 250, 255, 0.45),
    0 0 20px rgba(43, 231, 255, 0.82),
    0 6px 16px rgba(0, 0, 0, 0.35);
}

nav a::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  left: 0;
  bottom: -5px;
  background-color: var(--dorado);
  transition: width 0.3s ease;
}

nav a:hover::after {
  width: 100%;
}

nav a:hover {
  color: var(--dorado);
  transform: scale(1.1);
}

nav a.usuario-badge:hover {
  color: inherit;
  transform: scale(1.03);
}

nav .fa-shopping-cart {
  color: var(--plateado);
  margin-right: 6px;
  transition: color 0.3s ease;
}

nav a:hover .fa-shopping-cart {
  color: var(--dorado);
}

#cartCount {
  position: absolute;
  top: -7px;
  right: -10px;
  background: #FFD700;
  color: #000;
  font-size: 10px;
  font-weight: bold;
  padding: 3px 5px;
  border-radius: 999px;
  min-width: 12px;
  text-align: center;
  display: none;
  pointer-events: none;
  z-index: 9999;
}

footer {
  position: relative;
  background: linear-gradient(180deg, rgba(9, 9, 9, 0.9) 0%, rgba(16, 16, 16, 0.95) 100%);
  color: var(--plateado);
  text-align: center;
  border-top: 1px solid rgba(255, 215, 0, 0.24);
  box-shadow:
    0 -10px 24px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(6px);
  padding: 1.15rem clamp(0.85rem, 2.6vw, 1.6rem);
  overflow: hidden;
}

footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    rgba(255, 215, 0, 0) 0%,
    rgba(255, 215, 0, 0.16) 36%,
    rgba(255, 215, 0, 0.92) 50%,
    rgba(255, 215, 0, 0.16) 64%,
    rgba(255, 215, 0, 0) 100%
  );
  background-size: 220% 100%;
  animation: brillo 2.8s linear infinite;
}

footer p {
  margin: 0.32rem 0;
}

footer a {
  color: #ffe08a;
  text-decoration: none;
  margin: 0 0.5rem;
  transition: color 0.25s ease, text-shadow 0.25s ease;
}

footer a:hover {
  color: #ffffff;
  text-shadow: 0 0 9px rgba(255, 215, 0, 0.72);
}

@media (prefers-reduced-motion: reduce) {
  body:not(.sin-fondo-dinamico)::before,
  body:not(.sin-fondo-dinamico)::after {
    animation: none !important;
  }

  nav a,
  nav .fa-shopping-cart,
  footer a {
    transition: none !important;
  }
}

@media (max-width: 760px) {
  body:not(.sin-fondo-dinamico) {
    background-attachment: scroll;
  }
}

@media (max-width: 968px) {
  body {
    padding-top: calc(var(--header-height) + var(--content-gap));
  }

  header {
    padding: 0 0.72rem;
    box-sizing: border-box;
    height: var(--header-height);
    min-height: var(--header-height);
    gap: 0.4rem;
  }

  header img {
    width: 12.8rem;
    height: 5rem;
    max-height: 5rem;
    max-width: min(44vw, 12.8rem);
  }

  nav {
    justify-content: flex-end;
    width: auto;
    margin-left: auto;
    margin-right: 1.4rem;
  }

  nav a {
    font-size: 0.93rem;
    padding: 0.28rem 0.45rem;
  }
}

@media (max-width: 760px) {
  body {
    padding-top: 0;
  }

  header {
    margin-bottom: var(--content-gap) !important;
    position: relative;
    flex-direction: column;
    text-align: center;
    min-height: var(--header-height);
    padding: 0.36rem 0.62rem 0.42rem;
  }

  header img {
    width: min(72vw, 13rem);
    height: 4rem;
    max-height: 4rem;
    max-width: 100%;
  }

  nav {
    justify-content: center;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .header-search {
    order: 99;
    width: 100%;
    margin-top: 0.2rem;
  }

  .header-search input {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 560px) {
  header {
    padding: 0.32rem 0.55rem 0.4rem;
  }

  nav {
    gap: 0.28rem 0.55rem;
  }

  nav a {
    font-size: 0.88rem;
  }
}

@media (max-width: 420px) {
  header img {
    width: min(78vw, 11.2rem);
    height: 3.4rem;
    max-height: 3.4rem;
  }

  nav {
    gap: 0.2rem 0.45rem;
  }

  nav a {
    font-size: 0.81rem;
    padding: 0.22rem 0.28rem;
  }

  nav a:hover {
    transform: none;
  }

  nav a.usuario {
    max-width: 128px;
  }

  nav a.usuario-badge {
    min-width: 108px;
    max-width: 184px;
    padding: 0.25rem 0.56rem;
  }

  nav a.usuario-badge .usuario-nombre {
    font-size: 0.74rem;
  }
}
