.navbar {
  width: 100%;
  max-width: 1250px;
  margin: 28px auto 30px;
  padding: 14px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: #ffffff;
  background: transparent;
  border: none;
  border-bottom: 1px solid #ffffff;
  border-radius: 0;
  box-sizing: border-box;
  position: relative;
}

.logo-link {
  display: inline-flex;
  align-items: center;
}

.logo {
  width: 58px;
  height: auto;
}

.nav-toggle {
  display: none;
  background: #0b0b0b;
  border: 1px solid #2b2b2b;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease, border 0.2s ease;
  position: relative;
  z-index: 10002;
}

.nav-toggle img {
  width: 22px;
  height: 22px;
  display: block;
}

.nav-toggle:active {
  transform: scale(0.98);
}

.nav-toggle.hidden {
  opacity: 0;
  pointer-events: none;
}

.menu {
  display: flex;
  list-style: none;
  gap: 28px;
  font-weight: 600;
  font-size: 0.98rem;
  margin: 0;
  padding: 0;
  flex: 1;
  justify-content: center;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.menu li {
  cursor: pointer;
  color: #fff;
  transition: color 0.2s ease;
}

.menu li a {
  text-decoration: none;
  color: #fff;
  transition: color 0.2s ease;
}

.menu li:hover a,
.menu li.active a {
  color: #ff2e2e;
}

.menu li#admin-tab {
  cursor: pointer;
  color: #fff;
  transition: color 0.2s ease;
}

.menu li#admin-tab:hover a {
  color: #ff2e2e;
}

.admin-tab {
  display: none;
}

.icons {
  display: flex;
  gap: 18px;
  align-items: center;
}

.cart-icon-wrapper {
  position: relative;
  display: inline-flex;
}

.cart-badge {
  position: absolute;
  top: -5px;
  right: -8px;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  background: #ff2e2e;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.cart-badge.show {
  opacity: 1;
  transform: scale(1);
}

.icon {
  width: 26px;
  height: 26px;
  cursor: pointer;
  object-fit: contain;
  filter: brightness(0) invert(1);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.icons .icon:hover {
  transform: translateY(-2px);
  filter: invert(14%) sepia(100%) saturate(7458%) hue-rotate(-5deg) brightness(98%) contrast(112%);
}

#cart-icon {
  transition: transform 0.2s ease;
}

.user-menu:hover #user-icon,
.user-menu.open #user-icon,
#user-icon.glow {
  filter: invert(20%) sepia(96%) saturate(6242%) hue-rotate(0deg) brightness(102%) contrast(96%);
}

/* Menú desplegable del usuario */
.user-menu {
  position: relative;
  cursor: pointer;
  outline: none;
}

.user-menu .icon {
  display: block;
}

/* Usar opacity/visibility y transform para transiciones suaves (JS controla .open) */
.dropdown-menu {
  position: absolute;
  top: 50px;
  right: 0;
  background: rgba(16, 16, 16, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 20px 22px;
  min-width: 240px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  box-shadow: 0 35px 60px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  z-index: 1000;
}

.dropdown-menu::before {
  content: "";
  position: absolute;
  top: -8px;
  right: 28px;
  width: 16px;
  height: 16px;
  background: rgba(16, 16, 16, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  transform: rotate(45deg);
  z-index: -1;
}

.dropdown-menu {
  display: none !important;
}

/* Mostrar con clase .open (añadida por JS) */
.user-menu.open .dropdown-menu,
.user-menu:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Área invisible entre icono y menú para evitar que desaparezca */
.user-menu::after {
  content: '';
  position: absolute;
  top: 30px;
  left: 0;
  width: 100%;
  height: 15px;
  background: transparent;
  pointer-events: none;
}

.user-menu:hover::after {
  pointer-events: auto;
}

.user-info {
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 14px;
}

.user-info h4 {
  color: #fff;
  font-size: 0.75rem;
  margin: 0 0 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  opacity: 0.8;
}

.user-info p {
  color: #fff;
  font-size: 0.85rem;
  margin: 0;
  word-break: break-all;
}

.user-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dropdown-menu .nav-action,
.dropdown-menu a.nav-action,
.dropdown-menu .btn,
.dropdown-menu button {
  display: block;
  width: 100%;
  text-align: center;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border 0.2s ease;
  border-radius: 14px;
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  box-sizing: border-box;
}

.dropdown-menu .nav-action:hover,
.dropdown-menu a.nav-action:hover,
.dropdown-menu .btn:hover,
.dropdown-menu button:hover {
  color: #050505;
  background: #ff2e2e;
  border-color: #ff2e2e;
}

.dropdown-menu .logout-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dropdown-menu button:disabled,
.dropdown-menu .btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.08);
}

@media (max-width: 980px) {
  .navbar {
    padding: 12px 18px;
    gap: 12px;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 10px;
    background: rgba(5, 5, 5, 0.98);
    border: 1px solid #1f1f1f;
    border-radius: 16px;
    padding: 14px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    display: none;
    z-index: 10001;
  }

  .menu li {
    width: 100%;
  }

  .menu li a {
    display: block;
    width: 100%;
    padding: 6px 4px;
  }

  .navbar.menu-open .menu {
    display: flex;
  }

  .icons {
    margin-left: auto;
  }
}

@media (max-width: 576px) {
  .navbar {
    padding: 12px 16px;
    border-bottom: 1px solid #ffffff;
  }
  .menu {
    gap: 18px;
    font-size: 1rem;
  }
  .logo { width: 48px; }
  .dropdown-menu { right: -6px; min-width: 200px; }
}

.cart-link {
  display: flex;
  align-items: center;
}

.cart-link .icon {
  cursor: pointer;
}

/* ======== CARRITO LATERAL ======== */

