/* ============================================================
   MESSAGE NOTIFICATION STYLES
   Unread badge on Chat nav tab + In-app toast notification
   ============================================================ */

/* ── Unread Badge on Chat Nav Button ────────────────────────── */

.unread-badge {
    position: absolute;
    top: 2px;
    left: 50%;
    margin-left: 6px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    box-sizing: border-box;
    border-radius: 10px;
    background: linear-gradient(135deg, #ff3b6f 0%, #ef4444 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    line-height: 16px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.2px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--app-bg, #190B14);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.45),
                0 0 0 0.5px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    animation: badge-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10;
}

@keyframes badge-pop {
    0%   { transform: scale(0); }
    60%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* Light theme: badge border matches white nav so ring still separates cleanly */
[data-theme="light"] .unread-badge {
    border-color: var(--app-bg, #ffffff);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.45),
                0 0 0 0.5px rgba(0, 0, 0, 0.08);
}

/* ── In-App Message Toast Notification ──────────────────────── */

.msg-notification-toast {
    position: fixed;
    top: calc(8px + env(safe-area-inset-top, 0px));
    left: calc(12px + env(safe-area-inset-left, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    margin-left: auto;
    margin-right: auto;
    max-width: min(440px, calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(30, 30, 40, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    cursor: pointer;
    transform: translateY(-140%);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.3s ease;
    opacity: 0;
    user-select: none;
    -webkit-user-select: none;
}

.msg-notification-toast.msg-notif-show {
    transform: translateY(0);
    opacity: 1;
}

/* Avatar */
.msg-notif-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
}

/* Body text */
.msg-notif-body {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.msg-notif-title {
    margin: 0;
    font-size: 14px;
    color: #fff;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-notif-title strong {
    color: #a78bfa;
}

.msg-notif-preview {
    margin: 2px 0 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Close button */
.msg-notif-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.msg-notif-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ── Unread Badge in Contact List ────────────────────────────── */

.contact-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    margin-top: 4px;
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.35);
}

/* ── Desktop alignment ──────────────────────────────────────── */
@media (min-width: 768px) {
    .msg-notification-toast {
        max-width: 400px;
    }
}

/* ── Small phones: tighter layout so preview never clips ─────── */
@media (max-width: 360px) {
    .msg-notification-toast {
        gap: 10px;
        padding: 10px 12px;
        border-radius: 14px;
    }
    .msg-notif-avatar {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    .msg-notif-title { font-size: 13px; }
    .msg-notif-preview { font-size: 12px; }
    .msg-notif-close {
        width: 26px;
        height: 26px;
    }
}
