/* =================================================================
   SAVANTE - CUSTOM STYLES
   ================================================================= */

/* Tailwind Configuration */
:root {
    --primary: #8b5cf6;
    --primary-light: #a78bfa;
    --primary-dark: #7c3aed;
    --secondary: #111827;
    --light: #f9fafb;
    
    /* Light mode colors */
    --bg-color: #ffffff;
    --surface-color: #f9fafb;
    --text-color: #374151;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
}

/* Dark mode colors */
.dark {
    --bg-color: #0f0f23;
    --surface-color: #1a1a2e;
    --text-color: #e5e7eb;
    --text-secondary: #9ca3af;
    --border-color: #374151;
}

/* Custom Tailwind Configuration - Se configura en el HTML */
/* Variables CSS para compatibilidad con navegadores que no soportan Tailwind */

/* =================================================================
   BACKGROUND PATTERNS
   ================================================================= */

/* Hero Grid Background */
.hero-grid-bg {
    background-image:
        linear-gradient(rgba(139, 92, 246, 0.08) 1px, transparent 1px),
        linear-gradient(to right, rgba(139, 92, 246, 0.08) 1px, transparent 1px);
    background-size: 4rem 4rem;
}

.dark .hero-grid-bg {
    background-image:
        linear-gradient(rgba(139, 92, 246, 0.15) 1px, transparent 1px),
        linear-gradient(to right, rgba(139, 92, 246, 0.15) 1px, transparent 1px);
}

/* =================================================================
   ANIMATIONS & TRANSITIONS
   ================================================================= */

/* Fade In Animation for Intersection Observer */
.fade-in {
    opacity: 0;
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    transform: translateY(20px);
}

.fade-in.is-visible {
    opacity: 1;
    transform: translateY(0);
}

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

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

/* Fade In Up Animation */
@keyframes fade-in-up {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fade-in-up 0.8s ease-out forwards;
}

/* =================================================================
   ADVANCED AI-INSPIRED ANIMATIONS
   ================================================================= */

/* Neural Network Pulse Animation */
@keyframes neural-pulse {
    0%, 100% { 
        opacity: 0.6; 
        transform: scale(1); 
    }
    50% { 
        opacity: 1; 
        transform: scale(1.05); 
    }
}

.animate-neural-pulse {
    animation: neural-pulse 3s ease-in-out infinite;
}

/* Data Flow Animation */
@keyframes data-flow {
    0% { 
        transform: translateX(-100%) rotate(0deg); 
        opacity: 0; 
    }
    10% { 
        opacity: 1; 
    }
    90% { 
        opacity: 1; 
    }
    100% { 
        transform: translateX(100vw) rotate(360deg); 
        opacity: 0; 
    }
}

.animate-data-flow {
    animation: data-flow 8s linear infinite;
}

/* Morphing Shape Animation */
@keyframes morph {
    0%, 100% { 
        border-radius: 50% 20% 80% 30%; 
        transform: rotate(0deg); 
    }
    25% { 
        border-radius: 30% 70% 40% 60%; 
        transform: rotate(90deg); 
    }
    50% { 
        border-radius: 80% 30% 50% 70%; 
        transform: rotate(180deg); 
    }
    75% { 
        border-radius: 40% 60% 30% 80%; 
        transform: rotate(270deg); 
    }
}

.animate-morph {
    animation: morph 15s ease-in-out infinite;
}

/* Gradient Shift Animation */
@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.animate-gradient {
    background: linear-gradient(45deg, var(--primary), var(--primary-light), var(--primary-dark), var(--primary));
    background-size: 400% 400%;
    animation: gradient-shift 8s ease infinite;
}

