/**
 * VISUAL EFFECTS ENGINE - Command Center
 * Stunning visual effects, animations, and micro-interactions
 * Performance-optimized for 60fps rendering
 */

/* ============================================================================
   ENHANCED CSS VARIABLES - VISUAL EFFECTS
   ============================================================================ */
:root {
    /* Particle System Colors */
    --particle-primary: rgba(102, 126, 234, 0.6);
    --particle-success: rgba(16, 185, 129, 0.6);
    --particle-warning: rgba(245, 158, 11, 0.6);
    --particle-danger: rgba(239, 68, 68, 0.6);
    
    /* Glow Intensities */
    --glow-subtle: 0 0 10px rgba(102, 126, 234, 0.3);
    --glow-medium: 0 0 20px rgba(102, 126, 234, 0.5);
    --glow-intense: 0 0 30px rgba(102, 126, 234, 0.7);
    --glow-extreme: 0 0 40px rgba(102, 126, 234, 0.9);
    
    /* Spring Physics Animation */
    --spring-smooth: cubic-bezier(0.34, 1.56, 0.64, 1);
    --spring-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --spring-gentle: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    
    /* 3D Transform Perspective */
    --perspective-near: 1000px;
    --perspective-far: 2000px;
}

/* ============================================================================
   PARTICLE SYSTEM - Floating Background Elements
   ============================================================================ */
.particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--particle-primary);
    opacity: 0;
    animation: float-particle 15s infinite ease-in-out;
    filter: blur(1px);
}

.particle:nth-child(2n) {
    animation-duration: 20s;
    animation-delay: -5s;
    background: var(--particle-success);
}

.particle:nth-child(3n) {
    animation-duration: 25s;
    animation-delay: -10s;
    width: 6px;
    height: 6px;
}

.particle:nth-child(5n) {
    animation-duration: 18s;
    animation-delay: -7s;
    filter: blur(2px);
}

@keyframes float-particle {
    0% {
        transform: translateY(100vh) translateX(0) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-100px) translateX(100px) scale(1);
        opacity: 0;
    }
}

/* ============================================================================
   GLASSMORPHISM - Enhanced with Depth
   ============================================================================ */
.glass-card {
    background: rgba(26, 31, 53, 0.7);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 16px;
    box-shadow: 
        0 8px 32px 0 rgba(0, 0, 0, 0.37),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    transition: all 0.4s var(--spring-smooth);
}

/* Light mode override for glass cards */
[data-theme="light"] .glass-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 
        0 8px 32px 0 rgba(0, 0, 0, 0.08),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.8);
}

.glass-card::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.6s;
}

[data-theme="light"] .glass-card::before {
    background: linear-gradient(
        90deg,
        transparent,
        rgba(102, 126, 234, 0.05),
        transparent
    );
}

.glass-card:hover::before {
    left: 100%;
}

.glass-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 
        0 20px 60px 0 rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(148, 163, 184, 0.2),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .glass-card:hover {
    box-shadow: 
        0 20px 60px 0 rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(148, 163, 184, 0.3),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.9);
}

/* ============================================================================
   REGIME INDICATOR - Enhanced with 3D Depth
   ============================================================================ */
.regime-indicator-enhanced {
    position: relative;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, rgba(10, 14, 26, 0.95) 0%, rgba(26, 31, 53, 0.9) 100%);
    border-radius: 24px;
    overflow: hidden;
    perspective: var(--perspective-far);
    transform-style: preserve-3d;
}

/* Light mode override */
[data-theme="light"] .regime-indicator-enhanced {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 50%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .regime-indicator-enhanced .regime-name {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="light"] .regime-indicator-enhanced .gauge-label,
[data-theme="light"] .regime-indicator-enhanced .gauge-value {
    color: #1e293b;
}

[data-theme="light"] .regime-indicator-enhanced .last-update-time {
    color: #64748b;
}

.regime-indicator-enhanced::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        rgba(102, 126, 234, 0.1),
        rgba(118, 75, 162, 0.2),
        rgba(102, 126, 234, 0.1)
    );
    animation: rotate-gradient 20s linear infinite;
}

