/* ═══════════════════════════════════════════════
   Jrss — مكوّنات إضافية
   الشاشة المقفلة · الدوائر المتوهّجة · النماذج · الحاسبة · اللغة
   ═══════════════════════════════════════════════ */

/* ═══ الشاشة المقفلة ═══ */
.locked {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: var(--s5);
  background: radial-gradient(ellipse at 50% 30%, rgba(200,81,81,.10), transparent 62%), var(--bg);
}
.locked-in { text-align: center; max-width: 380px; animation: rise 600ms var(--ease) backwards; }

.locked-logo {
  display: block; width: 180px; height: 62px; margin: 0 auto var(--s4);
  background: var(--grad);
  -webkit-mask: url("/static/assets/wordmark.png") no-repeat center / contain;
          mask: url("/static/assets/wordmark.png") no-repeat center / contain;
  animation: breathe 4.5s var(--ease) infinite;
}
@keyframes breathe {
  0%,100% { opacity: .92; transform: scale(1); }
  50%     { opacity: 1;   transform: scale(1.035); }
}

.locked-title { font-size: 30px; font-weight: 800; letter-spacing: 2px; margin-bottom: 6px; }
.locked-sub { font-size: 13px; color: var(--text-2); margin-bottom: var(--s5); }

.locked-card {
  background: rgba(21,16,17,.72); backdrop-filter: blur(14px);
  border: 1px solid var(--border-2); border-radius: var(--r-lg);
  padding: var(--s5) var(--s4);
}
.locked-row {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 13.5px; font-weight: 600; color: var(--warn); margin-bottom: var(--s4);
}
.locked-cmd {
  display: inline-block; font: 600 22px/1 ui-monospace, monospace;
  letter-spacing: 1px; color: var(--brand-lt);
  background: var(--brand-a14); border: 1px solid var(--brand-a24);
  border-radius: var(--r-sm); padding: 10px 22px;
}
.locked-hint { font-size: 11.5px; color: var(--muted); margin-top: var(--s3); line-height: 1.6; }
.locked-id { font-size: 11px; color: var(--muted); margin-top: var(--s4); }
.locked-id b { color: var(--text-2); font-family: ui-monospace, monospace; }

/* ═══ الدوائر المتوهّجة ═══ */
.strip { display: flex; gap: var(--s2); overflow-x: auto; padding: var(--s3) 2px; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip:empty { display: none; }

.orb {
  flex: none; width: 72px; height: 72px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: var(--surface); cursor: pointer; font-family: inherit;
  animation: pop 420ms var(--ease) backwards;
  transition: transform var(--fast) var(--ease);
}
.orb:active { transform: scale(.92); }
.orb-sym { font-size: 12.5px; font-weight: 700; letter-spacing: -.2px; }
.orb-pnl { font-size: 10px; font-variant-numeric: tabular-nums; }

.orb.up {
  border: 1.5px solid rgba(63,185,132,.55);
  animation: pop 420ms var(--ease) backwards, glowUp 2.8s ease-in-out infinite;
}
.orb.up .orb-sym, .orb.up .orb-pnl { color: var(--up); }
.orb.down {
  border: 1.5px solid rgba(224,85,99,.5);
  box-shadow: 0 0 12px rgba(224,85,99,.22);
}
.orb.down .orb-sym, .orb.down .orb-pnl { color: var(--down); }
.orb.flat { border: 1.5px solid var(--border-2); }
.orb.flat .orb-sym { color: var(--text-2); }
.orb.flat .orb-pnl { color: var(--muted); }

@keyframes pop { from { opacity: 0; transform: scale(.7); } }
@keyframes glowUp {
  0%,100% { box-shadow: 0 0 12px rgba(63,185,132,.22), inset 0 0 16px rgba(63,185,132,.07); }
  50%     { box-shadow: 0 0 22px rgba(63,185,132,.42), inset 0 0 22px rgba(63,185,132,.13); }
}

/* ═══ زر التحديث ═══ */
.head-right { display: flex; align-items: center; gap: var(--s3); }
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  display: grid; place-items: center; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  transition: transform var(--fast) var(--ease);
}
.icon-btn:active { transform: scale(.9); }
.icon-btn.spin .ic { animation: spin 700ms var(--ease); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ صفوف الإدارة ═══ */
.rows { display: flex; flex-direction: column; gap: var(--s2); }
.row {
  display: flex; align-items: center; gap: var(--s3);
  width: 100%; min-height: 52px; padding: 0 var(--s4);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text);
  font: 500 14px Inter, sans-serif; cursor: pointer; text-align: start;
  transition: transform var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.row:active { transform: scale(.98); border-color: var(--brand-a24); }
.row .ic { color: var(--brand); }
.row span { flex: 1; }
.pill {
  min-width: 24px; padding: 2px 8px; border-radius: 99px;
  background: var(--surface-3); color: var(--text-2);
  font-size: 12px; font-weight: 600; text-align: center;
}
.pill.alert { background: var(--brand-a24); color: var(--brand-lt); }

/* ═══ النماذج ═══ */
.form {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: var(--s4);
  display: flex; flex-direction: column; gap: var(--s2);
}
.form label { font-size: 11.5px; color: var(--muted); margin-top: var(--s2); }
.form input, .calc-in input {
  min-height: 44px; padding: 0 var(--s3);
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--r-sm); color: var(--text);
  font: 500 16px Inter, sans-serif;
  transition: border-color var(--fast) var(--ease);
}
.form input:focus, .calc-in input:focus { outline: none; border-color: var(--brand); }
.form-hint { font-size: 11px; color: var(--muted); line-height: 1.6; }

