/* =========================================================
   RadKa — شروحات ربط القنوات (علامة "؟" + نافذة الشرح + محرر الأدمن)
   يُحمَّل بعد style.css ويستعمل نفس المتغيرات (الأسطح، الخطوط، الألوان).
   ========================================================= */

/* ---------------------------------------------------------
   زر "؟" الدائري فوق بطاقة كل قناة
   --------------------------------------------------------- */
.guide-help {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  z-index: 4;
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 17px;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-2);
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.18s var(--ease);
}
.guide-help i { pointer-events: none; line-height: 1; }
/* نبضة هادئة تلفت النظر حتى يفتح المستخدم أي شرح لأول مرة */
.guide-help::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px solid var(--ch, var(--glint));
  opacity: 0;
  pointer-events: none;
  animation: guidePulse 2.8s ease-out infinite;
}
body.guide-seen .guide-help::after { display: none; }
@keyframes guidePulse {
  0% { opacity: 0.6; transform: scale(0.8); }
  70%, 100% { opacity: 0; transform: scale(1.4); }
}
@media (hover: hover) {
  .guide-help:hover {
    color: var(--ch, var(--glint));
    border-color: var(--ch-line, var(--line-2));
    background: var(--ch-soft, var(--glint-soft));
    transform: scale(1.1);
  }
}
.guide-help:active { transform: scale(0.92); }
.guide-help:focus-visible { outline: 2px solid var(--ch, var(--glint)); outline-offset: 3px; border-radius: 50%; }
/* القناة المغلقة تُعتَّم كلها، لكن الشرح يبقى واضحًا وقابلًا للنقر */
.channel-card.channel-closed > .guide-help { filter: none; opacity: 1; }
.channel-card > .guide-help { grid-column: auto; grid-row: auto; }

/* ---------------------------------------------------------
   نافذة الشرح — سوداء مخففة، بلمسة لون القناة
   --------------------------------------------------------- */
.guide-backdrop { background: rgba(4, 5, 8, 0.8); }

