/* ============================================================================
   رادیکال‌گرام v6.10 — «برنامک‌ها» + مرورگر داخلی + برند گرادیانی
   این فایل هم در برنامه‌ی کاربران (index.html) و هم در پنل مدیریت (admin/) بار می‌شود.
   ============================================================================ */

/* ---------------------------------------------------------------------------
   ۱) برند «رادیکال‌گرام» — فونت مدرن + گرادیان متحرک (نوار بالای صفحه‌ی اصلی)
   --------------------------------------------------------------------------- */
html.m-shell .m-head-name {
  display: inline-block;
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -.2px;
  background: linear-gradient(100deg, #38bdf8 0%, #3390ec 22%, #7c3aed 45%, #e052a9 68%, #f59e0b 86%, #38bdf8 100%);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: rg-brand-flow 8s linear infinite;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .08));
}
@keyframes rg-brand-flow { to { background-position: 260% center; } }

/* همچنین در بالای صفحه‌ی ورود */
.au-brand b, .au-mark + div b {
  background: linear-gradient(100deg, #38bdf8, #7c3aed 40%, #e052a9 70%, #f59e0b);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: rg-brand-flow 7s linear infinite;
}

/* ---------------------------------------------------------------------------
   ۲) صفحه‌ی «برنامک‌ها» — نمای برنامه‌گونه، تمام‌ریسپانسیو
   --------------------------------------------------------------------------- */
.rg-apps {
  --rg-c1: #3390ec;
  --rg-c2: #7c3aed;
  --rg-card: var(--glass, var(--bg-3, rgba(255, 255, 255, .96)));
  --rg-card-2: var(--glass-2, var(--bg-4, #ffffff));
  --rg-line: var(--border-2, rgba(127, 127, 127, .22));
  --rg-ink: var(--text, #101010);
  --rg-ink-2: var(--text-2, #5a5f6a);
  --rg-ink-3: var(--text-3, #9aa0aa);
  --rg-soft: rgba(127, 127, 160, .12);
  width: 100%;
  min-height: 100%;
  box-sizing: border-box;
  color: var(--rg-ink);
}
.rg-apps * { box-sizing: border-box; }
.rg-apps .rg-hide { display: none !important; }

/* -- پس‌زمینه‌ی کل صفحه -- */
.rg-apps { background: var(--rg-page-bg, var(--bg, #eef1f6)); }
.rg-apps {
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(51, 144, 236, .14), transparent 60%),
    radial-gradient(900px 480px at 105% 0%, rgba(124, 58, 237, .16), transparent 55%),
    var(--rg-page-bg, var(--bg, #eef1f6));
}
.rg-apps[data-c1a] { background: var(--rg-c1bg, none), var(--rg-page-bg, var(--bg, #eef1f6)); }

/* هدر گرادیانی */
.rg-hero {
  position: relative;
  overflow: hidden;
  padding: calc(14px + var(--safe-top, 0px)) 20px 22px;
  text-align: center;
  color: #fff;
  background: linear-gradient(135deg, var(--rg-c1) 0%, var(--rg-c1) 42%, var(--rg-c2) 100%);
}
.rg-hero::before {
  content: "";
  position: absolute;
  inset: -60% -20% auto;
  height: 150%;
  background: radial-gradient(60% 50% at 78% 0%, rgba(255, 255, 255, .34), transparent 62%);
  pointer-events: none;
}
.rg-hero::after {
  content: "";
  position: absolute;
  inset: auto -10% -70%;
  height: 120%;
  background: radial-gradient(55% 55% at 15% 100%, rgba(255, 255, 255, .22), transparent 60%);
  pointer-events: none;
}
.rg-hero > * { position: relative; z-index: 1; }
.rg-hero .rg-hero-logo {
  width: 76px;
  height: 76px;
  margin: 2px auto 12px;
  border-radius: 22px;
  object-fit: cover;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .28), inset 0 0 0 2px rgba(255, 255, 255, .35);
}
.rg-hero .rg-hero-logo.emoji {
  display: grid;
  place-items: center;
  font-size: 40px;
  background: rgba(255, 255, 255, .22);
  backdrop-filter: blur(6px);
}
.rg-hero .rg-hero-logo.emoji img.em { width: 46px; height: 46px; }
.rg-hero h1 {
  margin: 0;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -.4px;
  line-height: 1.35;
  word-break: break-word;
}
.rg-hero .rg-hero-tag {
  display: block;
  margin-top: 7px;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(255, 255, 255, .9);
  white-space: pre-line;
  max-width: 560px;
  margin-inline: auto;
}
.rg-hero .rg-hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 7px 16px;
  border-radius: 99px;
  background: rgba(0, 0, 0, .22);
  backdrop-filter: blur(8px);
  font-size: 12.5px;
  font-weight: 500;
}
.rg-hero .rg-hero-chip svg { width: 15px; height: 15px; }

/* -- چیدمان بلوک‌ها -- */
.rg-blocks {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 620px;
  margin: -6px auto 0;
  padding: 18px 16px calc(40px + env(safe-area-inset-bottom, 0px));
}
.rg-block { min-width: 0; }

/* ---------- عنوان ---------- */
.rg-tblock { text-align: center; padding: 6px 8px 2px; }
.rg-tblock.align-right { text-align: right; }
.rg-tblock.align-left { text-align: left; }
.rg-tblock .eyebrow {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 4px 12px;
  border-radius: 99px;
  color: var(--rg-c1);
  background: var(--rg-c1a-13, rgba(51,144,236,.13));
  margin-bottom: 8px;
}
.rg-tblock h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.5;
  color: var(--rg-ink);
  word-break: break-word;
}
.rg-tblock .sub {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--rg-ink-2);
  line-height: 1.8;
  white-space: pre-line;
  word-break: break-word;
}

/* ---------- پاراگراف ---------- */
.rg-pblock {
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--rg-card);
  border: 1px solid var(--rg-line);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .05);
}
.rg-pblock p {
  margin: 0;
  font-size: 14.5px;
  line-height: 2.05;
  color: var(--rg-ink-2);
  white-space: pre-line;
  word-break: break-word;
}

/* ---------- تصویر ---------- */
.rg-imblock { padding: 0; border-radius: 20px; overflow: hidden; background: var(--rg-card); border: 1px solid var(--rg-line); box-shadow: 0 6px 22px rgba(0, 0, 0, .07); }
.rg-imblock img { display: block; width: 100%; max-height: 460px; object-fit: cover; }
.rg-imblock .cap {
  display: block;
  padding: 11px 16px 13px;
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--rg-ink-2);
  text-align: center;
  white-space: pre-line;
}
.rg-imblock.openable img { cursor: pointer; }
.rg-imblock .rg-ghost {
  display: grid;
  place-items: center;
  min-height: 120px;
  color: var(--rg-ink-3);
  background:
    repeating-linear-gradient(45deg, transparent, transparent 12px, rgba(128,128,128,.05) 12px, rgba(128,128,128,.05) 24px),
    var(--rg-soft);
}
.rg-imblock .rg-ghost svg { width: 34px; height: 34px; opacity: .7; }

/* ---------- اسلایدر ---------- */
.rg-slider-wrap { position: relative; border-radius: 20px; overflow: hidden; }
.rg-slider {
  direction: ltr;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-radius: 20px;
}
.rg-slider::-webkit-scrollbar { display: none; }
.rg-slider .slide {
  position: relative;
  flex: 0 0 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  min-height: 170px;
  max-height: 460px;
}
.rg-slider .slide img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 170px;
  max-height: 460px;
  object-fit: cover;
}
.rg-slider .slide .shade {
  position: absolute;
  inset: auto 0 0 0;
  height: 45%;
  background: linear-gradient(transparent, rgba(0, 0, 0, .65));
  pointer-events: none;
}
.rg-slider .slide .scap {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 26px 16px 14px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .35);
  white-space: pre-line;
}
.rg-slider .slide.empty {
  display: grid;
  place-items: center;
  min-height: 150px;
  background: var(--rg-soft);
  color: var(--rg-ink-3);
  font-size: 13px;
}
.rg-snav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .42);
  backdrop-filter: blur(6px);
  color: #fff;
  transition: opacity .18s, background .18s;
}
.rg-snav:active { background: rgba(0, 0, 0, .6); }
.rg-snav svg { width: 18px; height: 18px; }
.rg-snav.prev { left: 8px; right: auto; }
.rg-snav.next { right: 8px; left: auto; }
.rg-sdots { display: flex; justify-content: center; gap: 5px; padding: 9px 0 2px; }
.rg-sdots i {
  width: 6px; height: 6px; border-radius: 99px;
  background: var(--rg-ink-3);
  opacity: .45;
  transition: width .2s, opacity .2s, background .2s;
}
.rg-sdots i.on { width: 18px; opacity: 1; background: var(--rg-c1); }

/* ---------- دکمه‌ها ---------- */
.rg-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 50px;
  padding: 12px 20px;
  border-radius: 15px;
  border: 1px solid transparent;
  font-size: 15.5px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  transition: transform .12s, filter .2s, box-shadow .2s;
}
.rg-btn svg { width: 19px; height: 19px; flex-shrink: 0; }
.rg-btn:active { transform: scale(.985); filter: brightness(.96); }
.rg-btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .4);
  transform: scale(0);
  animation: rg-rip .5s ease-out forwards;
  pointer-events: none;
}
@keyframes rg-rip { to { transform: scale(4); opacity: 0; } }
.rg-btn.block { border-radius: 0; }
.rg-btns { display: flex; flex-direction: column; gap: 10px; }
.rg-btns .rg-btn { min-height: 48px; }
/* گزینه‌های حالت */
.rg-btn.grad { background: linear-gradient(100deg, var(--c1, var(--rg-c1)), var(--c2, var(--rg-c2))); box-shadow: 0 6px 16px var(--c1a-32, rgba(51,144,236,.32)); }
.rg-btn.solid { background: var(--c1, var(--rg-c1)); box-shadow: 0 6px 14px var(--c1a-26, rgba(51,144,236,.26)); }
.rg-btn.soft { background: rgba(51,144,236,.16); color: var(--c1, var(--rg-c1)); }
.rg-btn.soft { background: var(--c1-16, rgba(51,144,236,.16)); color: var(--c1, var(--rg-c1)); }
.rg-btn.outline { background: transparent; border-color: var(--c1, var(--rg-c1)); color: var(--c1, var(--rg-c1)); }
.rg-btn.glass { background: rgba(255,255,255,.2); color: #fff; border-color: rgba(255,255,255,.45); backdrop-filter: blur(6px); }
/* روی هدر گرادیانی، حالت‌های transparent را خوانا کن */
.rg-hero + .rg-blocks .rg-btn.outline, .rg-hero + .rg-blocks .rg-btn.soft { }
.rg-btn .ext { margin-inline-start: auto; opacity: .75; } .rg-btn .ext svg { width: 17px; height: 17px; }

/* ---------- آیکون‌ها ---------- */
.rg-igrid {
  display: grid;
  grid-template-columns: repeat(var(--rg-cols, 4), 1fr);
  gap: 12px 8px;
  padding: 14px 12px 16px;
  border-radius: 20px;
  background: var(--rg-card);
  border: 1px solid var(--rg-line);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .05);
}
.rg-icell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 0;
  text-align: center;
  cursor: pointer;
  color: var(--rg-ink);
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
}
.rg-icell .tile {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 74px;
  border-radius: 24px;
  background: linear-gradient(140deg, var(--c1, var(--rg-c1)), var(--c2, var(--c1, var(--rg-c1))));
  color: #fff;
  font-size: clamp(22px, 8vw, 30px);
  box-shadow: 0 6px 14px var(--c1a-30, rgba(51,144,236,.3));
}
.rg-icell .tile img { width: 62%; height: 62%; object-fit: contain; }
.rg-icell .tile img.em, .rg-icell .tile img[alt=""] { width: 52%; height: 52%; }
.rg-icell b {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--rg-ink-2);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