/* الزر الأساسي — عرض كامل.
   بدون width كان ينكمش على النص فيطلع مربّع صغير مزنوق في الورقة. */
.btn {
  display: block; width: 100%;
  min-height: 54px; padding: 0 var(--s4);
  margin-top: var(--s4); border: 0; cursor: pointer;
  border-radius: var(--r); background: var(--grad); color: #fff;
  font: 700 16px Inter, sans-serif; letter-spacing: .2px;
  box-shadow: 0 6px 20px rgba(200,81,81,.28);
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.btn:active { box-shadow: 0 2px 10px rgba(200,81,81,.22); }
.btn:active { transform: scale(.97); }

.acts { display: flex; gap: var(--s2); margin-top: var(--s3); }
.mini {
  flex: 1; min-height: 34px; border-radius: var(--r-sm); cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text-2);
  font: 500 12.5px Inter, sans-serif;
  transition: transform var(--fast) var(--ease);
}
.mini:active { transform: scale(.95); }
.mini.ok { background: var(--up-dim); border-color: rgba(63,185,132,.35); color: var(--up); }
.mini.danger { background: var(--down-dim); border-color: rgba(224,85,99,.32); color: var(--down); }

.card.no-tap { cursor: default; }
.card.no-tap:active { transform: none; }
.req-msg {
  font-size: 12.5px; line-height: 1.6; color: var(--text-2);
  background: var(--surface-2); border-radius: var(--r-sm);
  padding: var(--s3); margin-top: var(--s2);
}

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: var(--s3) var(--s4);
  font-size: 13.5px; margin-bottom: var(--s3);
}
.switch {
  width: 46px; height: 27px; border-radius: 99px; cursor: pointer;
  background: var(--surface-3); border: 1px solid var(--border-2);
  position: relative; transition: background var(--fast) var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 2px; inset-inline-start: 2px;
  width: 21px; height: 21px; border-radius: 50%; background: var(--muted);
  transition: transform var(--mid) var(--ease), background var(--fast) var(--ease);
}
.switch.on { background: var(--brand); border-color: var(--brand); }
.switch.on::after { background: #fff; transform: translateX(-19px); }
[dir="ltr"] .switch.on::after { transform: translateX(19px); }

/* ═══ حاسبة المبلغ ═══ */
.calc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: var(--s4); }
.calc label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.calc-in { display: flex; align-items: center; gap: var(--s2); }
.calc-in span { font-size: 18px; font-weight: 600; color: var(--muted); }
.calc-in input { flex: 1; }
.calc-out { margin-top: var(--s3); }
.calc-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0; font-size: 13px; border-bottom: 1px solid var(--border);
  animation: rise 300ms var(--ease) backwards;
}
.calc-row:last-child { border-bottom: 0; }
.calc-row span { color: var(--muted); }
.calc-row b { font-variant-numeric: tabular-nums; font-weight: 600; }
.calc-row.up b { color: var(--up); }
.calc-row.down b { color: var(--down); }

