/* ===== Theme Toggle Button ===== */
.theme-toggle {
    position: fixed;
    top: 100px;
    right: 2rem;
    z-index: 1000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    overflow: hidden;
    border: 2px solid transparent;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.theme-toggle i {
    position: absolute;
    font-size: 1.2rem;
    transition: var(--transition);
}

.theme-toggle .fa-moon {
    color: var(--primary-color);
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.theme-toggle .fa-sun {
    color: #fbbf24;
    opacity: 0;
    transform: rotate(180deg) scale(0);
}

[data-theme="dark"] .theme-toggle {
    background: rgba(167, 139, 250, 0.15);
    backdrop-filter: blur(10px);
    border-color: rgba(167, 139, 250, 0.3);
}

[data-theme="dark"] .theme-toggle .fa-moon {
    opacity: 0;
    transform: rotate(-180deg) scale(0);
}

[data-theme="dark"] .theme-toggle .fa-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ===== Loading Screen ===== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-ring {
    width: 120px;
    height: 120px;
    border: 4px solid transparent;
    border-top-color: var(--primary-color);
    border-right-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.loader-text {
    position: absolute;
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse 2s ease-in-out infinite;
}

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

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

/* ===== Smooth Theme Transition ===== */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== Dark Mode Enhancements ===== */
[data-theme="dark"] body {
    background: linear-gradient(to bottom, #0a0e1a 0%, #161b2e 50%, #0a0e1a 100%);
}

[data-theme="dark"] body::before {
    background: radial-gradient(at 27% 37%, hsla(262, 83%, 58%, 0.25) 0px, transparent 50%),
                radial-gradient(at 97% 21%, hsla(200, 98%, 72%, 0.2) 0px, transparent 50%),
                radial-gradient(at 52% 99%, hsla(330, 98%, 61%, 0.2) 0px, transparent 50%),
                radial-gradient(at 10% 29%, hsla(220, 96%, 67%, 0.25) 0px, transparent 50%);
    opacity: 0.6;
}

/* Enhanced glassmorphism for dark mode */
[data-theme="dark"] .navbar {
    background: rgba(22, 27, 46, 0.8) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    border-bottom: 1px solid rgba(167, 139, 250, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .competency-card,
[data-theme="dark"] .timeline-content,
[data-theme="dark"] .project-card,
[data-theme="dark"] .skill-category,
[data-theme="dark"] .education-card {
    background: rgba(22, 27, 46, 0.6) !important;
    backdrop-filter: blur(15px) saturate(180%);
    border: 1px solid rgba(167, 139, 250, 0.2);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

[data-theme="dark"] .competency-card:hover,
[data-theme="dark"] .project-card:hover,
[data-theme="dark"] .education-card:hover {
    background: rgba(22, 27, 46, 0.8) !important;
    border-color: rgba(167, 139, 250, 0.5);
    box-shadow: 0 20px 60px rgba(167, 139, 250, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-5px) scale(1.02);
}

/* Dark mode buttons */
[data-theme="dark"] .btn-primary {
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.5) !important;
}

[data-theme="dark"] .btn-primary:hover {
    box-shadow: 0 15px 40px rgba(139, 92, 246, 0.7) !important;
}

[data-theme="dark"] .btn-outline {
    border-color: rgba(167, 139, 250, 0.5);
    color: var(--primary-color);
}

[data-theme="dark"] .btn-outline:hover {
    background: rgba(167, 139, 250, 0.1);
    border-color: var(--primary-color);
}

/* Dark mode form inputs */
[data-theme="dark"] .contact-form input,
[data-theme="dark"] .contact-form textarea {
    background: rgba(22, 27, 46, 0.6);
    border: 1px solid rgba(167, 139, 250, 0.3);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
}

[data-theme="dark"] .contact-form input:focus,
[data-theme="dark"] .contact-form textarea:focus {
    background: rgba(22, 27, 46, 0.8);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2);
}

/* Dark mode profile image */
[data-theme="dark"] .profile-image-wrapper::after {
    background: conic-gradient(from 0deg, #8b5cf6, #ec4899, #06b6d4, #8b5cf6);
    filter: blur(15px);
}

[data-theme="dark"] .profile-image {
    box-shadow: 0 25px 50px rgba(139, 92, 246, 0.4) !important;
}

/* Dark mode skill progress bars */
[data-theme="dark"] .skill-progress {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .skill-progress-bar {
    background: linear-gradient(90deg, #8b5cf6, #ec4899);
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.5);
}

/* Dark mode scrollbar */
[data-theme="dark"]::-webkit-scrollbar-track {
    background: #0a0e1a;
}

[data-theme="dark"]::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #8b5cf6, #ec4899);
}

/* Dark mode social links */
[data-theme="dark"] .social-links a {
    background: rgba(167, 139, 250, 0.1);
    border: 1px solid rgba(167, 139, 250, 0.3);
}

[data-theme="dark"] .social-links a:hover {
    background: rgba(167, 139, 250, 0.2);
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.5);
}

/* Dark mode footer */
[data-theme="dark"] .footer {
    background: rgba(10, 14, 26, 0.8);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(167, 139, 250, 0.2);
}

/* Particle canvas for dark mode */
[data-theme="dark"] #particleCanvas {
    opacity: 0.3;
}

/* Enhanced glow effects for dark mode */
[data-theme="dark"] .gradient-text {
    text-shadow: 0 0 30px rgba(167, 139, 250, 0.5);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .theme-toggle {
        top: 80px;
        right: 1rem;
        width: 45px;
        height: 45px;
    }
    
    .theme-toggle i {
        font-size: 1rem;
    }
    
    .loader-ring {
        width: 80px;
        height: 80px;
    }
    
    .loader-text {
        font-size: 1.5rem;
    }
}
