/* ================== Notifications Styles ================== */
.notification-wrapper {
    position: relative;
    z-index: 1001;
}

.notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: bold;
    height: 16px;
    min-width: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-surface);
}

.notif-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 340px;
    max-height: 400px;
    background: var(--bg-surface-solid);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    overflow: hidden;
}

.notif-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.notif-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-main);
}

.notif-body {
    overflow-y: auto;
    flex: 1;
    max-height: 350px;
}

.notif-item {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.notif-item:hover {
    background: var(--bg-hover);
}

.notif-item.unread {
    background: rgba(59, 130, 246, 0.05);
}

.notif-item.unread::before {
    content: '';
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
}

.notif-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.sender-badge {
    font-size: 0.7rem;
    background: var(--border);
    color: var(--text-main);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.notif-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.notif-item h4 {
    margin: 0 0 4px 0;
    font-size: 0.9rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-empty {
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Modal Styles */
.notif-modal-box {
    max-width: 500px;
    width: 90%;
    padding: 24px;
}

.notif-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.notif-modal-box h3 {
    margin: 0 0 12px 0;
    font-size: 1.2rem;
    color: var(--text-main);
    line-height: 1.4;
}

.notif-modal-content {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.7;
}

/* ================== ناحیهٔ اصلی چت (بنر ثابت + اسکرول پیام‌ها) ================== */
.chat-area-stack {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    /* فاصله از هدر مطلق/ثابت تا بنر و چت زیر آن دیده شوند */
    padding-top: 72px;
    box-sizing: border-box;
}

/* ================== Temporary Chat Banner (ثابت بالای ناحیهٔ چت) ================== */
.temp-chat-banner {
    display: none;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
    margin: 0 16px;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--text-main);
    background: linear-gradient(120deg, rgba(251, 191, 36, 0.12) 0%, rgba(245, 158, 11, 0.08) 45%, rgba(14, 165, 233, 0.06) 100%);
    border: 1px solid rgba(217, 119, 6, 0.28);
    box-shadow: 0 2px 16px rgba(245, 158, 11, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(8px);
}

.temp-chat-banner-top {
    margin-top: 0;
    margin-bottom: 4px;
    position: relative;
    z-index: 55;
}

.temp-chat-banner-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 158, 11, 0.2);
    color: #b45309;
    border: 1px solid rgba(217, 119, 6, 0.25);
}

.temp-chat-banner-inner {
    flex: 1;
    min-width: 0;
}

.temp-chat-banner-lead {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-main);
}

.temp-chat-banner-sub {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.6;
}

[data-theme="dark"] .temp-chat-banner {
    border-color: rgba(251, 191, 36, 0.22);
    background: linear-gradient(120deg, rgba(180, 83, 9, 0.22) 0%, rgba(30, 41, 59, 0.5) 100%);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .temp-chat-banner-icon {
    background: rgba(251, 191, 36, 0.12);
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.2);
}

@media (max-width: 520px) {
    .temp-chat-banner {
        margin: 0 10px;
        padding: 10px 12px;
        gap: 10px;
    }
    .temp-chat-banner-icon {
        width: 38px;
        height: 38px;
    }
    .temp-chat-banner-lead {
        font-size: 0.88rem;
    }
}

/* ================== Mobile Optimizations (App-like) ================== */
@media (max-width: 768px) {
    .notif-dropdown {
        /* در موبایل به جای اینکه زیر آیکون باز شود، وسط صفحه باز می‌شود */
        position: fixed;
        top: 70px;
        left: 5%;
        width: 90%;
        max-width: none;
        max-height: 60vh;
        z-index: 9999;
    }
    
    .notif-item {
        padding: 16px; /* فضای لمس بیشتر */
    }
    
    .notif-header {
        padding: 16px;
    }
}