/* ============================================================================
   TROF UI 3.0 — نظام التصميم الجديد
   يُحمَّل بعد كل ملفات CSS القديمة فيعيد تلوين كل الصفحات + مكوّنات tx-* الجديدة
   ============================================================================ */
:root, [data-theme="dark"] {
  --c-bg: #07070f;
  --c-bg-alt: #0b0b16;
  --c-surface: rgba(255, 255, 255, .035);
  --c-surface-2: rgba(255, 255, 255, .05);
  --c-surface-3: rgba(255, 255, 255, .08);
  --c-surface-4: rgba(255, 255, 255, .12);
  --c-border: rgba(255, 255, 255, .09);
  --c-border-hi: rgba(255, 255, 255, .18);
  --c-border-lo: rgba(255, 255, 255, .05);
  --c-text: #f4f3fb;
  --c-text-mut: #a7a5c2;
  --c-text-dim: #6c6a88;
  --tx-a: #7c5cff;      /* بنفسجي */
  --tx-b: #22d3ee;      /* سماوي */
  --tx-c: #f2c23c;      /* ذهبي */
  --tx-d: #ff5db1;      /* وردي */
  --tx-radius: 20px;
  --tx-glow: 0 0 0 1px rgba(255,255,255,.06), 0 24px 60px -24px rgba(0,0,0,.8);
}
[data-theme="light"] {
  --c-bg: #f5f4fc; --c-bg-alt: #ecebf8; --c-surface: rgba(255,255,255,.75); --c-surface-2: rgba(255,255,255,.9);
  --c-surface-3: rgba(124,92,255,.08); --c-surface-4: rgba(124,92,255,.14);
  --c-border: rgba(30,20,80,.1); --c-border-hi: rgba(30,20,80,.2); --c-text: #16132b; --c-text-mut: #55527a; --c-text-dim: #8a87ad;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Tajawal', system-ui, sans-serif !important;
  background:
    radial-gradient(60rem 40rem at 85% -10%, rgba(124, 92, 255, .22), transparent 60%),
    radial-gradient(50rem 36rem at 0% 10%, rgba(34, 211, 238, .13), transparent 60%),
    radial-gradient(46rem 34rem at 50% 110%, rgba(242, 194, 60, .10), transparent 60%),
    var(--c-bg) !important;
  background-attachment: fixed !important;
  color: var(--c-text);
}
::selection { background: rgba(124, 92, 255, .45); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.26); background-clip: content-box; border: 2px solid transparent; }

/* ───────── الأزرار ───────── */
.btn { border-radius: 14px !important; font-weight: 800 !important; letter-spacing: .1px; transition: transform .18s, box-shadow .25s, filter .2s !important; }
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--tx-a), #5b8cff 55%, var(--tx-b)) !important;
  color: #fff !important; border: 0 !important;
  box-shadow: 0 10px 30px -10px rgba(124, 92, 255, .8), inset 0 1px 0 rgba(255,255,255,.25) !important;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -10px rgba(124, 92, 255, .95), inset 0 1px 0 rgba(255,255,255,.3) !important; filter: brightness(1.08); }