.guide-modal {
  --g: var(--glint);
  --g-soft: rgba(147, 167, 242, 0.14);
  --g-line: rgba(147, 167, 242, 0.32);
  --g-rgb: 147, 167, 242;
  max-width: 620px;
  padding: 0;
  overflow-x: hidden;
  border-radius: 24px;
  border: 1px solid rgba(190, 204, 255, 0.14);
  background:
    radial-gradient(560px 230px at 50% -50px, rgba(var(--g-rgb), 0.17), transparent 72%),
    linear-gradient(180deg, #12151c 0%, #0e1117 100%);
  box-shadow: 0 44px 100px -34px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(0, 0, 0, 0.45);
}
.guide-modal.g-wa        { --g: #57e58f; --g-soft: rgba(87, 229, 143, 0.12);  --g-line: rgba(87, 229, 143, 0.32);  --g-rgb: 87, 229, 143; }
.guide-modal.g-messenger { --g: #66b0ff; --g-soft: rgba(102, 176, 255, 0.12); --g-line: rgba(102, 176, 255, 0.32); --g-rgb: 102, 176, 255; }
.guide-modal.g-instagram { --g: #ff86b0; --g-soft: rgba(255, 134, 176, 0.12); --g-line: rgba(255, 134, 176, 0.32); --g-rgb: 255, 134, 176; }
.guide-modal.g-telegram  { --g: #62cdf5; --g-soft: rgba(98, 205, 245, 0.12);  --g-line: rgba(98, 205, 245, 0.32);  --g-rgb: 98, 205, 245; }
.guide-modal.g-tiktok    { --g: #dfe6f5; --g-soft: rgba(223, 230, 245, 0.09); --g-line: rgba(223, 230, 245, 0.28); --g-rgb: 223, 230, 245; }

.guide-modal .modal-close {
  position: absolute;
  top: 16px;
  inset-inline-end: 16px;
  z-index: 6;
  background: rgba(255, 255, 255, 0.05);
}

/* دخول متتابع للأقسام */
.g-anim { animation: gUp 0.55s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes gUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.g-hero { display: flex; align-items: center; gap: 14px; padding: 24px 24px 6px 64px; }
.g-ic {
  flex: none;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  font-size: 28px;
  color: var(--g);
  background: var(--g-soft);
  border: 1px solid var(--g-line);
  box-shadow: 0 0 34px -8px rgba(var(--g-rgb), 0.55);
}
.g-eyebrow { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; color: var(--g); margin-bottom: 2px; }
.g-title { font-size: 21px; font-weight: 700; line-height: 1.4; }
.g-intro { padding: 10px 24px 16px; font-size: 14px; line-height: 1.9; color: var(--text-2); }

/* إطار الصورة المتحركة */
.g-media {
  margin: 0 24px 6px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  background: #0a0c10;
  box-shadow: 0 22px 54px -28px rgba(0, 0, 0, 0.95);
}
.g-media-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 10px 0 12px;
  background: rgba(255, 255, 255, 0.035);
  border-bottom: 1px solid var(--line);
}
.g-dots { display: flex; gap: 5px; flex: none; }
.g-dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(190, 204, 255, 0.18); }
.g-media-title { flex: 1; min-width: 0; font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-live { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-2); }
.g-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--g); box-shadow: 0 0 0 3px rgba(var(--g-rgb), 0.18); animation: blink 1.6s infinite; }
.g-replay {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.g-replay i { font-size: 14px; transition: transform 0.45s var(--ease); }
.g-replay:hover { color: var(--g); border-color: var(--g-line); background: var(--g-soft); }
.g-replay:hover i { transform: rotate(-180deg); }
.g-stage { position: relative; aspect-ratio: 16 / 10; background: #0b0d11; }
.g-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 0.45s ease; }
.g-stage.loaded img { opacity: 1; }
.g-skel {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, #0f1218 30%, #181c26 46%, #0f1218 62%);
  background-size: 220% 100%;
  animation: gShimmer 1.4s linear infinite;
}
@keyframes gShimmer { from { background-position: 120% 0; } to { background-position: -100% 0; } }
.g-stage.loaded .g-skel, .g-stage.failed .g-skel { display: none; }
.g-fail { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text-3); font-size: 13px; text-align: center; padding: 16px; }
.g-fail i { font-size: 34px; color: var(--g); opacity: 0.8; }
.g-stage.failed .g-fail { display: flex; }
.g-stage.nomedia .g-skel { display: none; }

/* الخطوات التفاعلية */
.g-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 20px 24px 10px; }
.g-sec-head h4 { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.g-sec-head h4 i { color: var(--g); font-size: 18px; }
.g-count { direction: ltr; unicode-bidi: isolate; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; padding: 3px 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.g-tip { margin: -2px 24px 10px; font-size: 11.5px; color: var(--text-3); }
.g-bar { height: 3px; margin: 0 24px 10px; border-radius: 3px; background: rgba(190, 204, 255, 0.1); overflow: hidden; }
.g-bar i { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--g), #fff); transition: width 0.5s var(--ease); }
.g-steps { list-style: none; margin: 0; padding: 0 16px; display: flex; flex-direction: column; gap: 4px; }
.g-step {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 10px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.8;
  text-align: right;
  transition: background 0.2s, border-color 0.2s;
}
@media (hover: hover) { .g-step:hover { background: rgba(255, 255, 255, 0.035); border-color: var(--line); } }
.g-step:focus-visible { outline: 2px solid var(--g); outline-offset: 1px; }
.g-num {
  flex: none;
  width: 28px;
  height: 28px;
  margin-top: 1px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  color: var(--g);
  background: var(--g-soft);
  border: 1px solid var(--g-line);
  transition: background 0.25s, color 0.25s, transform 0.3s var(--ease);
}
.g-num i { display: none; font-size: 15px; }
.g-step.done .g-num { background: var(--g); color: #0c0e12; border-color: var(--g); transform: scale(1.08); }
.g-step.done .g-num b { display: none; }
.g-step.done .g-num i { display: block; animation: gPop 0.35s var(--ease); }
@keyframes gPop { from { transform: scale(0.3); } to { transform: scale(1); } }
.g-txt { flex: 1; min-width: 0; overflow-wrap: anywhere; transition: color 0.2s; }
.g-step.done .g-txt { color: var(--text-3); text-decoration: line-through; text-decoration-color: rgba(190, 204, 255, 0.28); }

.g-note {
  display: flex;
  gap: 10px;
  margin: 14px 24px 0;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.85;
  color: #e8d5a6;
  background: var(--wait-soft);
  border: 1px solid rgba(235, 187, 98, 0.22);
}
.g-note i { flex: none; margin-top: 3px; font-size: 18px; color: var(--wait); }

/* الروابط الخارجية */
.g-links { padding: 0 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.g-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  transition: transform 0.18s var(--ease), border-color 0.2s, background 0.2s;
}
.g-link:hover { transform: translateY(-2px); border-color: var(--g-line); background: var(--g-soft); }
.g-link:focus-visible { outline: 2px solid var(--g); outline-offset: 2px; }
.g-link .l-ic { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; font-size: 18px; color: var(--g); background: var(--g-soft); border: 1px solid var(--g-line); }
.g-link .l-tx { flex: 1; min-width: 0; }
.g-link b { display: block; font-size: 13px; font-weight: 600; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-link small { display: block; font-size: 11px; color: var(--text-3); direction: ltr; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-link .l-go { flex: none; font-size: 16px; color: var(--text-3); transition: transform 0.2s var(--ease), color 0.2s; }
.g-link:hover .l-go { color: var(--g); transform: translate(-3px, -3px); }

.g-foot { display: flex; gap: 10px; margin-top: 22px; padding: 16px 24px calc(22px + var(--safe-b)); border-top: 1px solid var(--line); background: rgba(0, 0, 0, 0.2); }
.g-foot .btn { flex: 1; }
.g-foot .btn.glow { animation: gGlow 1.8s ease-in-out infinite; }
@keyframes gGlow { 0%, 100% { box-shadow: 0 10px 30px -14px rgba(195, 207, 245, 0.55); } 50% { box-shadow: 0 0 0 5px rgba(var(--g-rgb), 0.22), 0 10px 34px -10px rgba(var(--g-rgb), 0.7); } }
.g-done-msg { display: none; align-items: center; gap: 8px; margin: 12px 24px 0; font-size: 13px; font-weight: 600; color: var(--ok); }
.g-done-msg.show { display: flex; animation: gUp 0.4s var(--ease) both; }

/* ---------------------------------------------------------
   محرر الأدمن (تبويب "شروحات الربط")
   --------------------------------------------------------- */
.gadm-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.gadm-tab {
  --c: var(--glint);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.12s;
}
.gadm-tab i.ti { font-size: 19px; }
.gadm-tab[data-ch="wa"] { --c: #57e58f; }
.gadm-tab[data-ch="messenger"] { --c: #66b0ff; }
.gadm-tab[data-ch="instagram"] { --c: #ff86b0; }
.gadm-tab[data-ch="telegram"] { --c: #62cdf5; }
.gadm-tab[data-ch="tiktok"] { --c: #dfe6f5; }
.gadm-tab:active { transform: scale(0.97); }
@media (hover: hover) { .gadm-tab:hover { color: var(--text); border-color: var(--line-2); } }
.gadm-tab.active { color: var(--c); border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, var(--surface)); font-weight: 600; }
.gadm-tab .cust { width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent); }

.gadm-warn { display: flex; gap: 10px; margin-bottom: 16px; padding: 12px 14px; border-radius: 14px; font-size: 13px; line-height: 1.8; color: #f0cfcb; background: var(--bad-soft); border: 1px solid rgba(255, 127, 118, 0.28); }
.gadm-warn i { flex: none; margin-top: 3px; color: var(--bad); font-size: 18px; }
.gadm-warn code { direction: ltr; unicode-bidi: isolate; font-family: var(--font-mono); font-size: 12px; padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.3); }

.gadm-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.gadm-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.gadm-grid .field { margin-bottom: 0; }
.gadm-hint { margin-top: 6px; font-size: 11.5px; color: var(--text-3); line-height: 1.7; }
.gadm-counter { direction: ltr; unicode-bidi: isolate; float: inline-end; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.gadm-links { display: flex; flex-direction: column; gap: 10px; }
.gadm-link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.gadm-link-row .inp-stack { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.gadm-link-row input { width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 400 13.5px/1.5 var(--font-body); }
.gadm-link-row input:focus { outline: none; border-color: var(--glint-2); box-shadow: 0 0 0 3px var(--glint-soft); }
.gadm-link-row input.ltr { direction: ltr; text-align: left; }
.gadm-link-row input.err { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.gadm-link-row .rm { align-self: start; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; font-size: 17px; color: var(--bad); background: var(--bad-soft); border: 1px solid rgba(255, 127, 118, 0.25); padding: 0; }

.gadm-gif { padding: 12px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.gadm-gif-prev { position: relative; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; background: #0b0d11; border: 1px solid var(--line); }
.gadm-gif-prev img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.gadm-gif-prev .badge-src { position: absolute; top: 8px; inset-inline-start: 8px; font-size: 11px; padding: 3px 9px; border-radius: 99px; background: rgba(8, 9, 12, 0.78); border: 1px solid var(--line-2); color: var(--text-2); }
.gadm-gif-prev .busy { position: absolute; inset: 0; display: none; place-items: center; background: rgba(8, 9, 12, 0.7); color: var(--text); font-size: 13px; gap: 8px; }
.gadm-gif-prev.uploading .busy { display: grid; }
.gadm-gif .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.gadm-gif .row .btn { flex: 1 1 auto; }
.gadm-gif input.ltr { direction: ltr; text-align: left; margin-top: 10px; }

.gadm-foot { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.gadm-foot .sp { flex: 1; }
.gadm-meta { font-size: 12px; color: var(--text-3); align-self: center; }

/* ---------------------------------------------------------
   الهاتف
   --------------------------------------------------------- */
@media (max-width: 960px) {
  .gadm-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .guide-modal { border-radius: 24px 24px 0 0; }
  .g-hero { padding: 6px 18px 4px 58px; }
  .g-ic { width: 46px; height: 46px; font-size: 24px; border-radius: 14px; }
  .g-title { font-size: 18px; }
  .g-intro { padding: 8px 18px 14px; font-size: 13.5px; }
  .g-media { margin-inline: 18px; border-radius: 14px; }
  .g-media-title { display: none; }
  .g-media-bar { padding-inline-end: 8px; }
  .g-live { flex: 1; }
  .g-sec-head { padding: 18px 18px 8px; }
  .g-tip { margin-inline: 18px; }
  .g-bar { margin-inline: 18px; }
  .g-steps { padding: 0 8px; }
  .g-note, .g-done-msg { margin-inline: 18px; }
  .g-links { padding: 0 18px; grid-template-columns: 1fr; }
  .g-foot { padding: 14px 18px calc(18px + var(--safe-b)); }
  .guide-modal .modal-close { top: 18px; inset-inline-end: 14px; }
  .gadm-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .gadm-tabs::-webkit-scrollbar { display: none; }
  .gadm-tab { flex: none; }
  .gadm-foot .btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .g-anim, .guide-help::after, .g-foot .btn.glow, .g-live::before, .g-skel { animation: none !important; }
  .g-step.done .g-num i { animation: none; }
}
