/* ======================================
   VARIABLES CSS
   ====================================== */
:root,
[data-bs-theme="light"] {
    --primary-color: #0d6efd;
    --secondary-color: #6610f2;
    --header-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --body-bg: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --card-bg: #ffffff;
    --card-secondary-bg: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --navbar-bg: rgba(255, 255, 255, 0.95);
    --progress-bg: #e9ecef;
    --cursor-color: #764ba2;
    --card-hover-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    --card-inner-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05);
    --badge-inner-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] {
    --primary-color: #0d6efd;
    --secondary-color: #6610f2;
    --header-gradient: linear-gradient(135deg, #4455bb 0%, #5e3a89 100%);
    --body-bg: linear-gradient(135deg, #1a1d29 0%, #2d1b3d 100%);
    --card-bg: #2a2e40;
    --card-secondary-bg: #343a40;
    --text-primary: #f8f9fa;
    --text-secondary: #adb5bd;
    --navbar-bg: rgba(33, 37, 41, 0.95);
    --progress-bg: #495057;
    --cursor-color: #9f7aea;
    --card-hover-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --card-inner-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
    --badge-inner-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.15);
    --bs-body-bg: var(--body-bg);
    --bs-body-color: var(--text-primary);
}

/* ======================================
   STYLES GÉNÉRAUX
   ====================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    cursor: none; 
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    scroll-behavior: smooth;
    background: var(--body-bg);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-primary);
    transition: background 0.5s ease, color 0.5s ease;
    overflow-x: hidden;
}

a, button, .accordion-button, .card, .nav-link, .list-group-item,
.badge, .btn, .form-control, .theme-toggle-btn {
    cursor: none !important;
}

section {
    padding: 4rem 1rem;
}

/* ======================================
   ANIMATIONS
   ====================================== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

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

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* CORRECTION PERFORMANCE : Animation via transform (GPU) */
@keyframes expandWidth {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

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

@keyframes pulse-shadow {
    0% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(13, 110, 253, 0); }
    100% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0); }
}

@keyframes pulse-danger {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

@keyframes moveBackground {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* ======================================
   TITRES DE SECTION
   ====================================== */
.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    position: relative;
    padding-bottom: 1rem;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60%; /* Largeur fixe */
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
    
    /* CORRECTION PERFORMANCE : Animation optimisée */
    transform-origin: left;
    transform: scaleX(0); 
    animation: expandWidth 0.8s ease-out forwards;
}

/* ======================================
   BARRE DE NAVIGATION
   ====================================== */
nav.navbar {
    backdrop-filter: blur(20px) saturate(180%);
    background-color: var(--navbar-bg) !important;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.3rem;
    transition: transform 0.3s ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.nav-link {
    position: relative;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 80%;
}

/* ======================================
   BOUTON TOGGLE THÈME
   ====================================== */
.theme-toggle-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    background-color: var(--card-bg);
    border-radius: 50%;
    padding: 5px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

.theme-toggle-container:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0,0,0,0.25);
}

.theme-toggle-btn {
    background: var(--header-gradient);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
    transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
    transform: rotate(180deg);
}

/* ======================================
   HEADER
   ====================================== */
header {
    background: var(--header-gradient);
    padding: 5rem 2rem;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: moveBackground 20s linear infinite;
}

header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin: 0;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
    animation: fadeInDown 0.8s ease-out;
}

header p {
    font-size: 1.4rem;
    margin-top: 1rem;
    opacity: 0.95;
    position: relative;
    z-index: 1;
    animation: fadeInDown 0.8s ease-out 0.2s backwards;
}

/* ======================================
   CARTES
   ====================================== */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08), var(--card-inner-shadow);
    background: var(--card-bg);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 2rem;
    overflow: hidden;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s ease;
}

.card:hover::before {
    left: 100%;
}

.card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: var(--card-hover-shadow), var(--card-inner-shadow);
}

/* ======================================
   ACCORDION
   ====================================== */
.accordion-item {
    background-color: var(--card-secondary-bg);
    border: none;
    border-radius: 15px !important;
    margin-bottom: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08), var(--card-inner-shadow);
    transition: all 0.4s ease;
    overflow: hidden;
}

.accordion-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow), var(--card-inner-shadow);
}

