/* ══ أزرار الأيقونات في الهيدر ══ */
.topbar-icon-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 10px;
    transition: background 0.2s;
    line-height: 1;
    color: inherit;
}
.topbar-icon-btn:hover { background: rgba(255,255,255,0.12); }

.topbar-badge {
    position: absolute;
    top: 2px; right: 2px;
    min-width: 16px; height: 16px;
    background: #e11d48;
    color: white;
    font-size: 9px;
    font-weight: 800;
    border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 3px;
    pointer-events: none;
    line-height: 1;
}

/* ══ إشعارات ══ */
.notif-wrap { position: relative; }

.notif-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    border: 1px solid #fde8f3;
    z-index: 10000;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}
.notif-dropdown.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}
[data-theme="dark"] .notif-dropdown {
    background: #1a0e2a;
    border-color: #3a2050;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.notif-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px 10px;
    font-weight: 800; font-size: 13px; color: #5a1a60;
    border-bottom: 1px solid #fde8f3;
}
[data-theme="dark"] .notif-header { color: #d0a0e8; border-color: #3a2050; }

.notif-mark-all {
    background: none; border: none; font-size: 11px; color: #b05080;
    cursor: pointer; font-weight: 600; padding: 2px 6px;
    border-radius: 6px; transition: background 0.2s;
}
.notif-mark-all:hover { background: #fde8f3; }

.notif-list { max-height: 360px; overflow-y: auto; }

.notif-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #fdf0f8;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none; color: inherit;
}
.notif-item:hover { background: #fdf6ff; }
.notif-item.unread { background: #fef6ff; }
[data-theme="dark"] .notif-item { border-color: #2a1840; }
[data-theme="dark"] .notif-item:hover { background: #2a1840; }
[data-theme="dark"] .notif-item.unread { background: #231535; }

.notif-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    overflow: hidden; flex-shrink: 0;
    background: #fde8f3;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}
.notif-avatar img { width: 100%; height: 100%; object-fit: cover; }

.notif-body { flex: 1; min-width: 0; }
.notif-text { font-size: 12px; color: #3a1a30; line-height: 1.5; }
[data-theme="dark"] .notif-text { color: #c8a8d8; }
.notif-time { font-size: 10px; color: #c0a0b0; margin-top: 2px; }

.notif-unread-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #b05080; flex-shrink: 0; margin-top: 4px;
}

.notif-empty {
    padding: 24px 16px;
    text-align: center; color: #c0a0b0; font-size: 13px;
}

/* ══ بانل الجات ══ */
.chat-panel {
    position: fixed;
    bottom: 90px; right: 24px;
    width: 340px;
    max-height: 520px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.2);
    border: 1px solid #fde8f3;
    z-index: 9990;
    display: flex; flex-direction: column;
    transform: translateY(20px) scale(0.97);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s;
    overflow: hidden;
}
.chat-panel.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}
[data-theme="dark"] .chat-panel {
    background: #1a0e2a;
    border-color: #3a2050;
    box-shadow: 0 12px 48px rgba(0,0,0,0.55);
}

.chat-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px 12px;
    background: linear-gradient(135deg, #7c3aed, #db2777);
    color: white;
    font-weight: 800; font-size: 14px;
    flex-shrink: 0;
}
.chat-close-btn, .chat-back-btn {
    background: rgba(255,255,255,0.2); border: none;
    color: white; border-radius: 8px; padding: 4px 10px;
    cursor: pointer; font-size: 13px; font-weight: 700;
    transition: background 0.2s;
}
.chat-close-btn:hover, .chat-back-btn:hover { background: rgba(255,255,255,0.35); }

.chat-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 9989;
}
.chat-overlay.active { display: block; }

/* قائمة المحادثات */
.chat-convos { flex: 1; overflow-y: auto; }

.chat-conv-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #fdf0f8;
    transition: background 0.15s;
    text-decoration: none; color: inherit;
}
.chat-conv-item:hover { background: #fdf6ff; }
[data-theme="dark"] .chat-conv-item { border-color: #2a1840; color: #d0b0e8; }
[data-theme="dark"] .chat-conv-item:hover { background: #2a1840; }

.chat-conv-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    overflow: hidden; flex-shrink: 0;
    background: #fde8f3;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; position: relative;
}
.chat-conv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-conv-online {
    position: absolute; bottom: 1px; right: 1px;
    width: 10px; height: 10px; border-radius: 50%;
    background: #22c55e; border: 2px solid white;
}

.chat-conv-info { flex: 1; min-width: 0; }
.chat-conv-name { font-size: 13px; font-weight: 700; color: #3a1a30; }
[data-theme="dark"] .chat-conv-name { color: #e0c0f0; }
.chat-conv-last { font-size: 11px; color: #b090c0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.chat-conv-time { font-size: 10px; color: #c0a0b0; }
.chat-unread-badge {
    background: #b05080; color: white;
    border-radius: 999px; padding: 1px 6px; font-size: 10px; font-weight: 800;
}

.chat-loading { padding: 24px; text-align: center; color: #c0a0b0; font-size: 13px; }

/* نافذة الرسائل */
.chat-messages-area {
    flex: 1; display: flex; flex-direction: column; min-height: 0;
}
.chat-messages-list {
    flex: 1; overflow-y: auto; padding: 12px 14px;
    display: flex; flex-direction: column; gap: 8px;
}

.chat-bubble {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 13px; line-height: 1.5;
    word-break: break-word;
}
.chat-bubble.mine {
    background: linear-gradient(135deg, #7c3aed, #db2777);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.chat-bubble.theirs {
    background: #f5f0fa;
    color: #3a1a30;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
[data-theme="dark"] .chat-bubble.theirs { background: #2a1840; color: #e0c0f0; }

.chat-bubble-time { font-size: 9px; opacity: 0.65; margin-top: 2px; }

.chat-input-row {
    display: flex; gap: 6px; padding: 10px 12px;
    border-top: 1px solid #fde8f3; flex-shrink: 0;
}
[data-theme="dark"] .chat-input-row { border-color: #3a2050; }

.chat-input {
    flex: 1; padding: 8px 12px;
    border: 1px solid #e0c0d0; border-radius: 999px;
    font-size: 13px; outline: none;
    background: white; color: #3a1a30;
    transition: border-color 0.2s;
}
.chat-input:focus { border-color: #b05080; }
[data-theme="dark"] .chat-input { background: #2a1840; border-color: #4a2060; color: #e0c0f0; }
[data-theme="dark"] .chat-input::placeholder { color: #8060a0; }

.chat-send-btn {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #db2777);
    border: none; color: white; font-size: 14px;
    cursor: pointer; flex-shrink: 0;
    transition: transform 0.15s, opacity 0.15s;
    display: flex; align-items: center; justify-content: center;
}
.chat-send-btn:hover { transform: scale(1.1); }
.chat-send-btn:active { transform: scale(0.92); }

/* شاشات صغيرة */
@media (max-width: 480px) {
    .chat-panel { right: 0; bottom: 0; width: 100%; border-radius: 20px 20px 0 0; max-height: 80vh; }
    .notif-dropdown { right: -60px; width: 290px; }
}

/* ══ Toast إشعارات ══ */
.notif-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border-radius: 14px;
    padding: 12px 16px 12px 14px;
    box-shadow: 0 6px 28px rgba(0,0,0,0.18);
    border-left: 4px solid #b05080;
    min-width: 240px;
    max-width: 300px;
    pointer-events: all;
    cursor: pointer;
    animation: toastIn 0.4s cubic-bezier(0.34,1.4,0.64,1) both;
    transition: opacity 0.3s, transform 0.3s;
}
.notif-toast.leaving {
    opacity: 0;
    transform: translateX(-20px);
}
@keyframes toastIn {
    from { opacity:0; transform: translateX(-30px) scale(0.95); }
    to   { opacity:1; transform: translateX(0) scale(1); }
}
[data-theme="dark"] .notif-toast {
    background: #1e1030;
    box-shadow: 0 6px 28px rgba(0,0,0,0.5);
    border-left-color: #9060c0;
}
.notif-toast-icon {
    font-size: 22px;
    flex-shrink: 0;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #fdf0f8;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.notif-toast-icon img { width:100%; height:100%; object-fit:cover; border-radius:50%; }
[data-theme="dark"] .notif-toast-icon { background: #2a1040; }
.notif-toast-body { flex:1; min-width:0; }
.notif-toast-text {
    font-size: 13px;
    font-weight: 600;
    color: #3a1020;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
[data-theme="dark"] .notif-toast-text { color: #e0b8d0; }
.notif-toast-time {
    font-size: 11px;
    color: #b09aaa;
    margin-top: 2px;
}
.notif-toast-close {
    background: none; border: none; color: #c0a0b0;
    font-size: 16px; cursor: pointer; flex-shrink: 0;
    padding: 2px 4px; border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.notif-toast-close:hover { color: #8B2635; background: #fde8f3; }
/* ── شريط الأدمن العائم ── */
.admin-float-bar {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9996;
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
}
.admin-float-bar > * { pointer-events: all; }

.afb-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #1e293b, #3a1a30);
    color: white;
    border: none;
    border-radius: 999px;
    padding: 8px 18px 8px 14px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.35);
    transition: transform 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}
.afb-toggle:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.45); }
.afb-label { font-size: 12px; opacity: 0.85; }

.afb-panel {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
    border: 1px solid #e2e8f0;
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 2px;
    min-width: 200px;
    animation: afbIn 0.2s cubic-bezier(0.34,1.56,0.64,1) both;
}
.afb-panel.open { display: flex; }
@keyframes afbIn {
    from { opacity:0; transform: translateY(10px) scale(0.95); }
    to   { opacity:1; transform: translateY(0) scale(1); }
}
[data-theme="dark"] .afb-panel {
    background: #1a0e2a;
    border-color: #3a2050;
    box-shadow: 0 8px 40px rgba(0,0,0,0.55);
}

.afb-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-align: left;
    width: 100%;
}
.afb-link:hover { background: #f1f5f9; color: #8B2635; }
[data-theme="dark"] .afb-link { color: #d0b0e8; }
[data-theme="dark"] .afb-link:hover { background: #2a1840; color: #f0d0ff; }

.afb-divider { height: 1px; background: #e2e8f0; margin: 4px 8px; }
[data-theme="dark"] .afb-divider { background: #3a2050; }

.afb-mode-btn.active { background: #fef3c7; color: #92400e !important; }
[data-theme="dark"] .afb-mode-btn.active { background: #3a2010; color: #fbbf24 !important; }

/* ── Highlight Mode: حدود حمراء على العناصر القابلة للحذف ── */
body.admin-overlay-on [data-admin-id] {
    outline: 2px dashed rgba(220,38,38,0.5) !important;
    position: relative;
}
body.admin-overlay-on [data-admin-id]:hover {
    outline-color: #dc2626 !important;
    outline-width: 2px !important;
}
body.admin-overlay-on [data-admin-id]:hover .admin-del-btn {
    display: flex !important;
}

/* ── زر الحذف الذي يظهر عند التمرير ── */
.admin-del-btn {
    display: none;
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 100;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 10px rgba(220,38,38,0.5);
    transition: transform 0.1s;
    white-space: nowrap;
}
.admin-del-btn:hover { transform: scale(1.05); background: #b91c1c; }
#lift-btn {
    position: fixed;
    bottom: 30px;
    right: 26px;
    z-index: 9998;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #7c3aed, #db2777);
    color: white;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(124,58,237,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.35s cubic-bezier(0.34,1.56,0.64,1),
                transform 0.35s cubic-bezier(0.34,1.56,0.64,1),
                background 0.3s, box-shadow 0.2s;
    pointer-events: none;
    line-height: 1;
}
#lift-btn.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}
#lift-btn:hover {
    transform: scale(1.12);
    box-shadow: 0 10px 32px rgba(124,58,237,0.6);
}
#lift-btn:active { transform: scale(0.92); }
/* وضع "للأسفل" — تدرج أخضر */
#lift-btn.going-down {
    background: linear-gradient(135deg, #059669, #0ea5e9);
    box-shadow: 0 6px 24px rgba(5,150,105,0.4);
}