/* ============================================================
   UnMark — design system replicated from the reference dashboard
   ============================================================ */
:root {
  --bg-page: #9298bb;
  --panel: #f4f5f8;
  --card: #ffffff;
  --ink: #16171d;
  --ink-2: #3d4049;
  --muted: #8a8e9b;
  --line: #ecedf2;
  --line-2: #e3e5ec;
  --accent: #f5531f;
  --accent-600: #e6440f;
  --accent-soft: #fde7de;
  --blue: #3b82f6;
  --blue-soft: #e5efff;
  --green: #1aa251;
  --green-soft: #e3f5ea;
  --grey-pill: #eef0f4;
  --radius-card: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow-card: 0 10px 30px rgba(20, 30, 60, .05);
  --shadow-soft: 0 6px 18px rgba(20, 30, 60, .06);
  --font: 'Onest', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
  --bg-page: #14151b;
  --panel: #1b1c23;
  --card: #23252e;
  --ink: #f2f3f7;
  --ink-2: #c7cad3;
  --muted: #9096a3;
  --line: #2f313b;
  --line-2: #363945;
  --accent-soft: #3a2418;
  --blue-soft: #1e2a40;
  --green-soft: #17301f;
  --grey-pill: #2c2e38;
  --shadow-card: 0 10px 30px rgba(0, 0, 0, .28);
  --shadow-soft: 0 6px 18px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* The hidden attribute must always win over component display rules. */
[hidden] { display: none !important; }
html:lang(ar) { --font: 'IBM Plex Sans Arabic', 'Onest', system-ui, sans-serif; }

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.page { padding: 18px; min-height: 100vh; }
.dashboard {
  width: 100%;
  margin: 0;
  min-height: calc(100vh - 36px);
  background: var(--panel);
  border-radius: 30px;
  padding: 22px 30px 30px;
  box-shadow: 0 30px 80px rgba(20, 25, 55, .25);
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 6px 4px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, #ff7a3c, var(--accent));
  display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(245, 83, 31, .35);
}
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: .2px; }

.nav { display: flex; gap: 26px; margin-inline-start: 14px; }
.nav-link {
  text-decoration: none; color: var(--muted);
  font-size: 14.5px; font-weight: 500; position: relative; padding: 4px 0;
}
.nav-link.active { color: var(--ink); font-weight: 600; }
.nav-link.active::after {
  content: ""; position: absolute; inset-inline: 0; bottom: -6px; height: 2px;
  background: var(--accent); border-radius: 2px;
}
.nav-link:hover { color: var(--ink-2); }

.top-actions { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; }
.search {
  display: flex; align-items: center; background: var(--card);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 6px 5px 16px; width: 250px; box-shadow: var(--shadow-soft);
}
.search input {
  border: none; outline: none; background: transparent; flex: 1;
  font-family: var(--font); font-size: 13.5px; color: var(--ink); min-width: 0;
}
.search input::placeholder { color: var(--muted); }
.search-btn {
  width: 30px; height: 30px; border-radius: 50%; background: var(--panel);
  color: var(--ink); display: grid; place-items: center; flex: none;
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  box-shadow: var(--shadow-soft); transition: transform .12s ease;
}
.icon-btn:hover { transform: translateY(-1px); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #ffb28a, var(--accent));
  color: #fff; display: grid; place-items: center; font-weight: 700;
}

/* ---------- Grid ---------- */
.grid { display: grid; grid-template-columns: 1.62fr 1fr; gap: 20px; }
.col-main { display: flex; flex-direction: column; gap: 20px; }
.col-side { display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--card); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); padding: 24px;
}

/* ---------- Hero ---------- */
.hero-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.hero-title-wrap { display: flex; gap: 12px; }
.hero-icon {
  width: 34px; height: 34px; border-radius: 10px; background: var(--panel);
  color: var(--ink); display: grid; place-items: center; flex: none; margin-top: 4px;
}
.hero-title { font-size: 34px; font-weight: 800; letter-spacing: -.5px; line-height: 1.05; }
.hero-sub { color: var(--muted); font-size: 14px; margin-top: 8px; max-width: 420px; line-height: 1.5; }

