/* ==========================================================================
   Variables et Styles de Base
   ========================================================================== */
:root {
    --primary-color: #9c5096;
    --accent-color: #00f5ca;
    --dark-bg: #111111;
    --light-bg: #ffffff;
    --card-bg: #1a1a1a;
    --text-light: #f5f5f5;
    --text-dark: #333333;
    --text-muted: #a0a0a0;
    --header-bg: rgba(17, 17, 17, 0.85);
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    --border-radius: 12px;
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; width: 100%; max-width: 100%; overflow-x: hidden; overflow-x: clip; }
body { font-family: var(--font-body); background-color: var(--dark-bg); color: var(--text-light); min-height: 100vh; line-height: 1.7; display: flex; flex-direction: column; width: 100%; max-width: 100%; overflow-x: hidden; overflow-x: clip; overscroll-behavior-x: none; }
main, header, footer, section, nav { max-width: 100%; overflow-x: clip; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; width: 100%; }
img, svg, video, iframe { max-width: 100%; height: auto; }
main { flex-grow: 1; position: relative; z-index: 1; }

/* ==========================================================================
   Composants Réutilisés (Background, Loader, Header, Footer...)
   ========================================================================== */
.background-glow { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; overflow: hidden; }
.firefly { position: absolute; border-radius: 50%; animation: move-firefly 20s infinite alternate ease-in-out; }
.firefly.large.fixed { filter: blur(200px); opacity: 0.3; animation: none; }
#glow1 { width: 700px; height: 700px; top: -25%; left: -15%; background-color: var(--primary-color); }
#glow2 { width: 600px; height: 600px; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: var(--accent-color); }
#glow3 { width: 550px; height: 550px; bottom: -30%; right: -20%; background-color: #3533cd; }
@keyframes move-firefly { 0% { transform: translate(0, 0); opacity: 0.4; } 50% { opacity: 0.8; } 100% { transform: translate(var(--x-end, 50px), var(--y-end, 50px)); opacity: 0; } }

#loader,
.loader {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 28% 18%, rgba(0, 245, 202, 0.12), transparent 55%),
        radial-gradient(circle at 72% 82%, rgba(120, 93, 255, 0.12), transparent 55%),
        linear-gradient(135deg, rgba(3, 6, 21, 0.96), rgba(5, 11, 32, 0.96));
    z-index: 9999;
    transition: opacity 360ms ease, visibility 360ms ease;
    overflow: hidden;
    visibility: visible;
}

#loader::before,
.loader::before {
    content: '';
    position: absolute;
    width: clamp(220px, 28vw, 280px);
    height: clamp(220px, 28vw, 280px);
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: rgba(0, 245, 202, 0.8);
    border-right-color: rgba(120, 93, 255, 0.75);
    background: radial-gradient(circle at 50% 50%, rgba(0, 245, 202, 0.1), transparent 70%);
    box-shadow:
        0 0 32px rgba(0, 245, 202, 0.22),
        inset 0 0 24px rgba(0, 245, 202, 0.18);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: loaderOrbit 1.9s linear infinite;
}

#loader::after,
.loader::after {
    content: 'FEI-AIX';
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    letter-spacing: 0.28rem;
    font-size: clamp(1.4rem, 2.6vw, 2.2rem);
    color: #ffffff;
    text-shadow: 0 0 18px rgba(0, 245, 202, 0.6);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 1.4rem;
    border-radius: 999px;
    background: rgba(3, 7, 18, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 18px rgba(0, 245, 202, 0.25);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: loaderPulse 1.9s ease-in-out infinite;
    white-space: nowrap;
}

.loader.loader-hidden,
#loader.loader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@keyframes loaderOrbit {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes loaderPulse {
    0%, 100% {
        opacity: 0.65;
        letter-spacing: 0.24rem;
        box-shadow: 0 0 14px rgba(0, 245, 202, 0.2);
    }
    50% {
        opacity: 1;
        letter-spacing: 0.34rem;
        box-shadow: 0 0 26px rgba(0, 245, 202, 0.45);
    }
}

