/* CRT Effects and Animations */

/* CRT Effects Container */
.crt-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* CRT Overlay Effect */
.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(rgba(18, 16, 16, 0.05) 50%, 
        rgba(0, 0, 0, 0.15) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.03), 
        rgba(0, 255, 0, 0.01), 
        rgba(0, 0, 255, 0.03));
    background-size: 100% 3px, 4px 100%;
    animation: scan 8s linear infinite;
}

@keyframes scan {
    0% { background-position: 0 0; }
    100% { background-position: 0 100%; }
}

/* CRT Glow Effect */
.crt-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 50px rgba(0, 80, 120, 0.08);
}

/* CRT Flicker Effect */
.crt-flicker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.02);
    animation: flicker 0.15s infinite;
    opacity: 0.5;
}

@keyframes flicker {
    0% { opacity: 0.2; }
    50% { opacity: 0.5; }
    100% { opacity: 0.2; }
}

/* Glitch Effect */
.glitch-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    background: linear-gradient(
        0deg, 
        transparent 45%,
        rgba(255, 0, 0, 0.1) 50%,
        transparent 55%
    );
    animation: glitch 15s infinite;
    background-size: 100% 10px;
}

@keyframes glitch {
    0% { opacity: 0; transform: translateY(0); }
    1% { opacity: 0.1; transform: translateY(-2px); }
    2% { opacity: 0; transform: translateY(0); }
    98% { opacity: 0; }
    99% { opacity: 0.2; transform: translateX(3px); }
    100% { opacity: 0; }
}

/* Page Transition Effects */
.page-transition-enter {
    opacity: 0;
    transform: translateX(100%);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateX(0);
    transition: all 0.3s ease-in-out;
}

.page-transition-exit {
    opacity: 1;
    transform: translateX(0);
}

.page-transition-exit-active {
    opacity: 0;
    transform: translateX(-100%);
    transition: all 0.3s ease-in-out;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 128, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-blue);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Icon Hover Effects */
.icon-glitch {
    animation: iconGlitch 0.3s ease-in-out;
}

@keyframes iconGlitch {
    0% { transform: translateX(0); }
    20% { transform: translateX(-2px); }
    40% { transform: translateX(2px); }
    60% { transform: translateX(-1px); }
    80% { transform: translateX(1px); }
    100% { transform: translateX(0); }
}

/* Fade In Animation */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Slide In Animation */
.slide-in {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Window Animations */
.window-minimize {
    animation: windowMinimize 0.3s ease-in-out;
}

@keyframes windowMinimize {
    to {
        transform: scale(0.1);
        opacity: 0.3;
    }
}

.window-maximize {
    animation: windowMaximize 0.3s ease-in-out;
}

@keyframes windowMaximize {
    from {
        width: 90vmin;
        height: 80vmin;
    }
    to {
        width: 100%;
        height: 100%;
    }
}

/* Button Press Effect */
.button-press {
    animation: buttonPress 0.1s ease-in-out;
}

@keyframes buttonPress {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* Notification Animation */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--window-bg);
    border: 2px solid #000;
    padding: 1rem;
    box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: notificationSlide 0.3s ease-out;
}

@keyframes notificationSlide {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    border-color: #008000;
    background: #f0fff0;
}

.notification.error {
    border-color: #ff0000;
    background: #fff0f0;
}

/* Performance Optimizations */
.gpu-accelerated {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .crt-overlay,
    .crt-flicker,
    .glitch-effect {
        animation: none;
    }
    
    .icon:hover {
        transform: none;
    }
    
    .page-transition-enter-active,
    .page-transition-exit-active {
        transition: none;
    }
    
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .crt-overlay,
    .crt-flicker,
    .glitch-effect {
        opacity: 0.1;
    }
    
    .window {
        border-width: 3px;
    }
    
    .icon {
        border-width: 3px;
    }
}