/* ========================================
   NAVEGACIÓN MÓVIL - ESTILO SITIO WEB DE BINGO
   Tema unificado morado/verde con armonía entre barras
   ======================================== */

/* ========================================
   BARRA DE ANUNCIOS (Opcional)
   ======================================== */

.mobile-announcement-bar {
  display: none;
  position: fixed;
  top: 90px;
  left: 0;
  right: 0;
  background: linear-gradient(145deg, #48c774 0%, #36a85f 100%);
  color: #ffffff;
  padding: 10px 15px;
  font-weight: 600;
  font-size: 0.85rem;
  text-align: center;
  z-index: 999;
  box-shadow: 0 4px 15px rgba(72, 199, 116, 0.4);
  animation: slideDown 0.4s ease-out;
  font-family: 'Poppins', 'Montserrat', sans-serif;
}

.mobile-announcement-bar i {
  margin-right: 5px;
  font-size: 1rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.mobile-announcement-bar .close-announcement {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #ffffff;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 300;
  transition: all 0.3s ease;
}

.mobile-announcement-bar .close-announcement:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

@media (max-width: 768px) {
  .mobile-announcement-bar {
    display: block;
    top: 52px;
  }
  
  body.has-announcement .top-section.live {
    margin-top: 92px !important;
  }
}

/* ========================================
   ENCABEZADO MÓVIL SUPERIOR
   Altura y diseño unificado con bottom nav
   ======================================== */

.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #6b3ec0 0%, #5f6af1 60%, #667eea 100%);
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10002 !important;
  padding: 4px 12px;
  font-family: 'Poppins', 'Montserrat', sans-serif;
  animation: slideDown 0.3s ease-out;
  border-bottom: 1px solid rgba(46, 204, 113, 0.25);
  transition: transform 0.3s ease;
}

/* Superposición de patrón sutil */
.mobile-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('../img/bg-background.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0.1;
  pointer-events: none;
}

/* Grid del header: logo + botones */
/* CAMBIO CRÍTICO: Todas las columnas usan 1fr para expansión equitativa automática */
/* Esto hace que cada elemento ocupe exactamente 1/7 del ancho disponible */
.mobile-header-nav {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  align-items: stretch;
  position: relative;
  z-index: 2;
}

/* Logo del header */
/* CAMBIO: Se centra el logo y se ajusta para que use todo su espacio asignado */
.mobile-header-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  width: 100%;
}

/* CAMBIO: Se ajusta el logo para que se adapte al espacio disponible */
.mobile-header-logo img {
  height: 26px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}

/* Ítems de navegación del header con efecto glassmorphism */
/* CAMBIO 1: Se eliminó min-width y se agregó width: 100% para expansión equitativa */
/* CAMBIO 2: Se agregó overflow: hidden para evitar que el contenido se desborde */
/* CAMBIO 3: Se aumentó el padding horizontal para aprovechar el ancho disponible */
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 3px 4px;
  border-radius: 4px;
  transition: all 0.25s ease;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  font-weight: 500;
  cursor: pointer;
  text-transform: capitalize;
  width: 100%;
  height: 100%;
  min-height: 38px;
  overflow: hidden;
}

/* CAMBIO: Se aumentó el tamaño del ícono de 1.1rem a 1.3rem para mejor visibilidad */
.mobile-nav-item i {
  font-size: 1.3rem;
  margin-bottom: 2px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}

/* CAMBIO 1: Se aumentó el tamaño de fuente de 0.5rem a 0.65rem para mejor legibilidad */
/* CAMBIO 2: Se agregó text-overflow y max-width para manejar textos largos */
.mobile-nav-item span {
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  font-size: 0.65rem !important;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.mobile-nav-item:hover,
.mobile-nav-item:active {
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(102, 126, 234, 0.35);
  color: white;
}

/* ========================================
   NAVEGACIÓN INFERIOR (BOTTOM NAV)
   Diseño unificado con header superior
   ======================================== */

.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #6b3ec0 0%, #5f6af1 60%, #667eea 100%);
  box-shadow: 0 -4px 20px rgba(102, 126, 234, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10001 !important;
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 8px;
  padding: 2px 2px;
  font-family: 'Poppins', 'Montserrat', sans-serif;
  animation: slideUp 0.3s ease-out;
  border-top: 1px solid rgba(46, 204, 113, 0.25);
  transition: transform 0.3s ease;
}

/* Línea decorativa superior */
.mobile-bottom-nav::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
}

