:root {
    --grey: rgb(206, 206, 206);
    --dark-blue: rgb(19, 29, 52);
    --dark-grey: #252525;;
    --rosa: rgb(255, 56, 156);
    --blue-purple: rgb(129, 87, 254);
    --lighter-blue-purple: rgb(181, 140, 253);
    --white: rgb(231, 231, 231);
    --green: #28a745;
    --light--green: #5cd65c;
    --black: #000000;
}

body {
    background-color: var(--grey);
    color: var(--black);
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
}

header {
    background-color: var(--white);
    padding: 10px 20px;
    display: flex;
    align-items: center; /* centre verticalement tout le contenu */
    justify-content: space-between;
}

header .logo {
    height: 90px;
    width: 90px;
}

/* Navigation principale */
header nav {
    display: flex;
    align-items: center; /* centre verticalement tous les liens */
    gap: 2rem; /* espace horizontal entre les liens */
}

/* Liens classiques */
header nav a {
    color: var(--black);
    text-decoration: none;
    font-weight: bold;
    padding: 8px 12px; /* padding uniforme */
    display: flex;
    align-items: center; /* centre verticalement le texte */
    transition: color 0.2s ease;
}

header nav a:hover {
    color: var(--rosa);
}

/* Barre promotionnelle */
.promo-bar {
    width: 100%;
    background-color: #252525; /* gris foncé */
    overflow: hidden;
    height: 40px;
    display: flex;
    align-items: center;
    position: relative;
}

/* Conteneur du texte défilant */
.promo-texts {
    display: inline-flex;       /* aligne les textes sur la même ligne */
    gap: 7rem;                  /* espace entre chaque texte */
    white-space: nowrap;        /* empêche le texte de se casser sur plusieurs lignes */
    padding-left: 100%;         /* démarre hors écran à droite */
    animation: slide-texts 20s linear infinite;
    font-weight: bold;
    color: #fff;
    font-size: 1rem;
}

/* Animation */
@keyframes slide-texts {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}


/* Conteneur du menu avatar */
.avatar-dropdown {
    position: relative;
    display: flex;         /* alignement avatar + texte sur la même ligne */
    align-items: center;   /* centre verticalement */
    gap: 0.5rem;           /* espace entre avatar et nom */
    cursor: pointer;
}

/* Avatar dans la navbar */
.avatar-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ccc;
    transition: transform 0.2s ease;
}

.avatar-icon:hover {
    transform: scale(1.05);
}

/* Nom affiché à côté de l’avatar */
.avatar-name {
    font-weight: bold;
    color: var(--black);
    font-size: 1rem;
}

/* Menu déroulant */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;             /* juste sous l’avatar */
    right: 0;
    background-color: white;
    min-width: 150px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border-radius: 8px;
    overflow: hidden;
    z-index: 1000;
}

/* Liens du menu */
.dropdown-menu a {
    display: block;
    padding: 10px 15px;
    color: black;
    text-decoration: none;
    font-weight: bold;
}

.dropdown-menu a:hover {
    background-color: var(--rosa);
    color: white;
}

/* Afficher le menu au survol */
.avatar-dropdown:hover .dropdown-menu {
    display: block;
}

.add-content {
    color: var(--blue-purple);
}

.center-container {
    text-align: center;
}

.purple {
    color: var(--blue-purple);
}  

footer {
    background: var(--black);
    padding: 1.5rem 0 1rem 0;
    text-align: center;
    margin-top: 3rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 0.5rem;
}

.footer-link {
    color: var(--white);
    text-decoration: none;
    font-size: 1rem;

    &:hover {
        color: var(--rosa);
    }
}

.footer-icon img {
    height: 28px;
    width: 28px;
    vertical-align: middle;
    filter: grayscale(0);
    transition: filter 0.2s;
}

.footer-copy {
    color: var(--white);
    font-size: 0.95rem;
    opacity: 0.8;
}

