/**
 * Avanza Code - Presentación Ejecutiva
 * Hoja de estilos principal con mejores prácticas CSS
 * @version 2.0.0
 * @author Avanza Code Team
 */

/* ==========================================
   CSS CUSTOM PROPERTIES (Variables)
   ========================================== */
:root {
  /* Colores principales */
  --color-primary: #667eea;
  --color-primary-dark: #4c63d2;
  --color-secondary: #764ba2;
  --color-accent: #0ea5e9;
  
  /* Colores de estado */
  --color-success: #4ade80;
  --color-warning: #fb923c;
  --color-error: #ef4444;
  
  /* Colores neutros */
  --color-white: #ffffff;
  --color-gray-100: #f3f4f6;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-900: #111827;
  --color-black: #0a0a0a;
  
  /* Fondos */
  --bg-dark: var(--color-black);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.08);
  
  /* Bordes */
  --border-glass: 1px solid rgba(255, 255, 255, 0.1);
  --border-glass-hover: 1px solid rgba(102, 126, 234, 0.5);
  
  /* Tipografía */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  
  /* Tamaños de fuente */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --text-6xl: 3.75rem;
  --text-8xl: 6rem;
  
  /* Espaciado */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Bordes redondeados */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-3xl: 2rem;
  --radius-full: 9999px;
  
  /* Sombras */
  --shadow-glow: 0 20px 40px -15px rgba(102, 126, 234, 0.3);
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  
  /* Transiciones */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;
  
  /* Z-index scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-dark);
  color: var(--color-white);
  overflow: hidden;
  line-height: 1.5;
  height: 100vh;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* Contenedor principal */
main {
  height: 100%;
  width: 100%;
  position: relative;
  overflow: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

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

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

/* ==========================================
   COMPONENTES
   ========================================== */

/* Grid de tecnología */
.tech-grid {
  background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.05) 1px, transparent 0);
  background-size: 40px 40px;
}

/* Texto degradado */
.gradient-text {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Tarjetas glassmorphism */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: var(--border-glass);
  transition: transform var(--transition-base), 
              border-color var(--transition-base), 
              box-shadow var(--transition-base);
}

.glass-card:hover {
  border-color: rgba(102, 126, 234, 0.5);
}

/* Tarjetas de servicio */
.service-card {
  composes: glass-card;
  border-radius: var(--radius-2xl);
  padding: var(--space-6);
  cursor: pointer;
}

.service-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-glow);
}

/* Botón de navegación */
.nav-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.2);
  transition: all var(--transition-base);
}

.nav-dot:hover,
.nav-dot:focus {
  background: rgba(255, 255, 255, 0.4);
}

.nav-dot.active {
  background: var(--color-primary);
  transform: scale(1.5);
}

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

@keyframes pulse {
  0%, 100% { 
    opacity: 0; 
    transform: scale(1); 
  }
  50% { 
    opacity: 1; 
    transform: scale(1.1); 
  }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.floating {
  animation: float 6s ease-in-out infinite;
}

.pulse-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(102, 126, 234, 0.3);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ==========================================
   SISTEMA DE SLIDES
   ========================================== */
/* Sistema de slides - Cada slide ocupa toda la pantalla */
.slide {
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, opacity;
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.slide.active {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 1 !important;
  transform: translateY(0) !important;
  z-index: 10;
}

/* ==========================================
   ACCESIBILIDAD
   ========================================== */
@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;
  }
  
  .floating,
  .pulse-ring {
    animation: none;
  }
}

