/* =========================================================
   Notifications (sprint NMT - DEC-035)
   Cloche dans la topbar + panel deroulant + page liste.
   ========================================================= */

/* ---- Cloche topbar ---- */
.notif-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0 .25rem;
}
.notif-bell__btn {
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: .25rem;
    display: inline-flex;
    align-items: center;
    color: var(--color-text-muted);
    border-radius: 6px;
    position: relative;
    transition: background .15s, color .15s;
}
.notif-bell__btn:hover { background: var(--color-bg-alt); color: var(--color-text); }
.notif-bell__btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
/* Pastille notifications : point rouge discret en haut a droite de la
   cloche quand au moins une notif non-lue. Pas de chiffre (le panel
   affiche le detail). */
.notif-bell__badge {
    display: none;
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc2626;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
    pointer-events: none;
}
.notif-bell__badge.is-visible {
    display: inline-block;
}

/* ---- Panel deroulant ---- */
.notif-bell__panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 360px;
    max-width: calc(100vw - 1rem);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(15,23,42,0.15);
    z-index: 100;
    max-height: 480px;
    display: flex;
    flex-direction: column;
}
.notif-bell__panel[hidden] { display: none; }
.notif-bell__panel-head {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.notif-bell__panel-head strong { font-size: .9rem; }
.notif-bell__see-all {
    font-size: .8rem;
    color: var(--color-primary);
    text-decoration: none;
}
.notif-bell__see-all:hover { text-decoration: underline; }

/* En-tête du panneau : l'action de masse et le lien vers la page complète
   cohabitent à droite du titre. */
.notif-bell__panel-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.notif-bell__mark-all {
    font-size: .8rem;
    color: var(--color-text-muted);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}
.notif-bell__mark-all:hover:not(:disabled) { color: var(--color-text); text-decoration: underline; }
.notif-bell__mark-all:disabled { opacity: .5; cursor: default; }
.notif-bell__panel-body {
    overflow-y: auto;
    flex: 1;
}

/* ---- Cards ---- */
.notif-panel__list, .notif-page__list { display: flex; flex-direction: column; }
.notif-panel__empty {
    text-align: center;
    color: var(--color-text-muted);
    padding: 2rem 1rem;
    font-size: .85rem;
}

.notif-card {
    display: flex;
    gap: .625rem;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    transition: background .1s;
}
.notif-card:last-child { border-bottom: 0; }
.notif-card:hover { background: var(--color-bg-alt); }
.notif-card--unread { background: #f0f6ff; }
.notif-card--unread:hover { background: #e7f1ff; }

.notif-card__pastille {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    background: var(--color-text-muted);
}
.notif-card__pastille--ok      { background: #16a34a; }
.notif-card__pastille--warning { background: #ea580c; }
.notif-card__pastille--danger  { background: #dc2626; }
.notif-card__pastille--muted   { background: #94a3b8; }

.notif-card__body { flex: 1; min-width: 0; }
.notif-card__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .5rem;
    margin-bottom: .15rem;
}
.notif-card__title {
    font-size: .85rem;
    font-weight: 500;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
}
.notif-card--unread .notif-card__title { font-weight: 700; }
.notif-card__time {
    flex: 0 0 auto;
    font-size: .7rem;
    color: var(--color-text-muted);
}
.notif-card__content {
    font-size: .8rem;
    color: var(--color-text-muted);
    margin: 0 0 .375rem;
    line-height: 1.4;
}
.notif-card__actions {
    display: flex;
    gap: .375rem;
    align-items: center;
    flex-wrap: wrap;
}
/* « Marquer comme lu » : une coche discrète, poussée à droite de la rangée
   d'actions pour ne pas concurrencer le bouton principal de la notification
   (« Voir les erreurs », « Contrôler le ticket »…). Elle disparaît une fois la
   notification lue, le bouton n'ayant alors plus d'objet. */
.notif-card__read {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: #fff;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: color .12s, border-color .12s, background .12s;
}
.notif-card__read:hover:not(:disabled) {
    color: #16a34a;
    border-color: #A7F3D0;
    background: #ECFDF5;
}
.notif-card__read:disabled { opacity: .5; cursor: default; }
.notif-card__read:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.notif-card__type-badge {
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 1px 6px;
    background: var(--color-bg-alt);
    color: var(--color-text-muted);
    border-radius: 3px;
    font-weight: 600;
}

/* Responsive : panel pleine largeur sur mobile */
@media (max-width: 640px) {
    .notif-bell__panel {
        right: -1rem;
        width: calc(100vw - 1rem);
    }
}
