body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: #f8f9fa;
  color: #222;
}

/* ============================================================
   TOPBAR (COLOR ORIGINAL SÓLIDO)
   ============================================================ */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: #0971CE; /* Tu color original */
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  /* Sin difuminación ni sombras pesadas */
}

.wallet {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1); /* Sutil realce para la billetera */
}

.actions button {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  margin-left: 12px;
  transition: transform 0.2s ease, opacity 0.2s;
}

.actions button:hover {
  transform: scale(1.1);
  opacity: 0.8;
}

/* Variables de Diseño Moderno (Tus originales) */
:root {
  --d-primary: #007bff;
  --d-bg: #ffffff;
  --d-text: #1a1d23;
  --d-text-muted: #6b7280;
  --d-hover: #f3f4f6;
  --d-border: rgba(0, 0, 0, 0.05);
  --d-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
  --d-transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modo Oscuro (Tus originales) */
body.dark-mode {
  --d-bg: #042738;
  --d-text: #ffffff;
  --d-text-muted: #9ca3af;
  --d-hover: rgba(255, 255, 255, 0.08);
  --d-border: rgba(255, 255, 255, 0.1);
}

/* Drawer Menu Principal */
.drawer-menu {
  position: fixed;
  top: 0;
  right: -320px; 
  width: 280px;
  height: 100%;
  background: var(--d-bg);
  box-shadow: var(--d-shadow);
  transition: var(--d-transition);
  z-index: 1100;
  display: flex; /* Añadido para gestionar el scroll */
  flex-direction: column; /* Añadido */
  border-left: 1px solid var(--d-border);
  visibility: hidden;
  overflow: hidden; /* Evita que el contenedor padre haga scroll */
}

/* Selector para forzar visibilidad cuando JS actúa */
.drawer-menu[style*="right: 0"],
.drawer-menu[style*="right:0"] {
  visibility: visible !important;
}

/* Botón de cierre elegante (Tus colores originales) */
.drawer-menu .close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 18px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  color: var(--d-text-muted);
  transition: var(--d-transition);
  background: var(--d-hover);
  z-index: 10; /* Asegura que esté sobre la lista */
}

.drawer-menu .close-btn:hover {
  background: #ff4d4d22;
  color: #ff4d4d;
  transform: rotate(90deg);
}

/* Lista de Navegación (CORREGIDA PARA SCROLL) */
.drawer-menu ul {
  list-style: none;
  margin: 0;
  /* 70px arriba por el botón X, 160px abajo para no taparse con el footer */
  padding: 70px 10px 160px 10px; 
  overflow-y: auto; /* Scroll habilitado aquí */
  flex-grow: 1;    /* Toma el espacio central */
  -webkit-overflow-scrolling: touch;
}

.drawer-menu li {
  padding: 12px 16px;
  margin: 4px 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--d-text);
  cursor: pointer;
  border-radius: 12px;
  transition: var(--d-transition);
}

.drawer-menu li:hover {
  background: var(--d-hover);
  padding-left: 22px;
  color: var(--d-primary);
}

.drawer-menu li i {
  font-size: 20px;
  color: var(--d-text-muted);
}

/* Overlay con desenfoque */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: none;
  z-index: 1050;
  animation: fadeIn 0.3s ease;
}

/* ========================= */
/* FOOTER totalmente protegido */
/* ========================= */
#drawerMenu .drawer-footer {
  all: unset;              /* elimina todas las propiedades heredadas y globales */
  all: revert;             /* vuelve a las propiedades default del navegador */
  position: sticky;
  bottom: env(safe-area-inset-bottom);
  left: 0;
  width: 100%;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  background: var(--d-bg);
  border-top: 1px solid var(--d-border);
  z-index: 1100;
  transition: var(--d-transition);
  box-shadow: 0 -6px 18px rgba(0,0,0,0.06);
}

/* Avatar */
#drawerMenu .drawer-footer img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--d-primary);
  padding: 2px;
  background: var(--d-bg);
  flex-shrink: 0;
}

