/* ==================== THEME STYLES (DARK/LIGHT MODE) ==================== */

/* Light Theme Colors */
body.light-mode {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --accent-color: #ec4899;
    --dark-bg: #f8fafc;
    --darker-bg: #ffffff;
    --light-text: #0f172a;
    --gray-text: #475569;
    --card-bg: #ffffff;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
}

body.light-mode #particles-js {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

body.light-mode .navbar {
    background: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-mode .navbar.scrolled {
    background: rgba(255, 255, 255, 0.95);
}

body.light-mode .skill-bar {
    background: #e2e8f0;
}

body.light-mode .form-control {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    color: var(--light-text);
}

body.light-mode .project-image::after {
    background: rgba(0, 0, 0, 0.05);
}

body.light-mode .social-link,
body.light-mode .tech-icon,
body.light-mode .contact-item {
    border: 1px solid #e2e8f0;
}

body.light-mode .footer {
    border-top: 1px solid #e2e8f0;
}

/* ==================== THEME TOGGLE BUTTON ==================== */
.theme-toggle {
    position: fixed;
    top: 50%;
    right: 30px;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: var(--gradient-1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 999;
    box-shadow: var(--shadow-glow);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.theme-toggle:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.8);
}

.theme-toggle-icon {
    position: absolute;
    font-size: 1.5rem;
    color: white;
    transition: all 0.3s ease;
}

.theme-toggle .sun-icon {
    opacity: 0;
    transform: rotate(-180deg) scale(0);
}

.theme-toggle .moon-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

body.light-mode .theme-toggle .sun-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

body.light-mode .theme-toggle .moon-icon {
    opacity: 0;
    transform: rotate(180deg) scale(0);
}

/* Theme toggle animation */
@keyframes themeSwitch {
    0% { transform: translateY(-50%) rotate(0deg); }
    50% { transform: translateY(-50%) rotate(180deg) scale(0.8); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

.theme-toggle.switching {
    animation: themeSwitch 0.6s ease;
}

/* ==================== SMOOTH TRANSITIONS FOR THEME CHANGE ==================== */
body,
.navbar,
.hero,
section,
.card-bg,
.skill-category,
.project-card,
.timeline-content,
.contact-item,
.footer,
.form-control,
.social-link,
.tech-icon {
    transition: background-color 0.3s ease,
                color 0.3s ease,
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}

/* ==================== LIGHT MODE SPECIFIC ADJUSTMENTS ==================== */
body.light-mode .glitch::before,
body.light-mode .glitch::after {
    opacity: 0.4;
}

body.light-mode .cursor-follower {
    border-color: var(--primary-color);
}

body.light-mode .avatar-ring {
    opacity: 0.3;
}

body.light-mode .image-overlay {
    mix-blend-mode: multiply;
}

body.light-mode .tag {
    background: #e0e7ff;
    color: var(--primary-color);
}

body.light-mode .filter-btn {
    background: #f8fafc;
    color: var(--light-text);
}

body.light-mode .filter-btn:hover,
body.light-mode .filter-btn.active {
    color: white;
}

body.light-mode .timeline::before {
    opacity: 0.3;
}

body.light-mode .timeline-date {
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.2);
}

/* ==================== RESPONSIVE THEME TOGGLE ==================== */
@media (max-width: 968px) {
    .theme-toggle {
        top: auto;
        bottom: 100px;
        right: 20px;
        width: 50px;
        height: 50px;
        transform: translateY(0);
    }

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

    @keyframes themeSwitch {
        0% { transform: rotate(0deg); }
        50% { transform: rotate(180deg) scale(0.8); }
        100% { transform: rotate(360deg); }
    }
}

/* ==================== THEME PREFERENCE PERSISTENCE ==================== */
/* Prevents flash of unstyled content on page load */
body.preload * {
    transition: none !important;
}

/* ==================== PRINT STYLES (For CV/Resume) ==================== */
@media print {
    body {
        background: white !important;
        color: black !important;
    }

    .navbar,
    .hamburger,
    .theme-toggle,
    .back-to-top,
    .cursor-follower,
    #particles-js,
    .scroll-indicator,
    .contact-form,
    .footer,
    .social-links,
    .hero-buttons {
        display: none !important;
    }

    section {
        page-break-inside: avoid;
        padding: 20px 0;
    }

    .container {
        max-width: 100%;
        padding: 0 20px;
    }

    .hero-content,
    .about-content,
    .contact-content {
        grid-template-columns: 1fr;
    }

    * {
        box-shadow: none !important;
        animation: none !important;
        transition: none !important;
    }
}

/* ==================== ACCESSIBILITY ==================== */
/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #4f46e5;
        --secondary-color: #7c3aed;
        --accent-color: #db2777;
    }

    body.light-mode {
        --light-text: #000000;
        --gray-text: #374151;
    }

    .btn,
    .social-link,
    .project-card,
    .skill-category {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .floating-card {
        animation: none !important;
    }

    .cursor-follower {
        display: none !important;
    }
}

/* ==================== COLOR BLIND MODES ==================== */
/* Optional: Add filters for color blind users */
body.protanopia {
    filter: url('#protanopia-filter');
}

body.deuteranopia {
    filter: url('#deuteranopia-filter');
}

body.tritanopia {
    filter: url('#tritanopia-filter');
}

/* ==================== THEME TRANSITION OVERLAY ==================== */
.theme-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at var(--x, 50%) var(--y, 50%),
                var(--primary-color) 0%,
                transparent 50%);
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
    transition: opacity 0.6s ease;
}

.theme-transition-overlay.active {
    opacity: 0.3;
}

/* ==================== SEASONAL THEMES (Optional) ==================== */
/* Christmas Theme */
body.christmas-theme {
    --primary-color: #dc2626;
    --secondary-color: #16a34a;
    --accent-color: #fbbf24;
}

/* Halloween Theme */
body.halloween-theme {
    --primary-color: #f97316;
    --secondary-color: #7c3aed;
    --accent-color: #000000;
}

/* ==================== CUSTOM SCROLLBAR ==================== */
/* Dark Mode Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 6px;
    border: 2px solid var(--dark-bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Light Mode Scrollbar */
body.light-mode ::-webkit-scrollbar-track {
    background: #f1f5f9;
}

body.light-mode ::-webkit-scrollbar-thumb {
    border-color: #f1f5f9;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--dark-bg);
}

body.light-mode * {
    scrollbar-color: var(--primary-color) #f1f5f9;
}