/* Makhluot Notifications — frontend styles
 * Facebook-style notification bell + dropdown.
 */

/* ========== BELL BUTTON ========== */
/* Hidden until JS positions it */
.mn-bell-root[data-mn-pending] { visibility: hidden; }
.mn-bell-root.is-guest { display: none !important; }

/* Inline mode: sits inside theme's .header-actions next to moon/search */
.mn-bell-root.mn-bell-inline {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 100;
  /* Critical: never clip the badge */
  overflow: visible !important;
}
.mn-bell-root.mn-bell-inline .mn-bell-btn {
  position: relative;
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .18s ease, transform .12s ease, border-color .18s ease, color .18s ease;
  flex-shrink: 0;
  /* Critical: never clip the badge */
  overflow: visible !important;
}
.mn-bell-root.mn-bell-inline .mn-bell-btn:hover {
  background: rgba(167,139,250,0.12);
  border-color: rgba(167,139,250,0.30);
}
.mn-bell-root.mn-bell-inline .mn-bell-btn:active { transform: scale(.95); }
.mn-bell-root.mn-bell-inline.is-open .mn-bell-btn {
  background: linear-gradient(135deg, #7a00df, #a855f7);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(122,0,223,.45);
}
.mn-bell-svg { display: block; pointer-events: none; }

/* Floating fallback (when no theme header found) */
.mn-bell-root.mn-bell-floating {
  position: fixed;
  top: 70px;
  inset-inline-end: 14px;
  z-index: 9998;
  overflow: visible !important;
}
.mn-bell-root.mn-bell-floating .mn-bell-btn {
  width: 44px; height: 44px;
  min-width: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.10);
  background: linear-gradient(135deg, #2a1240, #1a0d2a);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  overflow: visible !important;
}
@media (max-width: 480px) {
  .mn-bell-root.mn-bell-floating { top: 64px; inset-inline-end: 8px; }
  .mn-bell-root.mn-bell-floating .mn-bell-btn { width: 38px; height: 38px; min-width: 38px; }
}

/* ========== BADGE — never clipped, always visible ========== */
.mn-bell-badge {
  position: absolute;
  top: -6px;
  inset-inline-end: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;          /* center text vertically */
  text-align: center;
  display: inline-block;
  box-shadow: 0 0 0 2px var(--mn-badge-ring, #14091f), 0 2px 6px rgba(239,68,68,.55);
  pointer-events: none;
  z-index: 2;
  white-space: nowrap;
}
[data-theme="light"] .mn-bell-badge,
html:not([data-theme="dark"]) body:not(.dark) .mn-bell-badge {
  --mn-badge-ring: #ffffff;
}
.mn-bell-badge[hidden] { display: none; }

/* ========== PANEL ========== */
.mn-bell-panel {
  /* Hidden by default. Shown only when JS adds .is-open. The hidden attribute
   * alone is not enough because our author CSS sets display:flex with the
   * same specificity, so display:none from the UA stylesheet would lose. */
  display: none;
  position: fixed;
  z-index: 99999;
  background: #ffffff;
  color: #050505;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 12px 28px rgba(0,0,0,.20), 0 2px 4px rgba(0,0,0,.10), 0 0 0 1px rgba(0,0,0,.04);
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
}
.mn-bell-panel.is-open { display: flex; }
.mn-bell-panel[hidden] { display: none !important; }
[data-theme="dark"] .mn-bell-panel,
html:not([data-theme="light"]) body.dark .mn-bell-panel,
html[data-theme="dark"] .mn-bell-panel,
.mn-bell-panel.is-dark {
  background: #242526;
  color: #e4e6eb;
  border-color: rgba(255,255,255,0.10);
  box-shadow: 0 12px 28px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,0.04);
}
/* Auto dark when site is in dark mode (most Makhluot pages) */
@media (prefers-color-scheme: dark) {
  .mn-bell-panel {
    background: #242526;
    color: #e4e6eb;
    border-color: rgba(255,255,255,0.10);
    box-shadow: 0 12px 28px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,0.04);
  }
}

