/* ===================================
   CUSTOM ANIMATIONS - Tailwind Portfolio
   Animations complexes qui ne peuvent pas être faites avec Tailwind
   =================================== */

/* Scroll Animations - Direction variée avec bounce */
.animate-in {
    opacity: 1 !important;
    transform: translate(0, 0) scale(1) rotate(0deg) !important;
}

/* Animation de pulse pour les cartes au hover */
.skill-category .backdrop-blur-xl:hover,
.skill-category .bg-primary-lighter:hover {
    animation: pulse-glow 0.6s ease-in-out;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(139, 92, 246, 0.6), 0 0 60px rgba(139, 92, 246, 0.3);
    }
}

/* Loader Screen Animations */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-out {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.animate-fade-in {
    animation: fade-in 1s ease-out forwards;
}

/* SSH Simulation Terminal Style */
#ssh-simulation {
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 0.5px;
}

#ssh-logs div {
    animation: log-appear 0.2s ease-out;
    line-height: 1.6;
}

@keyframes log-appear {
    from {
        opacity: 0;
        transform: translateX(-5px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Cursor blink animation */
.animate-blink {
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    50.01%, 100% {
        opacity: 0;
    }
}

.animate-fade-out {
    animation: fade-out 0.8s ease-out forwards;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

.animate-blink {
    animation: blink 1s step-end infinite;
}

.bg-gradient-radial {
    background: radial-gradient(circle at center, var(--tw-gradient-stops));
}

@keyframes spin-slow {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin-slow {
    animation: spin-slow 3s linear infinite;
}

/* Particules flottantes pour le loader */
.loader-particles {
    background-image: 
        radial-gradient(2px 2px at 20% 30%, rgba(139, 92, 246, 0.3), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(139, 92, 246, 0.3), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(139, 92, 246, 0.4), transparent),
        radial-gradient(1px 1px at 80% 10%, rgba(139, 92, 246, 0.3), transparent),
        radial-gradient(2px 2px at 90% 60%, rgba(139, 92, 246, 0.3), transparent),
        radial-gradient(1px 1px at 33% 80%, rgba(139, 92, 246, 0.3), transparent),
        radial-gradient(1px 1px at 15% 90%, rgba(139, 92, 246, 0.3), transparent);
    background-size: 200% 200%;
    animation: particles-float 20s ease-in-out infinite;
}

@keyframes particles-float {
    0%, 100% {
        background-position: 0% 0%, 100% 100%, 50% 50%, 80% 10%, 90% 60%, 33% 80%, 15% 90%;
    }
    50% {
        background-position: 100% 100%, 0% 0%, 70% 70%, 10% 80%, 60% 90%, 80% 33%, 90% 15%;
    }
}

/* Custom Cursor */
* {
    cursor: none;
}

a, button, input, textarea, select {
    cursor: none;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    transition: transform 0.15s ease-out, opacity 0.3s ease;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.8),
                0 0 40px rgba(139, 92, 246, 0.4);
}

.cursor-outline {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(139, 92, 246, 0.5);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 9998;
    transition: all 0.2s ease-out;
    transform: translate(-50%, -50%);
}

.cursor-dot.hover {
    transform: translate(-50%, -50%) scale(1.5);
    background: linear-gradient(135deg, #a78bfa, #c4b5fd);
    box-shadow: 0 0 30px rgba(167, 139, 250, 1),
                0 0 60px rgba(167, 139, 250, 0.6);
}

.cursor-outline.hover {
    width: 60px;
    height: 60px;
    border-color: rgba(167, 139, 250, 0.8);
}

/* Grid Background with Depth Effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-color: #000000;
    background-image: 
        linear-gradient(rgba(107, 70, 193, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(107, 70, 193, 0.1) 1px, transparent 1px),
        linear-gradient(rgba(107, 70, 193, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(107, 70, 193, 0.05) 1px, transparent 1px);
    background-size: 
        100px 100px,
        100px 100px,
        20px 20px,
        20px 20px;
    background-position: 
        -1px -1px,
        -1px -1px,
        -1px -1px,
        -1px -1px;
    animation: gridMove 20s linear infinite;
}

/* Animated light gradient that follows scroll */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    transition: background 0.8s ease;
}

/* Light positions for each section */
#accueil.section-visible ~ body::after,
body.section-accueil::after {
    background: radial-gradient(
        ellipse 800px 600px at 50% 30%,
        rgba(139, 92, 246, 0.15) 0%,
        rgba(107, 70, 193, 0.08) 30%,
        rgba(0, 0, 0, 0.3) 70%,
        rgba(0, 0, 0, 0.5) 100%
    );
}

#apropos.section-visible ~ body::after,
body.section-apropos::after {
    background: radial-gradient(
        ellipse 700px 500px at 30% 40%,
        rgba(139, 92, 246, 0.12) 0%,
        rgba(107, 70, 193, 0.06) 30%,
        rgba(0, 0, 0, 0.3) 70%,
        rgba(0, 0, 0, 0.5) 100%
    );
}

#formation.section-visible ~ body::after,
body.section-formation::after {
    background: radial-gradient(
        ellipse 750px 550px at 70% 50%,
        rgba(139, 92, 246, 0.13) 0%,
        rgba(107, 70, 193, 0.07) 30%,
        rgba(0, 0, 0, 0.3) 70%,
        rgba(0, 0, 0, 0.5) 100%
    );
}

#experiences.section-visible ~ body::after,
body.section-experiences::after {
    background: radial-gradient(
        ellipse 800px 600px at 40% 60%,
        rgba(139, 92, 246, 0.14) 0%,
        rgba(107, 70, 193, 0.08) 30%,
        rgba(0, 0, 0, 0.3) 70%,
        rgba(0, 0, 0, 0.5) 100%
    );
}

#projets.section-visible ~ body::after,
body.section-projets::after {
    background: radial-gradient(
        ellipse 900px 650px at 60% 50%,
        rgba(139, 92, 246, 0.15) 0%,
        rgba(107, 70, 193, 0.09) 30%,
        rgba(0, 0, 0, 0.3) 70%,
        rgba(0, 0, 0, 0.5) 100%
    );
}

#certifications.section-visible ~ body::after,
body.section-certifications::after {
    background: radial-gradient(
        ellipse 800px 600px at 35% 45%,
        rgba(139, 92, 246, 0.13) 0%,
        rgba(107, 70, 193, 0.07) 30%,
        rgba(0, 0, 0, 0.3) 70%,
        rgba(0, 0, 0, 0.5) 100%
    );
}

#competences.section-visible ~ body::after,
body.section-competences::after {
    background: radial-gradient(
        ellipse 850px 600px at 65% 55%,
        rgba(139, 92, 246, 0.14) 0%,
        rgba(107, 70, 193, 0.08) 30%,
        rgba(0, 0, 0, 0.3) 70%,
        rgba(0, 0, 0, 0.5) 100%
    );
}

#contact.section-visible ~ body::after,
body.section-contact::after {
    background: radial-gradient(
        ellipse 700px 500px at 50% 70%,
        rgba(139, 92, 246, 0.12) 0%,
        rgba(107, 70, 193, 0.06) 30%,
        rgba(0, 0, 0, 0.3) 70%,
        rgba(0, 0, 0, 0.5) 100%
    );
}

/* Translucent sections and cards */
section {
    background: transparent !important;
}

.card, .project-card, .skill-card, .cert-card, .timeline-item {
    background: rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(139, 92, 246, 0.2) !important;
}

/* Translucent containers */
.bg-primary, .bg-primary-light, .bg-primary-lighter {
    background: transparent !important;
}

.bg-black\/40, .bg-black\/30, .bg-black\/20, .bg-black\/50 {
    background: rgba(0, 0, 0, 0.2) !important;
    backdrop-filter: blur(12px) !important;
}

/* Translucent buttons */
button, .btn, a[class*="bg-gradient"], a[class*="bg-secondary"] {
    backdrop-filter: blur(10px) !important;
}

/* Translucent inputs */
input, textarea, select {
    background: rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(8px) !important;
    border: 1px solid rgba(139, 92, 246, 0.3) !important;
}

input:focus, textarea:focus, select:focus {
    background: rgba(0, 0, 0, 0.4) !important;
    border-color: rgba(139, 92, 246, 0.6) !important;
}

/* Timeline items - proper styling */
.timeline-item {
    background: transparent !important;
    position: relative;
}

/* Formation timeline - wrapper transparent */
#formation .timeline-item {
    background: transparent !important;
}

#formation .timeline-item > div.relative {
    background: transparent !important;
}

/* Formation timeline content boxes */
#formation .md\\:text-right,
#formation .md\\:pl-12 {
    background: rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(12px) !important;
    padding: 2rem !important;
    border-radius: 1rem !important;
    border: 1px solid rgba(139, 92, 246, 0.2) !important;
    transition: all 0.3s ease !important;
}

#formation .md\\:text-right:hover,
#formation .md\\:pl-12:hover {
    border-color: rgba(139, 92, 246, 0.5) !important;
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.15) !important;
    transform: scale(1.02);
}

