/* Advanced 3D Animations for TechCentrix */

/* 3D Card Flip Animation */
.card-flip {
    perspective: 1000px;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.card-flip:hover {
    transform: rotateY(180deg);
}

.card-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-flip:hover .card-flip-inner {
    transform: rotateY(180deg);
}

.card-flip-front, .card-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 1rem;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
}

.card-flip-back {
    background-color: #3b82f6;
    color: white;
    transform: rotateY(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 2rem;
}

/* 3D Tilt Effect */
.tilt-3d {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.tilt-3d:hover {
    transform: perspective(1000px) rotateX(10deg) rotateY(10deg) translateZ(20px);
}

/* Morphing Background */
.morphing-bg {
    background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #f5576c);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

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

/* 3D Text Glow */
.text-glow-3d {
    text-shadow: 
        0 0 5px #010330,
        0 0 10px #010330,
        0 0 15px #010330,
        0 0 20px #010330;
    animation: glowPulse 2s ease-in-out infinite alternate;
}

@keyframes glowPulse {
    from { text-shadow: 0 0 5px #010330, 0 0 10px #010330, 0 0 15px #010330, 0 0 20px #010330; }
    to { text-shadow: 0 0 10px #010330, 0 0 20px #010330, 0 0 30px #010330, 0 0 40px #010330; }
}

/* 3D Button Hover */
.btn-3d {
    position: relative;
    transform-style: preserve-3d;
    transition: all 0.3s ease;
}

.btn-3d:hover {
    transform: translateY(-2px) rotateX(5deg);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.btn-3d:active {
    transform: translateY(0) rotateX(0deg);
    box-shadow: 0 5px 10px rgba(0,0,0,0.2);
}

/* Floating Animation */
.float-animation {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

/* 3D Cube Animation */
.cube-3d {
    width: 100px;
    height: 100px;
    position: relative;
    transform-style: preserve-3d;
    animation: rotateCube 10s infinite linear;
}

.cube-face {
    position: absolute;
    width: 100px;
    height: 100px;
    background: rgba(1, 3, 48, 0.8);
    border: 2px solid #010330;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
}

.cube-face.front { transform: rotateY(0deg) translateZ(50px); }
.cube-face.back { transform: rotateY(180deg) translateZ(50px); }
.cube-face.right { transform: rotateY(90deg) translateZ(50px); }
.cube-face.left { transform: rotateY(-90deg) translateZ(50px); }
.cube-face.top { transform: rotateX(90deg) translateZ(50px); }
.cube-face.bottom { transform: rotateX(-90deg) translateZ(50px); }

@keyframes rotateCube {
    0% { transform: rotateX(0deg) rotateY(0deg); }
    100% { transform: rotateX(360deg) rotateY(360deg); }
}

/* 3D Loading Spinner */
.spinner-3d {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #010330;
    border-radius: 50%;
    animation: spin3D 1s linear infinite;
    transform-style: preserve-3d;
}

@keyframes spin3D {
    0% { transform: rotate(0deg) rotateX(0deg); }
    100% { transform: rotate(360deg) rotateX(360deg); }
}

/* Holographic Effect */
.holographic {
    background: linear-gradient(45deg, #ff006e, #8338ec, #3a86ff, #06ffa5);
    background-size: 400% 400%;
    animation: holographicShift 3s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* 3D Card Stack */
.card-stack {
    position: relative;
    transform-style: preserve-3d;
}

.card-stack::before,
.card-stack::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: inherit;
    border-radius: inherit;
    transform-style: preserve-3d;
}

.card-stack::before {
    transform: translateZ(-10px) rotateX(5deg);
    opacity: 0.7;
}

.card-stack::after {
    transform: translateZ(-20px) rotateX(10deg);
    opacity: 0.4;
}

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

.matrix-column {
    position: absolute;
    top: -100%;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    animation: matrixFall linear infinite;
}

@keyframes matrixFall {
    0% { top: -100%; opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* 3D Parallax Layers */
.parallax-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.parallax-layer-1 { transform: translateZ(-100px) scale(2); }
.parallax-layer-2 { transform: translateZ(-50px) scale(1.5); }
.parallax-layer-3 { transform: translateZ(0px) scale(1); }

/* Glitch Effect */
.glitch {
    position: relative;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    text-transform: uppercase;
}

.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;
    color: #ff0000;
    z-index: -1;
}

.glitch::after {
    animation: glitch-2 0.5s infinite;
    color: #00ff00;
    z-index: -2;
}

@keyframes glitch-1 {
    0%, 14%, 15%, 49%, 50%, 99%, 100% { transform: translate(0); }
    15%, 49% { transform: translate(-2px, 2px); }
}

@keyframes glitch-2 {
    0%, 20%, 21%, 62%, 63%, 99%, 100% { transform: translate(0); }
    21%, 62% { transform: translate(2px, -2px); }
}

/* Responsive 3D Effects */
@media (max-width: 768px) {
    .tilt-3d:hover {
        transform: perspective(1000px) rotateX(5deg) rotateY(5deg) translateZ(10px);
    }
    
    .card-flip:hover {
        transform: rotateY(90deg);
    }
    
    .floating-3d {
        animation-duration: 4s;
    }
}

/* Performance Optimizations */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .floating-3d,
    .float-animation,
    .cube-3d,
    .spinner-3d,
    .morphing-bg,
    .text-glow-3d,
    .holographic {
        animation: none;
    }
    
    .tilt-3d:hover,
    .card-flip:hover,
    .btn-3d:hover {
        transform: none;
    }
}
