/*==================================================
  FLOATING ISLAND NAVIGATION
  Ultra-minimal bottom navigation bar
  Coherente con diseño premium metaverso CoinLottery
  
  Reutiliza funcionalidades existentes:
  - Home: scroll a #home
  - Wallet: navega a wallet.html
  - Game: scroll a #slot
  - Keno: toggleKenoModal()
==================================================*/

/* Variables locales coherentes con el sitio - Estilo sutil y elegante */
:root {
  --island-bg: linear-gradient(135deg, rgba(10, 14, 26, 0.82), rgba(17, 24, 40, 0.78));
  --island-border: rgba(255, 255, 255, 0.12);
  --island-glow-cyan: rgba(6, 190, 222, 0.15);
  --island-btn-active: linear-gradient(135deg, rgba(255, 255, 255, 0.14) 0%, rgba(6, 190, 222, 0.20) 100%);
}

/* ==========================================
   NAV CONTAINER - FLOATING ISLAND (LATERAL IZQUIERDA)
   Centrado verticalmente para no bloquear CTAs principales
   ========================================== */
.floating-island-nav {
  position: fixed;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1002;
  
  /* Glassmorphism sutil y elegante */
  background: var(--island-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  
  /* Borde muy sutil */
  border: 1px solid var(--island-border);
  border-radius: 24px;
  
  /* Sombra muy discreta */
  box-shadow: 
    0 3px 12px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  
  /* Layout flexbox - column para disposición vertical */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 6px;
  
  /* Animación de entrada suave */
  animation: islandSlideIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  
  /* Transición suave para collapse */
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Container de botones principales - disposición vertical */
.island-buttons-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Navegación colapsada - solo muestra toggle */
.floating-island-nav.collapsed {
  padding: 8px 10px;
  border-radius: 25px;
  max-width: 50px;
  overflow: hidden;
}

.floating-island-nav.collapsed .island-buttons-container {
  max-height: 0;
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  margin-top: 0;
}

/* ==========================================
   TOGGLE BUTTON - PARA COLAPSAR/EXPANDIR
   ========================================== */
.island-toggle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(6, 190, 222, 0.12);
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  cursor: pointer;
  position: relative;
  
  /* Reset de estilos de botón */
  outline: none;
  padding: 0;
  
  transition: all 0.25s ease;
  order: -1; /* Colocar al inicio (arriba) */
}

.island-toggle i {
  font-size: 0.8rem;
  color: rgba(6, 190, 222, 0.52);
  transition: all 0.25s ease;
}

.island-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(6, 190, 222, 0.25);
}

.island-toggle:hover i {
  color: rgba(6, 190, 222, 0.75);
}

/* Rotar icono cuando está colapsado */
.floating-island-nav.collapsed .island-toggle i {
  transform: rotate(90deg);
}

/* ==========================================
   BOTONES DEL ISLAND
   ========================================== */
.island-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  cursor: pointer;
  position: relative;
  overflow: hidden;
  
  /* Reset de estilos de botón */
  outline: none;
  padding: 0;
  
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Íconos — alto contraste sobre fondo oscuro/morado.
   IMPORTANTE: lucide-icons.js REEMPLAZA el <i data-lucide> por un <svg>
   directamente, así que el selector debe alcanzar tanto el <i> placeholder
   (antes de render) como el <svg> ya renderizado (hijo directo del botón
   o con clase .lucide). Forzamos stroke + color con !important para
   sobrescribir cualquier regla legacy de styles.css. */
.island-btn i,
.island-btn > svg,
.island-btn .lucide,
.island-btn i svg {
  font-size: 1.35rem;
  width: 22px;
  height: 22px;
  color: #ffffff !important;
  stroke: #ffffff !important;
  fill: none !important;
  stroke-width: 2.25 !important;
  opacity: 1 !important;
  transition: all 0.25s ease;
  position: relative;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}

/* ==========================================
   ESTADO ACTIVO - Sutil pero visible
   ========================================== */
.island-btn.active {
  background: var(--island-btn-active);
  border-color: rgba(6, 190, 222, 0.35);
  box-shadow: 0 4px 12px rgba(6, 190, 222, 0.22);
}

.island-btn.active i,
.island-btn.active > svg,
.island-btn.active .lucide {
  color: #ffffff !important;
  stroke: #ffffff !important;
  transform: scale(1.02);
}

/* ==========================================
   HOVER - Sutil y elegante
   ========================================== */
.island-btn:not(.active):hover {
  background: rgba(6, 190, 222, 0.07);
  border-color: rgba(6, 190, 222, 0.24);
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 6px 14px rgba(6, 190, 222, 0.15);
}

.island-btn:not(.active):hover i,
.island-btn:not(.active):hover > svg,
.island-btn:not(.active):hover .lucide {
  color: #06BEDE !important;
  stroke: #06BEDE !important;
  transform: scale(1.05);
}

/* ==========================================
   ACTIVE (click) - Feedback táctil sutil
   ========================================== */
.island-btn:active {
  transform: translateY(0) scale(0.98);
}

/* ==========================================
   ESTADO OCULTO (no se usa - menú siempre visible)
   ========================================== */
.floating-island-nav.is-hidden {
  transform: translateY(-50%) translateX(80px);
  opacity: 0;
  pointer-events: none;
}

/* ==========================================
   KENO MODAL OVERRIDE - Z-INDEX ELEVADO
   ========================================== */
.floating-island-nav.above-keno {
  z-index: 10001; /* Por encima de modal Keno (z-index: 1050) */
}

