/**
 * HackNet: Shadow Protocol - Effects Stylesheet
 * Contains visual effects like matrix rain, scanlines, CRT effects
 */

/* ========================================
   MATRIX RAIN BACKGROUND
   ======================================== */
#matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-background);
    pointer-events: none;
    opacity: 0.15;
}

/* Matrix disabled state */
body.matrix-disabled #matrix-bg {
    display: none;
}

/* ========================================
   SCANLINES OVERLAY
   ======================================== */
#scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    opacity: 0.5;
}

/* Scanlines disabled state */
body.scanlines-disabled #scanlines {
    display: none;
}

/* ========================================
   CRT FLICKER OVERLAY
   ======================================== */
#crt-flicker {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 998;
    pointer-events: none;
    opacity: 0;
    background: rgba(255, 255, 255, 0.03);
    animation: crt-flicker 0.15s infinite;
}

@keyframes crt-flicker {
    0% {
        opacity: 0.02;
    }
    5% {
        opacity: 0.03;
    }
    10% {
        opacity: 0.02;
    }
    15% {
        opacity: 0;
    }
    25% {
        opacity: 0.01;
    }
    30% {
        opacity: 0.03;
    }
    35% {
        opacity: 0.02;
    }
    40% {
        opacity: 0;
    }
    45% {
        opacity: 0.01;
    }
    50% {
        opacity: 0.02;
    }
    55% {
        opacity: 0;
    }
    60% {
        opacity: 0.03;
    }
    65% {
        opacity: 0.01;
    }
    70% {
        opacity: 0;
    }
    75% {
        opacity: 0.02;
    }
    80% {
        opacity: 0;
    }
    85% {
        opacity: 0.01;
    }
    90% {
        opacity: 0.03;
    }
    95% {
        opacity: 0.02;
    }
    100% {
        opacity: 0.01;
    }
}

/* CRT disabled state */
body.crt-disabled #crt-flicker {
    display: none;
}

/* ========================================
   VIGNETTE EFFECT
   ======================================== */
.effect-vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 997;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 60%,
        rgba(0, 0, 0, 0.4) 100%
    );
}

/* ========================================
   GLITCH EFFECTS
   ======================================== */

/* Screen glitch effect */
.screen-glitch {
    animation: screen-glitch 0.3s ease-out;
}

@keyframes screen-glitch {
    0% {
        transform: translate(0);
        filter: none;
    }
    10% {
        transform: translate(-5px, 0);
        filter: hue-rotate(90deg);
    }
    20% {
        transform: translate(5px, 0);
        filter: hue-rotate(-90deg);
    }
    30% {
        transform: translate(-3px, 3px);
        filter: hue-rotate(45deg);
    }
    40% {
        transform: translate(3px, -3px);
        filter: hue-rotate(-45deg);
    }
    50% {
        transform: translate(-2px, -2px);
        filter: none;
    }
    60% {
        transform: translate(2px, 2px);
        filter: hue-rotate(180deg);
    }
    70% {
        transform: translate(-1px, 1px);
        filter: none;
    }
    80% {
        transform: translate(1px, -1px);
        filter: hue-rotate(-180deg);
    }
    90% {
        transform: translate(0);
        filter: none;
    }
    100% {
        transform: translate(0);
        filter: none;
    }
}

/* Text glitch effect */
.text-glitch {
    position: relative;
}

.text-glitch::before,
.text-glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.text-glitch::before {
    color: var(--color-error);
    animation: glitch-before 0.3s infinite;
    clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
}

.text-glitch::after {
    color: var(--color-info);
    animation: glitch-after 0.3s infinite;
    clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
}

@keyframes glitch-before {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(2px, -2px);
    }
    60% {
        transform: translate(-2px, -2px);
    }
    80% {
        transform: translate(2px, 2px);
    }
    100% {
        transform: translate(0);
    }
}

@keyframes glitch-after {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(2px, -2px);
    }
    40% {
        transform: translate(-2px, 2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(-2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

/* ========================================
   GLOW EFFECTS
   ======================================== */

/* Text glow */
.glow-text {
    text-shadow: 
        0 0 5px currentColor,
        0 0 10px currentColor,
        0 0 20px currentColor;
}

.glow-text-strong {
    text-shadow: 
        0 0 5px currentColor,
        0 0 10px currentColor,
        0 0 20px currentColor,
        0 0 40px currentColor;
}

/* Box glow */
.glow-box {
    box-shadow: 
        0 0 5px var(--color-text),
        0 0 10px var(--color-text),
        inset 0 0 5px rgba(0, 255, 0, 0.1);
}

.glow-box-error {
    box-shadow: 
        0 0 5px var(--color-error),
        0 0 10px var(--color-error),
        inset 0 0 5px rgba(255, 0, 0, 0.1);
}

.glow-box-warning {
    box-shadow: 
        0 0 5px var(--color-warning),
        0 0 10px var(--color-warning),
        inset 0 0 5px rgba(255, 170, 0, 0.1);
}

/* Pulsing glow */
.glow-pulse {
    animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 
            0 0 5px var(--color-text),
            0 0 10px var(--color-text);
    }
    50% {
        box-shadow: 
            0 0 10px var(--color-text),
            0 0 20px var(--color-text),
            0 0 30px var(--color-text);
    }
}

/* ========================================
   FLASH EFFECTS
   ======================================== */

/* Screen flash */
.screen-flash {
    animation: screen-flash 0.3s ease-out;
}

@keyframes screen-flash {
    0% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(2);
    }
    100% {
        filter: brightness(1);
    }
}

/* Success flash */
.flash-success {
    animation: flash-success 0.5s ease-out;
}

@keyframes flash-success {
    0% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(0, 255, 0, 0.2);
    }
    100% {
        background-color: transparent;
    }
}