.form-box {
    display: flex;
    justify-content: center;        /* centre horizontalement */
    align-items: center;
    padding: 2rem;
    box-sizing: border-box;

    & form {
        width: 100%;
        max-width: 500px;
        background: var(--white);            /* fond du card */
        color: var(--black);
        padding: 2.2rem;
        box-sizing: border-box;
    }

    & .form-logo {
        display: block;
        margin: 0 auto 1rem;
        height: 84px;
        width: 84px;
        object-fit: cover;
        border-radius: 12px;
    }

    & h2 {
        margin: 0 0 1rem 0;
        color: var(--black);
        font-size: 1.4rem;
    }

    & label {
        display: block;
        margin-top: 0.6rem;
        font-size: 0.95rem;
        color: var(--black);
    }

    & input[type="text"], input[type="password"], input[type="email"], textarea {
        width: 90%;
        margin-top: 0.35rem;  
        margin-bottom: 0.6rem;
        padding: 0.8rem;
        border: 1px solid #e6e6e9;
        border-radius: 8px;
        font-size: 1rem;
        outline: none;
        transition: border-color 0.15s, box-shadow 0.15s;
    }   
    
    & input[type="text"]:focus, input[type="password"]:focus {
        border-color: var(--rosa);
        box-shadow: 0 4px 12px rgba(255,56,156,0.12);
    }   

    & button[type="submit"] {
        display: block;
        width: 100%;
        margin-top: 0.9rem;
        padding: 0.75rem;
        border: none;
        border-radius: 999px;
        background: linear-gradient(90deg, var(--blue-purple), var(--lighter-blue-purple));
        color: var(--black);
        font-weight: 700;
        font-size: 1rem;
        cursor: pointer;
        transition: transform 0.12s ease, box-shadow 0.12s ease;

        & :hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(129,87,254,0.18);
        } 
    }

    & p {
        margin: 1rem 0 0 0;
        color: #555;
        text-align: center;

        & a {
            color: var(--rosa);
            text-decoration: none;
            font-weight: 600;
        }
    }
}

.avatar-preview {
    display: block;
    width: 100px;
    height: 100px;
    object-fit: cover;
    margin: 1rem 1rem;
}

@media (max-width: 480px) {
    .form-box {
        padding: 1.2rem;
    }

    .form-box form {
        padding: 1.4rem;
    }
}

.articles-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    padding: 2rem 5%;
    box-sizing: border-box;
}

.article-card {
    background: var(--white);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 20px;
}

.article-image-container {
    width: 100%;
    height: 220px;
    border-radius: 10px;
    overflow: hidden; /* essentiel pour masquer le débordement */
    position: relative;
}

.article-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
    transform-origin: center center; /* zoom depuis le centre */
}

.article-image-container:hover .article-image {
    transform: scale(1.05); /* zoom interne */
}

.article-content {
    padding: 1.4rem;
}

.article-title {
    font-size: 1.3rem;
    color: var(--black);
    margin: 0 0 0.6rem 0;
}

.article-button {
    display: inline-block;
    padding: 0.6rem 0.95rem;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--blue-purple), var(--lighter-blue-purple));
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(129,87,254,0.12);
    transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.12s;
    will-change: transform;

    /* petite flèche ajoutée via pseudo-élément */
    &::after {
        content: '→';
        display: inline-block;
        margin-left: 10px;
        font-weight: 800;
        transition: transform 0.18s ease, opacity 0.18s ease;
        transform: translateX(0);
        opacity: 0.95;
    }

    /* hover / focus */
    &:hover,
    &:focus {
        transform: translateY(-4px);
        box-shadow: 0 16px 40px rgba(129,87,254,0.16);
        text-decoration: none;
    }

    &:hover::after,
    &:focus::after {
        transform: translateX(6px);
        opacity: 1;
    }
}

/* responsive sizing */
@media (max-width: 640px) {
    .article-button { padding: 0.55rem 0.75rem; font-size: 0.95rem; }
}

.center-wrapper {
    display: flex;
    justify-content: center; /* centre horizontalement */
    align-items: center;     /* centre verticalement */
    height: 70vh;           /* prend toute la hauteur de la page */
}

.account-info {
    margin: 2rem auto; /* auto sur les côtés centre horizontalement */
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    color: var(--black);
    text-align: center; /* centre le texte à l'intérieur */
}

.account-info strong {
    color: var(--blue-purple);
}

.account-info a {
    text-decoration: none;
    color: var(--black);
    background-color: var(--rosa);
    border-radius: 20px;
    padding: 10px;
}

.big-title {
    margin-top: 2rem;
    color: var(--rosa);
    text-align: center;
}

.admin-panel {
    margin-inline: 20px;
}

/* === BILLET DETAILS EN DEUX COLONNES === */
.billet-details {
    max-width: 1500px;
    margin: 2rem auto 4rem auto;
    padding: 2rem 2.5rem;
}

.billet-content {
    display: flex;
    gap: 2.5rem;
    flex-wrap: wrap;
}

.billet-left,
.billet-right {
    flex: 1 1 400px; /* minimum 400px pour mobile, sinon partage l'espace */
}

