/* ستوك — أنماط صفحة اختبار تقاطعات EMA (/ema) v1
   تعتمد على هوية stock.css العامة وتضيف فقط ما يخص الصفحة:
   تنبيه ثابت وحقول المدى الرقمي وشريطا تقدم وجدولا الترتيب والقاعدة
   والخريطة الحرارية وبطاقة التفاصيل وقوائم التحقق — Apple HIG: أرضية 12px — صفر إيموجي */

/* ===== التنبيه الثابت ===== */
.ema-warn {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 211, 77, 0.38);
  background: rgba(255, 211, 77, 0.08);
  color: #ffd34d;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.7;
}
.ema-warn b { font-weight: 900; }

/* ===== ملاحظة إعدادات وحقول رقمية ===== */
.ema-note { margin: 10px 2px 0; color: var(--dim); font-size: 0.75rem; line-height: 1.7; }
.ema-num {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.75rem; color: var(--ink2); font-weight: 700;
  white-space: nowrap;
}
.ema-num input {
  width: 62px; padding: 7px 8px; border-radius: 9px;
  border: 1px solid var(--line); background: rgba(17, 24, 38, 0.65);
  color: var(--ink); font: 800 0.78rem/1 Cairo, Tahoma, sans-serif;
  font-variant-numeric: tabular-nums; text-align: center;
}
.ema-num input:focus-visible { outline: 2px solid var(--acc2); outline-offset: 1px; }

/* ===== بطاقة الجودة ===== */
.ema-quality {
  margin-top: 14px;
  background: rgba(10, 15, 26, 0.72);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px 12px;
}
.ema-quality .idx-title { font-size: 1rem; }
.ema-quality .idx-note { line-height: 1.7; }