/* Ítems de la bottom nav con glassmorphism */
.mobile-bottom-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  text-decoration: none;
  font-size: 0.6rem;
  padding: 2px 2px;
  border-radius: 4px;
  transition: all 0.25s ease;
  flex: 1;
  max-width: 100px;
  position: relative;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  min-height: 30px;
}

.mobile-bottom-item i {
  font-size: 1.2rem;
  margin-bottom: 2px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}

.mobile-bottom-item span {
  font-size: 0.6rem;
  line-height: 1;
}

.mobile-bottom-item:hover,
.mobile-bottom-item:active {
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(102, 126, 234, 0.35);
}

/* Estilo de íconos consistente */
.mobile-bottom-item i,
.mobile-nav-item i {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}

.mobile-bottom-item:active i,
.mobile-nav-item:active i {
  transform: scale(0.9);
}

/* ========================================
   PANEL DE CONFIGURACIÓN MÓVIL (SLIDE-UP)
   ======================================== */

.mobile-settings-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10003;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-settings-overlay.active {
  display: block;
  opacity: 1;
}

.mobile-settings-panel {
  position: fixed;
  bottom: -100%;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #6b3ec0 0%, #5f6af1 100%);
  border-radius: 20px 20px 0 0;
  z-index: 10004;
  transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.3);
  max-height: 50vh;
  overflow-y: auto;
  border-top: 1px solid rgba(46, 204, 113, 0.25);
}

.mobile-settings-panel.active {
  bottom: 0;
}

