/* Separatore verticale fra il nome utente e la campanella */
#notif-bell {
    margin-left: .25rem;
    padding-left: .4rem;
    border-left: 1px solid #d5d5d5;
}

#notif-bell .notif-toggle {
    position: relative;
    padding: .25rem .3rem;
    color: var(--color-primary);
    font-size: 1rem;
    line-height: 1;
    opacity: .8;
    transition: opacity .15s;
}

#notif-bell .notif-toggle:hover,
#notif-bell .notif-toggle[aria-expanded="true"] {
    opacity: 1;
}

#notif-bell .notif-badge {
    position: absolute;
    top: -.2rem;
    right: -.25rem;
    min-width: .95rem;
    padding: 0 .25rem;
    border: 1.5px solid white;
    border-radius: 999px;
    background: var(--color-error);
    color: white;
    font-size: .6rem;
    line-height: .95rem;
    text-align: center;
}

#notif-bell .notif-menu {
    width: 340px;
    max-width: 90vw;
    padding: 0;
    text-align: left;
}

#notif-bell .notif-header {
    background-color: rgba(0, 0, 0, .03);
    border-bottom: 1px solid #dee2e6;
    font-size: .8rem;
}

#notif-bell .notif-header .btn {
    font-size: inherit;
}

#notif-bell .notif-mark-all,
#notif-bell .notif-more {
    color: var(--color-primary);
}

#notif-bell .notif-mark-all:hover,
#notif-bell .notif-more:hover {
    color: var(--color-primary-dark);
}

#notif-bell .notif-list {
    display: flex;
    flex-direction: column;
    max-height: 60vh;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

#notif-bell .notif-item {
    padding: .5rem .75rem;
    border-bottom: 1px solid #e7ebe9;
    cursor: default;
}

#notif-bell .notif-item.clickable {
    cursor: pointer;
}

#notif-bell .notif-item.clickable:hover {
    background: var(--color-primary-light-hover);
}

#notif-bell .notif-item.unread {
    background: var(--color-primary-lighter);
}

#notif-bell .notif-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: .8rem;
    line-height: 1.3;
    font-weight: 400;
    overflow-wrap: anywhere;
}

#notif-bell .notif-title strong {
    font-weight: 600;
}

#notif-bell .notif-quote {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin: .25rem 0 0;
    padding-left: .5rem;
    border-left: 2px solid #cfd8d3;
    color: #5c6560;
    font-size: .75rem;
    font-style: italic;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

#notif-bell .notif-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: .5rem;
    font-size: .75rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

#notif-bell .notif-date {
    margin-top: .2rem;
    color: #6c757d;
    font-size: .65rem;
}

/* contentHtml è il corpo dell'email, con stili inline pensati per il client di posta:
   si scavalcano solo con !important */
#notif-bell .notif-content p {
    margin: 0 !important;
    font-size: inherit !important;
    line-height: inherit !important;
    flex: 1 1 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Il bottone dell'email porta all'URL assoluto della configurazione: qui si usa "Apri", costruito dal ticketId */
#notif-bell .notif-content table.btn {
    display: none;
}



#notif-bell .notif-header .form-check {
    min-height: 0;
    font-size: .75rem;
}

#notif-bell .notif-header .form-check-input {
    margin-top: .15rem;
}

#notif-bell .notif-tabs {
    display: flex;
    gap: .75rem;
}

#notif-bell .notif-tab {
    padding: .3rem 0 .25rem;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: #6c757d;
    font-size: .75rem;
}

#notif-bell .notif-tab:hover {
    color: var(--color-primary);
}

#notif-bell .notif-tab.active {
    border-bottom-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: 600;
}

#notif-bell .notif-tab-count {
    display: inline-block;
    min-width: 1rem;
    margin-left: .15rem;
    padding: 0 .25rem;
    border-radius: 999px;
    background: var(--color-error);
    color: white;
    font-size: .6rem;
    font-weight: 400;
    line-height: 1rem;
    text-align: center;
}

/* Icona per tipo: menzione, assegnazione, risposta del cliente, riapertura da completato */
#notif-bell .notif-item {
    display: flex;
    gap: .5rem;
    align-items: flex-start;
}

#notif-bell .notif-body {
    flex: 1;
    min-width: 0;
}

#notif-bell .notif-icon {
    flex: 0 0 auto;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    font-size: .8rem;
    line-height: 1.5rem;
    text-align: center;
}

#notif-bell .notif-type-ticket-mention .notif-icon {
    background: #ede7f6;
    color: #6f42c1;
}

#notif-bell .notif-type-ticket-assign .notif-icon {
    background: #e7f1ff;
    color: #0d6efd;
}

#notif-bell .notif-type-ticket-answer .notif-icon {
    background: #e6f4ef;
    color: #198754;
}

#notif-bell .notif-type-ticket-reopened .notif-icon {
    background: #fff1e0;
    color: #d9480f;
}

/* Arrivo di notifiche nuove: oscillazione della campanella e pulsazione del badge */
#notif-bell .notif-toggle.ringing .bi-bell {
    display: inline-block;
    transform-origin: 50% 0;
    animation: notif-ring .9s ease-in-out;
}

#notif-bell .notif-toggle.ringing .notif-badge {
    animation: notif-pop .9s ease-out;
}

@keyframes notif-ring {
    0%, 100% { transform: rotate(0); }
    15% { transform: rotate(16deg); }
    30% { transform: rotate(-14deg); }
    45% { transform: rotate(10deg); }
    60% { transform: rotate(-6deg); }
    75% { transform: rotate(3deg); }
}

@keyframes notif-pop {
    0%, 100% { transform: scale(1); }
    30% { transform: scale(1.35); }
}

@media (prefers-reduced-motion: reduce) {
    #notif-bell .notif-toggle.ringing .bi-bell,
    #notif-bell .notif-toggle.ringing .notif-badge {
        animation: none;
    }
}
