body {
    margin: 0;
    font-family: 'Segoe UI', sans-serif;
    background: linear-gradient(to bottom, #ff9a8b, #ff6a88, #ff99ac);
    color: #fff;
    min-height: 100vh;
    padding-top: 70px; /* Espace pour la navbar */
    padding-bottom: 50px; /* Espace pour le footer */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

main {
    flex-grow: 1; /* Prend l'espace disponible */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Aligne le contenu en haut du main */
    padding: 20px 0; /* Padding vertical */
}

/* Conteneur principal de la page détail */
.projet-detail-container {
    background: #fff;
    color: #ff6a88;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(255, 106, 136, 0.2), 0 4px 15px rgba(0, 0, 0, 0.1);
    max-width: 1000px;
    width: 95%; /* Légèrement moins large pour les marges */
    margin: 0 auto; /* Centrage */
    overflow: hidden;
    position: relative; /* Pour positionner l'image et le bouton de retour */
    display: flex;
    flex-direction: column;
    align-items: center; /* Centre le contenu flex à l'intérieur */
}

/* Image du projet - Grande et en haut */
.projet-img-hero {
    width: 100%;
    /* Utilise une proportion pour la hauteur, ou min/max pour la flexibilité */
    /* La propriété aspect-ratio est la plus moderne et flexible */
    aspect-ratio: 16 / 9; /* Exemple: un ratio 16:9, commun pour les vidéos/bannières */
    /* Alternative si aspect-ratio ne convient pas (compatibilité ou besoin de hauteur fixe) : */
    /* height: 450px;  Commenté pour préférer aspect-ratio, mais peut être réactivé */
    max-height: 500px; /* Limite la hauteur maximale */
    min-height: 250px; /* Hauteur minimale même pour les petites images */
    overflow: hidden;
    position: relative;
    border-radius: 24px 24px 0 0; /* Coins supérieurs arrondis */
    /* Ajoutez un dégradé en arrière-plan pour les espaces vides de 'object-fit: contain' */
    background: linear-gradient(to bottom right, #ff9a8baa, #ff6a88aa); /* Semi-transparent et doux */
    display: flex; /* Pour centrer l'image avec 'contain' */
    justify-content: center;
    align-items: center;
}

.projet-img-hero img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Assure que toute l'image est visible */
    object-position: center; /* Centre l'image dans l'espace */
    display: block;
    transition: transform 0.3s ease-out; /* Effet de zoom léger au survol */
}

.projet-img-hero img:hover {
    transform: scale(1.02); /* Zoom léger car l'image est déjà entièrement visible */
}

/* Bouton de retour - Positionné absolument */
.btn-retour-projets {
    position: absolute;
    top: 25px;
    left: 25px;
    z-index: 10; /* Au-dessus de l'image */
    display: inline-flex;
    align-items: center;
    background: linear-gradient(90deg, rgba(255, 154, 139, 0.9) 60%, rgba(255, 106, 136, 0.9) 100%); /* Semi-transparent */
    color: #fff;
    padding: 10px 22px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.05rem;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px rgba(255, 106, 136, 0.2);
    backdrop-filter: blur(5px); /* Effet de flou derrière le bouton */
    -webkit-backdrop-filter: blur(5px);
}
.btn-retour-projets i {
    margin-right: 10px;
    font-size: 1.1em;
}
.btn-retour-projets:hover {
    background: linear-gradient(90deg, #ff6a88 60%, #ff9a8b 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 106, 136, 0.4);
}

/* Contenu principal du projet (titre, description, apprentissage) */
.projet-content-wrapper {
    padding: 35px; /* Padding généreux pour le contenu textuel */
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center; /* Centre le contenu textuel */
    text-align: center; /* Texte centré par défaut */
}

.projet-content-wrapper h1 {
    font-size: 3rem; /* Encore plus grand pour le titre */
    margin: 0 0 20px 0;
    color: #ff6a88;
    font-weight: 800;
    letter-spacing: 1px;
    line-height: 1.2;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.05); /* Légère ombre pour le titre */
}

.projet-description {
    background: #fff7fa;
    color: #ff6a88;
    border-radius: 18px;
    padding: 25px 30px;
    font-size: 1.2rem;
    line-height: 1.7;
    box-shadow: 0 5px 20px rgba(255, 106, 136, 0.1);
    max-width: 800px; /* Limite la largeur pour une meilleure lisibilité */
    margin-bottom: 30px; /* Espace après la description */
    text-align: left; /* Aligne le texte à gauche dans la description */
}

/* Apprentissage critique */
.apprentissage-critique-zone {
    margin: 0; /* Réinitialisé car intégré dans le flux */
    padding-top: 10px;
    padding-bottom: 40px; /* Plus d'espace en bas */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    width: 100%;
}

.apprentissage-btn {
    background: linear-gradient(90deg, #ff6a88 60%, #ff9a8b 100%);
    color: #fff;
    border: none;
    border-radius: 35px; /* Plus rond */
    padding: 15px 38px 15px 30px; /* Plus grand */
    cursor: pointer;
    font-weight: 700;
    font-size: 1.2rem; /* Plus grand */
    box-shadow: 0 6px 20px rgba(255, 106, 136, 0.3);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
    position: relative;
    z-index: 2;
}
.apprentissage-btn i {
    font-size: 1.3em;
}

.apprentissage-btn:hover, .apprentissage-btn:focus {
    background: linear-gradient(90deg, #ff9a8b 60%, #ff6a88 100%);
    box-shadow: 0 8px 30px rgba(255, 106, 136, 0.5);
    transform: translateY(-4px);
}

.apprentissage-bulle {
    display: none;
    position: absolute;
    left: 50%;
    top: calc(100% + 20px); /* Positionné plus bas sous le bouton */
    transform: translateX(-50%);
    background: #fff;
    color: #ff6a88;
    border: 2px solid #ff6a88;
    border-radius: 22px;
    padding: 28px 35px;
    min-width: 300px;
    max-width: 80vw;
    z-index: 10;
    box-shadow: 0 12px 45px rgba(255, 106, 136, 0.25), 0 4px 12px rgba(0, 0, 0, 0.1);
    font-size: 1.15rem;
    font-weight: 500;
    animation: fadeInBulle 0.4s ease forwards;
    text-align: left;
    line-height: 1.7;
    opacity: 0;
    overflow: visible;
    white-space: normal;
}


.apprentissage-bulle::before {
    content: "";
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 15px 18px 15px;
    border-style: solid;
    border-color: transparent transparent #fff transparent;
    filter: drop-shadow(0 -3px 3px rgba(255, 106, 136, 0.3));
}
.apprentissage-bulle::after {
    content: "";
    position: absolute;
    top: -19px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 15px 18px 15px;
    border-style: solid;
    border-color: transparent transparent #ff6a88 transparent;
    z-index: -1;
}

@keyframes fadeInBulle {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Commentaires Section */
.commentaires-section {
    padding: 35px;
    padding-top: 0; /* La marge est gérée par le padding du wrapper principal */
    width: 100%;
    box-sizing: border-box;
    border-top: 1px solid rgba(255, 106, 136, 0.15); /* Séparateur plus marqué */
    margin-top: 20px; /* Espace au-dessus du séparateur */
}

.commentaires-section h2 {
    color: #ff6a88;
    font-size: 2.2rem; /* Plus grand */
    margin-bottom: 30px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-align: center;
}

/* Formulaire d'ajout de commentaire */
.ajout-commentaire-form {
    background: #fff;
    color: #ff6a88;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(255, 106, 136, 0.1);
    padding: 25px 30px;
    margin-bottom: 35px;
    max-width: 750px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ajout-commentaire-form textarea {
    border-radius: 15px;
    border: 1px solid #ff9a8b;
    padding: 15px 18px;
    font-size: 1.1rem;
    resize: vertical;
    min-height: 90px;
    color: #ff6a88;
    font-family: 'Segoe UI', sans-serif;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.ajout-commentaire-form textarea:focus {
    border-color: #ff6a88;
    box-shadow: 0 0 0 4px rgba(255, 106, 136, 0.25);
    outline: none;
}

.ajout-commentaire-form button {
    background: linear-gradient(90deg, #ff6a88 60%, #ff9a8b 100%);
    color: #fff;
    border: none;
    border-radius: 28px;
    padding: 14px 30px;
    font-weight: 700;
    font-size: 1.15rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    align-self: flex-end;
    box-shadow: 0 5px 20px rgba(255, 106, 136, 0.25);
}
.ajout-commentaire-form button:hover {
    background: linear-gradient(90deg, #ff9a8b 60%, #ff6a88 100%);
    transform: translateY(-3px);
    box-shadow: 0 7px 25px rgba(255, 106, 136, 0.4);
}

/* Liste des commentaires */
.liste-commentaires {
    display: flex;
    flex-direction: column;
    gap: 25px; /* Espacement accru */
    max-width: 750px;
    margin: 0 auto;
}

.commentaire {
    background: #fff;
    color: #ff6a88;
    border-radius: 18px;
    box-shadow: 0 4px 18px rgba(255, 106, 136, 0.1);
    padding: 22px 28px;
    display: flex;
    align-items: flex-start;
    gap: 22px;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.commentaire:hover {
    transform: translateY(-4px);
    box-shadow: 0 7px 25px rgba(255, 106, 136, 0.2);
}

.commentaire-avatar {
    width: 60px; /* Encore plus grand */
    height: 60px;
    border-radius: 50%;
    background: #ff9a8b33; /* Plus transparent */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem; /* Plus grand */
    font-weight: bold;
    color: #ff6a88;
    flex-shrink: 0;
    border: 3px solid #ff6a88; /* Bordure plus épaisse */
}

.commentaire-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Aligne le contenu du commentaire à gauche */
}

.commentaire-header { /* Nouveau conteneur pour le nom et la date */
    display: flex;
    align-items: baseline;
    margin-bottom: 5px;
}

.commentaire strong {
    color: #ff6a88;
    font-size: 1.2rem;
    font-weight: 700;
}

.commentaire-date {
    font-size: 1rem;
    color: #ff9a8b;
    margin-left: 12px;
    opacity: 0.85;
}

.commentaire p {
    margin: 0; /* Supprime la marge par défaut */
    font-size: 1.1rem;
    line-height: 1.6;
    color: #4a4a4a;
}

.form-supprimer-commentaire {
    margin: 0;
    position: absolute;
    top: 18px;
    right: 18px;
}

.commentaire .supprimer-btn {
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 18px;
    padding: 8px 16px;
    font-size: 0.98rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.2);
}
.commentaire .supprimer_btn:hover {
    background: #c82333;
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Messages */
.success-message, .error-message {
    display: block;
    text-align: center;
    font-weight: bold;
    margin: 25px auto;
    padding: 15px 25px;
    border-radius: 15px;
    max-width: 500px;
    font-size: 1.15rem;
    animation: fadeIn 0.5s ease-out forwards;
}
.success-message {
    background: #e6fff2;
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.4);
}
.error-message {
    background: #fff0f3;
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.4);
}
.projet-introuvable, .no-comments-message {
    text-align: center;
    font-size: 1.3rem;
    color: #fff;
    margin-top: 40px;
    font-weight: 600;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.15);
}

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

/* Responsive */
@media (max-width: 1000px) {
    .projet-detail-container {
        width: 98%;
        border-radius: 20px;
    }
    .projet-img-hero {
        /* hauteur moins fixe, mais toujours un ratio pour les petites tailles */
        aspect-ratio: 4 / 3; /* Un peu plus carré */
        max-height: 400px;
        border-radius: 20px 20px 0 0;
    }
    .projet-content-wrapper {
        padding: 30px;
    }
    .projet-content-wrapper h1 {
        font-size: 2.5rem;
    }
    .projet-description {
        font-size: 1.1rem;
        padding: 20px 25px;
    }
    .apprentissage-btn {
        padding: 13px 32px 13px 25px;
        font-size: 1.1rem;
    }
    .apprentissage-bulle {
        font-size: 1.05rem;
        padding: 22px 28px;
    }
    .commentaires-section {
        padding: 30px;
    }
    .commentaires-section h2 {
        font-size: 1.8rem;
    }
    .ajout-commentaire-form {
        max-width: 650px;
        padding: 20px 25px;
    }
    .commentaire {
        padding: 20px 25px;
    }
    .commentaire-avatar {
        width: 55px;
        height: 55px;
        font-size: 1.8rem;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 60px;
        padding-bottom: 40px;
    }
    .projet-detail-container {
        border-radius: 15px;
    }
    .projet-img-hero {
        aspect-ratio: 3 / 2; /* Encore un peu plus carré */
        max-height: 300px;
        border-radius: 15px 15px 0 0;
    }
    .btn-retour-projets {
        top: 15px;
        left: 15px;
        padding: 8px 18px;
        font-size: 1rem;
        border-radius: 20px;
    }
    .projet-content-wrapper {
        padding: 25px;
    }
    .projet-content-wrapper h1 {
        font-size: 2rem;
    }
    .projet-description {
        font-size: 1rem;
        padding: 18px 22px;
        max-width: 100%;
    }
    .apprentissage-btn {
        padding: 10px 25px 10px 20px;
        font-size: 1rem;
    }
    .apprentissage-bulle {
        font-size: 0.95rem;
        padding: 18px 22px;
        border-radius: 18px;
    }
    .commentaires-section {
        padding: 25px;
    }
    .commentaires-section h2 {
        font-size: 1.6rem;
    }
    .ajout-commentaire-form {
        max-width: 100%;
        padding: 18px 22px;
    }
    .ajout-commentaire-form textarea {
        min-height: 80px;
        font-size: 1rem;
    }
    .ajout-commentaire-form button {
        padding: 10px 22px;
        font-size: 1.05rem;
    }
    .liste-commentaires {
        gap: 20px;
    }
    .commentaire {
        padding: 18px 22px;
        gap: 18px;
    }
    .commentaire-avatar {
        width: 48px;
        height: 48px;
        font-size: 1.6rem;
        border-width: 2px;
    }
    .commentaire strong {
        font-size: 1.1rem;
    }
    .commentaire-date {
        font-size: 0.9rem;
    }
    .commentaire p {
        font-size: 1rem;
    }
    .commentaire .supprimer-btn {
        padding: 6px 12px;
        font-size: 0.9rem;
        top: 15px;
        right: 15px;
    }
    .success-message, .error-message {
        font-size: 1rem;
        padding: 12px 18px;
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .projet-img-hero {
        aspect-ratio: 1 / 1; /* Presque carré sur mobile pour maximiser l'image */
        max-height: 250px;
        border-radius: 10px 10px 0 0;
    }
    .btn-retour-projets {
        top: 10px;
        left: 10px;
        padding: 6px 14px;
        font-size: 0.9rem;
        border-radius: 15px;
    }
    .projet-content-wrapper {
        padding: 20px 15px;
    }
    .projet-content-wrapper h1 {
        font-size: 1.8rem;
    }
    .projet-description {
        font-size: 0.9rem;
        padding: 15px 18px;
    }
    .apprentissage-btn {
        padding: 8px 18px 8px 15px;
        font-size: 0.9rem;
        border-radius: 25px;
    }
    .apprentissage-bulle {
        font-size: 0.85rem;
        padding: 12px 15px;
        border-radius: 15px;
    }
    .commentaires-section {
        padding: 20px 15px;
    }
    .commentaires-section h2 {
        font-size: 1.4rem;
    }
    .ajout-commentaire-form {
        padding: 15px 18px;
    }
    .ajout-commentaire-form textarea {
        min-height: 70px;
        font-size: 0.9rem;
    }
    .ajout-commentaire-form button {
        padding: 8px 18px;
        font-size: 0.95rem;
    }
    .liste-commentaires {
        gap: 15px;
    }
    .commentaire {
        padding: 15px 18px;
        gap: 15px;
    }
    .commentaire-avatar {
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
        border-width: 2px;
    }
    .commentaire strong {
        font-size: 1rem;
    }
    .commentaire-date {
        font-size: 0.8rem;
    }
    .commentaire p {
        font-size: 0.9rem;
    }
    .commentaire .supprimer-btn {
        padding: 4px 8px;
        font-size: 0.8rem;
        top: 10px;
        right: 10px;
    }
}