header { background: var(--header-bg); padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; position: fixed; width: 100%; top: 0; z-index: 1000; border-bottom: 1px solid var(--border-color); backdrop-filter: blur(10px); }
.logo-container a { text-decoration: none; }
.fei-logo-text { font-family: var(--font-heading); font-size: 2rem; font-weight: 700; display: flex; align-items: center; transition: transform 0.3s ease; }
.fei-logo-text:hover { transform: scale(1.05); }
.fei-logo-text .fei { color: var(--text-light); }
.fei-logo-text .separator { color: var(--accent-color); margin: 0 2px; }
.fei-logo-text .aix { color: var(--text-light); }

.logo-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.3rem;
    font-weight: 400;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.logo-container:hover .logo-subtitle {
    opacity: 1;
    transform: translateY(0);
}

.desktop-nav ul { list-style: none; display: flex; gap: 1.5rem; }
.desktop-nav ul li a { color: var(--text-light); text-decoration: none; font-weight: 500; font-size: 0.95rem; padding: 0.5rem 0; position: relative; transition: color 0.3s ease; }
.desktop-nav ul li a::after { content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 2px; background-color: var(--accent-color); transition: width 0.3s ease; }
.desktop-nav ul li a:hover, .desktop-nav ul li a.active { color: var(--accent-color); }
.desktop-nav ul li a:hover::after, .desktop-nav ul li a.active::after { width: 100%; }

.menu-toggle { display: none; }
.mobile-nav { display: none; }
.mobile-menu-icon { display: none; position: fixed; bottom: clamp(12px, 5vw, 24px); right: clamp(12px, 5vw, 24px); z-index: 1001; cursor: pointer; width: 50px; height: 50px; background: rgba(17, 17, 17, 0.8); border-radius: 50%; justify-content: center; align-items: center; border: 1px solid var(--border-color); box-shadow: var(--shadow); }
.mobile-menu-icon span { width: 24px; height: 2px; background: var(--text-light); position: absolute; transition: all 0.3s ease; }

footer { background: #000; padding: 2.5rem 1.5rem; text-align: center; color: var(--text-muted); border-top: 1px solid var(--border-color); z-index: 2; }
footer p { margin-bottom: 1rem; }
footer ul { list-style: none; display: flex; justify-content: center; gap: 1.5rem; }
footer a { color: var(--text-muted); text-decoration: none; transition: all 0.3s ease; }
footer a:hover { color: var(--accent-color); }
.footer-socials {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.footer-socials a {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.2));
    background: rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease, background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.footer-socials a:hover,
.footer-socials a:focus-visible {
    transform: translateY(-2px);
    color: var(--dark-bg, #111111);
    background: var(--accent-color);
    border-color: var(--accent-color);
    outline: none;
}
.footer-socials svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}
#scroll-top { position: fixed; bottom: 1.5rem; right: 1.5rem; width: 40px; height: 40px; background: var(--accent-color); color: var(--dark-bg); border: none; border-radius: 50%; font-size: 1.5rem; cursor: pointer; z-index: 100; display: none; opacity: 0; visibility: hidden; transition: all 0.3s ease; }

/* ==========================================================================
   Styles Spécifiques à la Page Entreprises Confirmées
   ========================================================================== */
#hero-entreprises {
    padding: 8rem 1.5rem 4rem;
    text-align: center;
}

#hero-entreprises h1 {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--text-light);
}

.hero-description {
    max-width: 800px;
    margin: 0 auto 3rem;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.6;
    text-align: center;
}

#hero-entreprises .section-subtitle {
    max-width: 700px;
    margin: 2rem auto 0;
    color: var(--text-light);
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    opacity: 0.9;
    font-family: var(--font-heading);
}

.partners-description {
    max-width: 700px;
    margin: 1rem auto 2rem;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
    text-align: center;
}

/* Filtres */
#filters {
    padding: 2rem 0;
    text-align: center;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.filter-btn {
    background: var(--card-bg);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.filter-btn:hover {
    background: var(--accent-color);
    color: var(--dark-bg);
    border-color: var(--accent-color);
}

.filter-btn.active {
    background: var(--accent-color);
    color: var(--dark-bg);
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(0, 245, 202, 0.3);
}

/* Grille des entreprises */
#company-grid {
    padding: 4rem 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.company-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex; /* Pour le filtrage */
}

.company-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border-color: var(--accent-color);
}

