/**
 * Mobile Menu Styles - Estilos para menú hamburguesa escalable
 * Estilos reutilizables para el sistema de menú móvil
 */

/* ========== DESKTOP STYLES ========== */
.mobile-menu-toggle {
  display: flex !important; /* Forzar visibilidad en desktop */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  gap: 4px;
  transition: all 0.2s ease;
  border-radius: 4px;
  z-index: 1001; /* Mayor que el panel lateral */
  position: relative;
}

/* Ocultar el segundo menú hamburguesa (el de la derecha) */
.mobile-menu-toggle:nth-of-type(2) {
  display: none !important;
}

/* Ocultar menús hamburguesa que no tengan el ID específico */
button.mobile-menu-toggle:not(#mobileMenuToggle) {
  display: none !important;
}

/* Asegurar que el header tenga suficiente espacio */
.topbar {
  padding-right: 20px !important;
  gap: 16px !important;
}

/* Mejorar el espaciado de los badges */
.meta-bar .badges {
  gap: 12px !important;
  margin-right: 20px !important;
}

.badge {
  white-space: nowrap !important;
  overflow: visible !important;
  background: rgba(79, 70, 229, 0.2) !important;
  color: #a5b4fc !important;
  padding: 4px 8px !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  border: 1px solid rgba(79, 70, 229, 0.3) !important;
}


.mobile-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
}

.mobile-menu-toggle:focus {
  outline: 2px solid rgba(255, 255, 255, 0.3);
  outline-offset: 2px;
}

.mobile-menu-toggle span {
  width: 20px;
  height: 2px;
  background: #fff;
  transition: all 0.3s ease;
  border-radius: 1px;
}

.mobile-menu-toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.mobile-menu-toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

.mobile-nav {
  display: none; /* Ocultar menú móvil en desktop por defecto */
  position: fixed;
  top: 0;
  right: -350px; /* Inicialmente oculto fuera de la pantalla */
  width: 350px; /* Reducir ancho para no cubrir el menú hamburguesa */
  height: 100vh;
  background: rgba(0, 0, 0, 0.98);
  backdrop-filter: blur(20px);
  padding: 40px 30px;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
  z-index: 999; /* Menor que el menú hamburguesa */
  transition: right 0.3s ease-in-out;
  overflow-y: auto;
}

.mobile-nav.show {
  display: flex !important;
  flex-direction: column;
  gap: 20px;
  right: 0; /* Se desliza desde la derecha */
}

/* Quitar el header "Navegación" */
.mobile-nav::after {
  display: none;
}

/* Ajustar el padding sin header */
.mobile-nav.show {
  padding-top: 40px;
}

.mobile-nav a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  color: #fff;
  text-decoration: none;
  font-size: 18px;
  font-weight: 500;
  transition: all 0.3s ease;
  border-radius: 12px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.mobile-nav a:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateX(-8px);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.mobile-nav a:active {
  background: rgba(255, 255, 255, 0.25);
  transform: translateX(-4px);
}

.mobile-nav a[data-icon]::before {
  font-size: 24px;
  width: 32px;
  text-align: center;
}

.desktop-nav {
  display: none; /* Ocultar navegación desktop */
}

/* Overlay para el side panel en escritorio */
.mobile-nav::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.mobile-nav.show::before {
  opacity: 1;
  pointer-events: auto;
}

/* ========== MOBILE STYLES ========== */
@media (max-width: 768px) {
  /* Ocultar navegación desktop en móvil */
  .desktop-nav {
    display: none !important;
  }
  
  /* Los estilos del botón hamburguesa ya están definidos en la sección desktop */
  
  /* Menú desplegable para móvil */
  .mobile-nav {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    height: auto !important;
    background: rgba(10, 10, 10, 0.98);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 0;
    display: none;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: none !important;
  }
  
  .mobile-nav.show {
    display: flex;
  }
  
  /* Enlaces del menú */
  .mobile-nav a {
    padding: 12px 20px;
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .mobile-nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: rgba(255, 255, 255, 0.3);
    transform: translateX(4px);
  }
  
  .mobile-nav a:focus {
    outline: 2px solid rgba(255, 255, 255, 0.3);
    outline-offset: -2px;
  }
  
  /* Botones especiales en el menú */
  .mobile-nav a.btn {
    margin: 8px 20px;
    text-align: center;
    border-radius: 8px;
    border-left: none;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
  }
  
  .mobile-nav a.btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
  }
  
  /* Iconos en enlaces */
  .mobile-nav a[data-icon]::before {
    content: attr(data-icon);
    font-size: 18px;
  }
  
  /* Separadores */
  .mobile-nav .separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 20px;
  }
  
  /* Grupos de enlaces */
  .mobile-nav .menu-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  
  .mobile-nav .menu-group-title {
    padding: 8px 20px 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
  }
}

/* ========== RESPONSIVE BREAKPOINTS ========== */
@media (max-width: 480px) {
  .mobile-menu-toggle {
    width: 36px;
    height: 36px;
  }
  
  .mobile-menu-toggle span {
    width: 18px;
    height: 2px;
  }
  
  .mobile-nav {
    padding: 12px 0;
  }
  
  .mobile-nav a {
    padding: 10px 16px;
    font-size: 15px;
  }
  
  .mobile-nav a.btn {
    margin: 6px 16px;
    padding: 10px 16px;
  }
}

@media (max-width: 360px) {
  .mobile-menu-toggle {
    width: 32px;
    height: 32px;
  }
  
  .mobile-menu-toggle span {
    width: 16px;
    height: 1.5px;
  }
  
  .mobile-nav a {
    padding: 8px 12px;
    font-size: 14px;
  }
  
  .mobile-nav a.btn {
    margin: 4px 12px;
    padding: 8px 12px;
  }
}

/* ========== ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
  .mobile-menu-toggle span,
  .mobile-nav a {
    transition: none;
  }
}

/* ========== DARK MODE SUPPORT ========== */
@media (prefers-color-scheme: dark) {
  .mobile-nav {
    background: rgba(0, 0, 0, 0.95);
  }
}

/* ========== HIGH CONTRAST MODE ========== */
@media (prefers-contrast: high) {
  .mobile-menu-toggle span {
    background: #000;
  }
  
  .mobile-nav {
    background: #fff;
    border-top-color: #000;
  }
  
  .mobile-nav a {
    color: #000;
    border-left-color: #000;
  }
  
  .mobile-nav a:hover {
    background: #f0f0f0;
  }
}
