@import url('/fonts/cairo.css');

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --surface: #ffffff;
  --text: #0e1525;
  --muted: #5d6676;
  --line: #e3e6eb;
  --brand: #1747d6;
  --brand-ink: #ffffff;
  --brand-soft: #e8eefe;
  --ok: #12a150;
  --fix: #d98a00;
  --bad: #d93636;
  --accent-grad: linear-gradient(135deg, #e8eefe 0%, #fff6e0 100%);
  --radius: 14px;
  --shadow: 0 6px 24px rgba(14, 21, 37, 0.07);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --bg-soft: #131a24; --surface: #161e2a; --text: #e8edf5; --muted: #9aa5b5;
    --line: #273142; --brand: #5b85ff; --brand-ink: #071023; --brand-soft: #1b2a4d;
    --accent-grad: linear-gradient(135deg, #1b2a4d 0%, #2c2616 100%); --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --bg-soft: #131a24; --surface: #161e2a; --text: #e8edf5; --muted: #9aa5b5;
  --line: #273142; --brand: #5b85ff; --brand-ink: #071023; --brand-soft: #1b2a4d;
  --accent-grad: linear-gradient(135deg, #1b2a4d 0%, #2c2616 100%); --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif; line-height: 1.6;
}
button, input, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

/* header */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px max(16px, calc((100vw - 1180px) / 2)); border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo-img { height: 40px; width: auto; display: block; }
.logo small { font-size: 0.75rem; color: var(--muted); max-width: 140px; line-height: 1.3; }
@media (max-width: 480px) { .logo small { display: none; } }
.ghost-btn {
  background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer;
}

/* layout */
.container { max-width: 1180px; margin: 0 auto; padding: 32px 16px 64px; }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.3; margin: 0 0 8px; }
.hero p { margin: 0 0 28px; color: var(--muted); max-width: 680px; }
.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 28px; align-items: start; }
.grid-2 > * { min-width: 0; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.step-title { display: flex; align-items: center; gap: 10px; font-weight: 700; margin: 0 0 14px; }
.step-num {
  width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-weight: 800; font-size: 0.9rem; flex: none;
}

label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=tel], select {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg);
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

.doc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.doc-item {
  text-align: start; border: 1.5px solid var(--line); background: var(--bg); border-radius: 12px;
  padding: 12px 14px; cursor: pointer; transition: border-color .15s;
}
.doc-item:hover { border-color: var(--brand); }
.doc-item.active { border-color: var(--brand); background: var(--brand-soft); }
.doc-item b { display: block; font-size: 0.95rem; }
@media (max-width: 600px) {
  .doc-list { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
  .doc-item { flex: 0 0 72%; scroll-snap-align: start; }
}
.doc-item small { color: var(--muted); }

.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px 16px; text-align: center;
  transition: border-color .15s, background .15s;
}
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 13px 26px; font-weight: 700; cursor: pointer;
  background: var(--text); color: var(--bg); text-decoration: none;
}
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.outline { background: transparent; color: var(--text); border: 1.5px solid var(--line); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 10px; width: 100%; }

.tips li { margin-bottom: 6px; }
.spec-box { background: var(--bg-soft); border-radius: 12px; padding: 14px; margin-top: 14px; font-size: 0.9rem; }
.spec-box .row { display: flex; justify-content: space-between; gap: 8px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line); vertical-align: middle; }
.warn-text { color: var(--fix); font-size: 0.85rem; margin-top: 6px; }

/* progress */
.progress-list { list-style: none; padding: 0; margin: 0; }
.progress-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: var(--muted); }
.progress-list li.active { color: var(--text); font-weight: 600; }
.progress-list li.done { color: var(--ok); }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--brand);
  animation: spin .8s linear infinite; flex: none;
}
.dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.5s; } }

/* checks */
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.checks li:last-child { border-bottom: 0; }
.checks .ico {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  font-size: 0.8rem; font-weight: 800; flex: none;
}
.ico.ok { background: var(--ok); } .ico.fix { background: var(--fix); } .ico.bad { background: var(--bad); }
.checks .tag { margin-inline-start: auto; font-size: 0.78rem; color: var(--muted); }
.banner { border-radius: 12px; padding: 12px 14px; font-weight: 700; margin-bottom: 14px; }
.banner.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.banner.fix { background: color-mix(in srgb, var(--fix) 16%, transparent); color: var(--fix); }
.banner.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }

/* checkout (result page) */
.checkout { display: grid; grid-template-columns: 1fr 1fr; min-height: calc(100vh - 77px); }
.checkout > .pane { padding: 40px max(16px, 5vw); }
.checkout > .pane.side { background: var(--bg-soft); }
@media (max-width: 900px) { .checkout { grid-template-columns: 1fr; } .checkout > .pane.side { order: -1; } }
.pane-inner { max-width: 470px; margin: 0 auto; }

.stepper { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.stepper button { background: none; border: 0; cursor: pointer; padding: 0 4px; font-size: 1.1rem; }
.bar { height: 4px; border-radius: 4px; background: var(--line); margin-bottom: 22px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ok); transition: width .3s; }