.card-link {
    text-decoration: none;
    color: inherit;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-header img {
    height: 40px;
    width: 40px;
    object-fit: contain;
    border-radius: 8px;
}

.logo-placeholder {
    height: 40px;
    width: 40px;
    border-radius: 8px;
    background: rgba(0, 245, 202, 0.12);
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.card-header h3 {
    font-size: 1.3rem;
    color: var(--text-light);
    margin: 0;
}

.description {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    flex-grow: 1;
    margin-bottom: 1rem;
}

.sector-tag {
    align-self: flex-start;
    background: rgba(0, 245, 202, 0.1);
    color: var(--accent-color);
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Chart Section */
#chart-section {
    padding: 6rem 0;
}

#chart-section h2 {
    font-size: clamp(2rem, 5vw, 2.8rem);
    text-align: center;
    margin-bottom: 1rem;
}

#chart-section .section-subtitle {
    color: var(--text-muted);
    text-align: center;
    max-width: 600px;
    margin: 0 auto 4rem auto;
}

.chart-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    opacity: 0;
    transform: scale(0);
    transform-origin: center;
    transition: all 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body.aos-animate .chart-container[data-aos="fade-up"] {
    opacity: 1;
    transform: scale(1);
}

.chart-container canvas {
    animation: chartReveal 2s ease-out forwards;
}

@keyframes chartReveal {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(0.8);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        padding: 1rem;
        justify-content: center;
    }
    
    .logo-container {
        flex-grow: 1;
        justify-content: center;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .logo-subtitle {
        display: none;
        opacity: 0;
    }
    
    .desktop-nav { display: none; }
    
    .menu-toggle {
        display: none;
    }
    
    .mobile-menu-icon { 
        display: flex; 
        position: fixed; 
        bottom: 20px; 
        right: 20px; 
        z-index: 1001; 
        cursor: pointer; 
        width: 50px; 
        height: 50px; 
        background: rgba(17, 17, 17, 0.8); 
        border-radius: 50%; 
        justify-content: center; 
        align-items: center; 
        border: 1px solid var(--border-color); 
        box-shadow: var(--shadow); 
    }
    
    .mobile-menu-icon span { 
        width: 24px; 
        height: 2px; 
        background: var(--text-light); 
        position: absolute; 
        transition: all 0.3s ease; 
    }
    
    .mobile-menu-icon span:nth-child(1) { top: 15px; } 
    .mobile-menu-icon span:nth-child(2) { top: 24px; } 
    .mobile-menu-icon span:nth-child(3) { top: 33px; }
    
    .mobile-nav { 
        display: flex; 
        flex-direction: column; 
        justify-content: center; 
        align-items: center; 
        position: fixed; 
        top: 0; 
        left: 0; 
        width: 100%; 
        height: 100%; 
        background: var(--dark-bg); 
        z-index: 999; 
        transform: translateX(100%); 
        transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1); 
    }
    
    .mobile-nav ul { list-style: none; text-align: center; padding: 0; }
    .mobile-nav ul li { margin: 1.5rem 0; }
    .mobile-nav ul li a { color: var(--text-light); text-decoration: none; font-size: 1.5rem; font-family: var(--font-heading); }
    
    .menu-toggle:checked ~ .mobile-nav { transform: translateX(0); }
    .menu-toggle:checked ~ .mobile-menu-icon span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
    .menu-toggle:checked ~ .mobile-menu-icon span:nth-child(2) { opacity: 0; }
    .menu-toggle:checked ~ .mobile-menu-icon span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

    /* Masquer le bouton scroll-top en mobile pour éviter les conflits */
    #scroll-top { 
        display: none !important;
        visibility: hidden !important;
    }

    #hero-entreprises { 
        padding: 6rem 1rem 3rem;
        text-align: center;
    }
    
    #hero-entreprises h1 {
        font-size: 2.5rem;
        text-align: center;
    }
    
    .hero-description {
        text-align: center;
        margin: 0 auto 2rem;
    }
    
    #hero-entreprises .section-subtitle {
        font-size: 2rem;
        text-align: center;
    }
    
    .partners-description {
        text-align: center;
        margin: 1rem auto 2rem;
    }
    
    .chart-container {
        max-width: 400px;
        margin: 2rem auto;
    }
    
    .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0 1rem;
    }
    
    .company-card {
        margin: 0 0.5rem;
    }
    .chart-container {
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    .filter-buttons {
        gap: 0.5rem;
    }
    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    .company-card {
        margin: 0;
    }
}
