/* ============================================================
   index.css - Lazarus Technology - Optimized Edition v2.1 (Refactorizado)
   Versión optimizada con mejor rendimiento y accesibilidad
   ============================================================ */

/* ============================================================
   VARIABLES CSS - Sistema de Diseño
   ============================================================ */
:root {
  /* Colores Primarios */
  --lazarus-primary: #2563eb;
  --lazarus-secondary: #7c3aed;
  --lazarus-accent-1: #059669;
  --lazarus-accent-2: #dc2626;
  
  /* Colores de Superficie */
  --lazarus-white: #ffffff;
  --lazarus-light: #f8fafc;
  --lazarus-medium: #e2e8f0;
  --lazarus-dark: #1e293b;
  --lazarus-darker: #0f172a;
  
  /* Gradientes */
  --gradient-primary: linear-gradient(135deg, var(--lazarus-primary), var(--lazarus-secondary));
  --gradient-hero: linear-gradient(135deg, #1e3a8a 0%, #3730a3 50%, #7e22ce 100%);
  --gradient-light: linear-gradient(180deg, var(--lazarus-light) 0%, #f1f5f9 100%);
  
  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 30px rgba(37, 99, 235, 0.3);
  
  /* Border Radius */
  --border-radius-sm: 6px;
  --border-radius-md: 12px;
  --border-radius-lg: 20px;
  --border-radius-xl: 30px;
  
  /* Espaciado */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-2xl: 5rem;
  
  /* Tipografía */
  --font-heading: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  
  /* Transiciones */
  --transition-fast: 200ms ease;
  --transition-normal: 300ms ease;
  --transition-slow: 500ms ease;
  --easing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   RESET Y BASE
   ============================================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  line-height: 1.7;
  color: var(--lazarus-dark);
  background-color: var(--lazarus-white);
  overflow-x: hidden;
}

/* ============================================================
   TRANSICIONES OPTIMIZADAS
   Solo propiedades específicas para mejor rendimiento
   ============================================================ */
button, a, .btn, .info-card, .form-control, .interactive-element,
.contact-content, .contact-item, .contact-form {
  transition: 
    transform var(--transition-normal) var(--easing-smooth),
    background-color var(--transition-normal) var(--easing-smooth),
    box-shadow var(--transition-normal) var(--easing-smooth),
    color var(--transition-fast) var(--easing-smooth),
    border-color var(--transition-fast) var(--easing-smooth);
}

/* ============================================================
   ACCESIBILIDAD
   ============================================================ */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--lazarus-primary);
  color: white;
  padding: var(--spacing-sm) var(--spacing-md);
  text-decoration: none;
  z-index: 10000;
  border-radius: 0 0 var(--border-radius-md) 0;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--lazarus-accent-1);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus visible para teclado */
*:focus-visible {
  outline: 3px solid var(--lazarus-primary);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--lazarus-accent-1);
}

/* ============================================================
   CONTENEDOR
   ============================================================ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* ============================================================
   SCROLL PROGRESS BAR
   ============================================================ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 4px;
  background: var(--gradient-primary);
  z-index: 9999;
  transition: width 0.1s ease;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
}

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero-section {
  background: var(--gradient-hero);
  color: var(--lazarus-white);
  padding: 12rem 0 8rem;
  position: relative;
  overflow: hidden;
}

/* Canvas de partículas */
#particles-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Patrón geométrico de fondo */
.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.03) 30%, rgba(255,255,255,0.03) 70%, transparent 70%),
    linear-gradient(-45deg, transparent 30%, rgba(255,255,255,0.03) 30%, rgba(255,255,255,0.03) 70%, transparent 70%);
  background-size: 60px 60px;
  animation: patternSlide 20s linear infinite;
}

@keyframes patternSlide {
  0% { background-position: 0 0; }
  100% { background-position: 60px 60px; }
}

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

.hero-logo {
  height: 100px;
  width: auto;
  margin-bottom: var(--spacing-md);
  filter: brightness(0) invert(1) drop-shadow(0 0 20px rgba(255,255,255,0.5));
  animation: float 3s ease-in-out infinite;
}

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

.hero-title {
  font-family: var(--font-heading);
  font-size: var(--text-5xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--spacing-sm);
  line-height: 1.2;
  text-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.hero-title.typing::after {
  content: '|';
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.hero-subtitle {
  font-size: var(--text-xl);
  margin-bottom: var(--spacing-lg);
  opacity: 0.95;
  animation: fadeInUp 1s ease 0.5s both;
}

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

.hero-actions {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeInUp 1s ease 0.8s both;
}

/* ============================================================
   SECCIONES
   ============================================================ */
.section-padding {
  padding: var(--spacing-2xl) 0;
}

.bg-light {
  background: var(--gradient-light);
  position: relative;
}

.bg-light::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
  pointer-events: none;
}

.section-header {
  margin-bottom: var(--spacing-2xl);
}

.section-header h2 {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  color: var(--lazarus-darker);
  margin-bottom: var(--spacing-sm);
  position: relative;
  display: inline-block;
}

.section-header h2::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: var(--gradient-primary);
  border-radius: 2px;
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--lazarus-secondary);
  font-weight: var(--font-medium);
}

