/* ============================================================
   Path: src/RichRich.Web/wwwroot/css/notifications.css
   Session: J-34
   LastModified: 2026-05-23
   Module: M16 Notifications (Frontend) — styles
   ============================================================
   🆕 NEW FILE — J-34

   أنماط نظام الإشعارات. يبني فوق متغيّرات الثيم (themes.css J-05)
   ويُكمّل كلاسات الـ dropdown/notif-row الموجودة (layout.css J-06).
   كل الألوان عبر CSS variables → تتبدّل تلقائياً مع الثيمات الأربعة
   والوضع الليلي. لا ألوان ثابتة عدا حالات الاتصال (دلالية).

   المرجع: 05_UI_UX_Design.md § 5.9-5.10
   ============================================================ */

/* ============================================================
   LIVE INDICATOR (🟢 SignalR connection state)
   ============================================================ */
.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    font-weight: 700;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--t3);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

/* 🟢 متصل — أخضر نابض */
.live-indicator.is-connected .live-dot {
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
    animation: livePulse 2s infinite;
}
.live-indicator.is-connected .live-text { color: #22c55e; }

/* 🟡 جارٍ الاتصال — أصفر */
.live-indicator.is-connecting .live-dot { background: #eab308; }
.live-indicator.is-connecting .live-text { color: #eab308; }

/* 🟠 يُعيد الاتصال — برتقالي نابض */
.live-indicator.is-reconnecting .live-dot {
    background: #f97316;
    animation: livePulse 1s infinite;
}
.live-indicator.is-reconnecting .live-text { color: #f97316; }

/* 🔴 منقطع — أحمر */
.live-indicator.is-disconnected .live-dot { background: var(--err); }
.live-indicator.is-disconnected .live-text { color: var(--err); }

@keyframes livePulse {
    0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
    70%  { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ============================================================
   NOTIFICATION BELL — ring animation on new notification
   ============================================================ */
.notif-bell.ringing i {
    transform-origin: top center;
    animation: bellRing 0.7s ease;
}

@keyframes bellRing {
    0%   { transform: rotate(0); }
    15%  { transform: rotate(18deg); }
    30%  { transform: rotate(-15deg); }
    45%  { transform: rotate(12deg); }
    60%  { transform: rotate(-9deg); }
    75%  { transform: rotate(5deg); }
    100% { transform: rotate(0); }
}

/* ============================================================
   NOTIFICATION PANEL (bell dropdown)
   ============================================================ */
.notif-head-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.notif-scroll {
    max-height: 360px;
    overflow-y: auto;
}

.notif-body {
    flex: 1;
    min-width: 0;
}
.notif-body strong,
.notif-body small {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notif-time {
    display: block;
    font-size: 0.66rem;
    color: var(--t3);
    margin-top: 2px;
}

/* نقطة "غير مقروء" على يمين الصف */
.notif-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--p);
    flex-shrink: 0;
    align-self: center;
}

/* الحالة الفارغة داخل اللوحة */
.notif-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--t3);
}
.notif-empty i {
    font-size: 1.8rem;
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.6;
}
.notif-empty strong {
    display: block;
    font-size: 0.85rem;
    color: var(--t2);
    margin-bottom: 0.2rem;
}
.notif-empty small { font-size: 0.74rem; }

/* عنصر جديد يُدرَج — أنميشن انزلاق */
.notif-row.just-arrived {
    animation: notifSlideIn 0.3s ease;
}
@keyframes notifSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   NOTIFICATIONS PAGE (/notifications)
   ============================================================ */
.notif-filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.notif-total {
    font-size: 0.8rem;
    color: var(--t3);
    font-weight: 700;
}

.notif-list-full {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notif-card {
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
    padding: 0.9rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--card-bdr);
    cursor: pointer;
    transition: background var(--tr), border-color var(--tr);
}
.notif-card:hover { background: var(--p-light); border-color: var(--p); }
.notif-card.unread { border-inline-start: 3px solid var(--p); }
.notif-card .ni-icon {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    flex-shrink: 0; font-size: 0.95rem;
}
.notif-card-body { flex: 1; min-width: 0; }
.notif-card-body strong { display: block; font-size: 0.9rem; color: var(--t1); }
.notif-card-body p {
    margin: 0.2rem 0; font-size: 0.82rem; color: var(--t2);
}

/* ============================================================
   PREFERENCES PAGE (/notifications/preferences)
   ============================================================ */
.prefs-table-wrap { overflow-x: auto; }
.prefs-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}
.prefs-table th,
.prefs-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--card-bdr);
    font-size: 0.84rem;
}
.prefs-table thead th {
    background: var(--body-bg);
    color: var(--t2);
    font-weight: 800;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.prefs-type { font-weight: 700; color: var(--t1); }
.prefs-table .text-center { text-align: center; }

/* ============================================================
   MENTION INPUT (@-mention)
   ============================================================ */
.mention-wrap { position: relative; }

.mention-textarea {
    width: 100%;
    resize: vertical;
    font-family: inherit;
}

.mention-popup {
    position: absolute;
    inset-inline-start: 0;
    top: calc(100% + 2px);
    z-index: 9998;
    width: 280px;
    max-height: 240px;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--card-bdr);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
    animation: dropIn 0.14s ease;
}

.mention-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    transition: background var(--tr);
}
.mention-option:hover,
.mention-option.active { background: var(--p-light); }

.mention-av {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--p); color: #fff;
    display: grid; place-items: center;
    font-size: 0.78rem; font-weight: 800;
    flex-shrink: 0;
}
.mention-meta { min-width: 0; }
.mention-meta strong {
    display: block; font-size: 0.82rem; color: var(--t1);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mention-meta small { font-size: 0.72rem; color: var(--t3); }

/* ============================================================
   J-34 (visibility fix) — bell connection dot + load-error banner
   ============================================================ */

/* نقطة حالة الاتصال على الجرس (أسفل-نهاية الأيقونة) */
.notif-bell { position: relative; }
.notif-bell .conn-dot {
    position: absolute;
    inset-block-end: 4px;
    inset-inline-end: 4px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 2px solid var(--card-bg);
    box-sizing: content-box;
}
.notif-bell .conn-dot.is-connecting   { background: #eab308; }
.notif-bell .conn-dot.is-reconnecting { background: #f97316; animation: connPulse 1s infinite; }
.notif-bell .conn-dot.is-disconnected { background: var(--err); }

@keyframes connPulse {
    0%   { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.5); }
    70%  { box-shadow: 0 0 0 5px rgba(249, 115, 22, 0); }
    100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
}

/* بانر خطأ التحميل داخل اللوحة (يميّز الانقطاع عن "لا إشعارات") */
.notif-error {
    padding: 1.8rem 1.2rem;
    text-align: center;
    color: var(--t2);
}
.notif-error i {
    font-size: 1.8rem;
    display: block;
    margin-bottom: 0.5rem;
    color: var(--err);
}
.notif-error strong {
    display: block;
    font-size: 0.88rem;
    color: var(--t1);
    margin-bottom: 0.25rem;
}
.notif-error small {
    display: block;
    font-size: 0.76rem;
    color: var(--t3);
    margin-bottom: 0.9rem;
}
.notif-retry-btn {
    background: var(--p-light);
    color: var(--p);
    border: 0;
    border-radius: 8px;
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background var(--tr), color var(--tr);
}
.notif-retry-btn:hover { background: var(--p); color: #fff; }