.btn-secondary, .btn-outline, .btn-ghost { background: var(--c-surface-2) !important; border: 1px solid var(--c-border) !important; color: var(--c-text) !important; }
.btn-secondary:hover, .btn-outline:hover, .btn-ghost:hover { border-color: var(--c-border-hi) !important; background: var(--c-surface-3) !important; transform: translateY(-1px); }
.btn-danger { background: linear-gradient(135deg, #ff4d6d, #d6204a) !important; border: 0 !important; color: #fff !important; }
.btn-success { background: linear-gradient(135deg, #10d98a, #059669) !important; border: 0 !important; color: #04130c !important; }

/* ───────── بطاقات ولوحة ───────── */
.dash-card, .setup-section, .pay-tier, .lb-row {
  background: var(--c-surface) !important;
  border: 1px solid var(--c-border) !important;
  border-radius: var(--tx-radius) !important;
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--tx-glow);
}
.dash-card-header { border-bottom: 1px solid var(--c-border-lo) !important; }
.dash-sidebar { background: rgba(10, 10, 22, .72) !important; backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); border-inline-end: 1px solid var(--c-border) !important; }
.dash-topbar { background: rgba(8, 8, 18, .6) !important; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 1px solid var(--c-border) !important; }
.dash-nav-label { letter-spacing: .12em; font-size: .68rem !important; text-transform: uppercase; color: var(--c-text-dim) !important; }
.dash-nav-item { border-radius: 12px !important; transition: background .2s, transform .2s, color .2s !important; }
.dash-nav-item:hover { background: var(--c-surface-2) !important; transform: translateX(-3px); }
html[dir="ltr"] .dash-nav-item:hover { transform: translateX(3px); }
.dash-nav-item.active {
  background: linear-gradient(135deg, rgba(124,92,255,.28), rgba(34,211,238,.14)) !important;
  color: #fff !important; box-shadow: inset 0 0 0 1px rgba(124,92,255,.5), 0 8px 24px -12px rgba(124,92,255,.7) !important;
}
.dash-sidebar-name { background: linear-gradient(90deg, #fff, var(--tx-c)); -webkit-background-clip: text; background-clip: text; color: transparent !important; font-weight: 900; }
.dash-page-title { font-weight: 900 !important; letter-spacing: -.3px; }
.dash-stat, .dash-quick-action { background: var(--c-surface) !important; border: 1px solid var(--c-border) !important; border-radius: 18px !important; transition: transform .25s, border-color .25s, box-shadow .25s !important; }
.dash-quick-action:hover, .dash-stat:hover { transform: translateY(-4px); border-color: rgba(124,92,255,.55) !important; box-shadow: 0 18px 40px -18px rgba(124,92,255,.65); }
.setup-row input, .setup-row select, .setup-row textarea, .tx-input, .tx-select, .tx-textarea {
  background: rgba(0,0,0,.28) !important; border: 1px solid var(--c-border) !important; color: var(--c-text) !important; border-radius: 12px !important; font-family: inherit;
}
.setup-row input:focus, .setup-row select:focus, .setup-row textarea:focus, .tx-input:focus, .tx-select:focus, .tx-textarea:focus {
  border-color: var(--tx-a) !important; box-shadow: 0 0 0 4px rgba(124,92,255,.2) !important; outline: 0;
}
.tab.active { background: linear-gradient(135deg, var(--tx-a), var(--tx-b)) !important; color: #fff !important; }
.switch-row .switch input:checked + .switch-track { background: var(--tx-a) !important; border-color: var(--tx-a) !important; }
.switch-row .switch input:checked + .switch-track::before { background: #fff !important; }

/* ═════════ مكوّنات tx الجديدة ═════════ */
.tx-wrap { display: grid; gap: 18px; }
.tx-hero { position: relative; overflow: hidden; padding: 28px; border-radius: 26px; border: 1px solid var(--c-border);
  background: linear-gradient(135deg, rgba(124,92,255,.22), rgba(34,211,238,.10) 55%, rgba(242,194,60,.10)); }
.tx-hero::after { content: ''; position: absolute; inset-inline-end: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); }
.tx-hero h1 { margin: 0 0 6px; font-size: clamp(1.4rem, 4vw, 2rem); font-weight: 900; }
.tx-hero p { margin: 0; color: var(--c-text-mut); }
.tx-grid { display: grid; gap: 16px; }
.tx-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tx-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tx-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); gap: 18px; align-items: start; }
.tx-sticky { position: sticky; top: 84px; }
@media (max-width: 960px) { .tx-split { grid-template-columns: 1fr; } .tx-sticky { position: static; } .tx-grid.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .tx-grid.cols-2, .tx-grid.cols-3 { grid-template-columns: 1fr; } }
.tx-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--tx-radius); padding: 18px; backdrop-filter: blur(16px); box-shadow: var(--tx-glow); }
.tx-card h3 { margin: 0 0 12px; font-size: 1rem; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.tx-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.tx-row > label { font-size: .85rem; font-weight: 800; color: var(--c-text); }
.tx-row .hint { font-size: .72rem; color: var(--c-text-mut); }
.tx-input, .tx-select, .tx-textarea { width: 100%; padding: 11px 13px; font-size: .92rem; }
.tx-textarea { min-height: 84px; resize: vertical; }
.tx-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tx-color { display: flex; align-items: center; gap: 10px; }
.tx-color input[type=color] { width: 46px; height: 40px; border: 1px solid var(--c-border); border-radius: 10px; background: transparent; padding: 3px; cursor: pointer; }
.tx-color code { font-family: 'JetBrains Mono', monospace; font-size: .78rem; color: var(--c-text-mut); direction: ltr; }
.tx-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tx-chip { padding: 8px 14px; border-radius: 100px; border: 1px solid var(--c-border); background: var(--c-surface-2); color: var(--c-text); font: 800 .82rem inherit; font-family: inherit; cursor: pointer; transition: .2s; }
.tx-chip:hover { border-color: var(--c-border-hi); transform: translateY(-1px); }
.tx-chip.on { background: linear-gradient(135deg, var(--tx-a), var(--tx-b)); border-color: transparent; color: #fff; box-shadow: 0 8px 22px -10px var(--tx-a); }
.tx-tabs { display: flex; gap: 6px; padding: 5px; background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: 16px; overflow-x: auto; scrollbar-width: none; width: fit-content; max-width: 100%; }
.tx-tabs::-webkit-scrollbar { display: none; }
.tx-tab { padding: 9px 16px; border: 0; background: transparent; color: var(--c-text-mut); border-radius: 12px; font: 800 .88rem inherit; font-family: inherit; cursor: pointer; white-space: nowrap; transition: .2s; }
.tx-tab.on { background: linear-gradient(135deg, var(--tx-a), var(--tx-b)); color: #fff; }
.tx-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.tx-swatch { position: relative; border: 1.5px solid var(--c-border); background: var(--c-surface-2); border-radius: 16px; padding: 10px 8px; cursor: pointer; text-align: center; transition: .2s; font-family: inherit; color: var(--c-text); }
.tx-swatch:hover { transform: translateY(-3px); border-color: var(--c-border-hi); }
.tx-swatch.on { border-color: var(--tx-b); box-shadow: 0 0 0 3px rgba(34,211,238,.22), 0 14px 30px -14px var(--tx-b); }
.tx-swatch .dot { height: 38px; border-radius: 11px; margin-bottom: 7px; }
.tx-swatch .nm { font-size: .72rem; font-weight: 800; line-height: 1.25; display: block; }
.tx-swatch .lock { position: absolute; top: 6px; inset-inline-start: 6px; font-size: .75rem; }
.tx-preview { border-radius: 22px; border: 1px solid var(--c-border); background: rgba(0,0,0,.35); padding: 10px; position: relative; overflow: hidden; min-height: 180px; }
.tx-preview img { width: 100%; height: auto; display: block; border-radius: 14px; }
.tx-preview .busy { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.45); backdrop-filter: blur(3px); font-weight: 800; }
.tx-preview.loading .busy { display: flex; }
.tx-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 100px; font-size: .72rem; font-weight: 900; background: var(--c-surface-3); border: 1px solid var(--c-border); }
.tx-upload { border: 2px dashed var(--c-border-hi); border-radius: 16px; padding: 18px; text-align: center; cursor: pointer; transition: .2s; color: var(--c-text-mut); }
.tx-upload:hover, .tx-upload.drag { border-color: var(--tx-b); background: rgba(34,211,238,.06); color: var(--c-text); }
.tx-upload img { max-width: 100%; max-height: 130px; border-radius: 12px; display: block; margin: 0 auto 8px; }
.tx-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.tx-savebar { position: sticky; bottom: 12px; z-index: 5; display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 16px; border-radius: 18px; border: 1px solid var(--c-border-hi); background: rgba(14,14,28,.82); backdrop-filter: blur(18px); box-shadow: 0 20px 50px -20px #000; }
.tx-savebar .dirty { font-size: .82rem; color: var(--tx-c); font-weight: 800; }
.tx-range { display: flex; align-items: center; gap: 12px; }
.tx-range input { flex: 1; accent-color: var(--tx-a); }
.tx-range output { min-width: 46px; text-align: center; font: 800 .82rem 'JetBrains Mono', monospace; }
.tx-stat { padding: 16px; border-radius: 18px; background: var(--c-surface); border: 1px solid var(--c-border); }
.tx-stat b { display: block; font-size: 1.7rem; font-weight: 900; line-height: 1.1; }
.tx-stat span { font-size: .78rem; color: var(--c-text-mut); }

/* ───────── المتجر (معرض الصور) ───────── */
.tx-shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.tx-item { --rar: #9ca3af; position: relative; border-radius: 22px; overflow: hidden; background: var(--c-surface); border: 1px solid var(--c-border); transition: transform .3s, box-shadow .3s, border-color .3s; display: flex; flex-direction: column; }
.tx-item:hover { transform: translateY(-6px); border-color: var(--rar); box-shadow: 0 22px 50px -22px var(--rar); }
.tx-item[data-rar=rare] { --rar: #38bdf8; } .tx-item[data-rar=epic] { --rar: #a855f7; } .tx-item[data-rar=legendary] { --rar: #f2c23c; } .tx-item[data-rar=mythic] { --rar: #ff5db1; }
.tx-item .media { position: relative; aspect-ratio: 16 / 10; background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.08), rgba(0,0,0,.4)); cursor: zoom-in; overflow: hidden; display: grid; place-items: center; }
.tx-item .media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s; }
.tx-item:hover .media img { transform: scale(1.08); }
.tx-item .media.icon img { width: 62%; height: 78%; object-fit: contain; filter: drop-shadow(0 12px 22px rgba(0,0,0,.6)); }
.tx-item .media .demo { font-size: 1.7rem; font-weight: 900; padding: 0 10px; text-align: center; }
.tx-item .tag { position: absolute; top: 10px; inset-inline-start: 10px; padding: 3px 10px; border-radius: 100px; font-size: .68rem; font-weight: 900; background: rgba(0,0,0,.6); border: 1px solid var(--rar); color: var(--rar); backdrop-filter: blur(6px); }
.tx-item .own { position: absolute; top: 10px; inset-inline-end: 10px; padding: 3px 10px; border-radius: 100px; font-size: .68rem; font-weight: 900; background: rgba(16,217,138,.2); color: #34f5a6; border: 1px solid rgba(16,217,138,.5); }
.tx-item .body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tx-item .nm { font-weight: 900; font-size: 1rem; }
.tx-item .ds { font-size: .78rem; color: var(--c-text-mut); flex: 1; }
.tx-item .price { font-weight: 900; color: var(--tx-c); }
.tx-item .btns { display: flex; gap: 8px; margin-top: 6px; }
.tx-item .btns .btn { flex: 1; padding: 9px 10px; font-size: .82rem; }
.tx-cat-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.tx-cat-bar::-webkit-scrollbar { display: none; }
.tx-lightbox { position: fixed; inset: 0; z-index: 9999; background: rgba(4,4,12,.88); backdrop-filter: blur(10px); display: none; align-items: center; justify-content: center; padding: 20px; }
.tx-lightbox.show { display: flex; animation: txfade .25s; }
.tx-lightbox .box { width: min(960px, 100%); max-height: 92vh; display: grid; gap: 12px; }
.tx-lightbox .big { position: relative; border-radius: 22px; overflow: hidden; background: #000; max-height: 62vh; display: grid; place-items: center; }
.tx-lightbox .big img { width: 100%; max-height: 62vh; object-fit: contain; }
.tx-lightbox .thumbs { display: flex; gap: 8px; overflow-x: auto; justify-content: center; }
.tx-lightbox .thumbs img { width: 84px; height: 56px; object-fit: cover; border-radius: 10px; opacity: .55; cursor: pointer; border: 2px solid transparent; }
.tx-lightbox .thumbs img.on { opacity: 1; border-color: var(--tx-b); }
.tx-lightbox .x { position: absolute; top: 14px; inset-inline-end: 14px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--c-border-hi); background: rgba(0,0,0,.6); color: #fff; font-size: 1.1rem; cursor: pointer; }
@keyframes txfade { from { opacity: 0; transform: scale(.98); } }

/* ───────── Discord mock (معاينة الرسائل) ───────── */
.dc { background: #313338; border-radius: 14px; padding: 14px; color: #dbdee1; font-family: 'gg sans', 'Tajawal', sans-serif; direction: rtl; }
.dc .msg { display: flex; gap: 12px; }
.dc .av { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--tx-a), var(--tx-b)); flex: none; display: grid; place-items: center; font-weight: 900; color: #fff; }
.dc .hd { font-weight: 800; color: #fff; font-size: .95rem; }
.dc .hd .bot { font-size: .62rem; background: #5865f2; color: #fff; border-radius: 4px; padding: 1px 5px; margin-inline-start: 6px; }
.dc .tx { font-size: .92rem; margin: 3px 0 8px; white-space: pre-wrap; word-break: break-word; }
.dc .mention { background: rgba(88,101,242,.3); color: #c9cdfb; border-radius: 4px; padding: 0 3px; }
.dc .emb { border-inline-start: 4px solid #5865f2; background: #2b2d31; border-radius: 6px; padding: 10px 12px; max-width: 460px; display: grid; gap: 6px; }
.dc .emb .t { font-weight: 800; color: #fff; }
.dc .emb .d { font-size: .86rem; white-space: pre-wrap; word-break: break-word; }
.dc .emb .f { font-size: .72rem; color: #949ba4; }
.dc .emb img.im { width: 100%; border-radius: 6px; margin-top: 4px; }
.dc .sel { margin-top: 8px; background: #1e1f22; border: 1px solid #3f4147; border-radius: 6px; padding: 9px 12px; font-size: .85rem; color: #b5bac1; display: flex; justify-content: space-between; max-width: 460px; }
.dc .opts { background: #2b2d31; border-radius: 6px; margin-top: 4px; max-width: 460px; padding: 6px; }
.dc .opts div { padding: 6px 8px; font-size: .82rem; border-radius: 4px; }
.dc .opts div small { display: block; color: #949ba4; }

/* ───────── Toast ───────── */
.tx-toasts { position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 99999; display: grid; gap: 8px; width: min(92vw, 420px); }
html[dir=rtl] .tx-toasts { transform: translateX(50%); inset-inline-start: auto; inset-inline-end: 50%; }
.tx-toast { padding: 13px 16px; border-radius: 14px; background: rgba(16,16,32,.95); border: 1px solid var(--c-border-hi); box-shadow: 0 18px 40px -16px #000; font-weight: 800; animation: txup .3s; display: flex; gap: 10px; align-items: center; }
.tx-toast.ok { border-color: rgba(16,217,138,.6); } .tx-toast.err { border-color: rgba(255,77,109,.6); }
@keyframes txup { from { opacity: 0; transform: translateY(12px); } }

/* ───────── مودال التأكيد ───────── */
.tx-modal { position: fixed; inset: 0; z-index: 9998; background: rgba(4,4,12,.72); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 18px; animation: txfade .2s; }
.tx-modal .m { width: min(460px, 100%); background: #11111f; border: 1px solid var(--c-border-hi); border-radius: 22px; padding: 22px; box-shadow: 0 30px 80px -20px #000; }
.tx-modal h3 { margin: 0 0 8px; font-weight: 900; }
.tx-modal p { margin: 0 0 16px; color: var(--c-text-mut); }

/* ───────── Server control ───────── */
.tx-member { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--c-surface-2); border: 1px solid var(--c-border); }
.tx-member img { width: 42px; height: 42px; border-radius: 50%; }
.tx-member .i { flex: 1; min-width: 0; }
.tx-member .i b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-member .i small { color: var(--c-text-mut); }
.tx-role { display: inline-block; font-size: .66rem; font-weight: 800; padding: 1px 8px; border-radius: 100px; border: 1px solid currentColor; margin: 2px 0 0 4px; }
.tx-ch { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: var(--c-surface-2); border: 1px solid var(--c-border-lo); margin-bottom: 6px; flex-wrap: wrap; }
.tx-ch .n { flex: 1; font-weight: 800; min-width: 120px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ───────── أقفال Premium ───────── */
.tx-lock { position: relative; display: grid; gap: 18px; }
.tx-lock > :not(.lk) { filter: blur(2px) saturate(.6); pointer-events: none; user-select: none; opacity: .55; }
.tx-lock .lk { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; text-align: center; background: linear-gradient(180deg, rgba(7,7,15,.35), rgba(7,7,15,.72)); border-radius: var(--tx-radius); }
