/* ===========================
   ADVANCED ENHANCEMENTS
   =========================== */

/* Glassmorphism Effect */
.glass-effect {
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Animated Gradient Text */
.gradient-text {
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #f59e0b, #3b82f6);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-flow 3s linear infinite;
}

@keyframes gradient-flow {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

/* Neon Glow Button */
.neon-button {
    position: relative;
    overflow: hidden;
}

.neon-button::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #3b82f6, #8b5cf6, #f59e0b, #3b82f6);
    background-size: 400%;
    border-radius: 50px;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: glow-border 8s linear infinite;
    z-index: -1;
}

.neon-button:hover::before {
    opacity: 1;
    filter: blur(10px);
}

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

/* Floating Animation for Icons */
@keyframes float-smooth {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-10px) rotate(2deg);
    }
    50% {
        transform: translateY(-20px) rotate(0deg);
    }
    75% {
        transform: translateY(-10px) rotate(-2deg);
    }
}

.float-animation {
    animation: float-smooth 6s ease-in-out infinite;
}

/* Pulse Effect */
@keyframes pulse-scale {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.pulse-effect {
    animation: pulse-scale 2s ease-in-out infinite;
}

/* Loading Spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(59, 130, 246, 0.1);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Card Flip Effect */
.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

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

.flip-card-front,
.flip-card-back {
    backface-visibility: hidden;
    position: absolute;
    width: 100%;
    height: 100%;
}

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

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 200px;
    height: 200px;
}

/* Shake Animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake-animation {
    animation: shake 0.5s ease;
}

/* Glow Text */
.glow-text {
    color: var(--primary-color);
    text-shadow: 
        0 0 10px var(--primary-color),
        0 0 20px var(--primary-color),
        0 0 30px var(--primary-color),
        0 0 40px var(--primary-color);
    animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        text-shadow: 
            0 0 10px var(--primary-color),
            0 0 20px var(--primary-color);
    }
    50% {
        text-shadow: 
            0 0 20px var(--primary-color),
            0 0 30px var(--primary-color),
            0 0 40px var(--primary-color);
    }
}

/* Slide In Animations */
@keyframes slideInFromLeft {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromRight {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromTop {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromBottom {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Bounce Animation */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

.bounce-animation {
    animation: bounce 2s infinite;
}

/* Zoom In Animation */
@keyframes zoomIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.zoom-in {
    animation: zoomIn 0.5s ease;
}

/* Rotate Animation */
@keyframes rotate360 {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.rotate-animation {
    animation: rotate360 2s linear infinite;
}

/* Gradient Background Animation */
.animated-gradient-bg {
    background: linear-gradient(-45deg, #0f172a, #1e293b, #8b5cf6, #3b82f6);
    background-size: 400% 400%;
    animation: gradient-shift 15s ease infinite;
}

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

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: typing-dot 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-dot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Progress Bar Animation */
.animated-progress {
    position: relative;
    overflow: hidden;
}

.animated-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 30%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
    0% { left: -30%; }
    100% { left: 100%; }
}

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

.button-3d:hover {
    transform: translateY(-5px) rotateX(10deg);
}

.button-3d::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    transform: translateZ(-10px);
    filter: brightness(0.7);
    border-radius: inherit;
}

/* Holographic Effect */
.holographic {
    position: relative;
    overflow: hidden;
}

.holographic::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(59, 130, 246, 0.3) 50%,
        transparent 70%
    );
    animation: holographic-shine 3s infinite;
}

@keyframes holographic-shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* Matrix Rain Effect */
.matrix-text {
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
    animation: matrix-fall 5s linear infinite;
}

@keyframes matrix-fall {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

/* Glitch Effect */
.glitch {
    position: relative;
}

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

.glitch::before {
    color: #f59e0b;
    animation: glitch-1 0.3s infinite;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.glitch::after {
    color: #3b82f6;
    animation: glitch-2 0.3s infinite;
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

@keyframes glitch-1 {
    0%, 100% { transform: translate(0); }
    33% { transform: translate(-2px, 2px); }
    66% { transform: translate(2px, -2px); }
}

@keyframes glitch-2 {
    0%, 100% { transform: translate(0); }
    33% { transform: translate(2px, -2px); }
    66% { transform: translate(-2px, 2px); }
}

/* Scan Line Effect */
.scanline {
    position: relative;
    overflow: hidden;
}

.scanline::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(59, 130, 246, 0.5);
    animation: scanline-move 3s linear infinite;
}

@keyframes scanline-move {
    0% { top: 0%; }
    100% { top: 100%; }
}

/* Scroll progress bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 4px;
    background: var(--gradient-primary);
    z-index: 9999;
    transition: width 0.2s ease;
}

/* Preloader avatar */
.preloader-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    margin-top: 15px;
    object-fit: cover;
    animation: pulse-scale 2s infinite;
}

/* GitHub info section */
.github-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding: 15px 20px;
    border-radius: 12px;
    background: rgba(30,41,59,0.6);
}
.github-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    object-fit: cover;
}
.github-text p {
    margin: 4px 0;
    font-size: 0.95rem;
}

/* make GitHub info stack on narrow screens */
@media (max-width: 768px) {
    .github-info {
        flex-direction: column;
        text-align: center;
    }
    .github-info .github-text {
        margin-top: 10px;
    }
}

/* animation when GitHub info is shown */
.github-info {
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.github-info:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
}

/* Theme toggle button */
.theme-toggle,
.fullscreen-toggle {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(15, 23, 42, 0.45);
    transition: color 0.3s ease;
}

.theme-toggle:hover,
.fullscreen-toggle:hover {
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.55);
    box-shadow: 0 0 14px rgba(59, 130, 246, 0.35);
    transform: scale(1.1);
}

.theme-toggle,
.fullscreen-toggle {
    transition: color 0.25s ease, background 0.25s ease, border-color 0.25s ease,
                box-shadow 0.25s ease, transform 0.2s ease;
}

/* Utility Classes */
.no-select {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

.smooth-transition {
    transition: all 0.3s ease;
}

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.fade-in {
    opacity: 1;
    transition: opacity 0.5s ease;
}