/* ---------- جداکننده / فاصله ---------- */
.rg-spacer { height: var(--rg-h, 16px); }
.rg-divider { height: 1px; margin: 2px 22px; background: var(--rg-line); }

/* ---------- صفحه‌ی آماده‌سازی / خالی ---------- */
.rg-empty { padding: 56px 24px 70px; text-align: center; color: var(--rg-ink-2); }
.rg-empty .ill { width: 74px; height: 74px; margin: 0 auto 16px; border-radius: 26px; display: grid; place-items: center; background: linear-gradient(135deg, var(--rg-c1), var(--rg-c2)); color: #fff; box-shadow: 0 10px 26px var(--rg-c1a-36, rgba(51,144,236,.36)); }
.rg-empty .ill svg { width: 38px; height: 38px; }
.rg-empty h3 { margin: 0 0 6px; font-size: 17px; color: var(--rg-ink); }
.rg-empty p { margin: 0; font-size: 13.5px; line-height: 1.9; color: var(--rg-ink-3); }

/* ---------- فوتر صفحه ---------- */
.rg-foot { padding: 4px 16px calc(16px + env(safe-area-inset-bottom, 0px)); text-align: center; font-size: 12px; color: var(--rg-ink-3); }

/* ---------- حالت روی موبایل: تمام‌عرض بدون کارت اضافی ---------- */
html.m-shell .rg-blocks { max-width: 640px; }

/* ---------------------------------------------------------------------------
   ۳) لایه‌ی تمام‌صفحه‌ی «برنامک‌ها» (دسکتاپ / وقتی کاربر از منو باز می‌کند)
   --------------------------------------------------------------------------- */
.rg-apps-root { position: fixed; inset: 0; z-index: 300; display: flex; }
.rg-apps-root .rg-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px); }
.rg-apps-root .rg-shell {
  position: relative;
  width: min(100%, 760px);
  height: 100%;
  margin-inline: auto;
  background: var(--bg, #eef1f6);
  box-shadow: 0 0 60px rgba(0, 0, 0, .35);
  display: flex;
  flex-direction: column;
  animation: rg-pop .22s cubic-bezier(.2, .8, .2, 1);
}
.rg-apps-root.out .rg-shell { animation: rg-fade .16s ease both; }
@keyframes rg-pop { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes rg-fade { to { opacity: 0; transform: translateY(8px); } }
.rg-apps-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(6px + var(--safe-top, 0px)) 8px 6px;
  background: rgba(128,128,128,.12);
  background: var(--rg-topbar-bg, rgba(255,255,255,.8));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-2, rgba(127,127,127,.2));
}
.rg-apps-topbar b { flex: 1; text-align: center; font-size: 15px; font-weight: 700; }
.rg-apps-topbar .btn-icon { width: 40px; height: 40px; }
.rg-apps-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* در موبایل، دکمه‌ی بستنِ لایه نباید در تب ظاهر شود (تب زیرش وجود دارد) */
html.m-shell .rg-apps-topbar { display: none; }

