/* Style pour le conteneur des notifications toast */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1055; /* Au-dessus de la plupart des éléments */
    width: 400px;
    display: flex;
    flex-direction: column-reverse; /* Les nouvelles notifications apparaissent en bas */
}

/* Style pour chaque notification toast */
.toast-notification {
    position: relative;
    margin-bottom: 1rem;
    background-color: var(--couleurdefond);
    border: none;
    border-radius: 16px; /* Augmentation du radius */
    box-shadow: 0 0 20px 5px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateX(120%);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden; /* Pour que la barre de progression reste dans les coins arrondis */
}
.toast-notification:hover {
    box-shadow: 0 12px 35px -5px rgba(0, 0, 0, 0.3);
    transform: scale(1.02);
}
.toast-notification.show {
    opacity: 1;
    transform: translateX(0);
}
.toast-notification.closing {
    animation: slideOutRight 0.5s forwards;
}

/* Header du toast */
.toast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: transparent;
    border-bottom: 1px solid var(--grisextraleger);
}
.toast-title {
    font-weight: 600; /* Un peu plus gras */
    color: var(--grisfonce);
}
.toast-close {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--grismoyen);
    cursor: pointer;
    transition: color 0.2s ease-in-out;
    padding: 0.5rem;
    margin: -0.5rem;
}
.toast-close:hover {
    color: var(--grisfonce);
}

/* Corps du toast */
.toast-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    color: var(--grisfonce);
    font-size: 0.95rem;
}
.toast-description {
    flex-grow: 1;
    margin-right: 1rem;
}
.toast-body .btn-aller-vers {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background-color: var(--grisextraleger);
    color: var(--grisfonce);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1rem;
    transition: background-color 0.2s, transform 0.2s;
}
.toast-body .btn-aller-vers:hover {
    background-color: var(--grisleger);
    transform: scale(1.1);
}

/* Barre de progression */
.toast-progress {
    position: absolute;
    bottom: 0;
    right: 0; /* Ancrage à droite pour que la barre diminue vers la droite */
    height: 4px;
    width: 100%;
    background-color: var(--rougemoyen);
    animation: progressAnimation 8s linear forwards;
}

/* Animations */
@keyframes progressAnimation {
    from { width: 100%; }
    to { width: 0%; }
}
@keyframes slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(120%); }
}

#listeNotifications.show {
    position: fixed;
    top: 50px;
    right: 20px;
    left: auto;
    z-index: 1050;
    width: auto; /* Changed to auto for responsiveness */
    max-width: 700px; /* Max width to maintain original size on larger screens */
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 0 20px 5px rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    border: none;
    display: block;
}

@media (max-width: 768px) {
    #listeNotifications.show {
        width: calc(100% - 40px); /* Full width minus padding on mobile */
        left: 20px;
        right: 20px;
        max-width: 100%; /* Ensure it doesn't exceed screen width */
    }
}

/* Styles pour les éléments individuels de la liste de notifications */
#listeNotifications > a.dropdown-item {
    display: flex; /* Utilise Flexbox pour aligner les éléments sur une ligne */
    align-items: center; /* Centre verticalement les éléments */
    gap: 10px; /* Espace entre le point, le texte et les boutons */
    padding-left: 1rem; /* Assure le padding standard des dropdown-item */
    padding-right: 1rem; /* Assure le padding standard des dropdown-item */
}

/* Le conteneur du texte doit prendre l'espace disponible et gérer l'overflow */
.notification-content-text {
    flex-grow: 1; /* Permet au texte de prendre tout l'espace restant */
    min-width: 0; /* Important pour permettre au flex item de réduire sa taille */
    overflow: hidden; /* Cache le texte qui dépasse */
}

/* Styles pour tronquer le titre et la description du texte */
.notification-content-text > div,
.notification-content-text > small {
    white-space: nowrap; /* Force le texte sur une seule ligne */
    overflow: hidden; /* Cache le texte qui dépasse */
    text-overflow: ellipsis; /* Affiche des points de suspension pour le texte coupé */
    display: block; /* S'assure que chaque élément prend sa propre ligne visuelle */
}

/* Le conteneur des boutons ne doit pas rétrécir et aligne ses propres boutons */
.notification-buttons-wrapper {
    flex-shrink: 0; /* Empêche ce conteneur de rétrécir */
    display: flex;
    align-items: center;
    gap: 5px; /* Espace entre les boutons */
}

.rating-system {
    margin-left: 15px;
    font-size: 1.5rem;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    background-color: var(--grisextraleger);
    border-radius: 8px;
    padding: 1px 5px;
    border: 1px solid var(--grisleger);
}
.emoji {
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
    filter: grayscale(100%);
    padding: 0 4px;
    background-color: transparent;
}
.emoji:hover,
.emoji.selected {
    transform: scale(1.1);
    filter: grayscale(0%);
}
.rating-system:hover .emoji:not(:hover) {
    filter: grayscale(100%);
}
.rating-system:hover .emoji:hover {
    filter: grayscale(0%);
}
.rating-system .emoji.selected ~ .emoji {
    filter: grayscale(100%);
}
.rating-system:hover .emoji.selected:not(:hover) ~ .emoji {
    filter: grayscale(100%);
}

@media (max-width: 700px) { /* Adjust breakpoint as needed for typical mobile devices */
    #toast-container {
        width: auto;
        left: 10px;
        right: 10px;
    }
    
    #modaleNotification .modal-dialog {
        max-width: 95% !important; /* Take up more width on small screens */
        margin: 0 auto !important; /* Center the modal */
    }

    #modaleNotification .modal-footer {
        flex-wrap: wrap; /* Allow buttons to wrap to the next line */
        justify-content: center; /* Center buttons when wrapped */
    }

    #modaleNotification .modal-footer > * {
        margin-bottom: 10px; /* Add some space between wrapped buttons */
    }
}