/* ================================
   MEGA EFFECTS - VISUAL SUPERPOWERS
   ================================ */

/* ================================
   DARK/LIGHT MODE VARIABLES
   ================================ */

:root {
    --bg-primary: #FFF8E1;
    --bg-secondary: #FFFFFF;
    --text-primary: #0A0A0A;
    --text-secondary: #333333;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --glow-color: rgba(255, 59, 59, 0.3);
    --mode-transition: 0.5s ease;
}

[data-theme="dark"] {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --text-primary: #eaeaea;
    --text-secondary: #a8a8a8;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --glow-color: rgba(0, 255, 255, 0.3);
}

body {
    transition: background-color var(--mode-transition), color var(--mode-transition);
}

/* ================================
   THEME TOGGLE BUTTON
   ================================ */

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--hero-yellow), var(--hero-orange));
    border: 4px solid var(--comic-black);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(20deg);
    box-shadow: 0 8px 25px var(--glow-color);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* ================================
   MATRIX CODE RAIN BACKGROUND
   ================================ */

.matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.03;
    pointer-events: none;
}

[data-theme="dark"] .matrix-canvas {
    opacity: 0.08;
}

/* ================================
   PARTICLE SYSTEM
   ================================ */

.particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--hero-blue);
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat 3s ease-in-out infinite;
}

@keyframes particleFloat {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(50px);
        opacity: 0;
    }
}

/* ================================
   GLITCH EFFECTS
   ================================ */

.glitch {
    position: relative;
}

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

.glitch:hover::before {
    animation: glitch-1 0.3s infinite;
    color: var(--hero-red);
    z-index: -1;
}

.glitch:hover::after {
    animation: glitch-2 0.3s infinite;
    color: var(--hero-blue);
    z-index: -2;
}

@keyframes glitch-1 {
    0% {
        transform: translate(0);
        opacity: 1;
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
        opacity: 1;
    }
}

@keyframes glitch-2 {
    0% {
        transform: translate(0);
        opacity: 1;
    }
    20% {
        transform: translate(2px, -2px);
    }
    40% {
        transform: translate(2px, 2px);
    }
    60% {
        transform: translate(-2px, -2px);
    }
    80% {
        transform: translate(-2px, 2px);
    }
    100% {
        transform: translate(0);
        opacity: 1;
    }
}

/* ================================
   3D CARD HOVER EFFECTS
   ================================ */

.card-3d {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
    will-change: transform;
}

.card-3d:hover {
    transform: perspective(1000px) rotateY(5deg) rotateX(5deg) scale(1.05);
}

.card-3d-content {
    transform: translateZ(50px);
}

/* ================================
   CURSOR TRAIL
   ================================ */

.cursor-trail {
    position: fixed;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--hero-yellow), transparent);
    pointer-events: none;
    z-index: 9999;
    opacity: 0.6;
    animation: trailFade 0.5s ease-out forwards;
}

@keyframes trailFade {
    to {
        transform: scale(2);
        opacity: 0;
    }
}

/* ================================
   SCROLL PROGRESS BAR
   ================================ */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 6px;
    background: linear-gradient(90deg, var(--hero-red), var(--hero-yellow), var(--hero-green), var(--hero-blue));
    z-index: 9999;
    transition: width 0.1s ease;
    box-shadow: 0 2px 10px var(--glow-color);
}

.scroll-progress::after {
    content: "⚡";
    position: absolute;
    right: -15px;
    top: -10px;
    font-size: 1.5rem;
    animation: powerPulse 1s infinite;
}

@keyframes powerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* ================================
   PAGE TRANSITIONS
   ================================ */

.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--hero-red);
    z-index: 10001;
    transform: scaleX(0);
    transform-origin: left;
    pointer-events: none;
}

.page-transition.active {
    animation: pageWipe 0.8s cubic-bezier(0.77, 0, 0.175, 1);
}

@keyframes pageWipe {
    0% {
        transform: scaleX(0);
    }
    50% {
        transform: scaleX(1);
        transform-origin: left;
    }
    51% {
        transform-origin: right;
    }
    100% {
        transform: scaleX(0);
        transform-origin: right;
    }
}

/* ================================
   ACHIEVEMENT NOTIFICATION
   ================================ */

.achievement {
    position: fixed;
    top: 100px;
    right: -400px;
    width: 350px;
    background: linear-gradient(135deg, var(--hero-purple), var(--hero-blue));
    border: 5px solid var(--comic-black);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px var(--shadow-color);
    z-index: 9998;
    transition: right 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.achievement.show {
    right: 30px;
}

.achievement-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 1rem;
}

.achievement-title {
    font-family: var(--font-hero);
    font-size: 1.5rem;
    color: white;
    text-align: center;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 0 var(--comic-black);
}

.achievement-desc {
    color: white;
    text-align: center;
    font-size: 1rem;
}

/* ================================
   PARALLAX SECTIONS
   ================================ */

.parallax-container {
    perspective: 1px;
    height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

.parallax-layer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.parallax-layer-back {
    transform: translateZ(-1px) scale(2);
}

.parallax-layer-base {
    transform: translateZ(0);
}

.parallax-layer-front {
    transform: translateZ(1px) scale(0.5);
}

/* ================================
   TYPING EFFECT
   ================================ */

.typing-text {
    overflow: hidden;
    border-right: 3px solid var(--hero-red);
    white-space: nowrap;
    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(--hero-red); }
}

/* ================================
   POWER-UP EFFECT (für Codex Aktionen)
   ================================ */

.power-effect {
    animation: screenFlash 0.5s ease-out;
}

@keyframes screenFlash {
    0% {
        background: var(--bg-primary);
    }
    50% {
        background: rgba(255, 255, 0, 0.3);
    }
    100% {
        background: var(--bg-primary);
    }
}

