/* ================================================
   ESTILOS PARA COBERTURA INTERNACIONAL - FLYNET
   ================================================ */

/* Hero Section Mejorado */
.hero-mapa {
  background: linear-gradient(135deg, #1697bf 0%, #55bde5 100%);
  padding: 120px 0 60px 0; /* Más padding inferior para mejor separación */
  margin-top: 0;
  color: white;
  position: relative;
  overflow: hidden;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-title {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  animation: fadeInUp 0.8s ease-out;
}

.hero-subtitle {
  font-size: 1.2rem;
  opacity: 0.95;
  margin-bottom: 2rem;
  line-height: 1.6;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* Botones del Hero */
.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  margin-bottom: 2rem;
  animation: fadeInUp 0.8s ease-out 0.4s both;
}

.btn-hero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 25px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  min-width: 160px;
  position: relative;
  overflow: hidden;
}

.btn-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn-hero:hover::before {
  left: 100%;
}

.btn-hero-primary {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border-color: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-hero-primary:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  color: white;
}

.btn-hero-secondary {
  background: transparent;
  color: white;
  border-color: rgba(255, 255, 255, 0.5);
}

.btn-hero-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.8);
  transform: translateY(-2px);
  color: white;
}

.btn-hero.active {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Indicador de estado de red */
.hero-network-status {
  animation: fadeInUp 0.8s ease-out 0.6s both;
}

.network-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.network-indicator.active i {
  color: #00ff88;
  animation: pulse 2s infinite;
}

/* Elementos decorativos flotantes */
.hero-decoration {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.floating-icon {
  position: absolute;
  color: rgba(255, 255, 255, 0.1);
  font-size: 2rem;
  animation: float 6s ease-in-out infinite;
}

.floating-icon:nth-child(1) {
  animation-delay: 0s;
}

.floating-icon:nth-child(2) {
  animation-delay: 2s;
}

.floating-icon:nth-child(3) {
  animation-delay: 4s;
}

/* Animaciones */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Responsive para móvil - Hero */
@media (max-width: 768px) {
  .hero-mapa {
    padding: 140px 0 50px 0;
    margin-top: 0;
  }
  
  .hero-title {
    font-size: 2.2rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .hero-buttons {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  
  .btn-hero {
    width: 100%;
    max-width: 280px;
    padding: 14px 20px;
  }
  
  .floating-icon {
    font-size: 1.5rem;
  }
}

/* ================================================
   CONTENEDOR DEL MAPA A PANTALLA COMPLETA
   ================================================ */

.mapa-fullscreen {
  position: relative;
  width: 100%;
  /* Calculamos la altura restante después del header y footer */
  min-height: calc(100vh - 300px);
  background: #f8f9fa;
  overflow: hidden;
  margin-top: 0; /* Sin margen ya que el hero maneja el espaciado */
}

/* El objeto SVG debe ocupar todo el contenedor */
.mapa-interactivo {
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 120px);
  border: none;
  display: block;
  transition: transform 0.3s ease;
  transform-origin: center center;
}

/* ================================================
   CONTROLES DE ZOOM Y NAVEGACIÓN
   ================================================ */

/* Controles de zoom */
.zoom-controls {
  position: absolute;
  bottom: 100px; /* Más espacio para el footer */
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.zoom-btn {
  width: 50px;
  height: 50px;
  background: rgba(22, 151, 191, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.zoom-btn:hover {
  background: rgba(22, 151, 191, 1);
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.zoom-btn:active {
  transform: scale(0.95);
}

.zoom-reset {
  background: rgba(85, 189, 229, 0.9);
  font-size: 14px;
  width: 60px;
  height: 35px;
  border-radius: 20px;
}

.zoom-reset:hover {
  background: rgba(85, 189, 229, 1);
}

/* Indicador de zoom */
.zoom-indicator {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 1000;
}

/* ================================================
   FUNCIONALIDAD DE ARRASTRE
   ================================================ */

/* Cursor de arrastre para el mapa */
.mapa-fullscreen.can-drag,
.mapa-fullscreen.can-drag *,
.mapa-interactivo.draggable {
  cursor: grab !important;
}

.mapa-fullscreen.can-drag:active,
.mapa-fullscreen.dragging,
.mapa-fullscreen.dragging *,
.mapa-interactivo.dragging,
.mapa-interactivo.dragging * {
  cursor: grabbing !important;
}

.mapa-interactivo.dragging {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Transición suave para el transform cuando no se está arrastrando */
.mapa-interactivo:not(.dragging) {
  transition: transform 0.2s ease-out;
}

/* Forzar cursor en el SVG object */
object.mapa-interactivo.draggable {
  cursor: grab !important;
}

object.mapa-interactivo.dragging {
  cursor: grabbing !important;
}

/* ================================================
   ESTILOS DEL HEADER - TEMA NEGRO PARA ESTA PÁGINA
   ================================================ */

/* Estilos adicionales para el header - FONDO TRANSPARENTE */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: transparent !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

/* Solo el navbar principal tendrá fondo negro */
#header .navbar {
  background: rgba(0, 0, 0, 0.95) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
  border-radius: 0 0 15px 15px;
}

/* Asegurar que los elementos del header se carguen correctamente */
.menu-wrap {
  transition: all 0.3s ease;
}

.menu-wrap.loading {
  opacity: 0.7;
}

/* Mejorar legibilidad del menú - TEMA NEGRO PARA ESTA PÁGINA */
#header .navbar .nav-menu {
  background: rgba(0, 0, 0, 0.98) !important;
  border-radius: 0 0 10px 10px;
}

#header .navbar .nav-menu a,
#header .navbar .nav-link {
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  font-weight: 500;
}

#header .navbar .nav-menu a:hover,
#header .navbar .nav-link:hover {
  color: #00d4ff !important;
  background: rgba(0, 212, 255, 0.1);
}

/* Logo y elementos del navbar en blanco */
#header .navbar .navbar-brand,
#header .navbar .navbar-brand *,
#header .navbar .nav-link,
#header .navbar .navbar-toggler {
  color: #ffffff !important;
}

/* Restaurar colores normales para el logo */
#header .navbar .navbar-brand img {
  filter: none;
}

/* Estilos adicionales para tema negro */
#header .navbar .menu-toggle .icon {
  background: #ffffff !important;
}

#header .navbar .dropdown-menu {
  background: rgba(0, 0, 0, 0.95) !important;
  border: 1px solid #333;
}

