/* ═══════════════════════════════════════════════════════════════════════════
   femto · MARKET WATCH card (carbon) — بطاقة مراقبة السوق المُدمجة (إضافة بحتة)
   ─────────────────────────────────────────────────────────────────────────────
   • بطاقة مُدمجة أعلى الـ sidebar تعرض أصولاً مختارة (كريبتو + ذهب + فوركس)
     بأسعار حيّة + خطوط شرارة + شارة نسبة — بنفس مصدر بيانات الـ watchlist.
   • تخفي الـ watchlist الكاملة من صفحة الأخبار (ديسكتوب فقط) — تبقى موجودة في
     الـ DOM وتظهر عند الضغط على «عرض المزيد» أو من سكّة التنقّل.
   • الموبايل غير ممسوس إطلاقاً (كل قواعد الإخفاء/العرض خلف ≥1101px).
   • لا تعدّل أي ملف موجود؛ كل اللون من توكنز السكِن الكربوني.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── البطاقة ───────────────────────────────────────────────────────────────── */
.fnrp-mw {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 14px 0;
  padding: 16px 16px 12px;
  background: var(--surface, #0e1014);
  border: 1px solid var(--border, rgba(255,255,255,.06));
  border-radius: var(--radius-lg, 14px);
  direction: ltr;            /* الأرقام/الرموز LTR دائماً — يطابق النموذج */
  font-feature-settings: "tnum" 1;
}

/* ── الرأس ─────────────────────────────────────────────────────────────────── */
.fnrp-mw-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.fnrp-mw-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text, #fbfbfc);
}
.fnrp-mw-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2, #9ea3ad);
}
.fnrp-mw-live::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--up, #2ebd6b);
  box-shadow: 0 0 0 3px var(--up-glow, rgba(46,189,107,.16));
  animation: fnrp-mw-pulse 2.2s ease-in-out infinite;
}
@keyframes fnrp-mw-pulse { 0%,100%{ opacity:1 } 50%{ opacity:.45 } }

/* ── صفّ الأصل ─────────────────────────────────────────────────────────────── */
.fnrp-mw-rows { display: flex; flex-direction: column; }
.fnrp-mw-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 4px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .12s ease;
}
.fnrp-mw-row + .fnrp-mw-row { border-top: 1px solid var(--border, rgba(255,255,255,.05)); }
.fnrp-mw-row:hover { background: rgba(255,255,255,.03); }

/* أيقونة الأصل */
.fnrp-mw-ic {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  color: #fff;
  text-transform: uppercase;
}

