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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Scroll Smooth */
html {
    scroll-behavior: smooth;
}

/* Header animations */
header {
    animation: fadeIn 0.8s ease-out;
    transition: all 0.3s ease;
}

header.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    padding: 0.7rem 2rem;
}

header nav ul li {
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both;
}

header nav ul li:nth-child(1) { animation-delay: 0.1s; }
header nav ul li:nth-child(2) { animation-delay: 0.2s; }
header nav ul li:nth-child(3) { animation-delay: 0.3s; }
header nav ul li:nth-child(4) { animation-delay: 0.4s; }
header nav ul li:nth-child(5) { animation-delay: 0.5s; }
header nav ul li:nth-child(6) { animation-delay: 0.6s; }

header nav ul li a {
    position: relative;
    transition: all 0.3s ease;
}

header nav ul li a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--tertiary-color, #FFD700);
    transition: width 0.3s ease;
}

header nav ul li a:hover::after,
header nav ul li a.active::after {
    width: 100%;
}

/* Hero section animations */
.hero {
    position: relative;
    overflow: hidden;
}

.hero-content {
    animation: fadeInUp 1s ease-out 0.3s;
    animation-fill-mode: both;
}

.hero-content h1 {
    animation: slideInLeft 1s ease-out 0.5s;
    animation-fill-mode: both;
}

.hero-content p {
    animation: slideInLeft 1s ease-out 0.7s;
    animation-fill-mode: both;
}

.btn, .btn-hero {
    animation: scaleIn 0.6s ease-out 1s;
    animation-fill-mode: both;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before, .btn-hero::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before, .btn-hero:hover::before {
    width: 300px;
    height: 300px;
}

/* Cards animations */
.actualites-grid article,
.disciplines-grid .discipline,
.document-card,
.actualite-card,
.discipline-card {
    animation: fadeInUp 0.8s ease-out;
    animation-fill-mode: both;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.actualites-grid article:nth-child(1),
.disciplines-grid .discipline:nth-child(1) { animation-delay: 0.1s; }
.actualites-grid article:nth-child(2),
.disciplines-grid .discipline:nth-child(2) { animation-delay: 0.2s; }
.actualites-grid article:nth-child(3),
.disciplines-grid .discipline:nth-child(3) { animation-delay: 0.3s; }
.actualites-grid article:nth-child(4) { animation-delay: 0.4s; }
.actualites-grid article:nth-child(5) { animation-delay: 0.5s; }
.actualites-grid article:nth-child(6) { animation-delay: 0.6s; }

.actualites-grid article:hover,
.disciplines-grid .discipline:hover,
.document-card:hover,
.actualite-card:hover,
.discipline-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 40px rgba(46, 139, 87, 0.25);
}

/* Images hover effect */
.actualites-grid article img,
.disciplines-grid .discipline img,
.document-image,
.actualite-image,
.discipline-card img {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.actualites-grid article:hover img,
.disciplines-grid .discipline:hover img,
.document-card:hover .document-image,
.actualite-card:hover .actualite-image,
.discipline-card:hover img {
    transform: scale(1.15) rotate(2deg);
}

/* Sections fade in on scroll */
.actualites, .presentation, .disciplines,
.actualites-section, .ressources-section,
.disciplines-section, .contact-section {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.actualites.visible, .presentation.visible, .disciplines.visible,
.actualites-section.visible, .ressources-section.visible,
.disciplines-section.visible, .contact-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Section titles */
.section-title, h2 {
    position: relative;
    display: inline-block;
    animation: fadeInUp 0.8s ease-out;
    animation-fill-mode: both;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--tertiary-color, #FFD700), var(--primary-color, #2E8B57));
    transition: width 0.8s ease;
}

.section-title.visible::after {
    width: 100%;
}

/* Form animations */
.form-group {
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both;
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }
.form-group:nth-child(4) { animation-delay: 0.4s; }

.form-group input,
.form-group textarea {
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 139, 87, 0.2);
}

/* Buttons */
.submit-btn, .map-btn, .btn-lire {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.submit-btn::after, .map-btn::after, .btn-lire::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.submit-btn:hover::after, .map-btn:hover::after, .btn-lire:hover::after {
    width: 400px;
    height: 400px;
}

/* Footer animation */
footer {
    animation: fadeIn 1s ease-out;
}

.social-icon {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-icon:hover {
    transform: translateY(-5px) scale(1.1);
}

/* Organigramme animations */
.node, .president {
    transition: all 0.3s ease;
    animation: scaleIn 0.6s ease-out;
    animation-fill-mode: both;
}

.nodes-row.first-level .node:nth-child(1) { animation-delay: 0.2s; }
.nodes-row.first-level .node:nth-child(2) { animation-delay: 0.3s; }
.nodes-row.second-level .node:nth-child(1) { animation-delay: 0.4s; }
.nodes-row.second-level .node:nth-child(2) { animation-delay: 0.5s; }
.nodes-row.second-level .node:nth-child(3) { animation-delay: 0.6s; }
.nodes-row.second-level .node:nth-child(4) { animation-delay: 0.7s; }
.nodes-row.second-level .node:nth-child(5) { animation-delay: 0.8s; }

/* Loading animation pour les images */
img {
    opacity: 0;
    transition: opacity 0.5s ease-in;
}

img.loaded {
    opacity: 1;
}

/* Responsive enhancements */
@media (max-width: 968px) {
    header nav ul {
        opacity: 0;
        max-height: 0;
        overflow: hidden;
        transition: all 0.4s ease;
    }
    
    header nav ul.active {
        opacity: 1;
        max-height: 500px;
    }
    
    .hero-content h1 {
        font-size: 2.5rem;
        line-height: 1.3;
    }
}

@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
}

/* Pulse animation pour les badges */
.file-badge, .actualite-tag {
    animation: pulse 2s infinite;
}

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

/* Shimmer effect pour les images en chargement */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.image-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Ajout de profondeur avec les ombres */
.actualite-card, .document-card, .discipline-card,
.form-container, .info-card, .map-card {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    transition: box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.actualite-card:hover, .document-card:hover, .discipline-card:hover,
.form-container:hover, .info-card:hover {
    box-shadow: 0 20px 40px rgba(46, 139, 87, 0.2);
}