.mobile-settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.mobile-settings-header h6 {
  color: white;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.close-settings {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.close-settings:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.mobile-settings-content {
  padding: 10px;
}

.mobile-setting-item {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
  padding: 14px 18px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
}

.mobile-setting-item:hover,
.mobile-setting-item:active {
  background: rgba(255, 255, 255, 0.25);
  transform: translateX(5px);
}

.mobile-setting-item i {
  font-size: 1.5rem;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}

.mobile-setting-item span {
  flex: 1;
  text-align: left;
}

/* ================================================================
   VISIBILIDAD CONDICIONAL DEL BOTÓN 'COBRAR'
   ================================================================ */

.mobile-btn-cobrar {
  display: none !important;
}

body.puede-cobrar .mobile-btn-cobrar {
  display: flex !important;
}

/* ========================================
   ÁREAS SEGURAS PARA DISPOSITIVOS CON NOTCH
   ======================================== */

@supports (padding: max(0px)) {
  .mobile-header {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  
  .mobile-bottom-nav {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    padding-left: max(6px, env(safe-area-inset-left));
    padding-right: max(6px, env(safe-area-inset-right));
  }
}

/* ========================================
   SOPORTE PARA MODO OSCURO
   ======================================== */

@media (prefers-color-scheme: dark) {
  .mobile-header,
  .mobile-bottom-nav {
    background: linear-gradient(135deg, #4a148c 0%, #311b92 100%);
  }
  
  .mobile-nav-item,
  .mobile-bottom-item {
    background: rgba(255, 255, 255, 0.08);
  }
}

/* ========================================
   MEJORAS DE ACCESIBILIDAD
   ======================================== */

.mobile-nav-item:focus,
.mobile-bottom-item:focus {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}

@media (prefers-contrast: high) {
  .mobile-header,
  .mobile-bottom-nav {
    background: #000000;
    border-top: 2px solid #ffffff;
  }
  
  .mobile-nav-item,
  .mobile-bottom-item {
    border: 2px solid #ffffff;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-header,
  .mobile-bottom-nav,
  .mobile-nav-item,
  .mobile-bottom-item {
    animation: none !important;
    transition: none !important;
  }
}

/* ========================================
   BARRA DE DESPLAZAMIENTO PERSONALIZADA
   ======================================== */

@media (max-width: 768px) {
  ::-webkit-scrollbar {
    width: 6px;
  }
  
  ::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
  }
  
  ::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
  }
  
  ::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  }
}

/* ========================================
   AJUSTES PARA OTROS ELEMENTOS
   ======================================== */

@media (max-width: 768px) {
  /* Navegación móvil visible */
  .mobile-header {
    display: block !important;
  }
  
  .mobile-bottom-nav {
    display: flex !important;
  }
  
  body {
    padding-top: 0 !important;
    padding-bottom: 70px !important;
  }

  /* Compactar la sección superior */
  .top-section {
    height: auto !important;
    min-height: 150px !important;
    padding: 2px 6px 8px 6px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    margin-top: 50px !important;
    border-radius: 0 0 0px 0px !important;
  }
  
  .top-section.live {
    height: auto !important;
    min-height: 70px !important;
    margin-top: 80px !important;
    border-radius: 0 0 15px 15px !important;
  }
  
  /* Tamaños de texto en top-section */
  .top-section h6 {
    font-size: 0.7rem !important;
    margin: 2px 0 0px 0 !important;
    line-height: 1.2 !important;
  }
  
  .top-section .next-game {
    margin: 6px 0 0px 0 !important;
    font-size: 0.9rem !important;
  }
  
  .top-section .total-balls,
  .top-section .total-accumulated {
    font-size: 0.9rem !important;
    margin: 2px 0 0px 0 !important;
  }
  
  .top-section .total-balls small,
  .top-section .total-accumulated small {
    font-size: 0.7rem !important;
  }

  /* Bola grande */
  .top-section .size-100 {
    width: 100px !important;
    height: 100px !important;
    min-width: 100px !important;
    min-height: 100px !important;
    max-width: 100px !important;
    max-height: 100px !important;
    font-size: 1.1rem !important;
    border-radius: 10% !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    padding-bottom: 2px !important;
    box-sizing: border-box !important;
    flex-shrink: 1 !important;
    aspect-ratio: 1 / 1 !important;
  }
  
  .top-section .size-100 small {
    position: absolute !important;
    top: 2px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    font-size: 1.5rem !important;
    z-index: 3 !important;
    line-height: 1 !important;
    margin: 0 !important;
    color: #111 !important;
    font-weight: 700 !important;
  }
  
  .top-section .size-100 span {
    font-size: 2.9rem !important;
    line-height: 1 !important;
    margin: 0 !important;
  }
  
  .top-section .size-100::after {
    border: 5px solid rgba(255, 255, 255, 0.8) !important;
    font-size: 2.9rem !important;
    width: 85% !important;
    height: 85% !important;
    border-radius: 50% !important;
  }
  
  /* Bolas pequeñas */
  .top-section .size-40 {
    width: 34px !important;
    height: 34px !important;
    font-size: 0.9rem !important;
    flex-shrink: 0 !important;
  }
  
  /* Últimos números */
  .top-section .last-numbers {
    padding: 4px 2px !important;
    gap: 3px !important;
    margin-top: 16px !important;
    max-width: calc(80vw - 60px) !important;
    box-sizing: border-box !important;
  }
  
  /* Botones más pequeños */
  .top-section .btn-cells,
  .top-section .btn-board {
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
  }

  /* Ocultar botones duplicados de escritorio */
  .top-section .btn-home,
  .top-section .btn-wallet,
  .top-section .btn-sliders,
  .btn-profile,
  .btn-wallet-profile,
  .btn-gamepad-profile,
  .btn-qrcode,
  .btn-volume,
  .btn-lock,
  .btn-sliders,
  .btn-logout {
    display: none !important;
  }

  /* WhatsApp en navegación inferior */
  #mobile-whatsapp-container {
    flex: 1;
    max-width: 100px;
    position: relative;
    max-height: 44px;
  }
  
  #mobile-whatsapp-container #whatsapp-plugin {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
  }
  
  #mobile-whatsapp-container .czm-button {
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    left: auto !important;
    top: auto !important;
    margin: 0 auto !important;
    display: block !important;
    transform: scale(0.9);
  }

  /* Popup de WhatsApp */
  .czm-popup {
    position: fixed !important;
    bottom: 85px !important;
    right: 15px !important;
    z-index: 9999 !important;
  }

  /* Ajuste de modales */
  .modal-dialog {
    margin-top: 25px !important;
  }

  .modal-content {
    margin-top: 2px !important;
  }

  .swal2-container {
    padding-top: 30px !important;
  }

  .swal2-popup {
    margin-top: 10px !important;
  }

  /* Páginas de juego sin márgenes extra */
  .container-section {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  /* Otras páginas con compensación por header */
  .container:not(.container-section),
  .container-fluid:not(.container-section) {
    padding-top: 58px !important;
  }
}