/* Desktop dropdown (positioned by JS) */
.mn-bell-panel.is-desktop {
  width: 360px;
  max-height: min(640px, 80vh);
  border-radius: 12px;
  animation: mn-panel-fade .15s ease;
}
@keyframes mn-panel-fade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Mobile full-screen takeover (Facebook-style) */
.mn-bell-panel.is-mobile {
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  max-height: none !important;
  height: 100vh !important;
  height: 100dvh !important;
  border-radius: 0 !important;
  border: 0;
  animation: mn-fs-in .2s ease;
}
@keyframes mn-fs-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
[dir="rtl"] .mn-bell-panel.is-mobile { animation-name: mn-fs-in-rtl; }
@keyframes mn-fs-in-rtl {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Lock body scroll when mobile takeover is open */
body.mn-bell-locked {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* ========== PANEL HEADER ========== */
.mn-bell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}
@media (prefers-color-scheme: dark) {
  .mn-bell-head { border-bottom-color: rgba(255,255,255,0.08); }
}
[data-theme="dark"] .mn-bell-head,
.mn-bell-panel.is-dark .mn-bell-head { border-bottom-color: rgba(255,255,255,0.08); }
.mn-bell-head strong {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

/* Close button — always visible (FB has a back arrow on mobile, X on desktop) */
.mn-bell-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.06);
  border: 0;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
}
.mn-bell-close:hover { background: rgba(0,0,0,0.10); }
.mn-bell-close:active { transform: scale(.92); }
@media (prefers-color-scheme: dark) {
  .mn-bell-close { background: rgba(255,255,255,0.10); }
  .mn-bell-close:hover { background: rgba(255,255,255,0.16); }
}
[data-theme="dark"] .mn-bell-close,
.mn-bell-panel.is-dark .mn-bell-close { background: rgba(255,255,255,0.10); }
[data-theme="dark"] .mn-bell-close:hover,
.mn-bell-panel.is-dark .mn-bell-close:hover { background: rgba(255,255,255,0.16); }

/* On desktop, hide the close button — clicking outside / on bell again closes */
@media (min-width: 768px) {
  .mn-bell-panel.is-desktop .mn-bell-close { display: none; }
}

/* ========== TOOLBAR ========== */
.mn-bell-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px 8px;
  flex-shrink: 0;
}
.mn-mark-all {
  background: transparent; border: 0;
  color: #1877f2;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background .15s;
}
.mn-mark-all:hover { background: rgba(24,119,242,.10); }
@media (prefers-color-scheme: dark) {
  .mn-mark-all { color: #2d88ff; }
  .mn-mark-all:hover { background: rgba(45,136,255,.15); }
}

/* ========== LIST ========== */
.mn-bell-list {
  list-style: none;
  margin: 0;
  padding: 0 8px 8px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}
.mn-bell-list::-webkit-scrollbar { width: 6px; }
.mn-bell-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 4px; }
.mn-bell-list::-webkit-scrollbar-track { background: transparent; }
@media (prefers-color-scheme: dark) {
  .mn-bell-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); }
}

.mn-bell-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s;
  position: relative;
}
.mn-bell-item:hover { background: rgba(0,0,0,0.05); }
.mn-bell-item:active { background: rgba(0,0,0,0.08); }
@media (prefers-color-scheme: dark) {
  .mn-bell-item:hover { background: rgba(255,255,255,0.08); }
  .mn-bell-item:active { background: rgba(255,255,255,0.12); }
}

