/* Cyberpunk Effects and Animations */

/* Glitch Effect */
.glitch {
    position: relative;
    display: inline-block;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    animation: glitch-1 0.5s infinite linear alternate-reverse;
    color: var(--primary-magenta);
    z-index: -1;
}

.glitch::after {
    animation: glitch-2 0.5s infinite linear alternate-reverse;
    color: var(--primary-cyan);
    z-index: -2;
}

@keyframes glitch-1 {
    0% { clip-path: inset(40% 0 61% 0); }
    5% { clip-path: inset(92% 0 1% 0); }
    10% { clip-path: inset(43% 0 1% 0); }
    15% { clip-path: inset(25% 0 58% 0); }
    20% { clip-path: inset(54% 0 7% 0); }
    25% { clip-path: inset(58% 0 43% 0); }
    30% { clip-path: inset(54% 0 18% 0); }
    35% { clip-path: inset(92% 0 9% 0); }
    40% { clip-path: inset(21% 0 67% 0); }
    45% { clip-path: inset(96% 0 6% 0); }
    50% { clip-path: inset(70% 0 27% 0); }
    55% { clip-path: inset(43% 0 54% 0); }
    60% { clip-path: inset(69% 0 23% 0); }
    65% { clip-path: inset(54% 0 38% 0); }
    70% { clip-path: inset(20% 0 20% 0); }
    75% { clip-path: inset(39% 0 7% 0); }
    80% { clip-path: inset(25% 0 52% 0); }
    85% { clip-path: inset(75% 0 23% 0); }
    90% { clip-path: inset(54% 0 35% 0); }
    95% { clip-path: inset(58% 0 24% 0); }
    100% { clip-path: inset(48% 0 36% 0); }
}

@keyframes glitch-2 {
    0% { clip-path: inset(25% 0 58% 0); }
    5% { clip-path: inset(54% 0 7% 0); }
    10% { clip-path: inset(58% 0 43% 0); }
    15% { clip-path: inset(54% 0 18% 0); }
    20% { clip-path: inset(92% 0 9% 0); }
    25% { clip-path: inset(21% 0 67% 0); }
    30% { clip-path: inset(96% 0 6% 0); }
    35% { clip-path: inset(70% 0 27% 0); }
    40% { clip-path: inset(43% 0 54% 0); }
    45% { clip-path: inset(69% 0 23% 0); }
    50% { clip-path: inset(54% 0 38% 0); }
    55% { clip-path: inset(20% 0 20% 0); }
    60% { clip-path: inset(39% 0 7% 0); }
    65% { clip-path: inset(25% 0 52% 0); }
    70% { clip-path: inset(75% 0 23% 0); }
    75% { clip-path: inset(54% 0 35% 0); }
    80% { clip-path: inset(58% 0 24% 0); }
    85% { clip-path: inset(48% 0 36% 0); }
    90% { clip-path: inset(40% 0 61% 0); }
    95% { clip-path: inset(92% 0 1% 0); }
    100% { clip-path: inset(43% 0 1% 0); }
}

/* Neon Glow Effects */
.neon {
    text-shadow: 
        0 0 5px currentColor,
        0 0 10px currentColor,
        0 0 20px currentColor,
        0 0 40px currentColor;
}

.neon-box {
    border: 2px solid var(--primary-cyan);
    box-shadow: 
        inset 0 0 20px rgba(0, 255, 255, 0.1),
        0 0 20px rgba(0, 255, 255, 0.4),
        0 0 40px rgba(0, 255, 255, 0.2);
}

/* Matrix Rain Effect */
.matrix-rain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.matrix-rain::before {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 200%;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 255, 0, 0.1) 2px,
            rgba(0, 255, 0, 0.1) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 98px,
            rgba(0, 255, 0, 0.05) 100px
        );
    animation: matrix-fall 10s linear infinite;
}

@keyframes matrix-fall {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(0); }
}

/* Scan Lines */
.scan-lines::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 255, 0.03) 2px,
        rgba(0, 255, 255, 0.03) 4px
    );
    pointer-events: none;
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100vh); }
}

/* Typewriter Effect */
.typewriter {
    overflow: hidden;
    border-right: 3px solid var(--primary-cyan);
    white-space: nowrap;
    margin: 0 auto;
    letter-spacing: 0.15em;
    animation: 
        typing 3.5s steps(40, end),
        blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--primary-cyan); }
}

/* Circuit Board Background */
.circuit-bg {
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(0, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 0, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(0, 255, 0, 0.1) 0%, transparent 50%);
    background-size: 200px 200px, 300px 300px, 250px 250px;
    background-position: 0 0, 100px 100px, 200px 50px;
    animation: circuit-move 20s linear infinite;
}

