/**
 * ParaGaming Advanced Styles
 * Sistema de estilos profesional con efectos modernos
 */

/* ========================================
   Variables CSS Avanzadas
   ======================================== */
:root {
  /* Colores del sistema */
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --dark-gradient: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  
  /* Colores para partículas */
  --gradient-color-1: #667eea;
  --gradient-color-2: #764ba2;
  --gradient-color-3: #f093fb;
  --gradient-color-4: #4facfe;
  --gradient-color-5: #00f2fe;
  
  /* Colores de glow */
  --glow-primary: rgba(102, 126, 234, 0.8);
  --glow-secondary: rgba(118, 75, 162, 0.8);
  --glow-accent: rgba(79, 172, 254, 0.8);
  
  /* Sombras avanzadas */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 30px var(--glow-primary), 0 0 60px var(--glow-secondary);
  
  /* Timing functions */
  --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ========================================
   Body y Background Base
   ======================================== */
body {
  position: relative;
  overflow-x: hidden;
}

/* Animated Gradient Background - CAPA MÁS PROFUNDA */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -3;
  background: linear-gradient(-45deg, #0f0c29, #302b63, #24243e, #0f0c29);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  pointer-events: none;
}

/* ========================================
   Animaciones Avanzadas
   ======================================== */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes floatUp {
  0% {
    transform: translateY(100vh) rotate(0deg) scale(1);
    opacity: 0;
  }
  10% {
    opacity: 0.2;
  }
  90% {
    opacity: 0.2;
  }
  100% {
    transform: translateY(-100vh) rotate(720deg) scale(1.2);
    opacity: 0;
  }
}

@keyframes meshFloat {
  0%, 100% {
    transform: scale(1) rotate(0deg);
  }
  33% {
    transform: scale(1.1) rotate(5deg);
  }
  66% {
    transform: scale(0.95) rotate(-5deg);
  }
}

@keyframes gradientFlow {
  0% {
    background-position: 0% 50%;
    filter: hue-rotate(0deg) brightness(1);
  }
  25% {
    filter: hue-rotate(10deg) brightness(1.1);
  }
  50% {
    background-position: 100% 50%;
    filter: hue-rotate(0deg) brightness(1);
  }
  75% {
    filter: hue-rotate(-10deg) brightness(1.1);
  }
  100% {
    background-position: 0% 50%;
    filter: hue-rotate(0deg) brightness(1);
  }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3),
                0 0 40px rgba(118, 75, 162, 0.2),
                inset 0 0 20px rgba(102, 126, 234, 0.1);
  }
  50% {
    box-shadow: 0 0 40px rgba(102, 126, 234, 0.6),
                0 0 80px rgba(118, 75, 162, 0.4),
                inset 0 0 30px rgba(102, 126, 234, 0.2);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes float3D {
  0%, 100% {
    transform: translateY(0) rotateX(0deg) rotateY(0deg);
  }
  25% {
    transform: translateY(-20px) rotateX(5deg) rotateY(5deg);
  }
  50% {
    transform: translateY(0) rotateX(0deg) rotateY(10deg);
  }
  75% {
    transform: translateY(-10px) rotateX(-5deg) rotateY(5deg);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(60px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-60px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(60px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8) rotate(-5deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* ========================================
   Glassmorphism Avanzado - SIN BACKDROP FILTER PARA EVITAR STACKING CONTEXT
   ======================================== */
.glass-advanced {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: var(--shadow-lg),
              inset 0 0 20px rgba(255, 255, 255, 0.05) !important;
  position: relative;
  overflow: hidden;
}

.glass-advanced::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255, 255, 255, 0.1), 
    transparent
  );
  transition: left 0.5s ease;
}

.glass-advanced:hover::before {
  left: 100%;
}

/* ========================================
   Cards con efectos avanzados
   ======================================== */
.service-card, .pricing-card, .feature-card {
  position: relative;
  transition: all 0.4s var(--ease-smooth);
  transform-style: preserve-3d;
  perspective: 1000px;
}

.service-card::after, .pricing-card::after, .feature-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(102, 126, 234, 0.15),
    transparent 50%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  border-radius: inherit;
}

.service-card:hover::after, 
.pricing-card:hover::after, 
.feature-card:hover::after {
  opacity: 1;
}

.service-card:hover, .pricing-card:hover, .feature-card:hover {
  transform: translateY(-15px) scale(1.03) rotateX(5deg);
  box-shadow: 0 20px 60px rgba(102, 126, 234, 0.4),
              0 0 80px rgba(118, 75, 162, 0.3),
              inset 0 0 30px rgba(102, 126, 234, 0.1) !important;
  border-color: rgba(102, 126, 234, 0.5) !important;
}

/* ========================================
   Botones con efectos avanzados
   ======================================== */
.btn, .cta-button, button[type="submit"] {
  position: relative;
  overflow: hidden;
  transition: all 0.3s var(--ease-bounce);
  z-index: 1;
}

.btn::before, .cta-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3), transparent);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn:hover::before, .cta-button:hover::before {
  width: 300px;
  height: 300px;
}