.engine-select { position: relative; flex: none; }
.engine-current {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 9px 14px; font-family: var(--font); font-size: 14px; font-weight: 600; color: var(--ink);
}
.engine-menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 20;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 16px;
  box-shadow: var(--shadow-card); padding: 6px; width: 230px;
}
.engine-menu button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; text-align: start; border: none; background: transparent;
  padding: 10px 12px; border-radius: 12px; cursor: pointer; color: var(--ink); font-family: var(--font);
}
.engine-menu button:hover { background: var(--panel); }
.engine-menu b { font-size: 14px; font-weight: 600; }
.engine-menu small { color: var(--muted); font-size: 12px; }

/* state switching */
.hero-body { margin-top: 26px; }
.hero[data-state="empty"] .state-empty,
.hero[data-state="uploading"] .state-uploading,
.hero[data-state="editing"] .state-editing,
.hero[data-state="processing"] .state-processing,
.hero[data-state="done"] .state-done { display: block; }
.state-empty, .state-uploading, .state-editing, .state-processing, .state-done { display: none; }

/* dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line-2); border-radius: var(--radius-md);
  padding: 46px 20px; background: var(--panel);
  transition: border-color .15s ease, background .15s ease;
}
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dz-icon {
  width: 62px; height: 62px; border-radius: 50%; background: var(--card);
  color: var(--accent); display: grid; place-items: center; box-shadow: var(--shadow-soft);
}
.dz-title { font-weight: 700; font-size: 17px; }
.dz-sub { color: var(--muted); font-size: 13.5px; }

/* workspace (preview + box) */
.workspace { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; align-items: center; }
.preview-wrap {
  position: relative; border-radius: var(--radius-md); overflow: hidden;
  background: #000; line-height: 0; box-shadow: var(--shadow-soft);
}
.preview-wrap img, .preview-wrap video { width: 100%; display: block; }
.preview-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.preview-wrap.play-mode canvas { pointer-events: none; }
.workspace-side { display: flex; flex-direction: column; gap: 22px; }
.ws-badge {
  display: inline-block; background: var(--accent-soft); color: var(--accent-600);
  font-weight: 600; font-size: 12.5px; padding: 6px 14px; border-radius: 999px;
}
.ws-badge.ready { background: var(--green-soft); color: var(--green); }
.ws-hint { color: var(--muted); font-size: 13.5px; margin-top: 12px; line-height: 1.55; }
.ws-actions { display: flex; flex-direction: column; gap: 10px; }

/* buttons */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  font-family: var(--font); font-weight: 600; font-size: 14.5px;
  padding: 13px 20px; border-radius: 14px; text-decoration: none;
  box-shadow: 0 8px 18px rgba(245, 83, 31, .28); transition: background .15s, transform .12s;
}
.btn-primary:hover { background: var(--accent-600); transform: translateY(-1px); }
.btn-ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--line-2);
  border-radius: 14px; padding: 12px 20px; cursor: pointer; font-family: var(--font);
  font-weight: 500; font-size: 14px;
}
.btn-ghost:hover { color: var(--ink); }
.btn-white {
  background: #fff; color: var(--ink); border: none; border-radius: 12px;
  padding: 11px 18px; font-weight: 600; font-family: var(--font); cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}

/* progress */
.progress-block { padding: 10px 4px 4px; }
.progress-numbers { display: flex; align-items: baseline; gap: 14px; }
.progress-pct { font-size: 46px; font-weight: 800; letter-spacing: -1px; }
.progress-msg { color: var(--muted); font-size: 14px; }
.progress-track {
  height: 12px; background: var(--panel); border-radius: 999px; margin: 20px 0 12px; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, #ff7a3c, var(--accent)); transition: width .35s ease;
}
.progress-note { color: var(--muted); font-size: 13px; }