#cart-drawer {
  position: fixed;
  top: 0;
  right: -360px;
  width: 320px;
  max-width: 90vw;
  height: 100vh;
  background: #050505;
  color: #fff;
  box-shadow: -4px 0 14px rgba(0, 0, 0, 0.55);
  border-left: 1px solid #2b2b2b;
  transition: right 0.35s ease;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  padding: 0;
}

#cart-drawer.open {
  right: 0;
}

#user-drawer {
  position: fixed;
  top: 0;
  right: -360px;
  width: 320px;
  max-width: 90vw;
  height: 100vh;
  background: #050505;
  color: #fff;
  box-shadow: -4px 0 14px rgba(0, 0, 0, 0.55);
  border-left: 1px solid #2b2b2b;
  transition: right 0.35s ease;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  padding: 0;
}

#user-drawer.open {
  right: 0;
}

.cart-header {
  position: relative;
  background: #4b4b4b;
  padding: 18px 20px;
  text-align: center;
  border-bottom: 1px solid #3a3a3a;
}

.cart-header h2 {
  margin: 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.close-cart {
  cursor: pointer;
  font-size: 22px;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  opacity: 0.8;
}

.close-cart:hover {
  opacity: 1;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 24px 18px 120px;
  background: #000;
}

.cart-empty-msg {
  text-align: center;
  color: #d8d8d8;
  font-size: 0.95rem;
  margin-top: 40px;
}

.user-header {
  position: relative;
  background: #4b4b4b;
  padding: 18px 20px;
  text-align: center;
  border-bottom: 1px solid #3a3a3a;
}

.user-header h2 {
  margin: 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.close-user {
  cursor: pointer;
  font-size: 22px;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  opacity: 0.8;
}

.close-user:hover {
  opacity: 1;
}

.user-body {
  flex: 1;
  padding: 20px 18px 26px;
  background: #000;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.user-email {
  margin: 0;
  color: #cfcfcf;
  font-size: 0.95rem;
  word-break: break-all;
}

.user-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-drawer-btn {
  width: 100%;
  padding: 14px 12px;
  border-radius: 10px;
  border: 1px solid #2d2d2d;
  background: #0f0f0f;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.user-drawer-btn:hover {
  background: #ffffff;
  color: #050505;
  transform: translateY(-1px);
}

.user-drawer-btn.danger {
  border-color: #ff4c4c;
  color: #ff4c4c;
}

.user-drawer-btn.danger:hover {
  background: #ff4c4c;
  color: #050505;
}

.user-drawer-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 360px;
}

.user-drawer-form input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 8px;
  border: 1px solid #2d2d2d;
  background: #0f0f0f;
  color: #fff;
  box-sizing: border-box;
}

.password-field {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.password-field input {
  width: 100%;
}

.password-field input.active {
  background: #ffffff;
  color: #000000;
  -webkit-text-fill-color: #000000;
  border-color: #ffffff;
}

.toggle-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  padding: 4px;
  border: none;
  background: transparent;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

.toggle-eye img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.user-drawer-message {
  color: #ff4c4c;
  font-size: 0.85rem;
  min-height: 18px;
}

@media (max-width: 520px) {
  .user-drawer-form {
    max-width: 100%;
  }
}

.user-divider {
  text-align: center;
  color: #cfcfcf;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin: 6px 0;
}

.cart-item {
  display: flex;
  gap: 16px;
  margin-bottom: 28px;
}

.cart-item-image img {
  width: 110px;
  height: 130px;
  object-fit: cover;
  border-radius: 8px;
  background: #141414;
  border: 1px solid #1e1e1e;
}

.cart-item-info {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    color: #fff;
}

.cart-item-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 6px;
}

.cart-item-size {
    display: block;
    font-size: 0.8rem;
    color: #d0d0d0;
    letter-spacing: 0.08em;
    margin-top: 4px;
}

.cart-item-price {
    margin: 0 0 14px;
    color: #d4d4d4;
    font-size: 0.9rem;
  font-weight: 500;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #4c4c4c;
  border-radius: 999px;
  padding: 6px 10px;
}

.qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
}

.qty-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.qty-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.qty-value {
  font-weight: 600;
  min-width: 22px;
  text-align: center;
}

.qty-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.remove-item-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 6px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.remove-item-btn img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
  transition: transform 0.2s ease;
}

.remove-item-btn:hover {
  transform: translateY(-1px);
}

.cart-item .remove-item-btn img {
  width: 18px !important;
  height: 18px !important;
}

.cart-footer {
  padding: 18px 20px 24px;
  background: #4b4b4b;
  border-top: 1px solid #3a3a3a;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  margin-bottom: 14px;
}

.checkout-btn {
  width: 100%;
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  background: #050505;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(255, 255, 255, 0.12);
}

.checkout-btn:hover {
  background: #101010;
}

/* Overlay */
#cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(3px);
    display: none;
    z-index: 9998;
}

#cart-overlay.show {
    display: block;
}

/* (código duplicado pero lo dejo porque ya estaba) */
#cart-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  height: 100vh;
  background: #111;
  transition: right 0.35s ease;
}

#cart-panel.open {
  right: 0;
}

#cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
}

#cart-overlay.show {
  display: block;
}

html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Toast notifications */
#toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 12000;
  max-width: min(520px, 90vw);
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(0,0,0,0.9);
  border: 1px solid rgba(255,255,255,0.08);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow: 0 16px 40px rgba(0,0,0,0.45);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-info { border-color: rgba(255,255,255,0.14); }
.toast-success { border-color: #3cb371; background: rgba(46,139,87,0.18); }
.toast-error { border-color: #ff4c4c; background: rgba(255,76,76,0.16); }

@media (max-width: 540px) {
  #toast-container {
    top: auto;
    bottom: 12px;
  }
}
