/* ============================================================
   SIDEBAR DE FILTROS - ESTILO LIMPIO Y FINAL
   ============================================================ */

/* --- Contenedor general --- */
#sidebar-filtros {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh; /* Fallback */
  height: 100dvh;
  background: #0b1d33;
  color: #fff;
  overflow-y: auto;
  padding: 10px 12px 0;
  box-shadow: 2px 0 10px rgba(0, 0, 0, .3);
  z-index: 998;
  transform: translateX(-100%);
  transition: transform .3s ease;
  display: flex;
  flex-direction: column;
}

#sidebar-filtros.visible {
  transform: translateX(0);
}

/* Escritorio → Sidebar fijo */
@media (min-width: 901px) {
  #sidebar-filtros {
    transform: none !important;
  }
}

/* --- Encabezado con botón cerrar --- */
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.cerrar-sidebar {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.2em;
  cursor: pointer;
}

@media(min-width:901px) {
  .cerrar-sidebar {
    display: none;
  }
}

/* ============================================
   UTILIDADES (Mostrar agotadas / actualizadas)
   ============================================ */
.utilidades button {
  width: calc(100% - 20px);
  margin: 8px 10px;
  background: #1f2937;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background .2s ease;
}

.utilidades button:hover {
  background: #0c569d;
}

#btn-actualizadas:hover,
#btn-sobres:hover,
#btn-compramos:hover,
#btn-habilidades:hover {
  background: #0b4f8c;
  transform: scale(1.03);
}

#btn-actualizadas.activo,
#btn-sobres.activo,
#btn-compramos.activo,
#btn-habilidades.activo {
  background: #ffd633;
  color: #002b64;
  font-weight: 900;
  transform: scale(1.03);
}

/* Ajuste específico para evitar que Habilidades se rompa en dos líneas o se salga */
#btn-habilidades {
  font-size: 0.82rem !important;
  white-space: nowrap;
  letter-spacing: -0.3px;
  width: calc(100% - 10px) !important;
  /* Más ancho reduciendo márgenes laterales */
  margin-left: 5px !important;
  margin-right: 5px !important;
  padding-left: 2px !important;
  padding-right: 2px !important;
}

/* ============================================================
   ACORDEONES PRINCIPALES (Expansiones / Tipo / Rareza)
   ============================================================ */
.acordeon-titulo {
  cursor: pointer;
  padding: 8px 10px;
  background: #143a67;
  color: #fff;
  border-radius: 6px;
  font-weight: bold;
  margin-top: 6px;
  font-size: 0.9rem;
}

.acordeon-contenido {
  max-height: 0;
  overflow: hidden;
  transition: max-height .4s ease;
  margin-bottom: 6px;
}

.acordeon.activo .acordeon-contenido {
  max-height: 4000px; /* Incrementado para evitar que filtros grandes como Misceláneas se empalmen */
}

/* ============================================================
   ERAS Y EXPANSIONES
   ============================================================ */
.era-titulo {
  cursor: pointer;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffcb05;
  font-size: 0.9em;
  border-radius: 4px;
  margin-top: 10px;
}

/* Modal Espía Premium - Glassmorphism & Bottom Sheet */
.modal-espia {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 5, 20, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-espia.visible {
  opacity: 1;
  visibility: visible;
}

.modal-espia-contenido {
  background: rgba(255, 255, 255, 0.95);
  color: #1f2937;
  padding: 0;
  border-radius: 20px;
  width: 95%;
  max-width: 420px;
  text-align: center;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.modal-espia.visible .modal-espia-contenido {
  transform: scale(1);
}

@media (max-width: 768px) {
  .modal-espia {
    align-items: flex-end;
  }

  .modal-espia-contenido {
    width: 100%;
    max-width: none;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
    padding-top: 0;
    padding-bottom: env(safe-area-inset-bottom, 20px);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
  }

  .modal-espia.visible .modal-espia-contenido {
    transform: translateY(0);
  }

  .indicador-pull {
    width: 36px;
    height: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
  }

  .cerrar-espia {
    display: none;
  }
}

.modal-espia-header {
  font-size: 1.3rem;
  font-weight: 800;
  padding: 20px 15px;
  margin-bottom: 0;
  color: #0c569d;
  background: #f8fafc;
  letter-spacing: -0.02em;
  transition: background-color 0.4s ease, color 0.4s ease;
}

.modal-espia-body {
  padding: 24px;
  font-size: 1.1rem;
  line-height: 1.5;
  color: #374151;
}

.modal-espia-body strong {
  color: #111827;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 6px;
}

.cerrar-espia {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 1.8rem;
  cursor: pointer;
  color: #9ca3af;
  line-height: 1;
  transition: color 0.2s;
}

.cerrar-espia:hover {
  color: #111827;
}

/* === Entrenadores Conectados - 2 Column Grid === */
#lista-entrenadores {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 4px 0;
}

.entrenador-card {
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0 !important;
  border-radius: 6px !important;
  text-align: center;
  /* Center text by default */
  margin: 0 !important;
  font-size: 0.75rem;
  line-height: 1.1;
  height: 54px;
  /* Reduced from 64px to make it more rectangular */
  overflow: hidden;
  /* Important for floor backgrounds */
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1), 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s ease;
  position: relative;
}