/* الكتلة الوسطى: الرمز + الشارة / الاسم */
.fnrp-mw-info { flex: 1 1 auto; min-width: 0; }
.fnrp-mw-code-l {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.fnrp-mw-code {
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #fbfbfc);
  white-space: nowrap;
}
.fnrp-mw-tag {
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-2, #9ea3ad);
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border, rgba(255,255,255,.06));
  padding: 2px 6px;
  border-radius: 5px;
  line-height: 1.2;
}
.fnrp-mw-name {
  font-size: 12px;
  color: var(--text-2, #9ea3ad);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* خطّ الشرارة */
.fnrp-mw-spark {
  flex: 0 0 auto;
  width: 46px; height: 26px;
  display: block;
}
.fnrp-mw-spark path { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; }

/* الأرقام: السعر + شارة النسبة */
.fnrp-mw-nums {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 56px;
}
.fnrp-mw-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #fbfbfc);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.fnrp-mw-chg {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.fnrp-mw-chg.up   { color: var(--up,   #2ebd6b); background: var(--up-glow,   rgba(46,189,107,.16)); }
.fnrp-mw-chg.down { color: var(--down, #f6465d); background: var(--down-glow, rgba(246,70,93,.16)); }
.fnrp-mw-chg.flat { color: var(--text-2, #9ea3ad); background: rgba(255,255,255,.06); }

/* أيقونة تتحرّك قليلاً عند تحديث السعر */
.fnrp-mw-row.tick-up   .fnrp-mw-price { animation: fnrp-mw-up   .5s ease; }
.fnrp-mw-row.tick-down .fnrp-mw-price { animation: fnrp-mw-down .5s ease; }
@keyframes fnrp-mw-up   { 0%{ color: var(--up,#2ebd6b) }   100%{ color: var(--text,#fbfbfc) } }
@keyframes fnrp-mw-down { 0%{ color: var(--down,#f6465d) } 100%{ color: var(--text,#fbfbfc) } }

/* ── زر «عرض المزيد» ───────────────────────────────────────────────────────── */
.fnrp-mw-more {
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent, #5e9eff);
  background: transparent;
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 10px;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.fnrp-mw-more:hover { background: rgba(94,158,255,.08); border-color: rgba(94,158,255,.25); }
.fnrp-mw-more svg { transition: transform .15s ease; }
.fnrp-mw-more:hover svg { transform: translateX(2px); }

/* ── خفّة على الثيم الفاتح ─────────────────────────────────────────────────── */
[data-fnrp-theme="light"] .fnrp-mw-row:hover { background: rgba(0,0,0,.03); }
[data-fnrp-theme="light"] .fnrp-mw-tag       { background: rgba(0,0,0,.05); }
[data-fnrp-theme="light"] .fnrp-mw-more:hover { background: rgba(94,158,255,.10); }

/* ═══════════════════════════════════════════════════════════════════════════
   إخفاء الـ watchlist الكاملة من صفحة الأخبار — ديسكتوب فقط (≥1101px).
   • تبقى في الـ DOM (display:none فقط) → كل وظائفها سليمة، تظهر فوراً عند الكشف.
   • نقطة الكسر 1101px تطابق MOBILE_BREAKPOINT_PAIRS في frontend.js، فالموبايل
     (حيث تنتقل الـ watchlist إلى slot أعلى الأخبار) لا يتأثّر أبداً.
   ═══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1101px) {
  /* مخفيّة افتراضياً داخل الـ sidebar */
  html.fnrp-active #fnrp-sidebar > #fs-pairs:not(.fnrp-mw-revealed) {
    display: none !important;
  }
  /* عند الكشف (زر عرض المزيد / سكّة الأسواق) تعود بكامل هيئتها */
  html.fnrp-active #fnrp-sidebar > #fs-pairs.fnrp-mw-revealed {
    display: block !important;
    animation: fnrp-mw-reveal .25s ease;
  }
}
@keyframes fnrp-mw-reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* البطاقة ديسكتوب فقط — على الموبايل تبقى الـ watchlist الأصلية كما هي */
@media (max-width: 1100px) {
  .fnrp-mw { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .fnrp-mw-live::before,
  .fnrp-mw-row.tick-up .fnrp-mw-price,
  .fnrp-mw-row.tick-down .fnrp-mw-price,
  html.fnrp-active #fnrp-sidebar > #fs-pairs.fnrp-mw-revealed { animation: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
/* ═══════════════════════════════════════════════════════════════════════════
   صفحة الأسواق — تصميم كربوني احترافي مستقلّ عن الأخبار.
   ═══════════════════════════════════════════════════════════════════════════ */
#fnrp-markets-page {
  position: fixed;
  inset: 0;
  z-index: 99990;
  display: none;
  flex-direction: column;
  background: var(--bg, #0a0b0d);
  color: var(--text, #fbfbfc);
  font-family: inherit;
}
#fnrp-markets-page.is-open { display: flex; animation: fnrp-mp-in .2s ease; }
@keyframes fnrp-mp-in { from { opacity: 0; } to { opacity: 1; } }
@media (min-width: 1025px) { #fnrp-markets-page { inset-inline-start: 92px; } }
html.fnrp-mp-lock, html.fnrp-mp-lock body { overflow: hidden !important; }

/* ── الرأس ─────────────────────────────────────────────────────────────────── */
.fnrp-mp-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 26px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,.07));
  background: var(--surface, #0e1014);
}
.fnrp-mp-back {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; font-size: 13px; font-weight: 600;
  color: var(--text-2, #9ea3ad); background: transparent;
  border: 1px solid var(--border, rgba(255,255,255,.1)); border-radius: 9px;
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.fnrp-mp-back:hover { color: var(--text, #fbfbfc); background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.18); }
.fnrp-mp-title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; color: var(--text, #fbfbfc); }
.fnrp-mp-live { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--text-2, #9ea3ad); }
.fnrp-mp-live::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--up, #2ebd6b); box-shadow: 0 0 0 3px var(--up-glow, rgba(46,189,107,.16));
  animation: fnrp-mw-pulse 2.2s ease-in-out infinite;
}
.fnrp-mp-close {
  margin-inline-start: auto; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; color: var(--text-2, #9ea3ad); background: transparent;
  border: 1px solid var(--border, rgba(255,255,255,.1)); border-radius: 9px;
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.fnrp-mp-close:hover { color: var(--text, #fbfbfc); background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.18); }

/* ── شريط الأدوات: تبويبات + بحث ────────────────────────────────────────────── */
.fnrp-mp-tools {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 26px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,.06));
  background: var(--bg-2, #0b0c0e);
}
.fnrp-mp-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.fnrp-mp-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; font-size: 13px; font-weight: 600;
  color: var(--text-2, #9ea3ad); background: transparent;
  border: 1px solid transparent; border-radius: 9px; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.fnrp-mp-tab:hover { color: var(--text, #fbfbfc); background: rgba(255,255,255,.03); }
.fnrp-mp-tab.is-active { color: var(--text, #fbfbfc); background: rgba(255,255,255,.06); border-color: var(--border, rgba(255,255,255,.1)); }
.fnrp-mp-tab em {
  font-style: normal; font-size: 11px; font-weight: 600;
  color: var(--text-2, #9ea3ad); background: rgba(255,255,255,.06);
  padding: 1px 7px; border-radius: 20px;
}
.fnrp-mp-tab.is-active em { color: var(--accent, #5e9eff); background: rgba(94,158,255,.14); }
.fnrp-mp-search {
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 220px; max-width: 320px; flex: 0 1 280px;
  padding: 0 12px; height: 38px;
  background: var(--surface, #0e1014);
  border: 1px solid var(--border, rgba(255,255,255,.1)); border-radius: 10px;
  color: var(--text-2, #9ea3ad);
}
.fnrp-mp-search:focus-within { border-color: rgba(94,158,255,.4); }
.fnrp-mp-search input {
  flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--text, #fbfbfc); font-size: 13px; font-family: inherit;
}
.fnrp-mp-search input::placeholder { color: var(--text-2, #9ea3ad); opacity: .8; }

/* ── الجسم + الشبكة ──────────────────────────────────────────────────────────── */
.fnrp-mp-body { flex: 1 1 auto; overflow-y: auto; padding: 20px 26px 44px; -webkit-overflow-scrolling: touch; }
.fnrp-mp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 10px;
  max-width: 1480px; margin: 0 auto;
}
.fnrp-mp-empty { padding: 60px 0; text-align: center; color: var(--text-2, #9ea3ad); font-size: 14px; }

/* ── بطاقة الأصل ─────────────────────────────────────────────────────────────── */
.fnrp-mp-tile {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px; direction: ltr; cursor: pointer; outline: none;
  background: var(--surface, #0e1014);
  border: 1px solid var(--border, rgba(255,255,255,.06));
  border-radius: 12px;
  transition: border-color .12s, background .12s, transform .12s, box-shadow .12s;
}
.fnrp-mp-tile:hover { border-color: rgba(255,255,255,.16); background: rgba(255,255,255,.022); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.22); }
.fnrp-mp-tile:focus-visible { border-color: var(--accent, #5e9eff); box-shadow: 0 0 0 2px rgba(94,158,255,.28); }
.fnrp-mp-go {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; margin-inline-start: 2px; border-radius: 7px;
  color: var(--text-2, #9ea3ad); opacity: .55;
  transition: opacity .12s, color .12s, background .12s;
}
.fnrp-mp-tile:hover .fnrp-mp-go { opacity: 1; color: var(--accent, #5e9eff); background: rgba(94,158,255,.12); }
.fnrp-mp-tile.is-focus { border-color: var(--accent, #5e9eff); box-shadow: 0 0 0 2px rgba(94,158,255,.18); }
.fnrp-mp-ic {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff; text-transform: uppercase; letter-spacing: .01em;
}
.fnrp-mp-meta { flex: 1 1 auto; min-width: 0; }
.fnrp-mp-code { font-size: 14px; font-weight: 700; color: var(--text, #fbfbfc); white-space: nowrap; }
.fnrp-mp-name { font-size: 12px; color: var(--text-2, #9ea3ad); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fnrp-mp-spark { flex: 0 0 auto; width: 56px; height: 28px; display: block; }
.fnrp-mp-spark path { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.fnrp-mp-nums { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 72px; }
.fnrp-mp-price { font-size: 14px; font-weight: 700; color: var(--text, #fbfbfc); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fnrp-mp-chg { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fnrp-mp-chg.up   { color: var(--up,   #2ebd6b); background: var(--up-glow,   rgba(46,189,107,.16)); }
.fnrp-mp-chg.down { color: var(--down, #f6465d); background: var(--down-glow, rgba(246,70,93,.16)); }
.fnrp-mp-chg.flat { color: var(--text-2, #9ea3ad); background: rgba(255,255,255,.06); }

[data-fnrp-theme="light"] .fnrp-mp-tile:hover { background: rgba(0,0,0,.02); }
[data-fnrp-theme="light"] .fnrp-mp-tab em { background: rgba(0,0,0,.05); }

@media (prefers-reduced-motion: reduce) {
  #fnrp-markets-page.is-open, .fnrp-mp-live::before { animation: none !important; }
}
