/*
 * Animations and effects for portfolio
 */

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

.particle {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0.6;
    animation: float-particle 15s infinite ease-in-out;
}

@keyframes float-particle {
    0%, 100% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(50px, 20px);
    }
    50% {
        transform: translate(0, 50px);
    }
    75% {
        transform: translate(-30px, 10px);
    }
}

/* Animated skill bars */
.skill-progress-bar {
    width: 0;
    transition: width 1.5s ease;
}

/* Enhanced form validation */
.contact-form .form-control.valid {
    border-color: #10B981;
    background-color: rgba(16, 185, 129, 0.05);
}

.contact-form .form-control.invalid {
    border-color: #EF4444;
    background-color: rgba(239, 68, 68, 0.05);
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* Image comparison slider */
.image-comparison {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
    border-radius: 12px;
    margin: 30px 0;
}

.before-image,
.after-image {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    top: 0;
    left: 0;
}

.before-image {
    clip-path: inset(0 50% 0 0);
    z-index: 1;
}

.comparison-slider {
    position: absolute;
    top: 0;
    left: 50%;
    height: 100%;
    width: 2px;
    background-color: #fff;
    z-index: 2;
    cursor: ew-resize;
    transform: translateX(-50%);
}

.comparison-slider::before {
    content: "";
    position: absolute;
    width: 30px;
    height: 30px;
    background-color: #fff;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.comparison-slider::after {
    content: "⟷";
    position: absolute;
    color: #333;
    font-size: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Theme switcher */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    position: fixed;
    right: 25px;
    bottom: 90px;
    z-index: 50;
}

.theme-switch {
    display: inline-block;
    height: 24px;
    position: relative;
    width: 48px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: rgba(255, 255, 255, 0.2);
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: 0.4s;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.slider:before {
    background-color: white;
    bottom: 3px;
    content: "";
    height: 16px;
    left: 4px;
    position: absolute;
    transition: 0.4s;
    width: 16px;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: rgba(109, 40, 217, 0.8);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.slider .icon {
    color: white;
    position: absolute;
    top: 3px;
}

.slider .icon-moon {
    right: 6px;
    opacity: 0;
}

.slider .icon-sun {
    left: 6px;
    opacity: 1;
}

input:checked + .slider .icon-moon {
    opacity: 1;
}

input:checked + .slider .icon-sun {
    opacity: 0;
}

/* Dark mode styles */
body.dark-mode {
    background-color: #111827;
    color: #E2E8F0;
}

.dark-mode .bg-white {
    background-color: #1F2937 !important;
}

.dark-mode .text-gray-800 {
    color: #E2E8F0 !important;
}

.dark-mode .service-card,
.dark-mode .work-card,
.dark-mode .blog-card,
.dark-mode .contact-form {
    background-color: #1F2937;
    border-color: #374151;
}

.dark-mode h1, .dark-mode h2, .dark-mode h3, 
.dark-mode h4, .dark-mode h5, .dark-mode h6 {
    color: #F9FAFB;
}

.dark-mode p {
    color: #D1D5DB;
}

.dark-mode .navbar {
    background-color: rgba(17, 24, 39, 0.9);
}

/* Parallax effects */
.parallax {
    position: relative;
    transition: transform 0.1s ease-out;
    will-change: transform;
}

/* Staggered animations */
.stagger-animation {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.stagger-animation.active {
    opacity: 1;
    transform: translateY(0);
}

/* Counter animations */
.counter-wrapper {
    text-align: center;
    margin: 30px 0;
}

.counter-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
    margin-bottom: 5px;
}

.counter-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--body);
}

/* Mobile menu animation enhancements */
#mobile-menu {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#mobile-menu a {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Enhanced 3D tilt effect */
.tilt {
    transform-style: preserve-3d;
    transform: perspective(1000px);
    transition: transform 0.6s ease;
}

.tilt-inner {
    transform: translateZ(30px);
}

.tilt-shadow {
    position: absolute;
    top: 5%;
    left: 5%;
    width: 90%;
    height: 90%;
    border-radius: inherit;
    background: rgba(0, 0, 0, 0.1);
    transform: translateZ(-30px);
    filter: blur(20px);
    z-index: -1;
}
