/* ========================================
   ECOSISTIA CRITICAL FIXES v3.0
   Correcciones específicas para problemas críticos
   ======================================== */

/* ========================================
   1. CORRECCIONES CRÍTICAS DE CONTRASTE
   ======================================== */

/* Asegurar texto blanco visible en hero */
.hero-title {
  color: #FFFFFF !important;
  text-shadow: 0 2px 15px rgba(0, 0, 0, 0.4) !important;
  font-weight: 800 !important;
}

.hero-subtitle {
  color: #E2E8F0 !important;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.3) !important;
}

/* Gradiente de texto con fallback */
.text-gradient {
  background: linear-gradient(135deg, #FFFFFF 0%, #E2E8F0 30%, #CBD5E1 70%, #94A3B8 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  /* Fallback crítico */
  color: #FFFFFF;
}

/* Soporte para navegadores sin backdrop-filter */
@supports not (backdrop-filter: blur(20px)) {
  .text-gradient {
    background: none !important;
    -webkit-text-fill-color: unset !important;
    color: #FFFFFF !important;
  }
}

/* ========================================
   2. MODAL DE COOKIES CORREGIDO
   ======================================== */

/* Tamaño del modal optimizado */
.cookie-modal-content {
  max-width: 420px !important;
  max-height: 60vh !important;
  margin: auto !important;
}

/* Espaciado interno reducido */
.cookie-modal-header {
  padding: 1.5rem !important;
}

.cookie-modal-body {
  padding: 1.25rem !important;
}

.cookie-modal-footer {
  padding: 1.25rem !important;
}

.cookie-category {
  margin-bottom: 1.25rem !important;
}

/* Botones más visibles */
.cookie-accept-all {
  background: linear-gradient(135deg, #3730A3 0%, #1D4ED8 100%) !important;
  color: white !important;
  border: none !important;
  font-weight: 600 !important;
  min-height: 44px !important;
}

.cookie-save {
  background: white !important;
  color: #3730A3 !important;
  border: 2px solid #3730A3 !important;
  font-weight: 600 !important;
  min-height: 44px !important;
}

/* Responsive mejorado para modal */
@media (max-width: 768px) {
  .cookie-modal-content {
    max-width: 95% !important;
    max-height: 80vh !important;
    margin: 1rem !important;
  }
  
  .cookie-modal-header,
  .cookie-modal-body,
  .cookie-modal-footer {
    padding: 1rem !important;
  }
  
  .cookie-modal-footer {
    flex-direction: column !important;
    gap: 0.75rem !important;
  }
  
  .cookie-accept-all,
  .cookie-save {
    width: 100% !important;
  }
}

/* ========================================
   3. NAVEGACIÓN CORREGIDA
   ======================================== */

/* Header con mejor contraste */
#header {
  background: rgba(248, 250, 252, 0.98) !important;
  backdrop-filter: blur(25px) !important;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8) !important;
}

/* Logo más visible */
.logo-text {
  background: linear-gradient(135deg, #3730A3 0%, #1D4ED8 70%, #2563EB 100%) !important;
  background-clip: text !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  font-weight: 900 !important;
}

/* Navegación móvil corregida */
@media (max-width: 768px) {
  .nav-menu {
    position: fixed !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    background: rgba(248, 250, 252, 0.98) !important;
    backdrop-filter: blur(25px) !important;
    border-top: 1px solid rgba(226, 232, 240, 0.8) !important;
    transform: translateY(-100%) !important;
    transition: transform 0.3s ease !important;
    flex-direction: column !important;
    padding: 1rem !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
  }
  
  .nav-menu.active {
    transform: translateY(0) !important;
  }
  
  .nav-toggle {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    padding: 8px !important;
  }
  
  .nav-toggle span {
    width: 25px !important;
    height: 3px !important;
    background: #3730A3 !important;
    border-radius: 2px !important;
    transition: all 0.3s ease !important;
  }
  
  .nav-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg) !important;
  }
  
  .nav-toggle.active span:nth-child(2) {
    opacity: 0 !important;
  }
  
  .nav-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg) !important;
  }
}

/* ========================================
   4. ELEMENTOS FLOTANTES CORREGIDOS
   ======================================== */

/* Floating cards responsivas */
@media (max-width: 1024px) {
  .hero-visual {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 1rem !important;
    height: auto !important;
    padding: 2rem 0 !important;
  }
  
  .floating-card {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0.5rem !important;
    animation: none !important;
    transform: none !important;
  }
}