.accordion-button {
    background-color: var(--card-secondary-bg);
    color: var(--text-primary);
    border: none;
    font-weight: 600;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.accordion-button:not(.collapsed) {
    background: var(--header-gradient);
    color: white;
    box-shadow: none;
}

.accordion-button:focus {
    box-shadow: none;
    border: none;
}

.accordion-body {
    padding: 1.5rem;
    background: var(--card-bg);
}

/* ======================================
   LIST GROUP
   ====================================== */
.list-group-item {
    background: var(--card-secondary-bg);
    border: none;
    border-radius: 12px !important;
    margin-bottom: 1rem;
    padding: 1.25rem;
    box-shadow: var(--card-inner-shadow);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.list-group-item:hover {
    transform: translateX(10px) scale(1.03);
    background: var(--header-gradient);
    color: white;
    box-shadow: var(--card-hover-shadow);
}

.list-group-item:hover i {
    transform: scale(1.2) rotate(5deg);
}

.list-group-item i {
    transition: transform 0.3s ease;
}

/* ======================================
   COMPÉTENCES
   ====================================== */
.skill-category {
    background: var(--card-secondary-bg);
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08), var(--card-inner-shadow);
    transition: all 0.4s ease;
    min-height: 150px;
}

.skill-category:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow), var(--card-inner-shadow);
}

.skill-category h3, 
.skill-category h4 {
    margin-bottom: 1.5rem;
    font-weight: 700;
    font-size: 1.3rem;
}

.badge {
    padding: 0.6rem 1.2rem;
    margin: 0.3rem 0.75rem 0.75rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 20px;
    box-shadow: var(--badge-inner-shadow);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-block;
}

.badge:hover {
    transform: scale(1.15) translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* ======================================
   BOUTONS
   ====================================== */
.btn {
    border-radius: 25px;
    padding: 0.75rem 2rem;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn::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 ease, height 0.6s ease;
    z-index: -1;
}

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

.btn-outline-primary:hover {
    animation: pulse-shadow 1.5s infinite;
    transform: translateY(-3px);
}

.btn-outline-danger:hover {
    animation: pulse-danger 1.5s infinite;
    transform: translateY(-3px);
}

/* ======================================
   FOOTER
   ====================================== */
footer {
    background: var(--header-gradient);
    color: white;
    text-align: center;
    padding: 1.5rem;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

footer p {
    font-size: 0.9rem !important;
    margin: 0 auto;
}

footer .fs-5 {
    font-size: 1rem !important;
}

footer i.bi-heart-fill {
    animation: heartbeat 1.5s infinite;
}

/* ======================================
   CURSEUR PERSONNALISÉ
   ====================================== */
.custom-cursor-dot {
    width: 12px;
    height: 12px;
    background: var(--cursor-color);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: transform 0.15s ease, background 0.3s ease, width 0.3s ease, height 0.3s ease;
    box-shadow: 0 0 15px var(--cursor-color);
}

.custom-cursor-dot.hover-target {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 2px solid var(--cursor-color);
}

/* ======================================
   RESPONSIVE
   ====================================== */
@media (max-width: 992px) {
    .theme-toggle-container {
        display: none !important; 
    }

    header h1 {
        font-size: 2.5rem;
    }

    .section-title {
        font-size: 2rem;
    }

    body {
        cursor: auto;
    }
    
    a, button, .accordion-button, .card, .nav-link, .list-group-item,
    .badge, .btn, .form-control, .theme-toggle-btn {
        cursor: pointer !important;
    }

    .custom-cursor-dot {
        display: none;
    }
}

@media (max-width: 768px) {
    header {
        padding: 3rem 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    section {
        padding: 2rem 1rem;
    }
}

/* ======================================
   IMPRESSION (Ctrl+P)
   ====================================== */
@media print {
    .theme-toggle-container, 
    .custom-cursor-dot, 
    .navbar, 
    footer, 
    .btn,
    form { 
        display: none !important; 
    }

    body, .card, .accordion-item, header {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
        cursor: auto !important;
    }
    
    body {
        color: black !important;
    }

    section, .card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    a::after {
        content: " (" attr(href) ")";
        font-size: 0.8rem;
    }
}