/* ============================================================================
   SIDEBAR V2 — Rediseño del menú lateral (BETA, ElDoria only)
   2026-05-14
   Reemplaza visualmente el sidebar de la izquierda. No toca el menú móvil
   bottom-tab ni otras secciones. Selectores con prefijo `.nv2-` para
   evitar conflictos con el sidebar viejo.
   ============================================================================ */

.nav-sidebar.nav-sidebar-v2 {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #14102b 0%, #0a0518 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
  /* 2026-05-15: anular el padding 12px del .nav-sidebar base (game.css) — el
     .nv2-header v2 trae su propio padding y se acumulaban como "doble margen". */
  padding: 0 !important;
  gap: 0 !important;
}

/* ───── HEADER (avatar + nombre + stats) ───── */
/* 2026-05-15: padding-top incluye safe-area-inset-top para que en iOS PWA
   (standalone) el avatar + nombre no queden tapados por la barra de estado
   (reloj/wifi/batería). En la web normal --m-safe-top es 0 y no cambia nada. */
.nv2-header {
  position: relative;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 14px 12px;
  background:
    radial-gradient(ellipse 80% 100% at 50% 0%, rgba(184, 132, 255, 0.18), transparent 65%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex: 0 0 auto;
}
.nv2-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.nv2-avatar {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 200, 87, 0.4);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.5),
    0 0 16px rgba(184, 132, 255, 0.25);
  flex: 0 0 auto;
}
.nv2-avatar .race-portrait,
.nv2-avatar .race-portrait-img {
  width: 100%; height: 100%;
  background-size: cover;
  background-position: center top;
}
.nv2-vip-crown {
  position: absolute;
  top: -4px; right: -4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #ffd24a, #b97f2e);
  color: #2a1a00;
  font-size: 11px;
  border: 2px solid #14102b;
}
.nv2-header-info { flex: 1; min-width: 0; }
.nv2-name {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  line-height: 1.15;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nv2-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
  flex-wrap: nowrap;
}
.nv2-lv-chip {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, rgba(255, 200, 87, 0.22), rgba(255, 200, 87, 0.08));
  border: 1px solid rgba(255, 200, 87, 0.45);
  color: #ffc857;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1;
  letter-spacing: 0.04em;
  flex: 0 0 auto;
}
.nv2-race {
  color: rgba(255, 255, 255, 0.55);
  text-transform: capitalize;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.nv2-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 16px;
  transition: all 0.15s ease;
  flex: 0 0 auto;
}
.nv2-close:hover {
  background: rgba(232, 90, 106, 0.15);
  border-color: rgba(232, 90, 106, 0.4);
  color: #ff8898;
}

/* 2026-05-15: en PC ocultamos las barras de HP/MP/Stamina del sidebar — ya hay
   un side panel a la derecha con esos datos. En mobile sí se muestran. */
body.desktop-mode .nv2-bars { display: none; }

/* Stats bars (HP/MP/Stamina) */
.nv2-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.nv2-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nv2-bar i {
  font-size: 11px;
  width: 14px;
  text-align: center;
  flex: 0 0 auto;
}
.nv2-bar-hp i   { color: #e85a6a; }
.nv2-bar-mp i   { color: #5aa6ff; }
.nv2-bar-stam i { color: #ffd24a; }
.nv2-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.nv2-bar-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 0.4s ease;
}
.nv2-bar-hp   .nv2-bar-fill { background: linear-gradient(90deg, #c83e4f, #e85a6a); }
.nv2-bar-mp   .nv2-bar-fill { background: linear-gradient(90deg, #3a82d0, #5aa6ff); }
.nv2-bar-stam .nv2-bar-fill { background: linear-gradient(90deg, #c08020, #ffd24a); }

/* ───── QUICK ACCESS GRID ───── */
.nv2-quick {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex: 0 0 auto;
}
.nv2-quick-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.nv2-quick-btn {
  aspect-ratio: 1;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  transition: all 0.15s ease;
}
.nv2-quick-btn:hover {
  background: rgba(255, 200, 87, 0.12);
  border-color: rgba(255, 200, 87, 0.4);
  color: #ffc857;
  transform: translateY(-1px);
}
.nv2-quick-btn:active { transform: scale(0.95); }

/* ───── BODY (grupos colapsables, scroll) ───── */
.nv2-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.nv2-body::-webkit-scrollbar { width: 6px; }
.nv2-body::-webkit-scrollbar-track { background: transparent; }
.nv2-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 999px; }
.nv2-body::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); }

/* Grupo colapsable */
.nv2-group {
  margin: 0 8px 4px;
}
.nv2-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  font-family: var(--font-title);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}
.nv2-group-head:hover {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.85);
}
.nv2-group-ico {
  width: 24px; height: 24px;
  border-radius: 6px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--nv2-color) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--nv2-color) 35%, transparent);
  color: var(--nv2-color);
  font-size: 12px;
  flex: 0 0 auto;
}
.nv2-group-label { flex: 1; min-width: 0; }
.nv2-group-caret {
  font-size: 12px;
  opacity: 0.55;
  transition: transform 0.25s ease;
}
.nv2-group.is-collapsed .nv2-group-caret { transform: rotate(-90deg); }