/* ========================================
   UTILIDADES RESPONSIVAS
   ======================================== */

@media (max-width: 480px) {
  .mobile-header {
    padding: 4px 4px;
  }
  
  .mobile-header-logo {
    padding-right: 4px;
  }
  
  .mobile-header-logo img {
    height: 26px;
  }
  
  .mobile-header-nav {
    gap: 4px;
  }
  
  .mobile-nav-item {
    font-size: 0.55rem;
    padding: 2px 3px;
    min-width: 30px;
  }
  
  .mobile-nav-item i {
    font-size: 1rem;
    margin-bottom: 2px;
  }
  
  .mobile-nav-item span {
    font-size: 0.45rem;
  }
  
  .mobile-bottom-item {
    font-size: 0.6rem;
    padding: 4px 4px;
  }
  
  .mobile-bottom-item i {
    font-size: 1.1rem;
  }
}

@media (min-width: 769px) {
  /* Ocultar navegación móvil en escritorio */
  .mobile-header,
  .mobile-bottom-nav,
  .mobile-announcement-bar {
    display: none !important;
  }
  
  body {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
}

/* ========================================
   ESTILOS DE IMPRESIÓN
   ======================================== */

@media print {
  .mobile-header,
  .mobile-bottom-nav,
  .mobile-announcement-bar {
    display: none !important;
  }
}

/* ========================================
   ANIMACIONES
   ======================================== */

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ========================================
   LAYOUT GRID PARA TOP-SECTION MÓVIL
   ======================================== */

@media (max-width: 768px) {
  .top-section {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: min-content;
    row-gap: 0px;
    padding: 5px 10px 10px 10px !important;
    align-content: center !important;
    justify-items: center !important;
  }
  
  .top-section .total-balls {
    grid-column: 1;
    justify-self: start;
    margin: 4 !important;
  }
  
  .top-section .total-accumulated {
    grid-column: 2;
    justify-self: end;
    margin: 2 !important;
  }
  
  .top-section .mobile-row {
    grid-column: 1 / -1;
    justify-self: center;
    padding: 0 12px !important;
    width: 100%;
    box-sizing: border-box;
    margin: 2px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
  }
  
  .top-section h6 {
    grid-column: 1 / -1;
    text-align: center;
    margin: 2px 0 0px 0 !important;
  }
  
  .top-section .next-game {
    grid-column: 1 / -1;
    text-align: center;
    margin: -20px 0 0px 0 !important;
  }
  
  /* Bola grande más pequeña */
  .top-section .mobile-row #last-number {
    transform: translateY(-2px) scale(0.60) !important;
    transform-origin: center center !important;
    margin-right: 0px;
    margin-top: 6px;
  }
  
  /* Barra de últimos números */
  .top-section .last-numbers {
    margin: 0 0 0 -6px !important;
    align-self: center;
  }
}

@media (min-width: 480px) and (max-width: 540px) {
  .top-section {
    min-height: 140px !important;
    padding-bottom: 14px !important;
  }
  
  .top-section .total-balls,
  .top-section .total-accumulated {
    margin-top: 0px !important;
    margin-bottom: 6px !important;
  }
  
  .top-section .mobile-row {
    margin-top: 0 !important;
    padding: 0 12px !important;
  }
  
  .top-section h6 {
    margin: -6px 0 0px 0 !important;
  }
  
  .top-section .next-game {
    margin: -4px 0 0px 0 !important;
  }
}

.top-section-mobile {
  display: none;
}

.top-section.mobile-side {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
}