/* Experience timeline items - different structure */
#experiences .timeline-item {
    background: rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(12px) !important;
    padding: 2rem !important;
    border-radius: 1rem !important;
    border: 1px solid rgba(139, 92, 246, 0.2) !important;
    border-left: 2px solid rgba(139, 92, 246, 0.3) !important;
    transition: all 0.3s ease !important;
}

#experiences .timeline-item:hover {
    border-color: rgba(139, 92, 246, 0.5) !important;
    border-left-color: rgba(139, 92, 246, 0.6) !important;
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.15) !important;
    transform: translateX(4px);
}

/* Modal translucent */
#project-modal {
    background: rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(20px) !important;
}

@keyframes gridMove {
    0% {
        background-position: 
            0 0,
            0 0,
            0 0,
            0 0;
    }
    100% {
        background-position: 
            100px 100px,
            100px 100px,
            20px 20px,
            20px 20px;
    }
}

/* Typewriter Effect */
@keyframes blink {
    50% { border-color: transparent; }
}

.typewriter,
.typewriter-subtitle {
    display: inline-block;
    border-right: 3px solid #8b5cf6;
    white-space: nowrap;
    animation: blink 0.75s step-end infinite;
}

/* Section Animations */
@keyframes sectionSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Floating dots animation */
@keyframes floatingDots {
    0%, 100% {
        background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 50% 50%;
    }
    25% {
        background-position: 20% 10%, 60% 70%, 50% 50%, 80% 10%, 90% 60%, 33% 80%, 60% 40%;
    }
    50% {
        background-position: 40% 20%, 40% 80%, 60% 40%, 70% 20%, 85% 55%, 30% 85%, 70% 30%;
    }
    75% {
        background-position: 10% 30%, 50% 60%, 45% 55%, 85% 15%, 95% 65%, 35% 75%, 40% 60%;
    }
}