.btn:hover, .cta-button:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5),
              0 0 50px rgba(118, 75, 162, 0.3);
  filter: brightness(1.2) saturate(1.3);
}

.btn:active, .cta-button:active {
  transform: translateY(-1px) scale(1.02);
}

/* ========================================
   Navbar con efectos avanzados
   ======================================== */
.navbar {
  position: relative;
  transition: all 0.3s ease;
}

.navbar::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent,
    var(--glow-primary),
    var(--glow-secondary),
    transparent
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.navbar.scrolled::after {
  opacity: 1;
}

.nav-link {
  position: relative;
  transition: all 0.3s var(--ease-smooth);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--primary-gradient);
  transform: translateX(-50%);
  transition: width 0.3s var(--ease-bounce);
  box-shadow: 0 0 10px var(--glow-primary);
}

.nav-link:hover::after, .nav-link.active::after {
  width: 100%;
}

/* ========================================
   Animaciones de entrada
   ======================================== */
.animate-element {
  opacity: 0;
  transform: translateY(60px) scale(0.95);
}

.animate-element.animate-in {
  animation: slideInUp 0.8s var(--ease-smooth) forwards;
}

.animate-element:nth-child(1) { animation-delay: 0.1s; }
.animate-element:nth-child(2) { animation-delay: 0.2s; }
.animate-element:nth-child(3) { animation-delay: 0.3s; }
.animate-element:nth-child(4) { animation-delay: 0.4s; }
.animate-element:nth-child(5) { animation-delay: 0.5s; }
.animate-element:nth-child(6) { animation-delay: 0.6s; }

/* ========================================
   Hero Section Mejorado
   ======================================== */
.hero-section {
  position: relative;
  overflow: hidden;
}

.hero-content {
  position: relative;
  z-index: 2;
  animation: slideInUp 1s var(--ease-smooth) forwards;
}

.hero-content h1 {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientFlow 8s ease infinite;
  background-size: 200% 200%;
  text-shadow: 0 0 40px rgba(102, 126, 234, 0.5);
}

/* ========================================
   Partículas mejoradas
   ======================================== */
.particles-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  pointer-events: none;
  opacity: 0;
  animation: fadeIn 1s ease forwards;
  overflow: hidden;
}

/* Floating Particles */
.particle-float {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.2;
  animation: floatUp linear infinite;
}

.particle-float:nth-child(1) {
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, var(--gradient-color-1), transparent);
  left: 15%;
  animation-duration: 20s;
  animation-delay: 0s;
}

.particle-float:nth-child(2) {
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, var(--gradient-color-2), transparent);
  left: 75%;
  animation-duration: 25s;
  animation-delay: 3s;
}

.particle-float:nth-child(3) {
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, var(--gradient-color-3), transparent);
  left: 45%;
  animation-duration: 18s;
  animation-delay: 6s;
}

.particle-float:nth-child(4) {
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, var(--gradient-color-4), transparent);
  left: 85%;
  animation-duration: 22s;
  animation-delay: 2s;
}

.particle-float:nth-child(5) {
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, var(--gradient-color-5), transparent);
  left: 30%;
  animation-duration: 24s;
  animation-delay: 8s;
}