/* Particle System Animation */
@keyframes particle-float {
    0% { 
        transform: translateY(0px) translateX(0px) rotate(0deg); 
        opacity: 0; 
    }
    10% { 
        opacity: 1; 
    }
    90% { 
        opacity: 1; 
    }
    100% { 
        transform: translateY(-100vh) translateX(50px) rotate(180deg); 
        opacity: 0; 
    }
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
    animation: particle-float 10s linear infinite;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; animation-delay: 2s; }
.particle:nth-child(3) { left: 30%; animation-delay: 4s; }
.particle:nth-child(4) { left: 40%; animation-delay: 6s; }
.particle:nth-child(5) { left: 50%; animation-delay: 8s; }
.particle:nth-child(6) { left: 60%; animation-delay: 1s; }
.particle:nth-child(7) { left: 70%; animation-delay: 3s; }
.particle:nth-child(8) { left: 80%; animation-delay: 5s; }

/* Text Glitch Effect */
@keyframes glitch {
    0% { transform: translateX(0); }
    20% { transform: translateX(-2px); }
    40% { transform: translateX(2px); }
    60% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
    100% { transform: translateX(0); }
}

.text-glitch:hover {
    animation: glitch 0.5s ease-in-out;
}

/* Loading Dots Animation */
@keyframes loading-dots {
    0%, 80%, 100% { 
        transform: scale(0); 
        opacity: 0.5; 
    }
    40% { 
        transform: scale(1); 
        opacity: 1; 
    }
}

.loading-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: loading-dots 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

/* =================================================================
   COMPONENT STYLES
   ================================================================= */

/* Header Styles */
#header {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* =================================================================
   ADVANCED BUTTON & INTERACTION EFFECTS
   ================================================================= */

/* AI-Inspired Button Effects */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(139, 92, 246, 0.4),
        0 0 20px rgba(139, 92, 246, 0.2);
    filter: brightness(1.1);
}

.btn-secondary {
    border: 2px solid rgba(139, 92, 246, 0.5);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.btn-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    transition: width 0.4s ease;
    z-index: -1;
}

.btn-secondary:hover::before {
    width: 100%;
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: white;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(139, 92, 246, 0.3),
        0 0 15px rgba(139, 92, 246, 0.15);
}

/* Advanced Card Effects */
.card {
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.dark .card {
    border: 1px solid rgba(139, 92, 246, 0.1);
}

.card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    transform: scale(0);
    transition: transform 0.5s ease;
    pointer-events: none;
}

.card:hover::before {
    transform: scale(1);
}

.card:hover {
    transform: translateY(-12px) rotateX(5deg);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.15),
        0 10px 30px rgba(139, 92, 246, 0.2);
}

/* Neural Network Node Effect */
.neural-node {
    position: relative;
    transition: all 0.3s ease;
}

.neural-node::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary-light), transparent);
    transform: translate(-50%, -50%);
    transition: all 0.4s ease;
    pointer-events: none;
}

.neural-node:hover::after {
    width: 200px;
    height: 200px;
    opacity: 0.3;
}

/* Holographic Text Effect */
.holographic-text {
    background: linear-gradient(45deg, 
        var(--primary) 0%, 
        var(--primary-light) 25%, 
        var(--primary-dark) 50%, 
        var(--primary-light) 75%, 
        var(--primary) 100%);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 3s ease infinite;
    position: relative;
}