/* ===== شريطا التقدم ===== */
.ema-runbar {
  margin-top: 14px;
  background: rgba(10, 15, 26, 0.72);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.ema-progress { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 220px; }
.ema-progress-track { flex: 1; height: 7px; border-radius: 4px; background: rgba(151, 167, 199, 0.16); overflow: hidden; }
.ema-progress-fill {
  height: 100%; width: 0%; border-radius: 4px;
  background: linear-gradient(90deg, rgba(10, 132, 255, 0.9), rgba(45, 212, 191, 0.9));
  transition: width 0.25s ease;
}
.ema-progress-text { font: 800 0.75rem/1 Cairo, Tahoma, sans-serif; color: var(--ink2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ema-run-tools { display: flex; gap: 8px; }

/* ===== قسم الترتيب ===== */
.ema-rank {
  margin-top: 16px;
  background: rgba(10, 15, 26, 0.72);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 12px;
}
.ema-rank-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ema-rank-head .idx-title { font-size: 1rem; }
.ema-rank-head .idx-note { max-width: 780px; line-height: 1.7; }
.ema-rank-tools { display: flex; flex-direction: column; gap: 7px; align-items: flex-end; }
.ema-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ema-chips button {
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(17, 24, 38, 0.5);
  color: var(--ink2); font: 700 0.75rem/1 Cairo, Tahoma, sans-serif;
  cursor: pointer; transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.ema-chips button:hover { color: var(--ink); border-color: var(--line2); }
.ema-chips button.on {
  color: #fff; border-color: rgba(10, 132, 255, 0.65);
  background: rgba(10, 132, 255, 0.22);
}

/* الجدول */
.ema-tbl-wrap { margin-top: 12px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.ema-tbl-wrap .data-table { min-width: 960px; margin: 0; }
.ema-tbl-wrap .data-table thead th { position: sticky; top: 0; background: rgba(10, 15, 26, 0.98); z-index: 2; }
.ema-tbl-wrap .data-table tbody td { white-space: nowrap; }
.ema-tbl-wrap .data-table tbody tr { transition: background 0.12s ease; cursor: pointer; }
.ema-tbl-wrap .data-table tbody tr:hover { background: rgba(10, 132, 255, 0.06); }
.ema-tbl-wrap .data-table tbody tr.is-picked { background: rgba(45, 212, 191, 0.08); box-shadow: inset 3px 0 0 #2dd4bf; }
.ema-tbl-wrap .combo-link { color: var(--ink); font-weight: 800; text-decoration: none; direction: ltr; display: inline-block; }
.ema-tbl-wrap .combo-link:hover { text-decoration: underline; }
.ema-tbl-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ema-tbl-foot .ext-foot-note { flex: 1; min-width: 200px; }

/* شارات الموثوقية والتحذيرات — بنفس لغة ext */
.ext-foot-note { margin: 10px 2px 0; color: var(--dim); font-size: 0.75rem; line-height: 1.7; }
.ema-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font: 800 0.75rem/1.3 Cairo, Tahoma, sans-serif;
  border: 1px solid transparent;
}
.ema-pill.high { color: #04060a; background: #34d399; }
.ema-pill.mid { color: #04060a; background: #ffd34d; }
.ema-pill.low { color: var(--ink2); background: rgba(151, 167, 199, 0.18); }
.ema-pill.sig { color: #04060a; background: #2dd4bf; }
.ema-warnchips { display: flex; flex-wrap: wrap; gap: 4px; }
.ema-warnchips i {
  font-style: normal; font-size: 0.75rem; font-weight: 800;
  padding: 2px 7px; border-radius: 999px;
  border: 1px solid rgba(255, 211, 77, 0.4); color: #ffd34d; white-space: nowrap;
}
.ema-nb {
  font-style: normal; font-size: 0.75rem; font-weight: 800;
  padding: 2px 7px; border-radius: 999px;
  border: 1px solid rgba(45, 212, 191, 0.4); color: #2dd4bf; white-space: nowrap;
}

/* ===== الخريطة الحرارية ===== */
.ema-heat-sec {
  margin-top: 16px;
  background: rgba(10, 15, 26, 0.72);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 12px;
  position: relative;
}
.ema-heat-sec .hm-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; margin: 0 0 10px; }
.ema-heat-sec .idx-title { font-size: 1rem; }
.ema-heat-sec .idx-note { max-width: 760px; line-height: 1.7; }
.ema-heat-host { position: relative; min-height: 340px; }
.ema-heat-host canvas { display: block; width: 100%; height: 340px; cursor: crosshair; }
.sw-hi { background: #34d399; }
.sw-mid { background: rgba(45, 212, 191, 0.45); }
.sw-lo { background: rgba(151, 167, 199, 0.18); }
.sw-off { background: rgba(23, 30, 46, 0.9); }

/* ===== قسم التفاصيل ===== */
.ema-detail-sec {
  margin-top: 16px;
  background: rgba(10, 15, 26, 0.72);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 12px;
}
.ema-detail-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ema-detail-head .idx-title { font-size: 1rem; }
.ema-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; margin-top: 12px; }
.ema-card {
  background: rgba(10, 15, 26, 0.72);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 14px 12px;
  min-width: 0;
}
.ema-card h3 { margin: 0 0 10px; font-size: 0.86rem; font-weight: 900; color: var(--ink); }
.ema-h3gap { margin-top: 14px; }
.ema-card-wide { min-width: 0; }
.ext-kv { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.ext-kv li { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.75rem; color: var(--ink2); }
.ext-kv li b { color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; direction: ltr; }
.ext-kv li b.is-up { color: #34d399; }
.ext-kv li b.is-dn { color: #fb5569; }
.ext-kv li b.is-dim { color: var(--dim); }
.ext-mini { margin: 8px 0 10px; color: var(--dim); font-size: 0.75rem; line-height: 1.6; }

/* قائمة التحقق على تريدغ فيو */
.ema-tvlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ema-tvlist li {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(17, 24, 38, 0.5);
  font-size: 0.75rem; color: var(--ink2);
}
.ema-tvlist li .tv-date { font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; direction: ltr; }
.ema-tvlist li.is-up .tv-kind { color: #34d399; font-weight: 900; }
.ema-tvlist li.is-dn .tv-kind { color: #fb5569; font-weight: 900; }
.ema-tvlist li .tv-px { margin-inline-start: auto; font-weight: 800; font-variant-numeric: tabular-nums; direction: ltr; color: var(--ink); }

/* جدول الأحداث */
.ema-ev-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; max-height: 430px; overflow-y: auto; }
.ema-ev-wrap .data-table { min-width: 860px; margin: 0; }
.ema-ev-wrap .data-table thead th { position: sticky; top: 0; background: rgba(10, 15, 26, 0.98); z-index: 2; }
.ema-ev-wrap .data-table tbody td { white-space: nowrap; }
.em-dir-up { color: #34d399; font-weight: 800; }
.em-dir-dn { color: #fb5569; font-weight: 800; }
.em-dim { color: var(--dim); }

/* ===== قسم المسح الكامل ===== */
.ema-scan {
  margin-top: 16px;
  background: rgba(10, 15, 26, 0.72);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 12px;
}
.ema-scan-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ema-scan-head .idx-title { font-size: 1rem; }
.ema-scan-head .idx-note { max-width: 780px; line-height: 1.7; }
.ema-scan-tools { display: flex; gap: 8px; flex: none; flex-wrap: wrap; }
.ema-scan-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.ema-scan-bar .hm-field input { min-width: 190px; }
.ema-scan .data-table tbody td { white-space: nowrap; }
.ema-scan .data-table thead th.sortable { cursor: pointer; user-select: none; }
.ema-scan .data-table thead th.sortable.is-sorted-asc::after { content: " ↑"; color: var(--acc2); }
.ema-scan .data-table thead th.sortable.is-sorted-desc::after { content: " ↓"; color: var(--acc2); }
.ema-scan .data-table tbody tr.is-up-ok { box-shadow: inset 3px 0 0 #34d399; }
.ema-scan .data-table tbody tr.is-dn-ok { box-shadow: inset 3px 0 0 #fb5569; }
.ema-scan .sym-link { color: var(--ink); font-weight: 800; text-decoration: none; }
.ema-scan .sym-link:hover { text-decoration: underline; }
.ema-symname { color: var(--dim); font-size: 0.75rem; font-weight: 600; }
.idx-controls .cache-chip, .ema-scan-bar .cache-chip { max-width: 100%; white-space: normal; line-height: 1.5; }

/* ===== الاستجابة ===== */
@media (max-width: 980px) {
  .ema-layout { grid-template-columns: 1fr; }
  .ema-rank-tools { align-items: flex-start; }
  .ema-scan-head { flex-direction: column; }
  .ema-scan-tools { width: 100%; }
  .ema-scan-tools .btn-sm { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 560px) {
  .ema-rank, .ema-heat-sec, .ema-detail-sec, .ema-scan, .ema-runbar { padding: 13px 11px 10px; }
  .ema-scan-bar .hm-field { flex: 1 1 100%; }
  .ema-scan-bar .hm-field input, .ema-scan-bar .hm-field select { width: 100%; }
  .ema-num { flex-wrap: wrap; }
  .ema-heat-host canvas { height: 280px; }
  .ema-chips button { padding: 6px 10px; font-size: 0.75rem; }
}