/* Error flash */
.flash-error {
    animation: flash-error 0.5s ease-out;
}

@keyframes flash-error {
    0% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(255, 0, 0, 0.2);
    }
    100% {
        background-color: transparent;
    }
}

/* Warning flash */
.flash-warning {
    animation: flash-warning 0.5s ease-out;
}

@keyframes flash-warning {
    0% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(255, 170, 0, 0.2);
    }
    100% {
        background-color: transparent;
    }
}

/* ========================================
   TRACE WARNING EFFECTS
   ======================================== */

/* Trace danger state - border pulse */
.trace-danger {
    animation: trace-danger-border 0.5s ease-in-out infinite;
}

@keyframes trace-danger-border {
    0%, 100% {
        border-color: var(--color-border-dim);
    }
    50% {
        border-color: var(--color-error);
    }
}

/* Trace critical - full screen overlay */
.trace-critical-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 996;
    pointer-events: none;
    background: transparent;
    animation: trace-critical 0.3s ease-in-out infinite;
}

@keyframes trace-critical {
    0%, 100% {
        background: transparent;
    }
    50% {
        background: rgba(255, 0, 0, 0.1);
    }
}

/* ========================================
   TRANSITION EFFECTS
   ======================================== */

/* Fade in */
.fade-in {
    animation: fade-in 0.3s ease-out forwards;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Fade out */
.fade-out {
    animation: fade-out 0.3s ease-out forwards;
}

@keyframes fade-out {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Slide in from bottom */
.slide-in-bottom {
    animation: slide-in-bottom 0.3s ease-out forwards;
}

@keyframes slide-in-bottom {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Slide in from right */
.slide-in-right {
    animation: slide-in-right 0.3s ease-out forwards;
}

@keyframes slide-in-right {
    from {
        transform: translateX(20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Scale in */
.scale-in {
    animation: scale-in 0.2s ease-out forwards;
}

@keyframes scale-in {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================
   TYPING EFFECT
   ======================================== */

/* Typing cursor */
.typing-cursor::after {
    content: '█';
    animation: typing-cursor 0.7s infinite;
}

@keyframes typing-cursor {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

/* ========================================
   HACKING EFFECTS
   ======================================== */

/* Data stream effect */
.data-stream {
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(0, 255, 0, 0.1) 50%,
        transparent 100%
    );
    background-size: 100% 20px;
    animation: data-stream 0.5s linear infinite;
}

@keyframes data-stream {
    from {
        background-position: 0 0;
    }
    to {
        background-position: 0 20px;
    }
}

/* Encryption effect */
.encrypting {
    position: relative;
    overflow: hidden;
}

.encrypting::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 255, 0, 0.2),
        transparent
    );
    animation: encrypt-scan 1s linear infinite;
}

@keyframes encrypt-scan {
    from {
        left: -50%;
    }
    to {
        left: 100%;
    }
}

/* ========================================
   NOTIFICATION EFFECTS
   ======================================== */

/* Notification enter */
.notification-enter {
    animation: notification-enter 0.3s ease-out forwards;
}

@keyframes notification-enter {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Notification exit */
.notification-exit {
    animation: notification-exit 0.3s ease-out forwards;
}

@keyframes notification-exit {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ========================================
   BOOT SEQUENCE EFFECT
   ======================================== */
.boot-line {
    opacity: 0;
    animation: boot-appear 0.1s ease-out forwards;
}

@keyframes boot-appear {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   CONNECTION EFFECTS
   ======================================== */

/* Connection establishing */
.connecting {
    position: relative;
}

.connecting::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--color-text),
        transparent
    );
    animation: connection-wave 1s ease-in-out infinite;
}

@keyframes connection-wave {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* ========================================
   SHAKE EFFECT
   ======================================== */
.shake {
    animation: shake 0.5s ease-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* ========================================
   PROGRESS ANIMATIONS
   ======================================== */

/* Indeterminate progress */
.progress-indeterminate {
    position: relative;
    overflow: hidden;
}

.progress-indeterminate::after {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        var(--color-text),
        transparent
    );
    animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
    0% {
        left: -50%;
    }
    100% {
        left: 100%;
    }
}