.holographic-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    background: linear-gradient(45deg, 
        transparent 30%, 
        rgba(139, 92, 246, 0.5) 50%, 
        transparent 70%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.holographic-text:hover::after {
    opacity: 1;
}

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

/* Mobile Menu Adjustments */
@media (max-width: 1024px) {
    #mobile-menu {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }
}

/* Hero Section Responsive */
@media (max-width: 768px) {
    .hero-grid-bg {
        background-size: 2rem 2rem;
    }
}

/* Text Size Adjustments for Small Screens */
@media (max-width: 640px) {
    .text-responsive-xl {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    .text-responsive-lg {
        font-size: 1.125rem;
        line-height: 1.6;
    }
}

/* =================================================================
   ARTICLE STYLES
   ================================================================= */

/* Prose Styles for Article Content */
.prose {
    color: #374151;
    max-width: none;
}

.prose h1 {
    color: #111827;
    font-weight: 800;
    font-size: 2.25rem;
    margin-top: 0;
    margin-bottom: 2rem;
    line-height: 1.2;
}

.prose h2 {
    color: #111827;
    font-weight: 700;
    font-size: 1.875rem;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

.prose h3 {
    color: #111827;
    font-weight: 600;
    font-size: 1.5rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.prose p {
    margin-bottom: 1.5rem;
    line-height: 1.75;
    font-size: 1.125rem;
}

.prose strong {
    color: var(--primary);
    font-weight: 600;
}

.prose em {
    font-style: italic;
    color: #6b7280;
}

.prose ul, .prose ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.prose li {
    margin-bottom: 0.5rem;
    line-height: 1.75;
}

.prose blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: #6b7280;
    background: #f9fafb;
    padding: 1.5rem;
    border-radius: 0.5rem;
}

.prose table {
    width: 100%;
    margin: 2rem 0;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.prose th {
    background: var(--primary);
    color: white;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
}

.prose td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.prose tr:nth-child(even) {
    background: #f9fafb;
}

/* Line Clamp Utility */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Back Button Styles */
.back-to-home {
    transition: all 0.3s ease;
}

.back-to-home a:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.3);
}

/* =================================================================
   PERFORMANCE OPTIMIZATIONS
   ================================================================= */

/* GPU Acceleration for Animations */
.animate-float,
.animate-neural-pulse,
.animate-morph,
.animate-gradient,
.particle,
.card,
.btn-primary,
.btn-secondary {
    transform: translateZ(0);
    will-change: transform, opacity;
}

/* Reduce Motion for Performance */
@media (prefers-reduced-motion: reduce) {
    .animate-float,
    .animate-neural-pulse,
    .animate-morph,
    .animate-gradient,
    .particle,
    .animate-data-flow,
    .loading-dots span {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        opacity: 1 !important;
        transform: none !important;
    }
    
    .holographic-text,
    .text-glitch {
        animation: none !important;
    }
}

/* Viewport-based Animation Control */
@media (max-width: 768px) {
    .particle {
        display: none; /* Remove particles on mobile for better performance */
    }
    
    .animate-morph {
        animation-duration: 30s; /* Slower morphing on mobile */
    }
    
    .neural-node::after {
        transition-duration: 0.2s; /* Faster hover effects on mobile */
    }
}

/* Battery Optimization */
@media (max-width: 480px) {
    .animate-gradient,
    .holographic-text {
        animation: none; /* Disable complex animations on small screens */
        background: var(--primary);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
}

/* =================================================================
   UTILITY CLASSES
   ================================================================= */

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* Glass Effect */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Shadow Utilities */
.shadow-primary {
    box-shadow: 0 10px 40px rgba(139, 92, 246, 0.3);
}

.shadow-primary-lg {
    box-shadow: 0 20px 60px rgba(139, 92, 246, 0.4);
}

/* =================================================================
   ACCESSIBILITY
   ================================================================= */

/* Focus States */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.5);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .fade-in,
    .animate-fade-in-up,
    .animate-float,
    .card {
        animation: none;
        transition: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .hero-grid-bg {
        background-image: none;
    }
    
    .glass {
        background: rgba(255, 255, 255, 0.9);
        border: 2px solid var(--primary);
    }
}

/* =================================================================
   PRINT STYLES
   ================================================================= */

@media print {
    .hero-grid-bg,
    .glass,
    .shadow-lg,
    .shadow-xl,
    .shadow-2xl {
        background: none !important;
        box-shadow: none !important;
    }
    
    .fixed,
    #header {
        position: static !important;
    }
    
    .bg-secondary {
        background: white !important;
        color: black !important;
    }
}
