/* Notification bell in the navbar + its quick-view dropdown, and the shared message-list rows
   (the same .msg-list markup is rendered in this dropdown and in the mobile full-screen modal). */

/* ---- Bell icon + badge ---- */
.notification-bell-wrapper {
    position: relative; /* anchor the dropdown to the bell, not the whole navbar-right */
}

.notification-bell-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    margin: 0; /* drop the base .navbar-nav>li>a 10px vertical margin so it centres with the pill */
    cursor: pointer;
    user-select: none;
}

/* icon + badge wrapper: the badge anchors to the icon's corner, not the padded <a>. */
.notification-bell-icon-wrap {
    position: relative;
    display: inline-flex;
    line-height: 1;
}

/* Greyed (muted) when everything is read; medium red when there are unread messages. */
.notification-bell-icon {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.2s ease, transform 0.2s ease;
}

.notification-bell-toggle:hover .notification-bell-icon {
    color: rgba(255, 255, 255, 0.95);
}

.notification-bell-icon.notification-bell--unread {
    color: #ef4444; /* medium red */
}

.notification-bell-toggle:hover .notification-bell-icon.notification-bell--unread {
    color: #f05252;
}

/* Small red count bubble pinned to the bell icon's top-right corner, with a light ring so it
   reads as a separate badge (rather than merging into the red bell). Self-contained — the badge
   no longer carries the shared .notification class, so the navbar's high-specificity scoped
   .notification rule can't reposition it. */
.notification-bell-badge {
    position: absolute;
    top: -7px;
    right: -8px;
    left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    box-sizing: border-box;
    border-radius: 999px;
    background-color: #e5332f;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 14px; /* 18px − 2×2px border, keeps the digit centred */
    text-align: center;
    border: 2px solid #ffffff; /* light ring separates the badge from the bell/navbar */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

/* ---- Bell dropdown ---- */
.notification-dropdown-menu {
    right: 0;
    left: auto;
    width: 340px;
    max-width: 92vw;
    margin-top: 12px !important; /* room for the arrow; overrides the base -5px pull-up */
    background: #ffffff;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.18);
    /* Smooth pop in AND out (mirrors the identity dropdown). The .visible class animates
       transform; opacity is driven 0 <-> 1 by the base .dropdown-menu(.visible) rules.
       visibility is delayed on the way to hidden so the OUT animation is actually seen. */
    transform-origin: top right;
    transform: scale(0.96) translateY(-8px);
    transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.22s;
}

.notification-dropdown-menu.visible {
    transform: scale(1) translateY(0);
    transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0s;
}

/* Upward pointer bridging the gap to the bell. Sits BEHIND the header (which is z-indexed
   above it), so only the tip above the header shows — that keeps it flush with the header's
   top edge (no lighter square over the gradient) and stops it covering the header buttons. */
.notification-dropdown-menu::before {
    content: "";
    position: absolute;
    top: -7px;
    right: 14px;
    width: 16px;
    height: 16px;
    background: #009fa4; /* = the header's top-of-gradient colour, so the seam is invisible */
    border-top-left-radius: 3px;
    transform: rotate(45deg);
    z-index: 0;
}

.notification-dropdown-header {
    position: relative;
    z-index: 1; /* paint over the arrow so only its tip shows and the button isn't covered */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px 12px 0 0;
    background: linear-gradient(180deg, #009fa4 0%, #007e82 100%);
    color: #ffffff;
}

.notification-dropdown-title {
    font-weight: 600;
    font-size: 14px;
}

.notification-send-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.notification-send-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.notification-dropdown-panel {
    max-height: 60vh;
    overflow-y: auto;
    border-radius: 0 0 12px 12px; /* clip the last row to the rounded bottom (no overflow:hidden on the menu) */
}

/* ---- Shared message list (dropdown + modal) ---- */
.msg-list {
    display: flex;
    flex-direction: column;
}

.msg-list-loading,
.msg-empty {
    padding: 26px 16px;
    text-align: center;
    color: #8a8a8a;
    font-size: 13px;
}

.msg-row {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    color: #2b2b2b;
}

.msg-row:last-child {
    border-bottom: 0;
}

/* The sliding track (message + trash). Slides left to reveal the confirm button behind it. */
.msg-row-slider {
    display: flex;
    align-items: stretch;
    position: relative;
    z-index: 1;
    background: #ffffff;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.msg-row.is-confirming .msg-row-slider {
    transform: translateX(-88px);
}

/* Red "Delete" confirm, sitting behind the slider on the right — only a tap here actually deletes. */
.msg-row-confirm {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 88px;
    border: 0;
    background: #e5332f;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    z-index: 0;
}

.msg-row-confirm:hover {
    background: #cf2b27;
}

/* The clickable "open" area — everything except the trash button. */
.msg-row-open {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 12px 6px 12px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
    font: inherit;
    color: inherit;
}

.msg-row-open:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* Trash button — hidden until row hover on desktop, always shown on touch (no hover). */
.msg-row-delete {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    border: 0;
    background: transparent;
    color: #b3b3b3;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.msg-row:hover .msg-row-delete,
.msg-row-delete:focus-visible {
    opacity: 1;
}

.msg-row-delete:hover {
    color: #e5332f;
    background: rgba(229, 51, 47, 0.08);
}

@media (hover: none) {
    .msg-row-delete {
        opacity: 1;
    }
}

/* Once the confirm is revealed, hide the trash so there's only one clear action. */
.msg-row.is-confirming .msg-row-delete {
    opacity: 0;
    pointer-events: none;
}

/* Unread dot — only shown for unread rows. */
.msg-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    margin-top: 6px;
    border-radius: 50%;
    background: transparent;
}

.msg-row.msg-unread .msg-dot {
    background: #ef4444;
}

.msg-row.msg-unread .msg-row-title {
    font-weight: 700;
}

.msg-row-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.msg-row-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #1f1f1f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-row-snippet {
    font-size: 12.5px;
    color: #6b6b6b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.msg-row-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    font-size: 11px;
    color: #9a9a9a;
}

.msg-row-sender {
    font-weight: 600;
}

/* ---- Mobile inline badge (the "Notifications" item inside the identity dropdown) ---- */
.notification-inline-badge {
    display: inline-block;
    margin-left: 8px;
    min-width: 18px;
    padding: 0 5px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    background: #991b1b;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

/* ---- Responsive swap: bell on desktop, identity-dropdown item on mobile ---- */
@media (max-width: 768px) {
    #notificationBell {
        display: none;
    }
}

@media (min-width: 769px) {
    .notification-dropdown-item-mobile {
        display: none !important;
    }
}