/* ============================================================
   ABOUT SECTION
   ============================================================ */
.about-content {
  max-width: 800px;
  margin: 0 auto;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-block;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--border-radius-md);
  text-decoration: none;
  font-weight: var(--font-medium);
  transition: all var(--transition-normal) var(--easing-smooth);
}

.btn-primary {
  background: var(--lazarus-primary);
  color: var(--lazarus-white);
  border: 2px solid var(--lazarus-primary);
}

.btn-primary:hover {
  background: var(--lazarus-white);
  color: var(--lazarus-primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--lazarus-secondary);
  color: var(--lazarus-white);
  border: 2px solid var(--lazarus-secondary);
}

.btn-secondary:hover {
  background: var(--lazarus-white);
  color: var(--lazarus-secondary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.btn-full {
  width: 100%;
}

/* ============================================================
   ANIMACIONES DE SCROLL
   ============================================================ */
.scroll-animate {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.8s var(--easing-smooth), transform 0.8s var(--easing-smooth);
}

.scroll-animate.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Utility para debug: Agregar a body para forzar visible */
.debug-visible .scroll-animate {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* ============================================================
   LOADING SCREEN
   ============================================================ */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-hero);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  z-index: 10000;
  transition: opacity 0.5s, visibility 0.5s;
}

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

.loader {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   ERROR STATES
   ============================================================ */
.component-error,
.critical-error {
  padding: var(--spacing-xl);
  background: #fef2f2;
  border: 2px solid var(--lazarus-accent-2);
  border-radius: var(--border-radius-md);
  text-align: center;
  margin: var(--spacing-lg) 0;
}

.critical-error {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  box-shadow: var(--shadow-xl);
  z-index: 10001;
  max-width: 500px;
  width: 90%;
}

.error-content h2 {
  color: var(--lazarus-accent-2);
  margin-bottom: var(--spacing-md);
}

.error-content button {
  margin-top: var(--spacing-md);
}

/* ============================================================
   UTILITIES
   ============================================================ */
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */
@media (max-width: 1024px) {
  .footer-content {
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
  }
  
  .contact-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
  }
}

@media (max-width: 768px) {
  :root {
    --spacing-2xl: 3rem;
    --spacing-xl: 2rem;
  }
  
  .hero-title {
    font-size: var(--text-4xl);
  }
  
  .hero-section {
    padding: 10rem 0 6rem;
  }
  
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .btn {
    width: 100%;
    max-width: 300px;
  }
  
  .services-grid {
    grid-template-columns: 1fr;
  }
  
  .products-grid {
    grid-template-columns: 1fr;
  }
  
  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .social-links {
    justify-content: center;
  }
  
  /* Deshabilitar efectos 3D en móviles */
  .service-card:hover {
    transform: translateY(-8px);
  }
  
  /* Reducir animaciones de partículas en móviles */
  #particles-canvas {
    opacity: 0.3;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--spacing-sm);
  }
  
  .hero-section {
    padding: 8rem 0 4rem;
  }
  
  .hero-title {
    font-size: var(--text-3xl);
  }
  
  .hero-logo {
    height: 80px;
  }
  
  .section-header h2 {
    font-size: var(--text-2xl);
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .social-link {
    width: 36px;
    height: 36px;
  }
  
  .social-icon {
    width: 18px;
    height: 18px;
  }
  
  .modal-content {
    width: 95%;
  }
  
  .modal-body {
    padding: var(--spacing-lg);
  }
}

/* ============================================================
   ACCESIBILIDAD - REDUCCIÓN DE MOVIMIENTO
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .hero-logo {
    animation: none;
  }
  
  .modal-icon {
    animation: none;
  }
  
  #particles-canvas {
    display: none;
  }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .skip-link,
  .scroll-progress,
  .hero-actions,
  .btn,
  .social-links,
  #particles-canvas,
  .loading-screen {
    display: none !important;
  }
  
  body {
    color: #000;
    background: #fff;
  }
  
  .hero-section {
    background: #fff;
    color: #000;
    padding: 2rem 0;
  }
  
  .section-padding {
    padding: 1rem 0;
  }
}

/* Optimización para particles */
@media (prefers-reduced-motion: reduce), (max-width: 768px) {
  #particles-canvas {
    display: none !important;
  }
}