/* ══════════════════════════════════════════════════════════════
   📊 نافذة الشارت — TradingView + الشارت البسيط
   ══════════════════════════════════════════════════════════════ */

.ch-modal {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(3, 9, 17, .97);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
}

.ch-box {
  width: 100%; max-width: 1360px; height: 94vh; max-height: 920px;
  display: flex; flex-direction: column;
  background: var(--pri); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
  transition: border-radius .2s;
}

/* ملء الشاشة */
.ch-box.ch-fs {
  max-width: 100%; width: 100vw; height: 100vh;
  max-height: 100vh; border-radius: 0; border: 0;
}

/* ── الهيدر ── */
.ch-head {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 15px; border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.ch-t { flex: 1; min-width: 0; }
.ch-t b {
  display: block; font: 900 1.08rem/1.25 system-ui, sans-serif;
  color: var(--gold);
}
.ch-t span {
  display: block; font: 500 .76rem/1.4 system-ui, sans-serif;
  color: var(--muted); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.ch-links { display: flex; gap: 5px; flex: 0 0 auto; }
.ch-lb {
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: transparent;
  color: var(--muted); font: 700 .9rem system-ui, sans-serif;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; transition: .14s;
}
.ch-lb:hover { border-color: var(--gold); color: var(--gold); }
.ch-lb.on { background: var(--gold); color: #0b1220; border-color: var(--gold); }

/* ── TradingView ── */
.ch-tv-wrap {
  flex: 1; position: relative; min-height: 0;
  background: var(--pri);
}
.ch-tv-wrap .tradingview-widget-container,
.ch-tv-wrap .tradingview-widget-container__widget {
  height: 100% !important; width: 100% !important;
}
.ch-tv-wrap iframe { display: block; }

/* ── شريط الأدوات (الشارت البسيط) ── */
.ch-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 15px; border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.ch-grp {
  display: flex; gap: 3px; padding: 3px;
  background: var(--pri2); border: 1px solid var(--line); border-radius: 9px;
}
.ch-b {
  padding: 7px 11px; border-radius: 7px; border: 0; cursor: pointer;
  background: transparent; color: var(--muted);
  font: 700 .74rem system-ui, sans-serif; white-space: nowrap;
  transition: .14s;
}
.ch-b:hover { background: rgba(255,255,255,.06); color: var(--txt); }
.ch-b.on { background: var(--gold); color: #0b1220; }

/* ── الكانفاس (الشارت البسيط) ── */
.ch-canvas-wrap {
  flex: 1; position: relative; overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.ch-canvas-wrap canvas { display: block; cursor: crosshair; }
.ch-hint {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  font: 700 .78rem system-ui, sans-serif; color: var(--gold);
  background: rgba(212,175,55,.13); border: 1px solid rgba(212,175,55,.3);
  border-radius: 8px; padding: 7px 15px; pointer-events: none;
}
.ch-hint:empty { display: none; }
.ch-nod {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font: 700 .98rem/1.8 system-ui, sans-serif; color: var(--muted);
}

/* ── الفوتر ── */
.ch-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 8px 15px; border-top: 1px solid var(--line);
  font: 500 .7rem system-ui, sans-serif; color: var(--muted);
  flex: 0 0 auto;
}
.ch-mini {
  padding: 7px 13px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: transparent;
  color: var(--muted); font: 700 .72rem system-ui, sans-serif;
}
.ch-mini:hover { border-color: var(--gold); color: var(--gold); }
#scInfo, #chInfo { color: var(--gold); font-weight: 700; }

/* ══════════════════════════════════════════════════════════════
   📱 موبايل
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 680px) {
  .ch-modal { padding: 0; }
  .ch-box {
    height: 100vh; max-height: 100vh;
    border-radius: 0; border: 0;
  }
  .ch-head { padding: 9px 11px; gap: 9px; }
  .ch-t b { font-size: .98rem; }
  .ch-t span { font-size: .7rem; max-width: 42vw; }
  .ch-lb { width: 32px; height: 32px; font-size: .84rem; }

  .ch-bar { padding: 7px 10px; gap: 6px; }
  .ch-b { padding: 8px 10px; font-size: .72rem; }

  .ch-foot { padding: 7px 11px; font-size: .64rem; }
  .ch-foot > span:first-child { display: none; }
}

/* ── الوضع الفاتح ── */
body.light .ch-modal { background: rgba(255,255,255,.98); }
body.light .ch-tv-wrap { background: #fff; }