.particle-float:nth-child(6) {
  width: 70px;
  height: 70px;
  background: radial-gradient(circle, var(--gradient-color-1), transparent);
  left: 60%;
  animation-duration: 26s;
  animation-delay: 5s;
}

.particle-float:nth-child(7) {
  width: 110px;
  height: 110px;
  background: radial-gradient(circle, var(--gradient-color-3), transparent);
  left: 10%;
  animation-duration: 28s;
  animation-delay: 10s;
}

.particle-float:nth-child(8) {
  width: 65px;
  height: 65px;
  background: radial-gradient(circle, var(--gradient-color-4), transparent);
  left: 90%;
  animation-duration: 21s;
  animation-delay: 4s;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* ========================================
   Mesh Overlay Mejorado
   ======================================== */
.mesh-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: screen;
  background: 
    radial-gradient(circle at 20% 20%, rgba(102, 126, 234, 0.6) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.6) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(79, 172, 254, 0.5) 0%, transparent 60%),
    radial-gradient(circle at 10% 90%, rgba(240, 147, 251, 0.5) 0%, transparent 50%),
    radial-gradient(circle at 90% 10%, rgba(0, 242, 254, 0.4) 0%, transparent 50%);
  animation: meshFloat 30s ease-in-out infinite;
  filter: blur(60px);
}

/* ========================================
   Z-Index Hierarchy - CRÍTICO
   ======================================== */
/* Backgrounds en capas negativas */
/* body::before = -3, .particles-bg = -2, .mesh-overlay = -1 */

/* Contenido principal sobre backgrounds */
section {
  position: relative;
  z-index: 1;
}

/* Elementos interactivos con mayor z-index */
.contact-grid,
.contact-form,
.contact-info,
form,
button,
input,
select,
textarea {
  position: relative;
  z-index: 2;
}

/* Navbar siempre visible */
.navbar {
  z-index: 1000 !important;
}

/* Nav actions y controles siempre accesibles */
.nav-actions,
.currency-selector,
.user-menu,
.nav-menu,
.nav-link {
  position: relative;
  z-index: 1001 !important;
}

/* ========================================
   Glass Effects para elementos principales - SIN BACKDROP
   ======================================== */
.hero-content,
.service-card,
.pricing-card,
.feature-card {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37) !important;
}

/* Enhanced card hover effects */
.service-card:hover,
.pricing-card:hover,
.feature-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 12px 40px 0 rgba(102, 126, 234, 0.4) !important;
  border-color: rgba(102, 126, 234, 0.3) !important;
}

/* ========================================
   Efectos de scroll
   ========================================== */
.scroll-indicator {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 50px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  display: flex;
  justify-content: center;
  padding-top: 8px;
  animation: float3D 3s ease-in-out infinite;
}

.scroll-indicator::after {
  content: '';
  width: 6px;
  height: 10px;
  background: var(--primary-gradient);
  border-radius: 3px;
  animation: scrollDown 2s ease-in-out infinite;
}

@keyframes scrollDown {
  0%, 100% {
    transform: translateY(0);
    opacity: 1;
  }
  50% {
    transform: translateY(15px);
    opacity: 0.3;
  }
}

/* ========================================
   Loading States Mejorados
   ======================================== */
.loading-spinner {
  position: relative;
  width: 50px;
  height: 50px;
  margin: 20px auto;
}

.loading-spinner::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid transparent;
  border-top-color: var(--glow-primary);
  border-right-color: var(--glow-secondary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   Text Effects Avanzados
   ======================================== */
.gradient-text {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: gradientFlow 5s ease infinite;
}

.glow-text {
  text-shadow: 0 0 10px var(--glow-primary),
               0 0 20px var(--glow-secondary),
               0 0 30px var(--glow-accent);
  animation: pulseGlow 3s ease-in-out infinite;
}

/* ========================================
   Responsive Improvements
   ======================================== */
@media (max-width: 768px) {
  .glass-advanced {
    backdrop-filter: blur(15px) saturate(150%) !important;
  }
  
  .service-card:hover, .pricing-card:hover, .feature-card:hover {
    transform: translateY(-10px) scale(1.02);
  }
  
  .mesh-overlay {
    opacity: 0.3;
    filter: blur(40px);
  }
}

/* ========================================
   Accessibility
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
