

/* Compatibilidad con loading crítico */
#critical-loading-screen.loading-screen {
  font-family: 'Nunito Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Loading screen avanzado (cuando no hay crítico) */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #9F2241 0%, #722436 50%, #4a1624 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Contenido del loading avanzado */
.loading-content {
  text-align: center;
  color: white;
  max-width: 400px;
  padding: 0 20px;
}

.loading-logo {
  width: 120px;
  height: auto;
  margin-bottom: 30px;
  animation: pulse-logo 2s ease-in-out infinite;
  filter: brightness(1.1);
}

.loading-title {
  font-size: 2rem;
  font-weight: 300;
  margin-bottom: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  animation: fadeInUp 1s ease-out 0.2s both;
}

.loading-subtitle {
  font-size: 1rem;
  font-weight: 400;
  margin-bottom: 40px;
  opacity: 0.9;
  animation: fadeInUp 1s ease-out 0.4s both;
}

.loading-spinner-container {
  position: relative;
  margin-bottom: 30px;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top: 3px solid #fff;
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
  margin: 0 auto;
}

.loading-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.loading-dot {
  width: 8px;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  animation: dot-bounce 1.4s ease-in-out infinite;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0s; }

.loading-message {
  font-size: 0.9rem;
  opacity: 0.8;
  animation: fadeInUp 1s ease-out 0.6s both;
  min-height: 20px;
}

.loading-progress {
  width: 200px;
  height: 2px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 1px;
  margin: 20px auto 0;
  overflow: hidden;
  animation: fadeInUp 1s ease-out 0.8s both;
}

.loading-progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,1) 50%, rgba(255,255,255,0.8) 100%);
  border-radius: 1px;
  transition: width 0.3s ease;
  animation: progress-shimmer 2s ease-in-out infinite;
}

/* ===== ANIMACIONES ===== */
@keyframes pulse-logo {
  0%, 100% { 
    transform: scale(1);
    filter: brightness(1.1);
  }
  50% { 
    transform: scale(1.05);
    filter: brightness(1.3);
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes dot-bounce {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes progress-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400px); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .loading-title {
    font-size: 1.5rem;
    letter-spacing: 1px;
  }
  
  .loading-subtitle {
    font-size: 0.9rem;
  }
  
  .loading-logo {
    width: 100px;
    margin-bottom: 25px;
  }
  
  .loading-progress {
    width: 160px;
  }
}

@media (max-width: 480px) {
  .loading-title {
    font-size: 1.3rem;
  }
  
  .loading-subtitle {
    font-size: 0.8rem;
  }
  
  .loading-logo {
    width: 80px;
    margin-bottom: 20px;
  }
}

/* ===== PREVENCION DE SCROLL DURANTE CARGA ===== */
/* Coordinación con loading crítico */
body.loading-active {
  overflow: hidden !important;
  height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Solo aplicar ocultación si NO hay loading crítico activo */
body.loading-active:not(.critical-loading-active) .navbar_inah,
body.loading-active:not(.critical-loading-active) .main_content,
body.loading-active:not(.critical-loading-active) header:not(.loading-screen),
body.loading-active:not(.critical-loading-active) nav:not(.loading-screen *),
body.loading-active:not(.critical-loading-active) main:not(.loading-screen *) {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Ocultar framework del gobierno cuando loading avanzado está activo */
body.loading-active header.navbar.navbar-inverse.navbar-fixed-top,
body.loading-active .gob-header,
body.loading-active .gm-header,
body.loading-active .framework-header {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
}

/* ===== COMPATIBILIDAD CON FRAMEWORK GOB.MX ===== */
.loading-screen {
  font-family: 'Nunito Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ===== ESTADOS ADICIONALES ===== */
.loading-screen.error {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 50%, #a71e2a 100%);
}

.loading-screen.success {
  background: linear-gradient(135deg, #28a745 0%, #20c997 50%, #17a2b8 100%);
}