/* Info container */
#drawerMenu .drawer-footer .info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
}

/* Nombre */
#drawerMenu .drawer-footer .info .name {
  font-weight: 700;
  font-size: 15px;
  color: var(--d-text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Email */
#drawerMenu .drawer-footer .info .email {
  font-size: 12.5px;
  color: var(--d-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Nivel row */
#drawerMenu .drawer-footer .level-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

/* Icono nivel */
#drawerMenu .drawer-footer .level-icon {
  font-size: 14px;
  margin-top: 1px;
}

#drawerMenu .drawer-footer .level-icon.avanzado { color: purple; }
#drawerMenu .drawer-footer .level-icon.pro { color: #2979ff; }
#drawerMenu .drawer-footer .level-icon.elite { color: deepskyblue; }
#drawerMenu .drawer-footer .level-icon.embajador { color: gold; }

/* Texto nivel */
#drawerMenu .drawer-footer .level-text {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--d-text);
  opacity: 0.85;
}

/* ============================================================
   ESTADO PARA DESKTOP (Visible por defecto)
   ============================================================ */
@media (min-width: 1024px) {
  .drawer-menu {
    right: 0 !important; /* Forzamos que esté siempre visible */
    visibility: visible !important;
    box-shadow: none; /* Quitamos sombra si está integrado al diseño */
    border-left: 1px solid var(--d-border);
  }

  .overlay {
    display: none !important; /* En desktop no necesitamos overlay */
  }

  .drawer-menu .close-btn {
    display: none; /* No hay botón de cerrar en desktop si es fijo */
  }

  .drawer-footer {
    bottom: 30px !important;
  }

  /* Ajuste del cuerpo de la página para que el menú no tape el contenido */
  /* body { padding-right: 280px; } */
}

/* Animación Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(5px);
  display: none;
  z-index: 1050;
  transition: opacity 0.3s ease;
}

/* ============================================================
   Breadcrumb
   ============================================================ */
.breadcrumb {
  padding: 20px 25px;      
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb a {
  text-decoration: none;
  color: #666;                
  font-weight: 500;
  transition: color 0.2s ease;
}

.breadcrumb a:hover {
  color: #444;               
}

.breadcrumb .current {
  color: rgba(0,0,0,0.6);    
  font-weight: 600;
}

/* Breadcrumb Dark Mode */
body.dark-mode .breadcrumb a {
  color: #fff;       
}

body.dark-mode .breadcrumb .current {
  color: rgba(255,255,255,0.7);  /* / Cupones en blanco opaco */
}

/* ============================================================
   TOAST
   ============================================================ */
/* Toast personalizado */
.custom-toast {
  display: none;
  background: #f3f4f5;
  position: fixed;
  z-index: 9999;
  top: 20px;
  right: 20px; /* agregado para móviles */
  left: auto;   /* agregado para móviles */
  padding: 15px 20px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  max-width: 90%;
  width: auto;
  animation: slideIn 0.4s ease;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
}

@media (min-width: 768px) {
  .custom-toast {
    /* ya no hace falta cambiar left/right aquí */
  }
}

/* Contenido del toast */
.custom-toast-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #333;
}

.custom-toast-content i {
  font-size: 24px;
}

/* Animación */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Desktop: esquina superior derecha */
@media (min-width: 768px) {
  .custom-toast {
    left: auto;
    right: 20px;
    top: 20px;
    transform: none;
  }
}

/* Colores por tipo */
.toast-error i {
  color: #FF4C4C;
}

.toast-warning i {
  color: #FFA500;
}

.toast-success i {
  color: #28A745;
}

/* Responsive */
@media (max-width: 768px) {
  .deposit-content {
    flex-direction: column;
  }
  .deposit-info {
    margin-top: 30px;
  }
}

/* ============================================================
   BOTTOM NAVIGATION (ESTILO PROFESIONAL)
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 70px; /* Un poco más alto para mejor ergonomía */
  background: rgba(255, 255, 255, 0.85); /* Efecto Glassmorphism */
  border: none !important;
  backdrop-filter: blur(15px) saturate(160%);
  -webkit-backdrop-filter: blur(15px) saturate(160%);
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.5);
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom); /* Soporte para iPhone con notch */
}