/* done */
.done-block { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.done-left { display: flex; align-items: center; gap: 14px; }
.done-check {
  width: 52px; height: 52px; border-radius: 50%; background: var(--green-soft); color: var(--green);
  display: grid; place-items: center; flex: none;
}
.done-title { font-size: 20px; font-weight: 700; }
.done-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.done-actions { display: flex; gap: 10px; }

/* ---------- Row cards ---------- */
.row-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-head h3 { font-size: 16px; font-weight: 700; }
.link { color: var(--muted); font-size: 13px; text-decoration: none; }
.link:hover { color: var(--accent); }

.steps { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.steps li { display: flex; gap: 12px; align-items: center; }
.step-n {
  width: 30px; height: 30px; border-radius: 50%; background: var(--panel); color: var(--accent);
  font-weight: 700; display: grid; place-items: center; flex: none; font-size: 14px;
}
.steps b { font-size: 14px; font-weight: 600; display: block; }
.steps small { color: var(--muted); font-size: 12.5px; }

.premium {
  background: linear-gradient(135deg, #2a2d3a, #1c1e29); color: #fff;
  position: relative; overflow: hidden;
}
.premium::after {
  content: ""; position: absolute; inset-inline-end: -40px; top: -40px;
  width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(245,83,31,.35), transparent 70%);
}
.premium-inner { position: relative; z-index: 1; }
.premium h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.premium p { color: #b9bccb; font-size: 13px; line-height: 1.5; margin-bottom: 18px; max-width: 260px; }

/* ---------- Side column ---------- */
.side-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px; }
.side-head h3 { font-size: 17px; font-weight: 700; }

.job-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.job-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; }
.job-item:hover { background: var(--panel); }
.job-ic {
  width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; color: #fff;
}
.job-ic.c-orange { background: linear-gradient(135deg, #ff7a3c, var(--accent)); }
.job-ic.c-blue { background: linear-gradient(135deg, #6aa8ff, var(--blue)); }
.job-ic.c-dark { background: linear-gradient(135deg, #454857, #2a2c37); }
.job-meta { flex: 1; min-width: 0; }
.job-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.pill { font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; flex: none; }
.pill.done { background: var(--green-soft); color: var(--green); }
.pill.processing { background: var(--accent-soft); color: var(--accent-600); }
.pill.failed { background: var(--grey-pill); color: var(--muted); }
.job-dl { color: var(--muted); text-decoration: none; display: grid; place-items: center; padding: 4px; }
.job-dl:hover { color: var(--accent); }
.jobs-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 22px 6px; }

.date-pill {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-2);
  border-radius: 999px; padding: 6px 12px; font-size: 12.5px; color: var(--ink-2);
}
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-num { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.bars { height: 34px; border-radius: 8px; margin-top: 4px; opacity: .9; }
.bars.b-orange { background: repeating-linear-gradient(90deg, var(--accent) 0 3px, transparent 3px 7px); }
.bars.b-grey { background: repeating-linear-gradient(90deg, var(--line-2) 0 3px, transparent 3px 7px); }
.bars.b-dark { background: repeating-linear-gradient(90deg, var(--ink) 0 3px, transparent 3px 7px); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; inset-inline: 0; bottom: 26px; margin: 0 auto; width: max-content; max-width: 90%;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px;
  font-size: 14px; z-index: 100; box-shadow: 0 12px 30px rgba(0,0,0,.3);
  opacity: 0; transform: translateY(10px); transition: .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ---------- Free badge ---------- */
.free-badge {
  display: inline-block; background: var(--green-soft); color: var(--green);
  font-weight: 700; font-size: 11.5px; padding: 5px 12px; border-radius: 999px; margin-bottom: 10px;
}

/* ---------- Auth button / user ---------- */
.btn-signin {
  background: var(--accent); color: #fff; border: none; border-radius: 999px;
  padding: 9px 18px; font-family: var(--font); font-weight: 600; font-size: 13.5px; cursor: pointer;
  box-shadow: 0 6px 14px rgba(245,83,31,.28);
}
.btn-signin:hover { background: var(--accent-600); }
.user-box { position: relative; }
.user-box .avatar { cursor: pointer; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.user-menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 30;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: var(--shadow-card); padding: 10px; min-width: 160px; display: flex; flex-direction: column; gap: 8px;
}
.user-name { font-weight: 600; font-size: 13.5px; padding: 4px 6px; }
.user-menu button {
  background: var(--panel); border: none; border-radius: 10px; padding: 9px; cursor: pointer;
  font-family: var(--font); font-weight: 600; font-size: 13px; color: var(--accent-600);
}

.dz-limit { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* ---------- Watch/mark toggle + result video ---------- */
.btn-toggle {
  align-self: flex-start; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 999px; padding: 8px 14px; cursor: pointer; font-family: var(--font);
  font-weight: 600; font-size: 13px; color: var(--ink);
}
.result-video { margin-top: 20px; }
.result-video video { width: 100%; max-height: 360px; border-radius: var(--radius-md); background: #000; display: block; }

/* ---------- Info / SEO sections ---------- */
.info { margin-top: 22px; padding: 6px 6px 0; }
.info h2 { font-size: 22px; font-weight: 800; letter-spacing: -.4px; margin-bottom: 16px; }
.info-lead { color: var(--muted); font-size: 14.5px; line-height: 1.6; max-width: 760px; margin-bottom: 14px; }
.info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.info-card { background: var(--card); border-radius: var(--radius-md); padding: 18px; box-shadow: var(--shadow-card); }
.info-n { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-600); font-weight: 800; margin-bottom: 10px; }
.info-card h4 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.info-card p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--card); border: 1px solid var(--line-2); border-radius: 999px; padding: 7px 16px; font-weight: 600; font-size: 13px; box-shadow: var(--shadow-soft); }
.faq { display: flex; flex-direction: column; gap: 10px; }
.faq details { background: var(--card); border-radius: var(--radius-md); padding: 14px 18px; box-shadow: var(--shadow-card); }
.faq summary { font-weight: 600; font-size: 15px; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq details[open] summary { color: var(--accent-600); margin-bottom: 8px; }
.faq p { color: var(--muted); font-size: 14px; line-height: 1.6; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 26px; padding: 22px 6px 6px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.foot-brand { font-weight: 800; }
.foot-credit { color: var(--muted); font-size: 14px; }
.foot-credit a { color: var(--accent); font-weight: 700; text-decoration: none; }
.foot-credit a:hover { text-decoration: underline; }
.foot-free { margin-inline-start: auto; color: var(--muted); font-size: 13px; }

/* ---------- Auth modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(10,14,30,.55);
  display: grid; place-items: center; padding: 20px; backdrop-filter: blur(3px);
}
.modal {
  background: var(--card); border-radius: 22px; padding: 26px; width: 100%; max-width: 400px;
  position: relative; box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
.modal-close { position: absolute; inset-inline-end: 16px; top: 14px; background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); }
.modal-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.modal-tabs .tab { flex: 1; background: var(--panel); border: none; border-radius: 12px; padding: 11px; font-family: var(--font); font-weight: 600; font-size: 14px; cursor: pointer; color: var(--muted); }
.modal-tabs .tab.active { background: var(--accent); color: #fff; }
.auth-form { display: flex; flex-direction: column; gap: 8px; }
.auth-form label { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-top: 6px; }
.auth-form input[type="text"], .auth-form input[type="email"], .auth-form input[type="password"] {
  border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; font-family: var(--font);
  font-size: 14px; background: var(--panel); color: var(--ink); outline: none;
}
.auth-form input:focus { border-color: var(--accent); }
.auth-form .btn-primary { margin-top: 14px; width: 100%; }
.auth-err { color: #e5484d; font-size: 13px; min-height: 16px; margin-top: 4px; }
.avatar-pick { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.avatar-preview {
  width: 56px; height: 56px; border-radius: 50%; overflow: hidden; flex: none;
  background: linear-gradient(135deg, #ffb28a, var(--accent)); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 20px;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-btn { background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 9px 14px; cursor: pointer; font-size: 13px; font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .row-cards { grid-template-columns: 1fr; }
  .workspace { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .nav, .search { display: none; }
  .hero-title { font-size: 28px; }
  .foot-free { margin-inline-start: 0; }
}