.hero-background {
    background: 
        radial-gradient(2px 2px at 20% 30%, rgba(139, 92, 246, 0.4), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(139, 92, 246, 0.3), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(139, 92, 246, 0.5), transparent),
        radial-gradient(1px 1px at 80% 10%, rgba(139, 92, 246, 0.4), transparent),
        radial-gradient(2px 2px at 90% 60%, rgba(139, 92, 246, 0.3), transparent),
        radial-gradient(1px 1px at 33% 80%, rgba(139, 92, 246, 0.4), transparent),
        radial-gradient(circle at 50% 50%, rgba(107, 70, 193, 0.1) 0%, transparent 50%);
    background-size: 200% 200%;
    animation: floatingDots 20s ease-in-out infinite;
}

/* Perspective grid for laptop section */
.laptop-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background-image: 
        repeating-linear-gradient(
            0deg,
            rgba(139, 92, 246, 0.03) 0px,
            transparent 1px,
            transparent 40px,
            rgba(139, 92, 246, 0.03) 41px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(139, 92, 246, 0.03) 0px,
            transparent 1px,
            transparent 40px,
            rgba(139, 92, 246, 0.03) 41px
        );
    transform: perspective(500px) rotateX(60deg);
    transform-origin: bottom;
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
}

/* Section separator animation */
section:not(.hero-section)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 80%;
    max-width: 200px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #8b5cf6, transparent);
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: 0.3s;
}