.mn-bell-item .mn-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #e4e6eb center/cover no-repeat;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
@media (prefers-color-scheme: dark) {
  .mn-bell-item .mn-avatar { background-color: #3a3b3c; }
}

.mn-bell-item .mn-body { flex: 1; min-width: 0; padding-top: 2px; }
.mn-bell-item .mn-msg {
  font-size: .94rem;
  line-height: 1.45;
  word-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mn-bell-item.is-unread .mn-msg { font-weight: 600; }
.mn-bell-item .mn-icon { margin-inline-end: 4px; }

.mn-bell-item .mn-time {
  display: block;
  margin-top: 4px;
  font-size: .82rem;
  color: #1877f2;
  font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  .mn-bell-item .mn-time { color: #2d88ff; }
}
.mn-bell-item.is-read .mn-time { color: #65676b; font-weight: 400; }
@media (prefers-color-scheme: dark) {
  .mn-bell-item.is-read .mn-time { color: #b0b3b8; }
}

/* Blue unread dot on the right (FB style) */
.mn-bell-item.is-unread::after {
  content: '';
  position: absolute;
  inset-inline-end: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #1877f2;
  box-shadow: 0 0 0 2px #fff;
}
@media (prefers-color-scheme: dark) {
  .mn-bell-item.is-unread::after {
    background: #2d88ff;
    box-shadow: 0 0 0 2px #242526;
  }
}

.mn-bell-empty {
  list-style: none;
  padding: 60px 16px;
  text-align: center;
  color: #65676b;
  font-size: .95rem;
}
@media (prefers-color-scheme: dark) {
  .mn-bell-empty { color: #b0b3b8; }
}

/* ========== FOOTER ========== */
.mn-bell-foot {
  display: block;
  padding: 12px;
  text-align: center;
  color: #1877f2;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
  border-top: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
  transition: background .15s;
}
.mn-bell-foot:hover { background: rgba(0,0,0,0.04); text-decoration: none; }
@media (prefers-color-scheme: dark) {
  .mn-bell-foot { color: #2d88ff; border-top-color: rgba(255,255,255,0.08); }
  .mn-bell-foot:hover { background: rgba(255,255,255,0.05); }
}

/* ========== TOAST ========== */
#mn-toast-root {
  position: fixed; top: 14px; inset-inline-start: 14px;
  z-index: 100000; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none; max-width: min(380px, 92vw);
}
.mn-toast {
  pointer-events: auto;
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 12px;
  background: #14091f; color: #e7d6ff;
  border: 1px solid rgba(167,139,250,0.35);
  box-shadow: 0 14px 36px rgba(0,0,0,.45);
  transform: translateY(-12px); opacity: 0;
  transition: opacity .25s, transform .25s;
}
.mn-toast.is-shown { opacity: 1; transform: translateY(0); }
.mn-toast-icon { font-size: 1.4rem; }
.mn-toast-body { flex: 1; min-width: 0; }
.mn-toast-msg { font-size: .92rem; line-height: 1.45; word-wrap: break-word; }
.mn-toast-link { display: inline-block; margin-top: 4px; color: #a78bfa; text-decoration: none; font-size: .85rem; }
.mn-toast-link:hover { text-decoration: underline; }
.mn-toast-close { background: transparent; border: 0; color: inherit; opacity: .6; font-size: 1.1rem; cursor: pointer; }
.mn-toast-close:hover { opacity: 1; }

/* ========== COMMENT ACTIONS (inside theme's .ms-comment-item) ========== */
.ms-comment-item .mn-comment-actions {
  display: flex; flex-wrap: wrap; gap: 14px;
  align-items: center;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255,255,255,0.07);
  font-size: .88rem;
}
.mn-like-btn, .mn-reply-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 0; color: inherit;
  cursor: pointer; padding: 4px 8px; border-radius: 6px;
  font-size: .88rem; transition: background .15s, color .15s;
}
.mn-like-btn:hover, .mn-reply-btn:hover { background: rgba(167,139,250,0.10); }
.mn-like-btn .mn-like-icon { font-size: 1rem; opacity: .65; transition: opacity .2s, color .2s, transform .2s; }
.mn-like-btn.is-liked .mn-like-icon { color: #ef4444; opacity: 1; transform: scale(1.15); }
.mn-like-btn.is-liked .mn-like-label { color: #ef4444; font-weight: 600; }
.mn-like-count { font-weight: 600; opacity: .85; }

.mn-reply-form-wrap { padding-top: 8px; }
.mn-reply-form { display: flex; gap: 8px; margin-top: 6px; }
.mn-reply-form textarea {
  flex: 1; min-height: 60px; padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  color: inherit; font: inherit; resize: vertical;
}
.mn-reply-form .mn-reply-actions { display: flex; flex-direction: column; gap: 4px; }
.mn-reply-form button {
  padding: 6px 12px; border: 0; border-radius: 8px; cursor: pointer;
  font-size: .85rem; font-weight: 600;
}
.mn-reply-form .mn-reply-submit { background: linear-gradient(135deg, #7a00df, #a855f7); color: #fff; }
.mn-reply-form .mn-reply-cancel { background: transparent; border: 1px solid rgba(255,255,255,0.15); color: inherit; }
.mn-reply-form .mn-reply-msg { font-size: .8rem; align-self: center; }

/* Inline replies inserted via JS */
.ms-comment-item.mn-injected-reply {
  background: rgba(167,139,250,0.05);
  border-radius: 12px;
  padding: 10px;
}

/* ========== NEW COMMENT FORM (above .ms-comments-list) ========== */
.mn-newcomment-host { margin: 0 0 16px; }
.mn-newcomment {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(167,139,250,0.05);
  border: 1px solid rgba(167,139,250,0.15);
}
.mn-newcomment textarea {
  width: 100%; min-height: 80px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.20);
  color: inherit; font: inherit; resize: vertical;
}
.mn-newcomment-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mn-newcomment-actions button {
  padding: 8px 18px; border: 0; border-radius: 8px;
  background: linear-gradient(135deg, #7a00df, #a855f7);
  color: #fff; font-weight: 700; cursor: pointer;
}
.mn-newcomment-msg { font-size: .85rem; }

.mn-comments-loginhint {
  padding: 12px;
  background: rgba(167,139,250,0.10);
  border: 1px dashed rgba(167,139,250,0.35);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
}
.mn-comments-loginhint button {
  padding: 6px 14px; border: 0; border-radius: 8px;
  background: linear-gradient(135deg, #7a00df, #a855f7);
  color: #fff; font-weight: 600; cursor: pointer;
}

/* ========== Notifications PAGE (shortcode) ========== */
.mn-page { max-width: 800px; margin: 0 auto; padding: 16px; }
.mn-page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.mn-page-head h1 { margin: 0; font-size: 1.5rem; }
.mn-page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mn-page-actions button {
  background: rgba(167,139,250,0.10);
  border: 1px solid rgba(167,139,250,0.20);
  color: inherit;
  padding: 6px 12px;
  border-radius: 8px; cursor: pointer; font-size: .85rem;
}
.mn-page-actions button.is-active { background: linear-gradient(135deg, #7a00df, #a855f7); color: #fff; border-color: transparent; }
.mn-page-list { list-style: none; margin: 0; padding: 0; }
.mn-page-list .mn-bell-item { padding: 14px; border-radius: 10px; margin-bottom: 6px; border: 1px solid rgba(255,255,255,0.05); }
.mn-page-list .mn-bell-item:hover { background: rgba(167,139,250,0.08); }
.mn-page-pager { text-align: center; margin-top: 12px; display: flex; justify-content: center; gap: 6px; }
.mn-page-pager button { padding: 6px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.10); background: transparent; color: inherit; cursor: pointer; }
.mn-page-pager button.is-current { background: #7a00df; border-color: #7a00df; color: #fff; }
.mn-page-empty { text-align: center; padding: 40px 14px; color: #8b7eb0; }

/* ========== PREFS ========== */
.mn-prefs { max-width: 600px; margin: 0 auto; padding: 16px; }
.mn-prefs h2 { margin: 0 0 4px; }
.mn-prefs-desc { margin: 0 0 16px; opacity: .8; font-size: .9rem; }
.mn-prefs label { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed rgba(255,255,255,0.06); cursor: pointer; }
.mn-prefs-save {
  margin-top: 14px; padding: 10px 22px;
  background: linear-gradient(135deg, #7a00df, #a855f7);
  border: 0; border-radius: 10px;
  color: #fff; font-weight: 700; cursor: pointer;
}
.mn-prefs-msg { margin-inline-start: 10px; font-size: .9rem; }


/* ========== BROKEN / DEAD-LINK NOTIFICATIONS ========== */
.mn-bell-item.is-broken { opacity: .55; cursor: default; }
.mn-bell-item.is-broken:hover { background: transparent; }
.mn-bell-item.is-broken .mn-msg::after {
  content: ' (لم يعد متاحاً)';
  font-size: .78rem;
  opacity: .7;
}

/* ========== HASH-TARGET FLASH (clicked from bell → highlight) ========== */
.ms-comment-item.mn-flash,
.mn-item.mn-flash {
  animation: mn-flash-bg 2s ease;
}
@keyframes mn-flash-bg {
  0%   { background: rgba(167,139,250,0.30); }
  100% { background: transparent; }
}

/* ========== GUEST NOTIFICATIONS PAGE ========== */
.mn-page-guest .mn-page-empty {
  text-align: center;
  padding: 40px 16px;
}
.mn-page-login-btn {
  display: inline-block;
  margin-top: 14px;
  padding: 10px 22px;
  background: linear-gradient(135deg, #7a00df, #a855f7);
  color: #fff;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
}
.mn-page-login-btn:hover { opacity: .9; text-decoration: none; }