.entrenador-card.espiable {
  cursor: pointer;
}

.entrenador-card:active {
  transform: scale(0.97);
}

.entrenador-card .floor-1 {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  flex-grow: 1;
  min-height: 28px;
}

.entrenador-card .nick {
  font-weight: 900;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 0.82rem;
  /* Increased from 0.74rem to fill space */
  line-height: 1;
  letter-spacing: -0.02em;
  text-align: center;
  width: 100%;
}

.entrenador-card .floor-2 {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 1px 4px;
  height: 22px;
  /* Fixed height for floor 2 */
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  /* Elegant division */
}

.entrenador-card .floor-2 svg {
  flex-shrink: 0;
}

/* Brillo dorado para nivel Dragón */
@keyframes pdeGlow {
  0% {
    box-shadow: 0 0 2px #DAA520;
  }

  50% {
    box-shadow: 0 0 7px #DAA520, 0 0 10px rgba(218, 165, 32, 0.4);
  }

  100% {
    box-shadow: 0 0 2px #DAA520;
  }
}

.entrenador-card.glow-pde {
  animation: pdeGlow 3s infinite ease-in-out;
  position: relative;
  z-index: 1;
}


.era-contenido {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
  padding-left: 8px;
}

.era.activa .era-contenido {
  max-height: none;
  overflow: visible;
}

/* Botones de expansiones dentro de eras */
.era-contenido button {
  display: block;
  text-align: left;
  padding: 6px 10px;
  background: #1f2937;
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  transition: background .2s ease;
}

.era-contenido button.activo {
  background: #0c569d;
  color: #fff;
}

@media (hover: hover) {
  .era-contenido button:hover {
    background: #0c569d;
  }
}


/* ============================================================
   Botones de Tipo / Rareza / Accesorios / Decks
   ============================================================ */
.acordeon-contenido>button,
.contenido-filtro button {
  display: block;
  text-align: left;
  padding: 6px 10px;
  background: #1f2937;
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  transition: background .2s ease;
}

.acordeon-contenido>button.activo,
.contenido-filtro button.activo {
  background: #0c569d;
  color: #fff;
}


/* ============================================================
   BOTONES FINALES: ESPACIADO LATERAL PERFECTO
   ============================================================ */
#sidebar-filtros .acordeon-contenido button,
#sidebar-filtros .era-contenido button,
#sidebar-filtros .contenido-filtro button {
  width: calc(100% - 20px) !important;
  margin-top: 6px !important;
  margin-bottom: 6px !important;
  margin-left: 10px !important;
  margin-right: 10px !important;
  box-sizing: border-box !important;
}

/* ============================================================
   BOTÓN FLOTANTE (solo móvil)
   ============================================================ */
@media(max-width:900px) {
  #btn-open-filtros {
    position: fixed !important;
    bottom: 16px !important;
    left: 16px !important;
    z-index: 950 !important;

    display: flex !important;
    justify-content: center;
    align-items: center;

    width: 58px !important;
    height: 58px !important;
    border-radius: 50% !important;
    border: none !important;


    color: #002b64 !important;
    font-size: 1.6rem !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
    cursor: pointer;
    transition: transform .2s ease;
  }
}


/* Quitar líneas extra */
#sidebar-filtros hr {
  display: none !important;
}

/* SWITCH moderno */
.switch-agotadas {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 12px;
  cursor: pointer;
  user-select: none;
}

.switch-agotadas input {
  display: none;
}

.switch-agotadas .slider {
  width: 42px;
  height: 22px;
  background: #555;
  border-radius: 22px;
  position: relative;
  transition: background 0.25s ease;
}

.switch-agotadas .slider::before {
  content: "";
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 3px;
  transition: transform 0.25s ease;
}

/* activado */
.switch-agotadas input:checked+.slider {
  background: #facc1f;
}

.switch-agotadas input:checked+.slider::before {
  transform: translateX(20px);
}

.switch-agotadas strong {
  font-size: 0.9rem;
  color: #fff;
}

