/* MC-206: notifications bell + offcanvas cards */

/* ---------- Bell button ---------- */
#notificationsBellBtn {
    border: none;
    background: transparent;
    padding: 0.35rem;
    border-radius: 50%;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

#notificationsBellBtn:hover,
#notificationsBellBtn:focus {
    background-color: rgba(13, 110, 253, 0.08);
    transform: scale(1.05);
}

#notificationsBellBtn:active {
    transform: scale(0.96);
}

#notificationsBellBtn img.notif-bell-icon {
    width: 28px;
    height: 28px;
    display: block;
    object-fit: contain;
}

/* Animate the bell when there are unread notifications */
#notificationsBellBtn:has(#notificationsBadge:not([hidden])) img.notif-bell-icon {
    animation: notif-bell-ring 2.4s ease-in-out infinite;
    transform-origin: 50% 10%;
}

@keyframes notif-bell-ring {
    0%, 70%, 100% { transform: rotate(0deg); }
    75%           { transform: rotate(-12deg); }
    80%           { transform: rotate(10deg); }
    85%           { transform: rotate(-8deg); }
    90%           { transform: rotate(6deg); }
    95%           { transform: rotate(-3deg); }
}

/* ---------- Unread badge ---------- */
.notif-badge {
    font-size: 0.65rem;
    min-width: 1.15rem;
    height: 1.15rem;
    line-height: 1;
    padding: 0.15rem 0.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px #fff, 0 2px 4px rgba(220, 53, 69, 0.35);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.notif-badge:not([hidden]) {
    animation: notif-badge-pulse 1.8s ease-in-out infinite;
}

@keyframes notif-badge-pulse {
    0%, 100% { box-shadow: 0 0 0 2px #fff, 0 0 0 0 rgba(220, 53, 69, 0.55); }
    50%      { box-shadow: 0 0 0 2px #fff, 0 0 0 6px rgba(220, 53, 69, 0); }
}

/* ---------- Offcanvas panel ---------- */
#notificationsOffcanvas {
    width: 400px;
    max-width: 92vw;
    border-left: 0;
    box-shadow: -6px 0 24px rgba(15, 23, 42, 0.08);
    background-color: #f8fafc;
}

/* Header */
#notificationsOffcanvas .offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: nowrap;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #0d6efd 0%, #4c8bf5 100%);
    color: #fff;
    border-bottom: 0;
}

#notificationsOffcanvas .offcanvas-title {
    flex: 1 1 auto;
    min-width: 0;
    margin-bottom: 0;
    padding-inline-end: 0.25rem;
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}

#notificationsOffcanvas .btn-close {
    flex-shrink: 0;
    margin: 0 !important;
    padding: 0.5rem;
    align-self: center;
    filter: brightness(0) invert(1);
    opacity: 0.85;
    transition: opacity 0.15s ease;
}

#notificationsOffcanvas .btn-close:hover {
    opacity: 1;
}

/* Toolbar under header */
#notificationsOffcanvas .offcanvas-body > .px-3.py-2 {
    background-color: #fff !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 0.6rem 1rem !important;
}

#notificationsMarkAllReadBtn {
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 999px;
    padding: 0.3rem 0.9rem;
    border-color: #cbd5e1;
    color: #475569;
    transition: all 0.15s ease;
}

#notificationsMarkAllReadBtn:hover {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

/* Scroll container */
#notificationsScrollContainer {
    padding: 0.75rem !important;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

#notificationsScrollContainer::-webkit-scrollbar {
    width: 6px;
}

#notificationsScrollContainer::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

#notificationsScrollContainer::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ---------- Notification cards ---------- */
.notification-card {
    position: relative;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    margin-bottom: 0.6rem !important;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.notification-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
    border-color: #cbd5e1;
}

.notification-card .card-body {
    padding: 0.85rem 1rem 0.6rem 1rem;
}

.notification-card .notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.notification-card .card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0;
    line-height: 1.35;
    flex: 1 1 auto;
    min-width: 0;
}

.notification-card .notif-sender {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 500;
    color: #1d4ed8;
    background-color: #eff6ff;
    border: 1px solid #dbeafe;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    line-height: 1;
    max-width: 45%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-card .notif-sender-icon {
    flex-shrink: 0;
    opacity: 0.85;
}

.notification-card .card-text {
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.5;
    margin-bottom: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.notification-card .card-footer {
    font-size: 0.75rem;
    color: #94a3b8;
    background-color: #f8fafc;
    border-top: 1px solid #eef2f7;
    padding: 0.4rem 1rem;
}

/* Unread state: left accent, bolder title, subtle tint, and a dot indicator */
.notification-card[data-read="0"] {
    border-color: #bfdbfe;
    background: linear-gradient(90deg, #eff6ff 0%, #ffffff 60%);
}

.notification-card[data-read="0"]::before {
    content: "";
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #0d6efd 0%, #4c8bf5 100%);
}

.notification-card[data-read="0"] .card-title {
    color: #0b1220;
    font-weight: 700;
}

.notification-card[data-read="0"] .card-title::after {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-inline-start: 0.45rem;
    vertical-align: middle;
    background-color: #0d6efd;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.6);
    animation: notif-dot-pulse 1.8s ease-in-out infinite;
}

@keyframes notif-dot-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.55); }
    50%      { box-shadow: 0 0 0 5px rgba(13, 110, 253, 0); }
}

/* Read state */
.notification-card[data-read="1"] {
    opacity: 0.85;
}

.notification-card[data-read="1"]:hover {
    opacity: 1;
}

/* ---------- States: loading / empty ---------- */
#notificationsScrollEnd {
    font-size: 0.8rem;
    color: #94a3b8;
}

#notificationsList > p.text-muted,
#notificationsList > p.text-danger {
    margin: 2rem 0;
    font-size: 0.9rem;
}