@media (max-width: 768px) {
  .hero-content {
    grid-template-columns: 1fr !important;
    text-align: center !important;
  }
  
  .hero-visual {
    order: 2 !important;
    padding: 1rem 0 !important;
  }
  
  .floating-card {
    width: 100% !important;
    max-width: 280px !important;
  }
}

/* ========================================
   5. ACCESIBILIDAD MEJORADA
   ======================================== */

/* Focus indicators mejorados */
.nav-link:focus-visible,
.btn:focus-visible,
.cookie-accept-all:focus-visible,
.cookie-save:focus-visible {
  outline: 3px solid #EA580C !important;
  outline-offset: 2px !important;
  border-radius: 4px !important;
}

/* Tamaños de toque mínimos */
.btn,
.nav-link,
.cookie-accept-all,
.cookie-save {
  min-height: 44px !important;
  min-width: 44px !important;
}

/* Contraste para usuarios con preferencias altas */
@media (prefers-contrast: high) {
  .text-gradient {
    background: none !important;
    -webkit-text-fill-color: unset !important;
    color: #FFFFFF !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8) !important;
  }
  
  .hero-subtitle {
    color: #FFFFFF !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8) !important;
  }
  
  .btn-primary {
    background: #1D4ED8 !important;
    border: 2px solid #FFFFFF !important;
  }
}

/* ========================================
   6. OPTIMIZACIONES DE RENDIMIENTO
   ======================================== */

/* Prevenir repaints innecesarios */
.floating-card,
.service-card,
.btn {
  will-change: transform !important;
  backface-visibility: hidden !important;
}

/* Fix para texto del hero no visible */
.hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
  color: #ffffff;
}

.hero-title {
  color: #ffffff !important;
}

.hero-title .text-gradient {
  background: linear-gradient(135deg, #10B981 0%, #34D399 50%, #6EE7B7 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
  filter: brightness(1.2);
  font-weight: 900;
}

.hero-subtitle {
  color: #e2e8f0 !important;
}

/* Animaciones optimizadas */
@keyframes float-optimized {
  0%, 100% {
    transform: translateY(0) translateZ(0);
  }
  50% {
    transform: translateY(-10px) translateZ(0);
  }
}

.floating-card {
  animation: float-optimized 6s ease-in-out infinite !important;
}

/* Desactivar animaciones en dispositivos de bajo rendimiento */
@media (prefers-reduced-motion: reduce) {
  .floating-card,
  .geometric-shape {
    animation: none !important;
    transform: none !important;
  }
  
  .btn,
  .service-card,
  .nav-link {
    transition: none !important;
  }
}

/* ========================================
   7. CORRECCIONES ESPECÍFICAS DE LAYOUT
   ======================================== */

/* Asegurar que el hero ocupe la altura correcta */
.hero {
  min-height: 100vh !important;
  min-height: 100dvh !important; /* Para navegadores modernos */
}

/* Espaciado consistente */
.section-spacing {
  padding: clamp(3rem, 8vw, 5rem) 0 !important;
}

/* Container responsivo */
.container {
  max-width: 1280px !important;
  margin: 0 auto !important;
  padding: 0 clamp(1rem, 4vw, 2rem) !important;
}

/* ========================================
   8. CORRECCIONES DE TIPOGRAFÍA
   ======================================== */

/* Escala tipográfica responsiva */
.hero-title {
  font-size: clamp(2rem, 6vw, 4rem) !important;
  line-height: 1.1 !important;
}

.hero-subtitle {
  font-size: clamp(1rem, 3vw, 1.25rem) !important;
  line-height: 1.6 !important;
}

.section-title {
  font-size: clamp(1.75rem, 5vw, 3rem) !important;
  line-height: 1.2 !important;
}

/* ========================================
   9. CORRECCIONES ESPECÍFICAS PARA SEO
   ======================================== */

/* Asegurar que el contenido sea legible para crawlers */
.text-gradient,
.hero-title,
.hero-subtitle {
  /* Mantener el color como fallback para SEO */
  color: #FFFFFF;
}

/* Estructura semántica clara */
main {
  outline: none !important;
}

/* Enlaces con mejor contraste */
a {
  color: #1D4ED8 !important;
}

a:hover {
  color: #3730A3 !important;
}

/* ========================================
   10. UTILITY CLASSES PARA CORRECCIONES
   ======================================== */

.force-white-text {
  color: #FFFFFF !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5) !important;
}

.high-contrast {
  background: #000000 !important;
  color: #FFFFFF !important;
}

.no-animation {
  animation: none !important;
  transition: none !important;
}

.visible-focus:focus {
  outline: 3px solid #EA580C !important;
  outline-offset: 2px !important;
}