/* Light mode gradient overlay */
[data-theme="light"] .regime-indicator-enhanced::before {
    background: conic-gradient(
        from 0deg,
        rgba(102, 126, 234, 0.03),
        rgba(118, 75, 162, 0.05),
        rgba(102, 126, 234, 0.03)
    );
}

@keyframes rotate-gradient {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.regime-wave-background {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    opacity: 0.15;
    pointer-events: none;
}

.regime-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        var(--particle-primary), 
        transparent
    );
    animation: wave-flow 8s ease-in-out infinite;
}

.regime-wave:nth-child(2) {
    animation-delay: -2s;
    opacity: 0.5;
    animation-duration: 10s;
}

.regime-wave:nth-child(3) {
    animation-delay: -4s;
    opacity: 0.3;
    animation-duration: 12s;
}

@keyframes wave-flow {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-25%) translateY(-20px);
    }
}

/* ============================================================================
   CIRCULAR GAUGES - Enhanced with Glow
   ============================================================================ */
.gauge-container-enhanced {
    position: relative;
    width: 140px;
    height: 140px;
    filter: drop-shadow(var(--glow-medium));
    transition: all 0.4s var(--spring-smooth);
}

.gauge-container-enhanced:hover {
    transform: scale(1.1) rotateY(5deg);
    filter: drop-shadow(var(--glow-intense));
}

.gauge-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(102, 126, 234, 0.4),
        transparent 70%
    );
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.8;
    }
}