/* Items del grupo (animación de collapse) */
.nv2-group-items {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 0 4px 4px;
  overflow: hidden;
  max-height: 2000px;
  transition: max-height 0.3s ease, padding 0.25s ease, opacity 0.2s ease;
}
.nv2-group.is-collapsed .nv2-group-items {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
}

/* Items individuales */
.nv2-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
}
.nv2-item::before {
  /* Indicador slide-in a la izquierda en hover/active */
  content: '';
  position: absolute;
  left: 0;
  top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--nv2-color, #ffc857);
  opacity: 0;
  transform: translateX(-4px);
  transition: all 0.18s ease;
}
.nv2-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  padding-left: 18px;
}
.nv2-item:hover::before {
  opacity: 0.7;
  transform: translateX(0);
}
.nv2-item.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.nv2-item.is-active::before {
  opacity: 1;
  transform: translateX(0);
  box-shadow: 0 0 12px var(--nv2-color, #ffc857);
}
.nv2-item-ico {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.7);
  width: 18px;
  text-align: center;
  flex: 0 0 auto;
  transition: color 0.15s ease;
}
.nv2-item:hover .nv2-item-ico,
.nv2-item.is-active .nv2-item-ico { color: var(--nv2-color, #ffc857); }
.nv2-item-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nv2-item-link {
  color: rgba(255, 255, 255, 0.7);
}
.nv2-item-link:hover { color: #fff; }

/* Badges */
.nv2-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-family: var(--font-title);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  flex: 0 0 auto;
}
.nv2-badge-gold {
  background: linear-gradient(180deg, #f0c674, #b97f2e);
  color: #2a1a00;
  box-shadow: 0 1px 4px rgba(255, 200, 87, 0.35);
}
.nv2-badge-violet {
  background: linear-gradient(180deg, #c9a6ff, #8a5bd9);
  color: #1a0a30;
}
.nv2-badge-blood {
  background: linear-gradient(180deg, #ff7e93, #c83e4f);
  color: #2a0010;
  box-shadow: 0 1px 4px rgba(232, 90, 106, 0.4);
  animation: nv2-pulse 1.6s ease-in-out infinite;
}
.nv2-badge-event {
  background: rgba(78, 195, 247, 0.18);
  border: 1px solid rgba(78, 195, 247, 0.55);
  color: #4ec3f7;
}
/* 2026-06-04: countdown badge — clock icon + tiempo restante */
.nv2-badge-countdown {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  background: rgba(255, 122, 61, 0.16);
  border: 1px solid rgba(255, 122, 61, 0.55);
  color: #ffb37a;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-transform: none;
  white-space: nowrap;
}
.nv2-badge-countdown i { font-size: 11px; }
.nv2-badge-countdown.is-ended {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.5);
}
/* 2026-05-17: pill "ACTIVO" inyectado dinámicamente cuando un evento está en curso.
   Más vivo que el badge regular — pulse animation y color verde. */
.nv2-active-pill {
  background: linear-gradient(135deg, rgba(74,222,128,0.20), rgba(34,197,94,0.28)) !important;
  border-color: rgba(74,222,128,0.65) !important;
  color: #6ee7a3 !important;
  font-weight: 800;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  animation: nv2-active-pulse 1.8s ease-in-out infinite;
}
.nv2-active-pill i { font-size: 10px; }
@keyframes nv2-active-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0.45); }
  50%      { box-shadow: 0 0 0 4px rgba(74,222,128,0); }
}
.nv2-badge-cyan {
  background: rgba(78, 195, 247, 0.22);
  border: 1px solid rgba(78, 195, 247, 0.55);
  color: #7dd3fc;
}
@keyframes nv2-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

/* ───── FOOTER ───── */
.nv2-footer {
  flex: 0 0 auto;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.3));
}
.nv2-footer-stats {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.nv2-stat-chip {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.85);
}
.nv2-stat-chip i { font-size: 12px; }
.nv2-stat-gold { color: #ffc857; }
.nv2-stat-gold i { color: #ffc857; }
.nv2-stat-gems { color: #b884ff; }
.nv2-stat-gems i { color: #b884ff; }

.nv2-logout {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid rgba(232, 90, 106, 0.35);
  border-radius: 8px;
  color: #ff8898;
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s ease;
}
.nv2-logout:hover {
  background: rgba(232, 90, 106, 0.12);
  border-color: rgba(232, 90, 106, 0.6);
  color: #ffaeb6;
}
.nv2-logout i { font-size: 14px; }

/* ───── Responsive: drawer mobile ───── */
@media (max-width: 768px) {
  .nav-sidebar.nav-sidebar-v2 {
    /* Hereda la posición de .nav-sidebar (drawer slide-in) — solo customizamos contenido */
  }
  .nv2-quick-grid { grid-template-columns: repeat(6, 1fr); }
  .nv2-avatar { width: 50px; height: 50px; }
  .nv2-name { font-size: 14px; }
}