#header .navbar .dropdown-item {
  color: #ffffff !important;
}

#header .navbar .dropdown-item:hover {
  background: rgba(0, 212, 255, 0.1) !important;
  color: #00d4ff !important;
}

/* Fix para elementos del menú que no cargan */
.nav-menu {
  display: flex;
  align-items: center;
}

/* ================================================
   MENÚ MÓVIL Y RESPONSIVE
   ================================================ */

@media (max-width: 767px) {
  .nav-menu {
    position: fixed;
    top: 70px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 70px);
    background: white;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    transition: left 0.3s ease;
  }
  
  .nav-menu.active {
    left: 0;
  }
}

/* Indicador de carga del header */
.loading-header {
  background: linear-gradient(89deg, #1697bf 3%, #55bde5 98%);
  color: white;
  text-align: center;
  padding: 15px;
  font-size: 14px;
}

/* Estilos para el menú móvil */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 30px;
}

.menu-toggle .icon {
  display: block;
  width: 25px;
  height: 3px;
  background: #333;
  transition: all 0.3s ease;
}

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

.menu-toggle.active .icon:nth-child(2) {
  opacity: 0;
}

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

@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }
  
  .main-menu {
    display: none;
    position: fixed;
    top: 120px;
    left: 0;
    width: 100%;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 999;
    padding: 20px;
  }
  
  .main-menu.mobile-active {
    display: block;
  }
  
  .menu-item {
    display: block;
    width: 100%;
    margin-bottom: 10px;
  }
  
  .sub-menu {
    position: static !important;
    display: none !important;
    box-shadow: none !important;
    background: #f8f9fa !important;
    margin-top: 10px;
    padding: 10px;
  }
}