/* Alto contraste */
@media (prefers-contrast: high) {
  .glass-card {
    background: rgba(0, 0, 0, 0.8);
    border-color: var(--color-white);
  }
  
  .gradient-text {
    color: var(--color-primary);
    -webkit-text-fill-color: var(--color-primary);
  }
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

/* Mobile First - Base styles son móviles */

/* Tablet (md) */
@media (min-width: 768px) {
  :root {
    --text-4xl: 2.5rem;
    --text-5xl: 3.5rem;
    --text-6xl: 4.5rem;
  }
}

/* Desktop (lg) */
@media (min-width: 1024px) {
  :root {
    --text-5xl: 4rem;
    --text-6xl: 5rem;
    --text-8xl: 7rem;
  }
}

/* Large Desktop (xl) */
@media (min-width: 1280px) {
  :root {
    --text-8xl: 8rem;
  }
}

/* Ajustes para pantallas pequeñas */
@media (max-width: 640px) {
  .nav-dot {
    width: 8px;
    height: 8px;
  }
  
  /* Ocultar logo en móviles muy pequeños si es necesario */
  .logo-container {
    transform: scale(0.7);
    top: 0.5cm;
    right: 0.5cm;
  }
}

/* Orientación landscape en móviles */
@media (max-height: 500px) and (orientation: landscape) {
  .slide {
    overflow-y: auto;
    padding: 2rem 0;
  }
}

/* ==========================================
   RESPONSIVE: MÓVIL Y TABLET (≤1024px)
   ========================================== */
@media (max-width: 1024px) {
  /* Ocultar logo en móvil/tablet */
  .logo-container {
    display: none !important;
  }
  
  /* Ocultar dots de navegación */
  .nav-dot,
  nav[role="tablist"] {
    display: none !important;
  }
  
  /* Ocultar controles de navegación inferior */
  .fixed.bottom-8 {
    display: none !important;
  }
  
  /* Permitir scroll en el body */
  body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
    min-height: 100vh;
  }
  
  /* Cambiar main a layout de bloque */
  main {
    height: auto !important;
    display: block !important;
    position: relative;
  }
  
  /* Mostrar todos los slides en columna */
  .slide {
    display: flex !important;
    position: relative !important;
    height: auto !important;
    min-height: 100vh !important;
    opacity: 1 !important;
    transform: none !important;
    padding: 100px 16px 60px !important;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    overflow-x: hidden !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .slide.active {
    opacity: 1 !important;
    transform: none !important;
  }
  
  /* Ajustar contenido de slides */
  .slide > div {
    max-width: 100% !important;
    position: relative !important;
  }
  
  /* Reducir tamaños de texto */
  .slide h1,
  .slide h1 .font-display {
    font-size: 2.5rem !important;
    line-height: 1.2 !important;
  }
  
  .slide h2,
  .slide h2 .font-display {
    font-size: 2rem !important;
    line-height: 1.3 !important;
  }
  
  .slide h3 {
    font-size: 1.5rem !important;
  }
  
  /* Ocultar progress bar */
  #progressBar,
  [role="progressbar"] {
    display: none !important;
  }
  
  /* Ajustar selector de idioma */
  .language-selector,
  .fixed.left-8 {
    left: 16px !important;
    top: 16px !important;
  }
  
  /* WhatsApp button */
  .fixed.bottom-24 {
    bottom: 20px !important;
    right: 20px !important;
  }
  
  /* Ocultar elementos decorativos pesados */
  .pulse-ring {
    display: none !important;
  }
  
  /* Ajustar grids para móvil - excepto feature cards del slide 1 */
  .grid.md\\:grid-cols-2,
  .grid.md\\:grid-cols-3,
  .grid.md\\:grid-cols-4,
  .grid.lg\\:grid-cols-4,
  .grid.lg\\:grid-cols-5 {
    grid-template-columns: 1fr !important;
  }
  
  /* El slide 1 usa clases responsive de Tailwind, no necesita override */
  
  /* Ajustar cards */
  .service-card,
  .glass-card {
    margin-bottom: 1rem;
  }
  
  /* Mapa más pequeño */
  svg[viewBox="0 0 800 450"] {
    max-height: 300px !important;
  }
}

/* Tablet específico (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .slide h1,
  .slide h1 .font-display {
    font-size: 3.5rem !important;
  }
  
  .slide h2,
  .slide h2 .font-display {
    font-size: 2.5rem !important;
  }
  
  /* Grids de 2 columnas en tablet */
  .grid.md\\:grid-cols-2 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ==========================================
   CONTACT FORM MODAL
   ========================================== */
.contact-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.contact-modal.active {
  opacity: 1;
  visibility: visible;
}

.contact-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.contact-modal-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  background: rgba(15, 15, 15, 0.95);
  border: var(--border-glass);
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-base);
}