/* ═══ اللغة ═══ */
.lang { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.lang-btn {
  min-height: 44px; border-radius: var(--r-sm); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  font: 500 14px Inter, sans-serif;
  transition: all var(--fast) var(--ease);
}
.lang-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.lang-btn:active { transform: scale(.96); }

@media (prefers-reduced-motion: reduce) {
  .locked-logo, .orb.up { animation: none !important; }
}

/* اليوزر والمعرّف */
.uname { color: var(--brand-lt); font-weight: 500; }
.mono { font-family: ui-monospace, monospace; font-size: 11px; }

/* ═══ ورقة الشرح المنزلقة ═══ */
.sheet { position: fixed; inset: 0; z-index: 70; }
.sheet-bg {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.74);
  backdrop-filter: blur(6px) saturate(70%);
  -webkit-backdrop-filter: blur(6px) saturate(70%);
  opacity: 0; transition: opacity 320ms var(--ease);
}
.sheet.on .sheet-bg { opacity: 1; }
.sheet-body {
  position: absolute; inset-inline: 0; bottom: 0;
  background: var(--surface-2); border-top: 1px solid var(--border-2);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -14px 44px rgba(0,0,0,.55);
  padding: var(--s3) var(--s4) calc(var(--s5) + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform 340ms var(--ease);
  max-height: 78vh; overflow-y: auto;
}
.sheet.on .sheet-body { transform: translateY(0); }
.sheet-grip {
  width: 38px; height: 4px; border-radius: 99px;
  background: var(--border-2); margin: 0 auto var(--s4);
}
.sheet-body h3 { font-size: 17px; font-weight: 700; margin-bottom: var(--s3); color: var(--brand-lt); }
.sheet-body p { font-size: 14px; line-height: 1.75; color: var(--text-2); margin-bottom: var(--s3); }
.sheet-why {
  background: var(--surface); border-inline-start: 2px solid var(--brand);
  border-radius: var(--r-sm); padding: var(--s3);
  color: var(--text) !important;
}

/* زر الشرح جنب كل مقياس */
.info-btn {
  width: 20px; height: 20px; margin-inline-start: auto; flex: none;
  display: grid; place-items: center; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 50%; color: var(--muted);
  transition: all var(--fast) var(--ease);
}
.info-btn:active { transform: scale(.85); color: var(--brand-lt); border-color: var(--brand); }
.ic-xs { width: 11px; height: 11px; stroke-width: 2.4; }
.metric-h { align-items: center; }

/* ═══ وسم التحضير ═══ */
.watch-note {
  display: flex; align-items: flex-start; gap: var(--s2);
  background: var(--surface); border: 1px dashed var(--border-2);
  border-radius: var(--r); padding: var(--s3) var(--s4); margin-top: var(--s2);
  font-size: 12px; line-height: 1.6; color: var(--muted);
}
.watch-note .ic { color: var(--brand-lt); flex: none; margin-top: 1px; }

/* ═══ مبالغ سريعة ═══ */
.quick { display: flex; gap: 6px; margin-top: var(--s2); flex-wrap: wrap; }
.qbtn {
  flex: 1; min-width: 52px; min-height: 34px; cursor: pointer;
  border-radius: var(--r-sm); background: var(--surface-2);
  border: 1px solid var(--border-2); color: var(--text-2);
  font: 600 13px Inter, sans-serif;
  font-variant-numeric: tabular-nums;
  transition: all var(--fast) var(--ease);
}
.qbtn:active { transform: scale(.92); background: var(--brand); border-color: var(--brand); color: #fff; }

/* ═══ تلميح في الحالة الفاضية ═══ */
.hint {
  display: block; margin-top: 8px; font-size: 11.5px;
  line-height: 1.65; color: var(--muted); opacity: .85;
}

/* الشارة النشطة تنبض — تفرّق بين نظام حيّ ونظام صامت */
.badge.live {
  background: var(--up-dim); color: var(--up);
  border: 1px solid rgba(63,185,132,.35);
  animation: pulseLive 2.6s ease-in-out infinite;
}
@keyframes pulseLive {
  0%,100% { box-shadow: 0 0 0 0 rgba(63,185,132,.34); }
  50%     { box-shadow: 0 0 0 5px rgba(63,185,132,0); }
}
.clock span { white-space: nowrap; }

/* سهم الصف يشير للأمام */
.row .chev { margin-inline-start: auto; color: var(--muted); transform: scaleX(-1); }
[dir="ltr"] .row .chev { transform: none; }

/* درجات الإشعار */
.tier-exceptional { border-color: rgba(224,85,99,.42); }
.tier-exceptional .card-sym .ic { color: var(--down); }
.tier-strong { border-color: rgba(63,185,132,.32); }
.tier-strong .card-sym .ic { color: var(--up); }
.tier-normal .card-sym .ic { color: var(--muted); }
.card-sym .ic { width: 17px; height: 17px; }

/* ملاحظة تحت عنوان المجموعة */
.sub-note {
  font-size: 12px; line-height: 1.6; color: var(--muted);
  margin: 0 var(--s1) var(--s3);
}

/* ═══ خيارات الورقة السفلية ═══ */
.opts { display: flex; flex-direction: column; gap: 2px; margin-top: var(--s2); }
.opt {
  display: flex; align-items: center; gap: var(--s3);
  width: 100%; min-height: 56px; padding: var(--s3) var(--s4);
  background: none; border: 0; border-radius: var(--r);
  color: var(--text); font-family: inherit; text-align: start; cursor: pointer;
  transition: background 200ms var(--ease), transform 160ms var(--ease);
}
.opt:active { transform: scale(.98); background: var(--surface-2); }
.opt.on { background: var(--brand-a14); color: var(--brand-lt); }
.opt > .ic { width: 19px; height: 19px; flex: none; }
.opt-txt { flex: 1; min-width: 0; }
.opt-txt b { display: block; font-size: 15px; font-weight: 600; }
.opt-txt span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.opt-check { width: 19px; height: 19px; flex: none; color: var(--brand-lt); }
.sheet-body .opts + * { margin-top: var(--s3); }

/* ═══ البحث ═══ */
.search-body { max-height: 88vh; }
.search-bar {
  display: flex; align-items: center; gap: var(--s2);
  padding: 0 var(--s3); margin-bottom: var(--s3);
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r); min-height: 50px;
}
.search-bar .ic { width: 18px; height: 18px; color: var(--muted); flex: none; }
.search-bar input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none;
  color: var(--text); font: 500 16px Inter, sans-serif;
}
.search-x {
  background: none; border: 0; cursor: pointer; color: var(--muted);
  display: grid; place-items: center; padding: 4px;
}
.search-results { max-height: 62vh; overflow-y: auto; }
.sres {
  display: flex; align-items: center; gap: var(--s3);
  width: 100%; min-height: 58px; padding: var(--s2) var(--s3);
  background: none; border: 0; border-bottom: 1px solid var(--border);
  color: var(--text); cursor: pointer; text-align: start;
}
.sres:active { background: var(--surface-2); }
.sres-sym { font: 700 15px Inter, sans-serif; flex: none; min-width: 62px; }
.sres-name {
  flex: 1; min-width: 0; font-size: 11.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sres-side { flex: none; text-align: end; font: 600 13px Inter, sans-serif; }
.sres-side span { display: block; font-size: 10.5px; color: var(--muted); font-weight: 400; }
.sres-tag {
  flex: none; font-size: 10px; padding: 2px 7px; border-radius: 99px;
  background: var(--brand-a14); color: var(--brand-lt);
}

/* ═══ الشارت ═══ */
.chart-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s3); margin-bottom: var(--s2);
}
.chart-head b { font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.chart-price { margin-inline-start: var(--s2); font: 700 17px Inter, sans-serif; }
.chart-price.up { color: var(--up); } .chart-price.down { color: var(--down); }
.chart-meta { font-size: 11px; color: var(--muted); }
.tfs {
  display: flex; gap: 5px; overflow-x: auto; padding-bottom: var(--s2);
  scrollbar-width: none;
}
.tfs::-webkit-scrollbar { display: none; }
.tf {
  flex: none; min-height: 32px; padding: 0 12px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font: 600 12px Inter, sans-serif; cursor: pointer;
  transition: all 200ms var(--ease);
}
.tf.on { background: var(--brand-a14); border-color: var(--brand); color: var(--brand-lt); }
.tf:active { transform: scale(.94); }
.chart-canvas {
  width: 100%; height: 58vh; min-height: 300px; display: block;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); touch-action: pan-y;
}
.chart-note { font-size: 11px; color: var(--muted); margin-top: var(--s2); text-align: center; }

/* ═══ مصدر كل هدف ═══ */
.basis {
  margin-top: var(--s2); padding: var(--s3);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.basis-row {
  display: flex; gap: var(--s2); align-items: baseline;
  font-size: 11.5px; line-height: 1.7;
}
.basis-row span { color: var(--muted); flex: none; min-width: 54px; }
.basis-row b { color: var(--text-2); font-weight: 500; }
