/* Estilos críticos del header para evitar FOUC */

/* Ocultar header hasta que los estilos estén cargados */
.navbar {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 1px solid #e2e8f0;
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
}

/* Asegurar que el botón de cerrar esté siempre visible */
.navbar-toggler {
  position: relative;
  z-index: 320 !important;
}

/* Clase para mostrar el header cuando los estilos estén listos */
.navbar-loaded {
  opacity: 1;
  visibility: visible;
}

/* Estilos mínimos críticos para el header */
.navbar-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.logo-header {
  max-height: 75px;
  width: auto;
  display: block;
}

/* Estilos básicos para navegación */
.navbar-nav {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: #374151;
  font-weight: 500;
  border-radius: 8px;
  margin: 0 2px;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: rgba(59, 130, 246, 0.08);
  color: #3b82f6;
  transform: translateY(-1px);
}

/* Estilos para dropdown */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 8px 0;
  min-width: 240px;
  max-width: 280px;
  max-height: none;
  overflow-y: visible;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: none;
  z-index: 320;
}

.dropdown-menu.show {
  display: block;
}

/* Estilos para la barra de desplazamiento del dropdown - OCULTADA */
.dropdown-menu::-webkit-scrollbar {
  width: 0;
  display: none;
}

.dropdown-menu::-webkit-scrollbar-track {
  display: none;
}

.dropdown-menu::-webkit-scrollbar-thumb {
  display: none;
}

.dropdown-menu::-webkit-scrollbar-thumb:hover {
  display: none;
}

.dropdown-item {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  text-decoration: none;
  color: #374151;
  font-weight: 500;
  border-radius: 6px;
  margin: 1px 6px;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  white-space: nowrap;
}

.dropdown-item:hover {
  background: rgba(59, 130, 246, 0.08);
  color: #3b82f6;
  transform: translateX(4px);
}

/* Estilos para el divider del dropdown */
.dropdown-divider {
  margin: 4px 8px;
  border-color: #e5e7eb;
  opacity: 0.6;
}

/* Estilos para botón de menú móvil */
.navbar-toggler {
  display: none;
  border: none;
  background: transparent;
  padding: 0.25rem 0.75rem;
  font-size: 1.25rem;
  line-height: 1;
  border-radius: 0.25rem;
  transition: box-shadow 0.15s ease-in-out;
  position: relative;
  z-index: 320;
}

/* Ocultar botón de menú en desktop */
@media (min-width: 992px) {
  .navbar-toggler {
    display: none !important;
  }
}

/* Responsive */
@media (max-width: 991.98px) {
  .navbar-toggler {
    display: block;
    position: relative;
    z-index: 320;
  }
  
  .navbar-collapse {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 310;
  }

  /* Botón de cerrar en la esquina superior derecha */
  .navbar-collapse .navbar-toggler {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 330;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
  }

  .navbar-collapse .navbar-toggler:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
  
  .navbar-collapse.show {
    transform: translateX(0);
  }
  
  .navbar-nav {
    flex-direction: column;
    padding: 4rem 1rem 2rem 1rem;
  }
  
  .nav-item {
    margin: 0.5rem 0;
  }
  
  .dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    background: transparent;
    padding-left: 1rem;
    max-height: none;
    overflow-y: visible;
  }
}

/* Desktop - Ocultar botón de menú y mostrar navegación */
@media (min-width: 992px) {
  .navbar-toggler {
    display: none !important;
  }
  
  .navbar-collapse {
    display: flex !important;
    opacity: 1 !important;
    transform: none !important;
    position: static;
    width: auto;
    height: auto;
    background: transparent;
    backdrop-filter: none;
  }
  
  .navbar-nav {
    flex-direction: row;
    padding: 0;
  }
  
  .nav-item {
    margin: 0;
  }
  
  .dropdown-menu {
    position: absolute;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    background: #ffffff;
    padding-left: 0;
    max-height: none;
    overflow-y: visible;
  }
  
  .dropdown-menu::-webkit-scrollbar {
    width: 0;
    display: none;
  }
  
  .dropdown-menu::-webkit-scrollbar-track {
    display: none;
  }
  
  .dropdown-menu::-webkit-scrollbar-thumb {
    display: none;
  }
  
  .dropdown-menu::-webkit-scrollbar-thumb:hover {
    display: none;
  }
}

/* Estilos para el botón de contacto al final del header */
.header-contact-btn {
  margin-left: auto;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
  background: #3b82f6;
  color: white;
  border: none;
}

.header-contact-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  background: #2563eb;
  color: white;
  text-decoration: none;
}

/* Ocultar botón de contacto en móvil */
@media (max-width: 991.98px) {
  .header-contact-btn {
    display: none !important;
  }
}

/* PREVENIR LAYOUT SHIFT - Estilos para componentes diferidos */
.final-cta {
  min-height: 400px; /* Reservar espacio para el componente verprecios */
}

.section-modern {
  min-height: 300px; /* Reservar espacio para componentes diferidos */
}

/* Placeholder para componentes que se cargan diferidamente */
.placeholder-container {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-radius: 8px;
  margin: 1rem 0;
}

/* Estilos para spinners de carga */
.spinner-border {
  width: 3rem;
  height: 3rem;
}

/* Reservar espacio para imágenes */
img {
  max-width: 100%;
  height: auto;
}

/* Asegurar que las imágenes tengan dimensiones */
img[width][height] {
  aspect-ratio: attr(width) / attr(height);
}

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

.navbar-loaded {
  animation: fadeInUp 0.5s ease-out;
} 