/* Animación de entrada desde la izquierda */
@keyframes islandSlideIn {
  from {
    transform: translateY(-50%) translateX(-80px);
    opacity: 0;
  }
  to {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
  }
}

/* ==========================================
   RESPONSIVE - TABLET
   ========================================== */
@media (max-width: 768px) {
  .floating-island-nav {
    left: 6px;
    gap: 5px;
    padding: 6px 5px;
  }
  
  .island-btn {
    width: 36px;
    height: 36px;
  }
  
  .island-btn i {
    font-size: 1.2rem;
  }
  
  .island-toggle {
    width: 32px;
    height: 32px;
  }
  
  .island-toggle i {
    font-size: 0.8rem;
  }
}

/* ==========================================
   RESPONSIVE - MOBILE
   ========================================== */
@media (max-width: 480px) {
  .floating-island-nav {
    left: 4px;
    gap: 4px;
    padding: 5px 4px;
  }
  
  .island-btn {
    width: 32px;
    height: 32px;
  }
  
  .island-btn i {
    font-size: 1.1rem;
  }
  
  .island-toggle {
    width: 32px;
    height: 32px;
  }
  
  .island-toggle i {
    font-size: 0.8rem;
  }
}

/* ==========================================
   ACCESIBILIDAD
   ========================================== */
.island-btn:focus {
  outline: 2px solid #06BEDE;
  outline-offset: 2px;
}

.island-btn:focus:not(:focus-visible) {
  outline: none;
}

/* ==========================================
   ESTADO CUANDO KENO MODAL ESTÁ ABIERTO
   ========================================== */
.island-btn[data-action="keno"].modal-open {
  background: rgba(255, 107, 107, 0.35);
  border-color: rgba(255, 107, 107, 0.3);
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.2);
}

.island-btn[data-action="keno"].modal-open i {
  color: rgba(255, 255, 255, 0.9);
}

/* ==========================================
   KENO ICON IMAGE - Imagen personalizada
   ========================================== */
.island-keno-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  transition: all 0.25s ease;
  position: relative;
  z-index: 2;
  pointer-events: none;
  opacity: 0.55;
}

/* Hover effect para la imagen de Keno */
.island-btn[data-action="keno"]:not(.active):hover .island-keno-icon {
  transform: scale(1.05);
  filter: brightness(1.15);
  opacity: 0.85;
}

/* Active state para la imagen de Keno */
.island-btn[data-action="keno"].active .island-keno-icon {
  transform: scale(1.02);
  filter: brightness(1.1);
  opacity: 0.9;
}

/* Modal open state para la imagen de Keno */
.island-btn[data-action="keno"].modal-open .island-keno-icon {
  filter: brightness(1.1);
  opacity: 0.9;
}

/* Responsive - Tablet */
@media (max-width: 768px) {
  .island-keno-icon {
    width: 18px;
    height: 18px;
  }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
  .island-keno-icon {
    width: 16px;
    height: 16px;
  }
}

/* ==========================================
   HIDE FLOATING ISLAND WHEN MOBILE MENU IS OPEN
   ========================================== */
@media screen and (max-width: 768px) {
  body:has(.show-menu) .floating-island-nav {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(60px);
  }
}

/* ==========================================
   LIVE BUTTON - Sutil con indicador discreto
   ========================================== */
.island-btn-live {
  background: rgba(239, 68, 68, 0.18) !important;
  border: 1px solid rgba(239, 68, 68, 0.25) !important;
}

.island-btn-live:hover {
  background: rgba(239, 68, 68, 0.28) !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
  transform: translateY(-1px) scale(1.03) !important;
}

.island-btn-live.active {
  background: rgba(239, 68, 68, 0.45) !important;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.island-btn-live i {
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.75);
}

/* Indicador de pulso sutil */
.island-btn-live::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 6px;
  height: 6px;
  background: rgba(239, 68, 68, 0.7);
  border-radius: 50%;
  animation: livePulse 2.2s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.15); }
}

/* ==========================================
   AI CHAT BUTTON - Sutil y elegante
   ========================================== */
.island-btn-ai {
  background: rgba(6, 190, 222, 0.12) !important;
  border: 1px solid rgba(6, 190, 222, 0.25) !important;
}

.island-btn-ai:hover {
  background: rgba(6, 190, 222, 0.22) !important;
  box-shadow: 0 4px 12px rgba(6, 190, 222, 0.2);
  transform: translateY(-1px) scale(1.03);
}

.island-btn-ai.active,
.island-btn-ai.chat-open {
  background: rgba(6, 190, 222, 0.38) !important;
  box-shadow: 0 4px 14px rgba(6, 190, 222, 0.28);
}

.island-btn-ai i {
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.75);
}

/* ========== AUTHENTICATION-BASED VISIBILITY ========== */

/* Por defecto: ocultar botones que requieren auth */
.floating-island-nav .island-btn.requires-auth {
    display: none;
}

/* Por defecto: mostrar botón de login para invitados */
.floating-island-nav .island-btn.guest-only {
    display: flex;
}

/* Cuando el usuario está autenticado */
.floating-island-nav.authenticated .island-btn.requires-auth {
    display: flex;
}

.floating-island-nav.authenticated .island-btn.guest-only {
    display: none;
}

/* Estilo especial para el botón de login */
.floating-island-nav .island-btn-login {
    background: linear-gradient(135deg, #06BEDE 0%, #4AABDF 100%);
}

.floating-island-nav .island-btn-login:hover {
    background: linear-gradient(135deg, #4AABDF 0%, #06BEDE 100%);
    transform: scale(1.1);
}

.floating-island-nav .island-btn-login i {
    color: #ffffff;
}