.option {
  display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; cursor: pointer;
  margin-bottom: 12px; background: var(--surface);
}
.option.active { border: 1.5px solid var(--text); }
.option .head { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.1rem; }
.option .head .price { margin-inline-start: auto; }
.option input { width: 20px; height: 20px; accent-color: var(--text); margin: 0; }
.option ul { list-style: none; padding: 0; margin: 10px 0 0; color: var(--muted); }
.option ul li { padding: 3px 0; }
.option .note { background: var(--bg-soft); border-radius: 10px; padding: 10px 12px; margin-top: 10px; font-size: 0.85rem; }

.doc-card { background: var(--accent-grad); border-radius: var(--radius) var(--radius) 0 0; padding: 22px; display: flex; gap: 14px; justify-content: space-between; }
.doc-card h3 { margin: 0 0 4px; font-size: 1.15rem; line-height: 1.4; }
.thumb { width: 96px; flex: none; border-radius: 6px; overflow: hidden; background: #fff; box-shadow: var(--shadow); align-self: flex-start; }
.summary { background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: 6px 22px; }
.summary .row { display: flex; justify-content: space-between; padding: 14px 0; color: var(--muted); }
.summary .row.total { border-top: 1px solid var(--line); color: var(--text); font-weight: 800; font-size: 1.1rem; }
.summary .row.total .amt { color: var(--ok); }
.trust { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px; font-size: 0.9rem; color: var(--muted); }

.preview-wrap { position: relative; max-width: 300px; margin: 0 auto 10px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.preview-wrap canvas { width: 100%; display: block; }
.toggle { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 0.9rem; cursor: pointer; }

.status-box { text-align: center; padding: 28px 10px; }
.status-box .spinner { width: 42px; height: 42px; border-width: 4px; margin: 0 auto 14px; }
.status-box .stack { display: grid; gap: 10px; margin-top: 18px; }
.ad-slot:empty { display: none; }
.ad-slot { margin: 16px 0; }
.ad-card {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; color: var(--text);
  border: 1px dashed color-mix(in srgb, var(--fix) 55%, var(--line)); background: color-mix(in srgb, var(--fix) 7%, var(--surface)); border-radius: var(--radius);
}
.ad-card img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; flex: none; }
.ad-body { flex: 1; min-width: 0; }
.ad-body b { display: block; }
.ad-body small { display: block; color: var(--muted); }
.ad-tag { position: absolute; top: -10px; inset-inline-start: 12px; font-size: 0.72rem; padding: 0 8px; border-radius: 6px; background: var(--surface); color: var(--fix); border: 1px solid color-mix(in srgb, var(--fix) 45%, var(--line)); }
.vip-overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(8, 14, 28, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 16px; animation: vipFade .25s ease-out;
}
.vip-card {
  position: relative; width: min(380px, 100%); background: var(--surface); color: var(--text);
  border-radius: 20px; padding: 26px 20px 14px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.vip-card img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 14px; margin-bottom: 12px; }
.vip-card h3 { margin: 0 0 6px; font-size: 1.2rem; }
.vip-card p { margin: 0 0 16px; color: var(--muted); }
.vip-tag {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: #f5b300; color: #3a2a00; font-size: 0.8rem; font-weight: 700; padding: 3px 12px; border-radius: 999px;
}
@keyframes vipFade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .vip-overlay { animation: none; } }
.free-only { display: none; }
.free-mode .paid-only { display: none !important; }
.free-mode .free-only { display: block; }
.free-mode .doc-card { border-radius: var(--radius); }
@media (max-width: 900px) { .free-mode > .pane.side { order: 0; } }
.demo-note { font-size: 0.82rem; color: var(--fix); margin: 10px 0 0; }
.error { color: var(--bad); font-size: 0.9rem; margin-top: 8px; }

.icon-btn { background: none; border: 0; font-size: 1.1rem; cursor: pointer; padding: 6px 10px; color: var(--muted); }
.icon-btn.light { color: #fff; }
.install-banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 20px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--brand-soft);
}
.install-banner img { border-radius: 10px; flex: none; }
.install-banner p { margin: 0; }
.install-banner > div { flex: 1; min-width: 0; }
.install-banner .btn { padding: 9px 16px; flex: none; }

/* live camera */
.camera { position: fixed; inset: 0; z-index: 50; background: #000; color: #fff; display: flex; flex-direction: column; }
.camera-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px; font-weight: 600; font-size: 0.95rem; }
.camera-stage { position: relative; flex: 1; overflow: hidden; }
.camera-stage video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.camera-stage video.rear { transform: none; }
.camera-guide { position: absolute; inset: 0; width: 100%; height: 100%; }
.camera-tips { text-align: center; font-size: 0.85rem; opacity: .85; margin: 10px 16px 0; }
.camera-bottom { display: flex; justify-content: center; padding: 18px 0 28px; }
.shutter { width: 72px; height: 72px; border-radius: 50%; border: 5px solid #fff; background: var(--brand); cursor: pointer; }
.shutter:active { transform: scale(.94); }
.install-banner a { color: var(--brand); text-decoration: underline; }