.bottom-nav button {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  cursor: pointer;
  color: var(--text-muted); /* Usamos tu variable de texto suave */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* Iconos */
.bottom-nav button i {
  font-size: 22px;
  transition: transform 0.3s ease;
}

/* Etiquetas de texto */
.bottom-nav button span {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
  opacity: 0.8;
  transition: all 0.3s ease;
}

/* ============================================================
   ESTADOS ACTIVOS Y ANIMACIONES
   ============================================================ */

/* Al pasar el mouse o estar activo */
.bottom-nav button:hover,
.bottom-nav button.active {
  color: var(--primary); /* Tu azul corporativo #0971CE */
}

.bottom-nav button:hover i,
.bottom-nav button.active i {
  transform: translateY(-5px); /* Pequeño salto hacia arriba */
}

.bottom-nav button.active span {
  opacity: 1;
  transform: scale(1.1);
}

/* Círculo indicador de fondo (opcional, muy moderno) */
.bottom-nav button.active::before {
  content: '';
  position: absolute;
  top: 10px;
  width: 35px;
  height: 35px;
  background: rgba(9, 113, 206, 0.1);
  border-radius: 12px;
  z-index: -1;
  animation: pulseIn 0.4s ease-out;
}

/* Animación de entrada para el menú al cargar */
@keyframes navEntrance {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes pulseIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.bottom-nav {
  animation: navEntrance 0.6s ease-out;
}

@media (min-width: 1024px) {
  /* Drawer fijo */
  .drawer-menu {
    right: 0 !important;
    position: fixed;
    top: 60px;                   /* debajo de la topbar */
    height: calc(100% - 120px);  /* resta topbar (60px) + bottom-nav (60px) */
    box-shadow: none;
    border-left: none;
    background: #fff;
    z-index: 99;
    padding-top: 15px;           /* pequeño espacio arriba */
  }

  /* Ocultar el botón burger */
  #menuToggle {
    display: none !important;
  }

  /* Ocultar el botón de cerrado */
  .drawer-menu .close-btn {
    display: none !important;
  }

  /* Subir opciones del menú (ul) */
  .drawer-menu ul {
    margin-top: 0;     /* quita espacio extra */
    padding-top: 10px; /* un poco de aire */
  }

  /* Overlay nunca en desktop */
  .overlay {
    display: none !important;
  }

  /* El contenido principal se corre para no quedar debajo del menú */
  .main-content {
    margin-right: 250px; /* ancho del drawer */
  }
}

/* ======================== */
/*        MODO OSCURO       */
/* ======================== */

/* Topbar y Bottom-nav */
body.dark-mode .topbar,
body.dark-mode .bottom-nav {
  background: #042738;
}

body.dark-mode .bottom-nav button {
  color: #FFFFFF;
}

body.dark-mode .bottom-nav button:hover {
  color: #97c0ff;
}

body.dark-mode .bottom-nav button.active {
  color: #0971CE;
}

/* Drawer Menu */
body.dark-mode .drawer-menu {
  background: #042433;
}

body.dark-mode .drawer-menu .close-btn {
  color: #FFFFFF;
}

body.dark-mode .drawer-menu li {
  color: #FFFFFF;
}

body.dark-mode .drawer-menu li:hover {
  background: #021923;
}

/* Toast */
body.dark-mode .custom-toast {
  background: #042433;
  color: #FFFFFF;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.04);
}

body.dark-mode .custom-toast .custom-toast-content {
  color: #FFFFFF;
}

body.dark-mode .custom-toast .custom-toast-content i {
  color: inherit;
}

/* Mantener colores de tipo */
body.dark-mode .toast-error i {
  color: #FF4C4C !important;
}

body.dark-mode .toast-warning i {
  color: #FFA500 !important;
}

body.dark-mode .toast-success i {
  color: #28A745 !important;
}