/* === Escritorio: sidebar fijo y contenido desplazado === */
@media (min-width: 901px) {
  #sidebar-filtros {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: #0b1d33;
    color: #fff;
    overflow-y: auto;
    z-index: 998;
    transform: none !important;
  }

  #contenido-principal {
    margin-left: 260px;
    /* 👈 aquí es donde se recorre todo el contenido */
    padding-left: 20px;
    box-sizing: border-box;
  }

  /* Ocultar botón flotante de filtros en escritorio */
  #btn-open-filtros {
    display: none !important;
  }
}

@media (hover: hover) {

  .acordeon-contenido>button:hover,
  .contenido-filtro button:hover {
    background: #0c569d;
  }
}

/* Fix: en móvil y escritorio, que solo .activo pinte el botón */
#sidebar-filtros button {
  outline: none;
}

#sidebar-filtros button:focus:not(.activo),
#sidebar-filtros button:active:not(.activo) {
  background: #1f2937;
  /* color base */
  color: #fff;
}

/* ============================================================ */
/*   SIDEBAR COMPACT REDESIGN                                   */
/* ============================================================ */

/* Segmented Control (Cartas / Sobres) */
.segmented-control {
  display: flex;
  background: #1f2937;
  border-radius: 8px;
  padding: 3px;
  margin: 10px;
  gap: 4px;
}

.segmented-control button {
  flex: 1;
  padding: 8px 5px !important;
  margin: 0 !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  background: transparent !important;
  color: #999 !important;
  border-radius: 6px !important;
  border: none !important;
  transform: none !important;
  box-shadow: none !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 5px;
}

.segmented-control button.activo {
  background: #0c569d !important;
  color: #fff !important;
}

/* Grid Actions (Comunidad / Servicios) */
.section-label {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 1px;
  margin: 15px 12px 6px;
  display: block;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 10px;
  margin-bottom: 20px;
}

.action-grid button {
  width: 100% !important;
  margin: 0 !important;
  padding: 10px 5px !important;
  font-size: 0.75rem !important;
  line-height: 1.2 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  min-height: 52px;

  /* Glassmorphism Premium */
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 12px !important;

  color: rgba(255, 255, 255, 0.9) !important;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
  position: relative;
  overflow: hidden;
}

/* Micro-interaction: Hover Lift & Brightness */
@media (hover: hover) {
  .action-grid button:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    color: #fff !important;
  }
}

.action-grid button:active {
  transform: scale(0.98);
}

.action-grid .full-row {
  grid-column: span 2;
}

.action-grid button span.icon {
  font-size: 1.1rem;
  margin-bottom: 2px;
}

/* Estado Activo: Gold Premium */
.action-grid button.activo {
  background: linear-gradient(135deg, #ffd633 0%, #ffcc00 100%) !important;
  border: 1px solid #ffe680 !important;
  color: #002b64 !important;
  font-weight: 800 !important;
  box-shadow: 0 0 10px rgba(255, 214, 51, 0.3);
  transform: none;
}

/* Force white text for non-active buttons (Security override) */
.action-grid button:not(.activo),
.segmented-control button:not(.activo) {
  color: #fff !important;
}

.segmented-control button.activo {
  color: #fff !important;
}

/* ============================================================
   SIDEBAR AUTH & WHATSAPP (New Elegant Styles)
   ============================================================ */

.sidebar-auth-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding: 0 10px;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: none;
  font-weight: 800;
  /* Bolder */
  font-size: 0.75rem;
  /* Smaller/Sharper */
  text-transform: uppercase;
  /* Premium feel */
  letter-spacing: 0.5px;
  color: #fff !important;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  line-height: 1.1;
  /* Tighter for stacked */
  text-align: center;
  /* white-space: nowrap; REMOVED to allow stacking */
  width: 100%;
  flex-direction: column;
  /* Allow stacking */
}

.sidebar-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.sidebar-btn:active {
  transform: scale(0.96);
}

/* WhatsApp Specific */
.sidebar-btn.whatsapp {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  flex: 1;
  height: 48px;
  /* Slightly taller for elegance */
}

.sidebar-btn.whatsapp:hover {
  box-shadow: 0 0 15px rgba(37, 211, 102, 0.4);
}

/* Auth Buttons (Login / Account) */
.sidebar-btn.auth {
  flex: 2;
  background: #0c569d;
  /* Blue from Cartas */
  /* Remove glassmorphism */
  backdrop-filter: none;
  border: none;
  /* Clean solid look */
  height: 48px;
}

.sidebar-btn.auth:hover {
  background: #0a4b8a;
  /* Slightly darker on hover */
  border: none;
}

/* Logout Specific */
.sidebar-btn.logout {
  flex: 1;
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  border: none;
}

.sidebar-btn.logout:hover {
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}