/* ================================================
   ELEMENTOS DE INTERFAZ
   ================================================ */

/* Estilos adicionales para mejorar la experiencia */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007cba;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Información del mapa */
.mapa-info {
  position: absolute;
  top: 200px; /* Espacio para el header fijo */
  left: 20px;
  background: rgba(255, 255, 255, 0.95);
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  max-width: 300px;
  z-index: 5;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.mapa-info h4 {
  margin: 0 0 10px 0;
  color: #007cba;
  font-size: 1.1rem;
}

.mapa-info p {
  margin: 0;
  font-size: 0.9rem;
  color: #6c757d;
}

/* ================================================
   LEYENDA DE SIMBOLOGÍA DE RED
   ================================================ */

/* Leyenda de simbolos de red - Inferior izquierda */
.mapa-info-simbolos {
  position: absolute;
  bottom: 80px; /* Más separación del indicador zoom */
  left: 20px;
  background: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  z-index: 1000;
  max-width: 240px;
}

.mapa-info-simbolos h4 {
  font-size: 15px;
  margin-bottom: 8px;
  font-weight: 600;
  color: #007cba;
  margin: 0 0 8px 0;
}

.mapa-info-simbolos ul {
  margin: 0;
}

.mapa-info-simbolos ul li {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  color: #495057;
}

.mapa-info-simbolos ul li:last-child {
  margin-bottom: 0;
}

.mapa-info-simbolos .simbolo {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
}

.mapa-info-simbolos .verde { 
  background-color: #28a745; 
}

.mapa-info-simbolos .celeste { 
  background-color: #d50303; 
}

.mapa-info-simbolos .rojo { 
  background-color: #dc3545; 
}

/* ================================================
   BOTÓN DE PANTALLA COMPLETA
   ================================================ */

.fullscreen-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: #007cba;
  color: white;
  border: none;
  padding: 10px;
  border-radius: 5px;
  cursor: pointer;
  z-index: 5;
  transition: background-color 0.3s ease;
}

.fullscreen-btn:hover {
  background: #0056a3;
}

/* Ocultamos el header/footer en modo pantalla completa */
.fullscreen .mapa-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  min-height: 100vh;
}

.fullscreen .mapa-interactivo {
  min-height: 100vh;
}

/* ================================================
   INTERACTIVIDAD DE PAÍSES EN EL MAPA SVG
   ================================================ */