.gauge-value-enhanced {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #818cf8, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(102, 126, 234, 0.5));
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* ============================================================================
   ACTION BUTTONS - Micro-interactions
   ============================================================================ */
.action-button-enhanced {
    position: relative;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s var(--spring-smooth);
    box-shadow: 
        0 4px 12px rgba(102, 126, 234, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.action-button-enhanced::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.action-button-enhanced:hover::before {
    width: 300px;
    height: 300px;
}

.action-button-enhanced:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 24px rgba(102, 126, 234, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.action-button-enhanced:active {
    transform: translateY(0) scale(0.98);
}

/* Ripple Effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ============================================================================
   DATA CARDS - Enhanced with Depth
   ============================================================================ */
.data-card-enhanced {
    position: relative;
    padding: 1.5rem;
    background: rgba(26, 31, 53, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 16px;
    transition: all 0.4s var(--spring-smooth);
    transform-style: preserve-3d;
}

[data-theme="light"] .data-card-enhanced {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.data-card-enhanced::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent,
        var(--cc-accent-purple),
        transparent
    );
    transform: scaleX(0);
    transition: transform 0.4s var(--spring-smooth);
}

.data-card-enhanced:hover::after {
    transform: scaleX(1);
}

.data-card-enhanced:hover {
    transform: translateZ(10px) rotateX(2deg);
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(102, 126, 234, 0.2);
}

/* ============================================================================
   SPARKLINE CHARTS - Mini Real-time Visualizations
   ============================================================================ */
.sparkline-container {
    position: relative;
    height: 60px;
    margin: 0.5rem 0;
    overflow: hidden;
}

.sparkline-path {
    fill: none;
    stroke: url(#sparkline-gradient);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 2px 4px rgba(102, 126, 234, 0.4));
    animation: draw-sparkline 1s ease-out forwards;
}

@keyframes draw-sparkline {
    from {
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dashoffset: 0;
    }
}

.sparkline-area {
    fill: url(#sparkline-area-gradient);
    opacity: 0;
    animation: fade-in-area 1s 0.5s ease-out forwards;
}

@keyframes fade-in-area {
    to {
        opacity: 0.3;
    }
}

.sparkline-dot {
    fill: var(--cc-accent-purple);
    stroke: white;
    stroke-width: 2;
    filter: drop-shadow(0 2px 6px rgba(102, 126, 234, 0.6));
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        r: 4;
        opacity: 1;
    }
    50% {
        r: 6;
        opacity: 0.7;
    }
}

/* ============================================================================
   TOAST NOTIFICATIONS - Sliding Animations
   ============================================================================ */
.toast-container {
    position: fixed;
    top: 5rem;
    right: 2rem;
    z-index: 10000;
    pointer-events: none;
}

.toast {
    position: relative;
    margin-bottom: 1rem;
    padding: 1rem 1.5rem;
    min-width: 300px;
    background: rgba(26, 31, 53, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    border-left: 4px solid var(--cc-accent-purple);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(102, 126, 234, 0.2);
    pointer-events: all;
    animation: toast-slide-in 0.4s var(--spring-smooth);
}

[data-theme="light"] .toast {
    background: rgba(255, 255, 255, 0.98);
    border-left: 4px solid #667eea;
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.12),
        0 0 20px rgba(102, 126, 234, 0.15);
}

@keyframes toast-slide-in {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.toast-exit {
    animation: toast-slide-out 0.3s ease-in forwards;
}

@keyframes toast-slide-out {
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast-success {
    border-left-color: var(--cc-accent-green);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(72, 187, 120, 0.2);
}

.toast-warning {
    border-left-color: var(--cc-accent-orange);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(246, 173, 85, 0.2);
}

.toast-danger {
    border-left-color: var(--cc-accent-red);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(252, 129, 129, 0.2);
}

/* ============================================================================
   LOADING STATES - Skeleton Screens
   ============================================================================ */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(45, 53, 72, 0.5) 25%,
        rgba(51, 65, 85, 0.7) 50%,
        rgba(45, 53, 72, 0.5) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
    width: 70%;
}

/* ============================================================================
   PROGRESS BARS - Gradient Animated
   ============================================================================ */
.progress-bar-enhanced {
    position: relative;
    height: 8px;
    background: rgba(45, 53, 72, 0.5);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, 
        var(--cc-accent-purple),
        var(--cc-accent-blue),
        var(--cc-accent-purple)
    );
    background-size: 200% 100%;
    border-radius: 9999px;
    transition: width 0.6s var(--spring-smooth);
    animation: progress-shimmer 2s linear infinite;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

@keyframes progress-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================================================
   HOVER EFFECTS - Cards & Buttons
   ============================================================================ */
.hover-lift {
    transition: all 0.3s var(--spring-smooth);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.hover-glow {
    transition: all 0.3s ease;
}

.hover-glow:hover {
    filter: drop-shadow(0 0 15px rgba(102, 126, 234, 0.6));
}

.hover-scale {
    transition: transform 0.3s var(--spring-smooth);
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* ============================================================================
   SCROLL ANIMATIONS - Reveal on Scroll
   ============================================================================ */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s var(--spring-smooth);
}

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

.fade-in-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.6s var(--spring-smooth);
}

.fade-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.6s var(--spring-smooth);
}

.fade-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================================================
   PERFORMANCE OPTIMIZATIONS
   ============================================================================ */
/* Enable hardware acceleration */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Theme Toggle Button Enhancement */
.theme-toggle-button {
    position: relative;
    transition: all 0.3s var(--spring-smooth) !important;
}

.theme-toggle-button:hover {
    transform: scale(1.15) rotate(20deg);
    filter: drop-shadow(0 0 8px rgba(102, 126, 234, 0.6));
}

.theme-toggle-button:active {
    transform: scale(0.95) rotate(-10deg);
}

.theme-toggle-button #theme-icon {
    display: inline-block;
    transition: transform 0.6s var(--spring-bounce);
}

.theme-toggle-button:hover #theme-icon {
    transform: rotateY(180deg);
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */
@media (max-width: 768px) {
    .glass-card:hover {
        transform: none;
    }
    
    .gauge-container-enhanced:hover {
        transform: scale(1.05);
    }
    
    .particle-container {
        display: none; /* Disable particles on mobile for performance */
    }
}
