/* ============================================================
   Header notification bell + the "View all notifications" page.

   These rules lived in messagesystem.css, twice, verbatim (two
   near-identical "Notification Bell" blocks ~200 lines apart, with a
   third mobile override further down). They belong to the header, not
   the inbox, so they live here now and exist once.

   Behavioural change from that version: the dropdown opens on CLICK,
   not hover. Its contents are fetched from account/notification.latest
   on first open, and firing that off an accidental hover — or never
   firing it at all on touch — is not what we want.
   ============================================================ */

/* ---------- Bell ---------- */

.notification-bell-wrapper {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin: 0 15px;
    z-index: 2;
}

.notification-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #333;
    padding: 8px 12px;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

.notification-bell:hover,
.notification-bell-wrapper.open .notification-bell {
    color: #667eea;
    text-decoration: none;
}

.notification-bell i {
    font-size: 22px;
    line-height: 1;
}

.notification-bell .badge1 {
    position: absolute;
    top: 2px;
    right: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ---------- Dropdown ---------- */

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin-top: 2px;
    display: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 10000;
}

.notification-bell-wrapper.open .notification-dropdown {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notification-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #667eea;
}

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 12px 15px;
    border-radius: 8px 8px 0 0;
    font-size: 14px;
}

.notification-header .notification-read-all {
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    text-decoration: underline;
    opacity: 0.9;
    white-space: nowrap;
}

.notification-header .notification-read-all:hover {
    color: #fff;
    opacity: 1;
}

.notification-header .notification-read-all[hidden] {
    display: none;
}

.notification-list {
    max-height: 350px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ---------- One row in the dropdown ---------- */

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
    color: #333;
    transition: background 0.2s ease;
}

.notification-item:hover {
    background: #f8f9fa;
    text-decoration: none;
    color: #333;
}

.notification-item:last-child {
    border-bottom: none;
}

/* Unread carries a tinted background and an accent bar, so the state is
   readable without relying on the badge count alone. */
.notification-item.unread {
    background: #f4f6ff;
    box-shadow: inset 3px 0 0 #667eea;
}

.notification-item.unread:hover {
    background: #eceffd;
}

.notification-item-icon {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #eef1fb;
    color: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.notification-item-text {
    flex: 1 1 auto;
    /* Without this a flex item refuses to shrink below its content width, so a
       long tracking number widens the dropdown and the list scrolls sideways
       instead of the body ellipsising. */
    min-width: 0;
}

/* All three are <span>s so the row stays one anchor; they have to be told to
   stack, or the title, body and timestamp run together on a single line. */
.notification-title {
    display: block;
    font-weight: 600;
    font-size: 13px;
    line-height: 1.3;
    color: #2c3e50;
    margin-bottom: 3px;
}

.notification-body {
    display: block;
    font-size: 12px;
    line-height: 1.3;
    color: #555;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-time {
    display: block;
    font-size: 11px;
    color: #999;
}

/* ---------- Dropdown footer / empty / loading ---------- */

.notification-footer {
    padding: 10px 15px;
    text-align: center;
    border-top: 1px solid #f0f0f0;
}

.notification-footer a {
    color: #667eea;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.notification-footer a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.notification-empty,
.notification-loading {
    padding: 30px 15px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* ---------- "View all notifications" page ---------- */

.notification-page-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.notification-page-title {
    margin: 0;
    font-size: 24px;
}

.notification-page-title i {
    color: #667eea;
    margin-right: 6px;
}

.notification-page .notification-read-all {
    color: #667eea;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.notification-page .notification-read-all:hover {
    color: #764ba2;
    text-decoration: underline;
}

.notification-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    border-bottom: 1px solid #e5e5e5;
}

.notification-tabs li {
    margin-bottom: -1px;
}

.notification-tab {
    display: block;
    padding: 8px 16px;
    color: #555;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid transparent;
}

.notification-tab:hover {
    color: #667eea;
    text-decoration: none;
}

.notification-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.notification-page-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}

.notification-row + .notification-row {
    border-top: 1px solid #f0f0f0;
}

.notification-row.unread {
    background: #f4f6ff;
    box-shadow: inset 3px 0 0 #667eea;
}

.notification-row-link {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    color: #333;
    text-decoration: none;
}

.notification-row-link:hover {
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
}

.notification-row-icon {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #eef1fb;
    color: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-row-text {
    flex: 1 1 auto;
    min-width: 0;
}

.notification-row-title {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
}

.notification-row-body {
    display: block;
    font-size: 13px;
    color: #555;
    margin-top: 3px;
}

.notification-row-date {
    display: block;
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

.notification-page-empty {
    padding: 40px 15px;
    text-align: center;
    color: #999;
}

.notification-page-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.notification-results {
    color: #777;
    font-size: 13px;
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
    .notification-bell-wrapper {
        margin: 0 8px;
    }

    .notification-dropdown {
        width: 300px;
        right: -50px;
    }

    .notification-dropdown::before {
        right: 65px;
    }

    .notification-page-foot {
        flex-direction: column;
        align-items: flex-start;
    }
}