/* ================================
   FLOATING ACTION BUTTON
   ================================ */

.fab-menu {
    position: fixed;
    bottom: 100px;
    right: 30px;
    z-index: 9997;
}

.fab-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--hero-green), var(--hero-blue));
    border: 4px solid var(--comic-black);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab-button:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px var(--glow-color);
}

.fab-options {
    position: absolute;
    bottom: 70px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.fab-menu.active .fab-options {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.fab-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--hero-purple);
    border: 3px solid var(--comic-black);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px var(--shadow-color);
    transition: all 0.3s ease;
}

.fab-option:hover {
    transform: scale(1.15);
}

/* ================================
   SOUND TOGGLE
   ================================ */

.sound-toggle {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 10000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--hero-green);
    border: 3px solid var(--comic-black);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: all 0.3s ease;
}

.sound-toggle:hover {
    transform: scale(1.1);
}

.sound-toggle.muted {
    background: #999;
    opacity: 0.5;
}

/* ================================
   KONAMI CODE EASTER EGG EFFECT
   ================================ */

.konami-active {
    animation: rainbowBackground 3s ease infinite;
}

@keyframes rainbowBackground {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

.konami-stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.konami-star {
    position: absolute;
    font-size: 2rem;
    animation: starFall 2s ease-out forwards;
}

@keyframes starFall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* ================================
   BLOG CARD EFFECTS
   ================================ */

.blog-card {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.blog-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    transition: all 0.5s ease;
}

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

/* ================================
   SKILL TIMELINE
   ================================ */

.skill-timeline {
    position: relative;
    padding: 2rem 0;
}

.skill-timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--hero-red), var(--hero-purple), var(--hero-blue));
    transform: translateX(-50%);
}

.skill-item {
    position: relative;
    margin: 2rem 0;
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.5s ease;
}

.skill-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.skill-item::before {
    content: '⚡';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    background: var(--hero-yellow);
    border: 4px solid var(--comic-black);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

/* ================================
   RESPONSIVE ADJUSTMENTS
   ================================ */

@media (max-width: 768px) {
    .theme-toggle {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .achievement {
        width: 280px;
    }
    
    .fab-menu {
        bottom: 80px;
        right: 20px;
    }
    
    .sound-toggle {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
}

/* ================================
   LOADING SCREEN
   ================================ */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--comic-black);
    z-index: 10002;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-hero {
    font-family: var(--font-hero);
    font-size: 4rem;
    color: var(--hero-red);
    text-shadow: 4px 4px 0 var(--hero-blue);
    animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.loading-bar {
    width: 300px;
    height: 20px;
    background: #333;
    border: 4px solid var(--hero-blue);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 2rem;
}

.loading-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--hero-red), var(--hero-yellow), var(--hero-green));
    animation: loadingFill 2s ease-in-out infinite;
}

@keyframes loadingFill {
    0% { width: 0%; }
    50% { width: 100%; }
    100% { width: 0%; }
}

/* ================================
   DONKEY KONG GAME STYLES
   ================================ */

.donkey-kong-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 5px solid var(--hero-red);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
    max-width: 95vw;
}

.dk-game-header {
    text-align: center;
    margin-bottom: 15px;
}

.dk-game-header h2 {
    font-family: var(--font-hero);
    font-size: 2rem;
    color: var(--hero-yellow);
    margin: 0 0 10px 0;
    text-shadow: 3px 3px 0 var(--comic-black);
}

.dk-stats {
    display: flex;
    justify-content: space-around;
    font-size: 1.1rem;
    color: white;
    font-weight: bold;
}

#dkCanvas {
    display: block;
    margin: 0 auto;
}

.dk-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
    flex-wrap: wrap;
}

.dk-btn {
    padding: 12px 20px;
    font-size: 1rem;
    background: var(--hero-green);
    color: white;
    border: 3px solid var(--comic-black);
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.dk-btn:hover {
    transform: scale(1.1);
    background: var(--hero-blue);
}

.dk-btn-close {
    padding: 12px 20px;
    font-size: 1rem;
    background: var(--hero-red);
    color: white;
    border: 3px solid var(--comic-black);
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
}

/* ================================
   DEFENDER GAME STYLES
   ================================ */

.defender-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    background: linear-gradient(135deg, #000000, #1a1a2e);
    border: 5px solid var(--hero-blue);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
    max-width: 95vw;
}

.defender-header {
    text-align: center;
    margin-bottom: 15px;
}

.defender-header h2 {
    font-family: var(--font-hero);
    font-size: 2rem;
    color: var(--hero-blue);
    margin: 0 0 10px 0;
    text-shadow: 3px 3px 0 var(--hero-red);
}

.defender-stats {
    display: flex;
    justify-content: space-around;
    font-size: 1.1rem;
    color: white;
    font-weight: bold;
}

#defCanvas {
    display: block;
    margin: 0 auto;
}

.defender-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
    flex-wrap: wrap;
}

.defender-btn {
    padding: 12px 20px;
    font-size: 1rem;
    background: var(--hero-blue);
    color: white;
    border: 3px solid var(--comic-black);
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.defender-btn:hover {
    transform: scale(1.1);
    background: var(--hero-purple);
}

.defender-btn-close {
    padding: 12px 20px;
    font-size: 1rem;
    background: var(--hero-red);
    color: white;
    border: 3px solid var(--comic-black);
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
}

/* Responsive für Spiele */
@media (max-width: 768px) {
    .donkey-kong-container,
    .defender-container {
        padding: 10px;
    }
    
    #dkCanvas,
    #defCanvas {
        max-width: 100%;
        height: auto;
    }
    
    .dk-btn,
    .defender-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}
