/* 4k-fps — تنسيق الواجهة (RTL، ثيم فاتح) */
:root {
  --bg: #ffffff;
  --ink: #17181c;
  --muted: #6b7280;
  --line: #e7e8ec;
  --card: #fafafb;
  --accent: #e5533d;
  --accent-2: #d4412b;
  --accent-soft: #fdeceb;
  --dark: #1c1d21;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(20, 20, 30, .08);
  --font: "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, -apple-system, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, .035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, .035) 1px, transparent 1px);
  background-size: 36px 36px;
  background-position: top center;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- الشريط العلوي ---------- */
.topbar { background: rgba(255, 255, 255, .85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar__in { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand__logo { width: 36px; height: 36px; color: var(--accent); }
.brand__name { font-weight: 800; font-size: 20px; letter-spacing: -.2px; }
.nav { display: flex; align-items: center; gap: 22px; }
.nav a:not(.btn) { color: var(--muted); text-decoration: none; font-size: 14px; }
.nav a:not(.btn):hover { color: var(--ink); }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 15px; cursor: pointer;
  border: 0; border-radius: 999px; padding: 14px 22px; text-decoration: none;
  transition: transform .08s ease, filter .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn--sm { padding: 9px 16px; font-size: 13px; }
.btn--block { width: 100%; }
.btn--dark { background: var(--dark); color: #fff; }
.btn--primary { background: linear-gradient(180deg, #ec6450, var(--accent-2)); color: #fff; box-shadow: 0 6px 16px rgba(229, 83, 61, .28); }
.btn--primary:hover { filter: brightness(1.04); }
.btn--ghost { background: #efeff1; color: var(--ink); }
.btn--ghost:hover { background: #e6e6e9; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------- المنطقة الرئيسية ---------- */
.stage-wrap { padding: 44px 0 56px; min-height: 560px; }

.alert { background: #fff4f2; border: 1px solid #f5c9c2; color: #9b2c1c; border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; font-size: 14px; }
.alert--info { background: #f2f7ff; border-color: #cfe0fb; color: #1f4a8a; }

/* الرفع */
.panel-idle { text-align: center; padding-top: 28px; }
.hero-title { font-size: clamp(28px, 4.5vw, 44px); margin: 0 0 10px; letter-spacing: -.5px; }
.hero-sub { color: var(--muted); margin: 0 auto 30px; max-width: 560px; }
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: min(720px, 100%); margin: 0 auto; padding: 56px 24px;
  background: rgba(255, 255, 255, .8); border: 2px dashed #d6d8de; border-radius: 24px;
  cursor: pointer; transition: border-color .15s, background .15s, transform .15s;
}
.drop:hover, .drop:focus-visible, .drop.is-over { border-color: var(--accent); background: var(--accent-soft); outline: none; transform: translateY(-2px); }
.drop__icon { width: 44px; height: 44px; color: var(--accent); }
.drop__title { font-size: 18px; font-weight: 700; }
.drop__hint { color: var(--muted); font-size: 13px; }
.samples-note { margin-top: 18px; color: var(--muted); font-size: 13px; }

/* التقسيم: اللوحة الجانبية + العارض */
.split { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 36px; align-items: start; }
@media (max-width: 880px) { .split { grid-template-columns: 1fr; } }

.side__title { font-size: 22px; margin: 4px 0 4px; }
.side__sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.side--center { text-align: center; }
.side .btn { margin-top: 12px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 6px 18px; margin: 0 0 18px; }
.kv > div { display: flex; justify-content: space-between; gap: 14px; padding: 13px 0; font-size: 14px; }
.kv > div + div { border-top: 1px solid #f0f0f2; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; max-width: 62%; text-align: end; }

.opts { padding: 14px 18px; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; padding: 7px 0; }
.opt > span { color: var(--muted); }
.opt select { font: inherit; font-size: 13px; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; max-width: 60%; }
.opt--range { flex-direction: column; align-items: stretch; }
.opt--range input { width: 100%; accent-color: var(--accent); }
.opt--range output { color: var(--ink); font-weight: 700; margin-inline-start: 6px; }
.est { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }

/* العارض */
.frame {
  background: #0d1417; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  aspect-ratio: 16 / 10.5; display: grid; place-items: center; position: relative;
}
.frame video, .frame canvas { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; display: block; }
.live-badge { position: absolute; top: 12px; inset-inline-start: 12px; z-index: 2; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; padding: 5px 10px; border-radius: 999px; }

/* حلقة التقدم */
.ring { position: relative; width: 132px; height: 132px; margin: 6px auto 16px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring__bg { stroke: #ececef; }
.ring__fg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset .25s ease; }
.ring__txt { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 26px; }

/* مشغّل المقارنة */
.player { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.compare { --pos: 50%; position: relative; background: #0d1417; aspect-ratio: 16 / 10.5; user-select: none; touch-action: none; cursor: ew-resize; max-height: 74vh; margin-inline: auto; }
.compare video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
#vBefore { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare__handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; background: #fff; transform: translateX(-1px); outline: none; }
.compare__handle i { position: absolute; top: 50%; left: 50%; width: 18px; height: 44px; border-radius: 9px; background: #fff; transform: translate(-50%, -50%); box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
.compare__handle:focus-visible i { box-shadow: 0 0 0 3px var(--accent); }
.tag { position: absolute; bottom: 14px; font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px; pointer-events: none; direction: rtl; unicode-bidi: isolate; }
.tag--before { left: 14px; background: rgba(15, 20, 24, .75); color: #fff; }
.tag--after { right: 14px; background: #f1f1f3; color: #111; }

.seek { position: relative; height: 5px; background: #d9d9dd; }
.seek__bar { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); }
.seek input { position: absolute; inset: -8px 0; width: 100%; height: 21px; opacity: 0; cursor: pointer; margin: 0; }

.controls { display: flex; align-items: center; gap: 14px; padding: 16px 20px; }
.play { width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center; color: #fff; cursor: pointer; background: linear-gradient(180deg, #ec6450, var(--accent-2)); box-shadow: 0 4px 12px rgba(229, 83, 61, .3); flex: none; }
.time { color: var(--muted); font-size: 13px; flex: none; }
.fname { margin-inline-start: auto; font-weight: 600; font-size: 15px; min-width: 0; direction: ltr; text-align: end; }

/* معلومات أسفل الصفحة */
.info { padding: 36px 0 8px; max-width: 820px; }
.info h2 { margin: 0 0 14px; font-size: 22px; }
.steps { padding-inline-start: 22px; color: #3a3d46; line-height: 1.9; }
details { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 16px; margin-bottom: 10px; }
summary { cursor: pointer; font-weight: 700; }
details p { margin: 10px 0 0; color: var(--muted); line-height: 1.8; }
.foot { display: flex; justify-content: space-between; padding: 32px 0 40px; color: var(--muted); font-size: 13px; }

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