/* ---------------------------------------------------------------------------
   ۴) مرورگر داخلی
   --------------------------------------------------------------------------- */
.rg-brw-root { position: fixed; inset: 0; z-index: 400; background: #101418; display: flex; }
.rg-brw { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #fff; color: #101418; }
html[data-theme="dark"] .rg-brw { background: #0d1117; color: #e6edf3; }
.rg-brw-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: calc(7px + var(--safe-top, 0px)) 10px 7px;
  background: var(--glass, #17212b);
  border-bottom: 1px solid rgba(128,128,128,.18);
}
.rg-brw-bar .bic {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: none; border: 0; color: inherit; cursor: pointer;
}
.rg-brw-bar .bic:hover { background: rgba(128,128,128,.15); }
.rg-brw-bar .bic:disabled { opacity: .35; pointer-events: none; }
.rg-brw-bar .bic svg { width: 21px; height: 21px; }
.rg-brw-addr {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  background: rgba(128,128,128,.14);
  cursor: text;
  font-size: 13.5px;
  direction: ltr;
}
.rg-brw-addr svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .75; }
.rg-brw-addr .lock { color: #4dcd5e; }
.rg-brw-addr span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-brw-urlbar {
  display: none;
  padding: 0 10px 10px;
  gap: 6px;
}
.rg-brw-urlbar.on { display: flex; }
.rg-brw-urlbar .input { direction: ltr; text-align: left; }
.rg-brw-progress { position: relative; height: 2.5px; background: transparent; overflow: hidden; }
.rg-brw-progress i {
  position: absolute; inset: 0; width: 40%;
  background: linear-gradient(90deg, #3390ec, #7c3aed, #e052a9);
  border-radius: 99px;
  animation: rg-brw-load 1s ease-in-out infinite;
  opacity: 0;
  transition: opacity .2s;
}
.rg-brw-progress.on i { opacity: 1; }
@keyframes rg-brw-load { 0% { transform: translateX(-110%); } 100% { transform: translateX(320%); } }
.rg-brw-frame { flex: 1; position: relative; min-height: 0; background: #fff; }
.rg-brw-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.rg-brw-error {
  position: absolute; inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  text-align: center;
  padding: 24px;
  background: #fff;
  color: #30363d;
}
html[data-theme="dark"] .rg-brw-error { background: #0d1117; color: #c9d1d9; }
.rg-brw-error .ill { width: 66px; height: 66px; border-radius: 20px; display: grid; place-items: center; background: #f8514918; color: #f85149; }
.rg-brw-error .ill svg { width: 34px; height: 34px; }
.rg-brw-error b { font-size: 15px; }
.rg-brw-error p { font-size: 13px; max-width: 340px; line-height: 1.8; opacity: .8; }
.rg-brw-frame .tip {
  position: absolute;
  inset-inline: 0;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  margin: 0 auto;
  max-width: 92%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 14px;
  background: rgba(15, 20, 26, .9);
  color: #fff;
  font-size: 12.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  z-index: 2;
}
.rg-brw-frame .tip svg { width: 17px; height: 17px; color: #4dcd5e; flex-shrink: 0; }
.rg-brw-frame .tip .btn { margin-inline-start: auto; }
@media (max-width: 900px) { .rg-brw-frame .tip { font-size: 12px; } }

/* دکمه‌ی انتقال بیرونی در حالت دسکتاپ کوچک مخفی نمی‌شود */
.rg-brw-out { display: grid; }

/* ---------------------------------------------------------------------------
   ۶) تب موبایل (m-page.apps) و هماهنگی‌های ریز
   --------------------------------------------------------------------------- */
html.m-shell .m-page.apps { background: var(--bg, #eef1f6); }
html.m-shell .m-page.apps .rg-apps { min-height: 100%; background: transparent; }
html.m-shell .m-page.apps .rg-blocks { max-width: 640px; }
html.m-shell .m-page.apps .rg-hero { border-radius: 0 0 26px 26px; }
@media (max-width: 900px) {
  /* هدر گرادیانی به لبه‌های پایین گرد شده؛ کنار بدنه */
  html.m-shell .m-page.apps .rg-hero { border-radius: 0 0 22px 22px; }
}
/* پیش‌نمایش پنل مدیریت */
.rg-preview-frame { position: relative; max-width: 430px; margin: 0 auto; border-radius: 30px; background: #0b0d12; padding: 10px; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.rg-preview-frame .rg-notch { width: 116px; height: 6px; border-radius: 99px; background: rgba(255,255,255,.22); margin: 0 auto 10px; }
.rg-preview-frame .rg-view { height: 74vh; min-height: 460px; border-radius: 24px; overflow-y: auto; background: #eef1f6; overscroll-behavior: contain; scrollbar-width: thin; }
.rg-preview-frame .rg-view .rg-apps { border-radius: 24px; }
/* پیش‌نمایش با پالت روشنِ پیش‌فرضِ برنامه رندر می‌شود (مستقل از تم پنل) */
.rg-preview-frame .rg-view {
  --bg: #eef1f6; --bg-2: #eef1f6; --bg-3: #ffffff; --bg-4: #ffffff;
  --glass: #ffffff; --glass-2: #f6f8fa; --glass-3: #e8edf2;
  --border: #e4e8ee; --border-2: #d9e0e8;
  --text: #0f1419; --text-2: #566370; --text-3: #8b98a6;
  --accent: #3390ec;
}
@media (max-width: 560px) {
  .rg-preview-frame .rg-view { height: 66vh; }
}