section.section-visible:not(.hero-section)::before {
    transform: translateX(-50%) scaleX(1);
}

/* Initial state for sections (except hero) */
section:not(.hero-section) {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Force sections to be visible when detected */
section.section-visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Stagger animations for section content */
.section-visible .project-card,
.section-visible .timeline-item,
.section-visible .skill-category,
.section-visible .cert-card {
    animation: sectionSlideIn 0.6s ease-out forwards;
    opacity: 0;
}

.section-visible .project-card:nth-child(1),
.section-visible .timeline-item:nth-child(1),
.section-visible .skill-category:nth-child(1),
.section-visible .cert-card:nth-child(1) {
    animation-delay: 0.1s;
}

.section-visible .project-card:nth-child(2),
.section-visible .timeline-item:nth-child(2),
.section-visible .skill-category:nth-child(2),
.section-visible .cert-card:nth-child(2) {
    animation-delay: 0.2s;
}

.section-visible .project-card:nth-child(3),
.section-visible .timeline-item:nth-child(3),
.section-visible .skill-category:nth-child(3),
.section-visible .cert-card:nth-child(3) {
    animation-delay: 0.3s;
}

.section-visible .project-card:nth-child(4),
.section-visible .timeline-item:nth-child(4),
.section-visible .skill-category:nth-child(4) {
    animation-delay: 0.4s;
}

.section-visible .project-card:nth-child(5),
.section-visible .timeline-item:nth-child(5) {
    animation-delay: 0.5s;
}

.section-visible .project-card:nth-child(6),
.section-visible .timeline-item:nth-child(6) {
    animation-delay: 0.6s;
}

/* Scroll progress bar */
#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #6b46c1, #8b5cf6);
    z-index: 9999;
    transition: width 0.1s ease;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

/* Tab Navigation Styles */
.tab-navigation {
    display: flex;
    gap: 1rem;
    margin-bottom: 2.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: wrap;
    justify-content: center;
}

.tab-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 1.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(107, 70, 193, 0.3);
    border-radius: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    white-space: nowrap;
    min-height: 3.2rem;
}

.tab-button:hover {
    background: rgba(107, 70, 193, 0.2);
    color: rgba(255, 255, 255, 0.9);
    transform: scale(1.05);
    border-color: rgba(139, 92, 246, 0.5);
}

.tab-button.active {
    background: linear-gradient(135deg, rgba(107, 70, 193, 0.4), rgba(139, 92, 246, 0.4));
    color: #ffffff;
    border-color: rgba(139, 92, 246, 0.8);
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.5), inset 0 0 20px rgba(139, 92, 246, 0.2);
}

.tab-button.active::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #6b46c1, #8b5cf6);
    border-radius: 0.75rem;
    z-index: -1;
    opacity: 0.3;
    filter: blur(8px);
}

.tab-button svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.tab-content {
    animation: fadeInTab 0.4s ease-in-out;
}

.tab-content.hidden {
    display: none !important;
}

@keyframes fadeInTab {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive tab navigation */
@media (max-width: 768px) {
    .tab-button {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
    
    .tab-button svg {
        width: 1rem;
        height: 1rem;
    }
}

/* Modal animations */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal.active {
    display: block !important;
    animation: modalFadeIn 0.3s ease forwards;
}

/* Mobile menu animations */
#mobile-menu.active {
    transform: translateX(0);
}

#nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

#nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

#nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Navbar scroll effect */
#navbar {
    background: rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(15px) !important;
}

#navbar.scrolled {
    background: rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: blur(15px) !important;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

/* Active nav link */
.nav-link.active {
    color: #8b5cf6 !important;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #8b5cf6, transparent);
}
