/* ============================================================================
   TROF DESIGN v2 — طبقة التصميم الجديدة (تُحمَّل بعد كل ملفات الستايل)
   • خلفية متحركة ناعمة (شبكة + شفق) بدون ما تأثر على الأداء
   • تجاوب كامل: مفيش عنصر يطلع برا الشاشة (هاتف / تابلت / كمبيوتر / شاشات كبيرة)
   • أسطح وأزرار وخطوط أنظف وأهدأ (بدون مبالغة بالتوهج)
   ============================================================================ */
:root { --v2-radius: 18px; --v2-ease: cubic-bezier(.22,.8,.24,1); --v2-grid: rgba(255,255,255,.035); --vh: 1vh; }
html[data-theme="light"] { --v2-grid: rgba(20,20,40,.06); }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { overflow-x: clip; max-width: 100%; }
body { text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; overflow-wrap: break-word; }
::selection { background: color-mix(in srgb, var(--tx-a, #f2c23c) 40%, transparent); color: inherit; }

/* ───────── أمان التجاوب: لا شيء يطلع برا الشاشة ───────── */
img, svg, video, canvas, iframe { max-width: 100%; }
img { height: auto; } img.emj, svg { height: revert-layer; }
.tx-grid > *, .px-feats > *, .px-stats > *, .st-grid > *, .bk-list > *, .dash-content, .dash-main, .tx-wrap, .tx-card, .tx-row, .px-row .t, .bk-item > div { min-width: 0; }
.tx-card, .px-stat, .px-feat, .bk-item, .px-ev { overflow-wrap: anywhere; }
.tx-card table, .tx-table-wrap, .table-wrap { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
pre, code { max-width: 100%; overflow-x: auto; }
.tx-modal { padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.tx-modal .m { max-width: 100%; max-height: calc(var(--vh, 1vh) * 92); overflow-y: auto; overscroll-behavior: contain; }
.tx-toast, .toast, #tx-toasts { max-width: min(92vw, 420px); }
/* تدرّج الخطوط حسب الشاشة */
.px-hero h1, .tx-hero h1 { font-size: clamp(1.35rem, 1rem + 2.2vw, 2.1rem); line-height: 1.25; }
.tx-wrap { padding-inline: clamp(10px, 2.4vw, 28px); }
.tx-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.tx-grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.tx-grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.px-feats { grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); }
.st-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.px-stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.px-seg { max-width: 100%; } .px-seg button { flex: 1 1 auto; }
html[data-vp="phone"] .px-hero { padding: 20px 16px; border-radius: 22px; }
html[data-vp="phone"] .px-art { width: 112px; height: 112px; }
html[data-vp="phone"] .px-ring-num { font-size: 1.7rem; }
html[data-vp="phone"] .bk-item { padding: 12px; } html[data-vp="phone"] .bk-ib { width: 40px; height: 40px; }
html[data-vp="phone"] .bk-modal .m { border-radius: 22px 22px 0 0 !important; align-self: flex-end; width: 100% !important; }
html[data-vp="phone"] .tx-modal { align-items: flex-end; padding: 0; }
html[data-vp="phone"] .tx-savebar { flex-direction: column; gap: 8px; text-align: center; }
html[data-vp="phone"] .px-pal-ov { padding-top: 6vh; }
html[data-vp="phone"] #px-top { bottom: 84px; }
html[data-vp="wide"] .tx-wrap { max-width: 1480px; margin-inline: auto; }
@media (hover: none) { .px-glow::before, .px-magnet { display: none; } }
@media (max-width: 560px) { .px-btn-row > .btn { flex: 1 1 auto; } .px-row .px-seg { width: 100%; } }

/* ───────── الخلفية المتحركة (ناعمة، GPU فقط) ───────── */
.v2-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; contain: strict; }
.v2-bg i { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5; will-change: transform; }
.v2-bg i:nth-child(1) { width: 56vmax; height: 56vmax; inset-block-start: -22vmax; inset-inline-end: -14vmax; background: radial-gradient(circle, color-mix(in srgb, var(--tx-a, #f2c23c) 46%, transparent), transparent 62%); animation: v2f1 26s ease-in-out infinite alternate; }
.v2-bg i:nth-child(2) { width: 50vmax; height: 50vmax; inset-block-end: -20vmax; inset-inline-start: -12vmax; background: radial-gradient(circle, color-mix(in srgb, var(--tx-b, #f7d446) 32%, transparent), transparent 62%); animation: v2f2 32s ease-in-out infinite alternate; }
.v2-bg i:nth-child(3) { width: 38vmax; height: 38vmax; inset-block-start: 38%; inset-inline-start: 38%; background: radial-gradient(circle, color-mix(in srgb, var(--tx-c, #8b5cf6) 22%, transparent), transparent 62%); animation: v2f3 38s ease-in-out infinite alternate; }
.v2-bg::before { content: ''; position: absolute; inset: -60px; background-image: linear-gradient(var(--v2-grid) 1px, transparent 1px), linear-gradient(90deg, var(--v2-grid) 1px, transparent 1px); background-size: 56px 56px; -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 10%, transparent 72%); mask-image: radial-gradient(ellipse at 50% 30%, #000 10%, transparent 72%); animation: v2grid 40s linear infinite; }
.v2-bg::after { content: ''; position: absolute; inset: 0; opacity: .05; mix-blend-mode: overlay; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
@keyframes v2f1 { to { transform: translate3d(-14vmax, 12vmax, 0) scale(1.15); } }
@keyframes v2f2 { to { transform: translate3d(16vmax, -10vmax, 0) scale(1.1); } }
@keyframes v2f3 { to { transform: translate3d(-12vmax, -14vmax, 0) scale(.85); } }
@keyframes v2grid { to { transform: translate3d(56px, 56px, 0); } }
html[data-theme="light"] .v2-bg i { opacity: .3; }
html[data-motion="reduced"] .v2-bg i, html[data-motion="off"] .v2-bg i, html[data-motion="reduced"] .v2-bg::before, html[data-motion="off"] .v2-bg::before { animation: none !important; }
html[data-vp="phone"] .v2-bg i { filter: blur(56px); } html[data-vp="phone"] .v2-bg::before { background-size: 40px 40px; }
/* الصفحات اللي لها خلفية خاصة تبقى ظاهرة: نخلي العناصر الأساسية شفافة */
body { background-color: var(--c-bg, #07070d); }

/* ───────── أسطح وأزرار أنظف ───────── */
.tx-card, .px-stat, .px-feat, .bk-item { border-radius: var(--v2-radius); box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 18px 40px -28px rgba(0,0,0,.7); }
html[data-theme="light"] .tx-card, html[data-theme="light"] .px-stat, html[data-theme="light"] .px-feat, html[data-theme="light"] .bk-item { box-shadow: 0 1px 2px rgba(20,20,40,.06), 0 14px 32px -24px rgba(20,20,40,.25); }
.btn { transition: transform .25s var(--v2-ease), box-shadow .25s var(--v2-ease), filter .2s; }
.btn:active { transform: scale(.97); }
:focus-visible { outline: 2px solid var(--tx-b, #f7d446); outline-offset: 2px; border-radius: 8px; }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--tx-a, #f2c23c) 45%, transparent) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; } *::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--tx-a, #f2c23c) 40%, transparent); border-radius: 9px; border: 2px solid transparent; background-clip: content-box; }
.tx-input, .tx-select, input[type="text"], select { max-width: 100%; }
@media (prefers-reduced-motion: reduce) { .v2-bg i, .v2-bg::before { animation: none !important; } }
html[data-vp="phone"] .px-stats { grid-template-columns: 1fr 1fr; gap: 10px; } html[data-vp="phone"] .px-stat { padding: 12px; } html[data-vp="phone"] .px-stat b { font-size: 1.35rem; }

/* ───────── قسم العرض (GIF/WebP) بالصفحة الرئيسية ───────── */
.showcase { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: clamp(14px, 2.4vw, 26px); align-items: start; }
.shw { margin: 0; border-radius: 22px; overflow: hidden; border: 1px solid var(--c-border-hi, #2c2c3c); background: var(--c-surface, #101018); box-shadow: 0 40px 80px -40px #000, 0 0 0 1px rgba(255,255,255,.03) inset; transition: transform .5s var(--v2-ease), box-shadow .5s; }
.shw:hover { transform: translateY(-6px) scale(1.01); box-shadow: 0 50px 90px -40px color-mix(in srgb, var(--tx-a, #f2c23c) 40%, #000); }
.shw-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: rgba(255,255,255,.04); border-bottom: 1px solid var(--c-border, #222); font-size: .74rem; font-weight: 800; color: var(--c-text-mut, #999); }
.shw-bar i { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; } .shw-bar i:nth-child(2) { background: #febc2e; } .shw-bar i:nth-child(3) { background: #28c840; } .shw-bar span { margin-inline-start: auto; }
.shw picture img { display: block; width: 100%; height: auto; }
.shw figcaption { padding: 14px 18px 18px; font-size: .88rem; line-height: 1.8; color: var(--c-text-mut, #aaa); } .shw figcaption b { display: block; color: var(--c-text, #fff); font-size: 1rem; margin-bottom: 2px; }

.shw figcaption img.emj { width: 1.2em; height: 1.2em; display: inline-block; }

/* ───────── الهاتف: الكروت واحد تحت الثاني (والمربعات الصغيرة فقط بعمودين) ───────── */
html[data-vp="phone"] .tx-grid.px-cardgrid, html[data-vp="phone"] .tx-grid:has(> .tx-card, > a.tx-card, > .px-feat, > .bk-item) { grid-template-columns: 1fr !important; }
html[data-vp="tablet"] .tx-grid.cols-2.px-cardgrid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.tx-grid > a.tx-card > div { min-width: 0; } .tx-grid > a.tx-card h3 { overflow-wrap: anywhere; }

/* ───────── شريط التنقل السفلي + ورقة "المزيد" (هاتف/تابلت) ───────── */
#px-tabbar, #px-sheet-ov { display: none; }
html[data-vp="phone"] #px-tabbar, html[data-vp="tablet"] #px-tabbar { display: flex; }
html[data-vp="phone"] .dash-content, html[data-vp="tablet"] .dash-content { padding-bottom: calc(88px + env(safe-area-inset-bottom)) !important; }
#px-tabbar { position: fixed; z-index: 950; inset-inline: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); gap: 4px; padding: 6px; border-radius: 24px; background: color-mix(in srgb, var(--c-surface-2, #14141f) 86%, transparent); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); border: 1px solid var(--c-border-hi, #333); box-shadow: 0 18px 44px -12px rgba(0,0,0,.8); animation: v2tab .5s var(--v2-ease) both; max-width: 560px; margin-inline: auto; }
@keyframes v2tab { from { transform: translateY(120%); opacity: 0; } }
#px-tabbar button { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px 6px; border: 0; border-radius: 18px; background: transparent; color: var(--c-text-mut, #9a9aaa); font: 800 .66rem inherit; font-family: inherit; cursor: pointer; position: relative; transition: .3s var(--v2-ease); -webkit-tap-highlight-color: transparent; }
#px-tabbar button .i { font-size: 1.35rem; line-height: 1; transition: transform .3s var(--v2-ease); } #px-tabbar button .i img.emj { width: 1.4rem; height: 1.4rem; margin: 0; vertical-align: top; }
#px-tabbar button .t { max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; text-align: center; font-size: .64rem; }
#px-tabbar button.on { color: var(--c-text, #fff); background: linear-gradient(135deg, color-mix(in srgb, var(--tx-a, #f2c23c) 30%, transparent), color-mix(in srgb, var(--tx-b, #f7d446) 12%, transparent)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tx-a, #f2c23c) 45%, transparent); }
#px-tabbar button.on .i { transform: translateY(-2px) scale(1.12); }
#px-tabbar button:active { transform: scale(.93); }
html[data-vp="phone"] #px-top { bottom: 96px; } html[data-vp="tablet"] #px-top { bottom: 96px; }
#px-sheet-ov { position: fixed; inset: 0; z-index: 99990; background: rgba(4,4,12,.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); align-items: flex-end; justify-content: center; animation: pxFade .2s; }
#px-sheet-ov.open { display: flex; }
#px-sheet { width: min(640px, 100%); max-height: 86vh; max-height: calc(var(--vh, 1vh) * 88); display: flex; flex-direction: column; border-radius: 28px 28px 0 0; background: var(--c-surface-2, #12121c); border: 1px solid var(--c-border-hi, #333); border-bottom: 0; box-shadow: 0 -30px 80px -20px #000; animation: v2sheet .38s var(--v2-ease); padding-bottom: env(safe-area-inset-bottom); }
@keyframes v2sheet { from { transform: translateY(100%); } }
#px-sheet .grab { width: 44px; height: 5px; border-radius: 5px; background: var(--c-border-hi, #444); margin: 10px auto 6px; flex: none; }
#px-sheet .sh-top { display: flex; gap: 8px; padding: 6px 14px 10px; flex: none; }
#px-sheet .sh-top input { flex: 1; min-width: 0; padding: 12px 16px; border-radius: 16px; border: 1px solid var(--c-border-hi, #333); background: var(--c-surface, #0e0e16); color: var(--c-text, #fff); font: 700 .95rem inherit; font-family: inherit; outline: 0; }
#px-sheet .sh-top input:focus { border-color: var(--tx-a, #f2c23c); }
#px-sheet .sh-top button { width: 46px; border-radius: 16px; border: 1px solid var(--c-border-hi, #333); background: var(--c-surface, #0e0e16); color: var(--c-text, #fff); cursor: pointer; font-size: 1.1rem; }
#px-sheet .sh-body { overflow-y: auto; padding: 4px 14px 18px; overscroll-behavior: contain; }
#px-sheet .sh-label { margin: 14px 4px 8px; font-size: .74rem; font-weight: 900; color: var(--c-text-mut, #999); letter-spacing: .02em; }
#px-sheet .sh-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#px-sheet .sh-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px 12px; border-radius: 18px; border: 1px solid var(--c-border, #262636); background: var(--c-surface, #0e0e16); color: var(--c-text, #fff); font: 800 .74rem/1.35 inherit; font-family: inherit; text-align: center; cursor: pointer; transition: .25s var(--v2-ease); animation: pxPageIn .45s var(--v2-ease) both; animation-delay: calc(var(--i, 0) * 16ms); -webkit-tap-highlight-color: transparent; }
#px-sheet .sh-tile .i { font-size: 1.6rem; line-height: 1; } #px-sheet .sh-tile .i img.emj { width: 1.7rem; height: 1.7rem; margin: 0; }
#px-sheet .sh-tile.on { border-color: var(--tx-a, #f2c23c); background: color-mix(in srgb, var(--tx-a, #f2c23c) 14%, var(--c-surface, #0e0e16)); }
#px-sheet .sh-tile:active { transform: scale(.95); }
#px-sheet .sh-empty { text-align: center; padding: 30px 0; color: var(--c-text-mut, #999); font-size: .85rem; }
html[data-vp="tablet"] #px-sheet .sh-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
html[data-vp="phone"] .dash-topbar-menu { display: none !important; }
html[data-vp="phone"] .fab, html[data-vp="tablet"] .fab { bottom: calc(96px + env(safe-area-inset-bottom)) !important; }
html[data-vp="phone"] #px-top, html[data-vp="tablet"] #px-top { inset-inline-start: auto; inset-inline-end: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); }

.shw.phone { max-width: 330px; margin-inline: auto; grid-row: span 2; border-radius: 34px; padding: 10px; background: #08080d; border: 2px solid var(--c-border-hi, #3a3a4c); box-shadow: 0 40px 80px -40px #000, inset 0 0 0 4px #14141c; }
.shw.phone .shw-bar { display: none; } .shw.phone picture img { border-radius: 24px; } .shw.phone figcaption { padding-inline: 8px; }
@media (max-width: 900px) { .shw.phone { grid-row: auto; } }

/* ───────── 🖥️ الكمبيوتر: المحتوى يملأ العرض (كان ينضغط بنص الشاشة) + شبكات أوسع ───────── */
.dash-page-content > .tx-wrap, #page-content > .tx-wrap { flex: 1 1 100%; width: 100%; max-width: none !important; margin-inline: 0 !important; min-width: 0; }
@media (min-width: 1100px) {
  .dash-content { padding: clamp(20px, 2vw, 36px) !important; }
  .tx-wrap { gap: 22px; }
  .tx-grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
  .tx-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
  .tx-hero { padding: 30px 34px; }
}
@media (min-width: 1500px) { .tx-grid.cols-3 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .dash-content { max-width: 1680px !important; } }
@media (min-width: 1900px) { .dash-content { max-width: 1840px !important; } }

/* شريط البحث السريع بالـ Topbar (الكمبيوتر) */
#px-search { display: none; align-items: center; gap: 10px; min-width: 240px; max-width: 360px; padding: 9px 14px; border-radius: 14px; border: 1px solid var(--c-border-hi, #333); background: var(--c-surface, #0e0e16); color: var(--c-text-mut, #999); font: 700 .82rem inherit; font-family: inherit; cursor: pointer; transition: .25s var(--v2-ease); }
#px-search:hover { border-color: var(--tx-a, #f2c23c); color: var(--c-text, #fff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tx-a, #f2c23c) 14%, transparent); }
#px-search .t { flex: 1; text-align: start; } #px-search kbd { padding: 2px 8px; border-radius: 7px; border: 1px solid var(--c-border-hi, #444); font: 800 .68rem monospace; color: var(--c-text-mut, #999); background: var(--c-surface-2, #14141f); }
html[data-vp="desktop"] #px-search, html[data-vp="wide"] #px-search { display: flex; }

/* القائمة الجانبية: مؤشر قسم أوضح + hover ناعم + صفحات أنظف */
@media (min-width: 1025px) {
  .dash-nav-item { transition: background .25s var(--v2-ease), transform .25s var(--v2-ease), color .2s; }
  .dash-nav-item:hover:not(.active) { transform: translateX(-3px); background: color-mix(in srgb, var(--tx-a, #f2c23c) 8%, transparent); }
  .dash-nav-label { letter-spacing: .04em; }
}