@keyframes circuit-move {
    0% { background-position: 0 0, 100px 100px, 200px 50px; }
    100% { background-position: 200px 200px, 300px 300px, 400px 250px; }
}

/* Holographic Effect */
.holographic {
    background: linear-gradient(
        45deg,
        var(--primary-cyan),
        var(--primary-magenta),
        var(--primary-green),
        var(--primary-cyan)
    );
    background-size: 400% 400%;
    animation: holographic 4s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes holographic {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Data Stream Effect */
.data-stream {
    position: relative;
    overflow: hidden;
}

.data-stream::before {
    content: '01010101 11010110 00110011 10101010 01100110 11001100';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--primary-green);
    opacity: 0.3;
    white-space: nowrap;
    animation: data-flow 8s linear infinite;
    z-index: 1;
}

@keyframes data-flow {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Cyberpunk Loading Animation */
.cyber-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-cyan);
    animation: cyber-spin 1s linear infinite;
}

@keyframes cyber-spin {
    to { transform: rotate(360deg); }
}

/* Glitch Button */
.btn-glitch {
    position: relative;
    overflow: hidden;
}

.btn-glitch::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: var(--transition-normal);
}

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

/* Neon Border Animation */
.neon-border {
    position: relative;
    border: 1px solid transparent;
    background: linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
                linear-gradient(45deg, var(--primary-cyan), var(--primary-magenta), var(--primary-green)) border-box;
}

/* Terminal Cursor */
.cursor {
    display: inline-block;
    background: var(--primary-cyan);
    animation: cursor-blink 1s infinite;
}

.cursor-blink {
    animation: cursor-blink 1s infinite;
}

@keyframes cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Power Button Effect */
.power-btn {
    position: relative;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.power-btn::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--primary-cyan), var(--primary-magenta));
    z-index: -1;
    opacity: 0;
    transition: var(--transition-normal);
}

.power-btn:hover::before {
    opacity: 1;
}

/* Circuit Lines */
.circuit-line {
    position: relative;
    overflow: hidden;
}

.circuit-line::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--primary-cyan),
        transparent
    );
    transform: translateY(-50%);
    animation: circuit-pulse 3s ease-in-out infinite;
}

@keyframes circuit-pulse {
    0%, 100% { opacity: 0.3; transform: translateY(-50%) scaleX(0.8); }
    50% { opacity: 1; transform: translateY(-50%) scaleX(1); }
}

/* Digital Noise */
.digital-noise {
    position: relative;
}

.digital-noise::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.1'/%3E%3C/svg%3E");
    animation: noise 0.2s infinite;
    pointer-events: none;
}

@keyframes noise {
    0%, 100% { opacity: 0.05; }
    50% { opacity: 0.1; }
}

/* Cyberpunk Grid */
.cyber-grid {
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    animation: grid-move 10s linear infinite;
}

@keyframes grid-move {
    0% { background-position: 0 0; }
    100% { background-position: 20px 20px; }
}

/* Hexagon Pattern */
.hex-pattern {
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(0, 255, 255, 0.1) 2px, transparent 2px);
    background-size: 30px 30px;
    background-position: 0 0, 15px 15px;
}

/* Error Glitch */
.error-glitch {
    animation: error-shake 0.5s ease-in-out infinite;
    color: #ff0040;
    text-shadow: 0 0 10px #ff0040;
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* Success Pulse */
.success-pulse {
    animation: success-pulse 1s ease-in-out;
    color: var(--primary-green);
    text-shadow: 0 0 10px var(--primary-green);
}

@keyframes success-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .glitch::before,
    .glitch::after {
        animation-duration: 0.3s;
    }
    
    .typewriter {
        animation: typing 2s steps(30, end), blink-caret 0.75s step-end infinite;
    }
    
    .matrix-rain::before {
        animation-duration: 8s;
    }
}

@media (prefers-reduced-motion: reduce) {
    .glitch::before,
    .glitch::after,
    .typewriter,
    .matrix-rain::before,
    .scan-lines::after,
    .holographic,
    .data-stream::before,
    .cyber-loading,
    .circuit-line::after,
    .digital-noise::before,
    .cyber-grid,
    .error-glitch,
    .success-pulse {
        animation: none !important;
    }
}

/* High contrast adjustments */
@media (prefers-contrast: high) {
    .glitch::before { color: #ff00ff; }
    .glitch::after { color: #00ffff; }
    .neon { text-shadow: 0 0 10px currentColor; }
    .digital-noise::before { opacity: 0; }
}