.contact-modal.active .contact-modal-content {
  transform: scale(1) translateY(0);
}

.contact-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.contact-modal-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.contact-modal-close {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gray-400);
  background: rgba(255, 255, 255, 0.05);
  border: var(--border-glass);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.contact-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-white);
  transform: rotate(90deg);
}

.contact-modal-subtitle {
  font-size: var(--text-sm);
  color: var(--color-gray-400);
  margin-bottom: var(--space-6);
}

/* Form Styles */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.contact-form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.contact-form-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-gray-100);
}

.contact-form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  font-family: var(--font-primary);
  color: var(--color-white);
  background: rgba(255, 255, 255, 0.05);
  border: var(--border-glass);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  outline: none;
}

.contact-form-input::placeholder {
  color: var(--color-gray-500);
}

.contact-form-input:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.contact-form-input:focus {
  border-color: var(--color-primary);
  background: rgba(102, 126, 234, 0.05);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.contact-form-input:invalid:not(:placeholder-shown) {
  border-color: var(--color-error);
}

.contact-form-input:invalid:not(:placeholder-shown) + .contact-form-error {
  display: block;
}

.contact-form-error {
  display: none;
  font-size: var(--text-xs);
  color: var(--color-error);
  margin-top: calc(var(--space-1) * -1);
}

.contact-form-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-4) var(--space-6);
  margin-top: var(--space-2);
  font-size: var(--text-base);
  font-weight: 600;
  font-family: var(--font-primary);
  color: var(--color-black);
  background: var(--color-white);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.contact-form-submit:hover:not(:disabled) {
  background: var(--color-gray-100);
  transform: translateY(-2px);
}

.contact-form-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.contact-form-submit .spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-black);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Success/Error Messages */
.contact-form-message {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-8) var(--space-4);
  animation: fadeIn 0.3s ease;
}

.contact-form-message.active {
  display: flex;
}

.contact-form-message-icon {
  margin-bottom: var(--space-4);
  animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
  0% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) rotate(10deg);
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

.contact-form-success .contact-form-message-icon {
  color: var(--color-success);
  filter: drop-shadow(0 0 20px rgba(74, 222, 128, 0.4));
}

.contact-form-success h4 {
  font-size: var(--text-xl);
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-success) 0%, #22c55e 50%, var(--color-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: slideInUp 0.5s ease 0.2s both;
}

.contact-form-error-message .contact-form-message-icon {
  color: var(--color-error);
}

.contact-form-message h4 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-white);
  line-height: 1.5;
}

/* Hide form when showing messages */
.contact-form.hidden {
  display: none;
}

/* Responsive Modal */
@media (max-width: 640px) {
  .contact-modal {
    padding: var(--space-2);
    align-items: flex-end;
  }
  
  .contact-modal-content {
    max-height: 85vh;
    padding: var(--space-6);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    transform: translateY(100%);
  }
  
  .contact-modal.active .contact-modal-content {
    transform: translateY(0);
  }
  
  .contact-modal-title {
    font-size: var(--text-xl);
  }
}

/* Prevent body scroll when modal is open */
body.modal-open {
  overflow: hidden;
}

/* ==========================================
   PRINT STYLES
   ========================================== */
@media print {
  .no-print,
  .nav-dot,
  .progress-bar,
  .language-selector {
    display: none !important;
  }
  
  .slide {
    display: block !important;
    page-break-after: always;
  }
  
  body {
    background: white;
    color: black;
  }
}