.billet-left {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.billet-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-blue);
    margin-bottom: 1.5rem;
}

.billet-image {
    width: 100%;
    max-height: 450px;
    object-fit: cover;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.billet-image:hover {
    transform: scale(1.02);
}

.billet-right {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.billet-description {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--black);
    margin-bottom: 1.5rem;
}

.billet-advanced-description {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--dark-blue);
    background-color: var(--grey);
    padding: 1rem 1.2rem;
    border-radius: 12px;
}

/* RESPONSIVE POUR MOBILES */
@media screen and (max-width: 768px) {
    .billet-content {
        flex-direction: column;
        gap: 1.5rem;
    }

    .billet-left,
    .billet-right {
        flex: 1 1 100%;
    }

    .billet-title {
        font-size: 1.8rem;
    }

    .billet-advanced-description {
        padding: 0.8rem 1rem;
    }
}

/* === SECTION COMMENTAIRES DANS LE BILLET === */
.commentaries-section {
    margin: 3rem auto;
    padding: 2rem 2.5rem;
    background-color: var(--dark-grey);
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.commentaries-section h2 {
    text-align: center;
    font-size: 1.8rem;
    color: var(--white);
    margin-bottom: 1.5rem;
    position: relative;
}

.commentaries-section h2::after {
    content: "";
    display: block;
    width: 60px;
    height: 3px;
    background-color: var(--blue-purple);
    border-radius: 5px;
    margin: 0.5rem auto 0;
}

.commentary {
    display: flex;
    flex-direction: column;
    background-color: var(--grey);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    margin-bottom: 1.2rem;
}

.commentary-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.6rem;
}

.commentary-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    border: 2px solid #ddd;
}

.commentary-meta {
    display: flex;
    flex-direction: column;
}

.commentary-author {
    font-weight: bold;
    color: var(--dark-blue);
}

.commentary-date {
    font-size: 0.85rem;
    color: #555;
}

.commentary-content {
    padding-left: 62px;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--black);
}

/* === FORMULAIRE DE COMMENTAIRE === */
.comment-form {
    display: flex;
    flex-direction: column;
    margin-top: 2rem;
}

.comment-form textarea {
    resize: none;
    height: 100px;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--grey);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.comment-form textarea:focus {
    border-color: var(--blue-purple);
    outline: none;
}

.comment-form button {
    align-self: flex-end;
    background-color: var(--blue-purple);
    color: white;
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.comment-form button:hover {
    background-color: var(--lighter-blue-purple);
    transform: translateY(-2px);
}

.no-comment {
    color: var(--white);
}

/* Masquer la checkbox */
.toggle-comments-checkbox {
    display: none;
}

/* Style du label comme bouton */
.toggle-comments-label {
    display: inline-block;
    margin-bottom: 10px;
    padding: 6px 12px;
    background-color: var(--blue-purple);
    color: white;
    border-radius: 4px;
    cursor: pointer;
}

.toggle-comments-label:hover {
    background-color: #7033ff;
}

/* Masquer / afficher les commentaires selon la checkbox */
.comments-container {
    display: block;
    transition: all 0.3s ease;
}

/* Quand la checkbox est décochée, masquer les commentaires */
.toggle-comments-checkbox:not(:checked) ~ .comments-container {
    display: none;
}

/* Changer le texte du label selon l’état */
.toggle-comments-checkbox:not(:checked) + .toggle-comments-label::after {
    content: "Afficher les commentaires";
}

.toggle-comments-checkbox:checked + .toggle-comments-label::after {
    content: "Masquer les commentaires";
}

/* Optionnel : cacher l’ancien texte du label pour remplacer par ::after */
.toggle-comments-label::before {
    content: "";
}

/* === MESSAGE LOGIN POUR COMMENTER === */
.login-message {
    text-align: center;
    color: var(--white);
    margin-top: 1.5rem;
}

.login-message a {
    color: var(--blue-purple);
    text-decoration: none;
    font-weight: bold;
}

.login-message a {
  color: var(--blue-purple);
  text-decoration: none;
  font-weight: bold;
}

.avatar-preview-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

#avatarPreview {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#avatarPreview:hover {
    transform: scale(1.05);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ddd;
    display: block;
    margin: 15px auto;
}

.delete-avatar {
    background-color: #ff4d4d;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
}

.delete-avatar:hover {
    background-color: #e03333;
}

.logo-admin img {
    width: 100px;
    height: 100px;
}

.blue-p-backgroun {
    background-color: var(--blue-purple);
}