/* ==========================================================================
   ToBeep — Centre de notifications du header
   Fichier autonome : aucun style de cloche ne doit rester dans header.php.
   ========================================================================== */

.tobeep-notifications {
    position: relative;
    flex: 0 0 auto;
}

/* Mobile visible, desktop caché par défaut */
.tobeep-notifications--mobile {
    display: block;
}

.tobeep-notifications--desktop {
    display: none;
}

.tobeep-notification-button {
    position: relative;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid rgba(15, 94, 255, .16);
    border-radius: 50%;
    background: #fff;
    color: #10233f;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 26px rgba(16,35,63,.10);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease, background .25s ease;
    cursor: pointer;
}

.tobeep-notification-button:hover,
.tobeep-notification-button:focus-visible,
.tobeep-notification-button.is-unread {
    color:#0f5eff;
    border-color:rgba(15,94,255,.35);
    transform:translateY(-1px) scale(1.04);
    box-shadow:0 14px 34px rgba(16,35,63,.18);
}

.tobeep-notification-button:focus-visible {
    outline: 3px solid rgba(15, 94, 255, .2);
    outline-offset: 2px;
}

.tobeep-notification-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.tobeep-notification-icon i,
.tobeep-notification-icon i::before {
    display: block;
    line-height: 1;
}

/* Pulse uniquement sur la cloche lorsqu'il existe des notifications non lues */
.tobeep-notification-button.is-unread .tobeep-notification-icon{
    animation:tobeepNotificationIconPulse 2.8s ease-in-out infinite;
}
.tobeep-notification-button.is-unread::after{
 content:"";
 position:absolute;
 inset:-3px;
 border-radius:50%;
 border:2px solid rgba(15,94,255,.22);
 animation:tobeepNotificationHalo 2.8s ease-out infinite;
 pointer-events:none;
}

.tobeep-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #e53935;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 15px;
    text-align: center;
}

.tobeep-notification-menu {
    width: min(360px, calc(100vw - 24px));
    padding: 0;
    border: 0;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 55px rgba(16, 35, 63, .18);
}

.tobeep-notification-menu__head {
    padding: 16px 18px;
    background: linear-gradient(135deg, #10233f, #07111f);
    color: #fff;
}

.tobeep-notification-item {
    display: flex;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #edf1f7;
    color: #10233f;
    text-decoration: none;
}

.tobeep-notification-item:hover {
    background: #f6f9ff;
    color: #10233f;
}

.tobeep-notification-item__icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eaf2ff;
    color: #0f5eff;
}

.tobeep-notification-empty {
    padding: 22px 18px;
    color: #6c7788;
    text-align: center;
}

@keyframes tobeepNotificationIconPulse{
0%,100%{transform:rotate(0deg) scale(1)}
8%{transform:rotate(-12deg) scale(1.08)}
16%{transform:rotate(10deg) scale(1.08)}
24%{transform:rotate(-8deg) scale(1.06)}
32%{transform:rotate(5deg) scale(1.04)}
40%{transform:rotate(0deg) scale(1)}
}
@keyframes tobeepNotificationHalo{
0%{transform:scale(.9);opacity:0}
20%{opacity:.35}
100%{transform:scale(1.45);opacity:0}
}

/* Desktop */
@media (min-width: 992px) {
    .tobeep-notifications--mobile {
        display: none !important;
    }

    .tobeep-notifications--desktop {
        display: flex !important;
        align-items: center;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Mobile */
@media (max-width: 991.98px) {
    .tobeep-notifications--desktop {
        display: none !important;
    }

    .tobeep-notifications--mobile {
        display: block !important;
        margin-left: -4px;
        margin-right: 10px;
        margin-left: 5px;
    }

    .tobeep-notification-button {
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
    }

    .tobeep-notification-button i {
        font-size: 1.05rem;
    }

    .tobeep-notification-menu {
        position: fixed !important;
        top: 72px !important;
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        max-width: none !important;
        max-height: min(70vh, 520px);
        overflow-y: auto;
        transform: none !important;
        border-radius: 16px;
    }

    .tobeep-notification-menu__head {
        padding: 14px 16px;
    }

    .tobeep-notification-item {
        padding: 12px 16px;
    }

    .tobeep-notification-empty {
        padding: 18px 16px;
    }
}

@media (max-width: 575.98px) {
    .tobeep-notification-button {
        width: 35px;
        height: 35px;
        flex-basis: 35px;
    }
}

@media (max-width: 420px) {
    .tobeep-notification-button {
        width: 33px;
        height: 33px;
        flex-basis: 33px;
        font-size: .76rem;
    }
}

/* Accessibilité : le badge reste visible, seule l'animation s'arrête. */
@media (prefers-reduced-motion: reduce) {
    .tobeep-notification-button.is-unread .tobeep-notification-icon {
        animation: none;
    }
}

/* ========================================================================== 
   Correctif pulse desktop
   Le mobile reste inchangé. Sur ordinateur, l'animation est appliquée
   directement à l'icône visible avec une priorité supérieure.
   ========================================================================== */
@media (min-width: 992px) {
    .tobeep-notifications--desktop .tobeep-notification-button.is-unread {
        overflow: visible;
    }

    .tobeep-notifications--desktop .tobeep-notification-button.is-unread .tobeep-notification-icon,
    .tobeep-notifications--desktop .tobeep-notification-button.is-unread .tobeep-notification-icon i,
    .tobeep-notifications--desktop .tobeep-notification-button.is-unread .tobeep-notification-icon i::before {
        transform-origin: 50% 10%;
        animation: tobeepDesktopBellRing 2.4s ease-in-out infinite !important;
        will-change: transform;
    }

    .tobeep-notifications--desktop .tobeep-notification-button.is-unread::after {
        animation: tobeepDesktopBellHalo 2.4s ease-out infinite !important;
    }
}

@keyframes tobeepDesktopBellRing {
    0%, 58%, 100% { transform: rotate(0deg) scale(1); }
    6%  { transform: rotate(-15deg) scale(1.10); }
    12% { transform: rotate(13deg) scale(1.10); }
    18% { transform: rotate(-10deg) scale(1.08); }
    24% { transform: rotate(8deg) scale(1.06); }
    30% { transform: rotate(-5deg) scale(1.04); }
    36% { transform: rotate(3deg) scale(1.02); }
    42% { transform: rotate(0deg) scale(1); }
}

@keyframes tobeepDesktopBellHalo {
    0%, 55%, 100% { transform: scale(.92); opacity: 0; }
    8% { opacity: .45; }
    42% { transform: scale(1.55); opacity: 0; }
}

/* Certains ordinateurs ont “Réduire les animations” activé dans le système.
   On conserve malgré tout une sonnerie légère pour cette alerte fonctionnelle. */
@media (min-width: 992px) and (prefers-reduced-motion: reduce) {
    .tobeep-notifications--desktop .tobeep-notification-button.is-unread .tobeep-notification-icon,
    .tobeep-notifications--desktop .tobeep-notification-button.is-unread .tobeep-notification-icon i,
    .tobeep-notifications--desktop .tobeep-notification-button.is-unread .tobeep-notification-icon i::before {
        animation: tobeepDesktopBellRingReduced 3.2s ease-in-out infinite !important;
    }
}

@keyframes tobeepDesktopBellRingReduced {
    0%, 18%, 100% { transform: rotate(0deg); }
    6% { transform: rotate(-7deg); }
    12% { transform: rotate(7deg); }
}

.tobeep-notification-time{display:inline-block;margin-right:.35rem;color:#f28a24;font-weight:800;white-space:nowrap}