/* Hover con efecto glass amarillo fosforescente */
.country-hover,
.country-hover path,
.country-hover * { 
  filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 8px #ffff00); 
  stroke: #ffff00 !important; 
  stroke-width: 2 !important; 
  fill: rgba(255, 255, 0, 0.15) !important; /* Glass amarillo fosforescente */
  transition: all 0.3s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* Animación de brillo pulsante para el hover */
.country-hover,
.country-hover path,
.country-hover * {
  animation: glassGlow 2s ease-in-out infinite alternate;
}

@keyframes glassGlow {
  0% {
    filter: brightness(1.2) saturate(1.3) drop-shadow(0 0 8px #ffff00);
    stroke-opacity: 0.8;
  }
  100% {
    filter: brightness(1.4) saturate(1.5) drop-shadow(0 0 15px #ffff00);
    stroke-opacity: 1;
  }
}

.country-active,
.country-active path,
.country-active * { 
  filter: brightness(1.1) saturate(1.4) drop-shadow(0 0 12px #ffd700); 
  stroke: #ffd700 !important; 
  stroke-width: 3 !important; 
  fill: rgba(255, 215, 0, 0.2) !important; /* Glass dorado para activo */
  transition: all 0.3s ease;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* Tooltip del mapa */
.map-tooltip {
  position: fixed; /* se posiciona respecto a viewport */
  z-index: 2000;
  pointer-events: none;
  background: rgba(15, 23, 42, .95);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  transform: translate(-50%, 8px); /* Centrado horizontalmente, 8px abajo del cursor */
  opacity: 0;
  transition: opacity .15s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap; /* Evita que el texto se divida en múltiples líneas */
  max-width: 320px;
  min-width: 120px;
  text-align: center;
}

/* Flecha apuntando hacia arriba para conectar con el cursor */
.map-tooltip::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid rgba(15, 23, 42, .95);
  filter: drop-shadow(0 -1px 2px rgba(0,0,0,.15));
}

.map-tooltip.show { 
  opacity: 1; 
}

.map-tooltip .hint { 
  opacity: .7; 
  font-size: 11px; 
  display: block; 
  margin-top: 2px; 
  color: #94a3b8;
}

/* Cursor y focus visibles */
svg .is-country, 
svg .is-country path,
svg .is-country * { 
  cursor: pointer; 
  outline: none; 
  transition: all 0.2s ease;
}

svg .is-country:focus,
svg .is-country:focus path,
svg .is-country:focus * { 
  filter: brightness(1.18) !important; 
  stroke: #36c2ff !important; 
  stroke-width: 3 !important; 
}

svg .is-country:focus {
  outline: 2px solid #36c2ff;
  outline-offset: 2px;
}

/* Animación sutil para países interactivos */
svg .is-country:hover,
svg .is-country:hover path,
svg .is-country:hover * {
  transform-origin: center;
  animation: countryPulse 1.5s ease-in-out infinite;
}

@keyframes countryPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

/* Indicador visual de país seleccionado */
.country-active,
.country-active path,
.country-active * {
  filter: brightness(1.1) saturate(1.2) !important;
  stroke: #ffd700 !important;
  stroke-width: 4 !important;
  stroke-dasharray: 8 4;
  animation: selectedCountry 2s ease-in-out infinite;
}

@keyframes selectedCountry {
  0%, 100% {
    stroke-dashoffset: 0;
  }
  50% {
    stroke-dashoffset: 12;
  }
}

/* Responsive para tooltip en móvil */
@media (max-width: 768px) {
  .map-tooltip {
    font-size: 12px;
    padding: 7px 12px;
    border-radius: 6px;
    transform: translate(-50%, 15px); /* Más separado en móvil para evitar el dedo */
    max-width: 280px;
    min-width: 100px;
  }
  
  .map-tooltip .hint {
    font-size: 11px;
  }
  
  /* En móvil, el tooltip se muestra debajo para evitar ser tapado por el dedo */
  .map-tooltip.mobile {
    transform: translate(-50%, 15px);
  }
  
  /* Flecha más pequeña en móvil */
  .map-tooltip::before {
    top: -4px;
    border-left-width: 4px;
    border-right-width: 4px;
    border-bottom-width: 4px;
  }
}

/* ================================================
   RESPONSIVE DESIGN - MÓVIL
   ================================================ */

@media (max-width: 768px) {
  .mapa-fullscreen {
    min-height: calc(100vh - 320px);
    margin-top: 0; /* Sin margen ya que el hero maneja el espaciado */
  }
  
  /* Controles de zoom en móvil */
  .zoom-controls {
    bottom: 60px;
    right: 10px;
    flex-direction: row;
    gap: 8px;
  }
  
  .zoom-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  
  .zoom-reset {
    width: 50px;
    height: 30px;
    font-size: 12px;
  }
  
  /* Indicador de zoom en móvil */
  .zoom-indicator {
    bottom: 10px;
    left: 10px;
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .mapa-interactivo {
    min-height: calc(100vh - 160px);
  }
  
  /* Responsive para la información del mapa */
  .mapa-info {
    position: relative;
    top: auto;
    left: auto;
    margin: 10px;
    max-width: none;
  }
  
  /* Responsive para leyenda en móvil */
  .mapa-info-simbolos {
    position: absolute;
    bottom: 90px; /* Más separación en móvil también */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 90%;
  }
}
