﻿/* استبيان Digitala Code
   الهوية: كحلي الشعار أساساً، والأخضر للإجراء والاختيار فقط.
   العنصر المميز: شرائط «الشيفرون» المأخوذة من زوايا شعار DC لعرض التقدم. */
:root {
  --ink: #0E213F;
  --ink-2: #1B3A5B;
  --deep: #0A1A33;
  --ink-tint: #EEF2F8;
  --green: #46B646;
  --green-ink: #2A7F2B;
  --green-tint: #EBF7EA;
  --paper: #F2F4F8;
  --surface: #FFFFFF;
  --line: #DCE2EB;
  --line-strong: #B4BFCF;
  --text: #13213A;
  --muted: #5B687D;
  --on-ink-muted: rgba(255, 255, 255, .72);
  --danger: #C23434;
  --radius: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--paper); color: var(--text);
  font: 400 16px/1.7 'Readex Pro', 'Segoe UI', Tahoma, sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }

/* ── الشريط العلوي ── */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 60px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.top-brand img { display: block; height: 36px; width: auto; }
.top-label { font-size: 14px; color: var(--muted); }

/* ── الهيكل ── */
.shell { width: 100%; }
.rail { display: none; }
.stage { max-width: 720px; margin: 0 auto; padding-bottom: 8px; }

/* ── رأس الخطوة (على الجوال شريط كحلي) ── */
.step-head { background: var(--ink); color: #fff; padding: 22px 20px 38px; }
.step-count { font-size: 13.5px; color: var(--on-ink-muted); }
.step-title { font-size: 26px; font-weight: 600; line-height: 1.35; margin-top: 2px; }
.step-lead { font-size: 15px; color: var(--on-ink-muted); margin-top: 4px; }

/* شيفرونات التقدم: كل خطوة سهم بزاوية شعار DC يتجه مع اتجاه القراءة */
.chev { display: flex; gap: 5px; margin-top: 18px; }
.chev span {
  flex: 1; height: 10px; background: rgba(255, 255, 255, .16);
  clip-path: polygon(0 50%, 8px 0, 100% 0, calc(100% - 8px) 50%, 100% 100%, 8px 100%);
  transition: background .35s ease;
}
.chev span.done { background: var(--green); }
.chev span.now { background: #fff; }

/* ── ورقة الأسئلة ── */
.sheet {
  position: relative; margin: -20px 12px 0; padding: 24px 18px 8px;
  background: var(--surface); border-radius: 18px; border: 1px solid var(--line);
  box-shadow: 0 10px 30px -12px rgba(14, 33, 63, .18);
}
.sheet.enter { animation: enter .32s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.field { margin-bottom: 28px; }
.field > label, .field > .label { display: block; font-size: 15.5px; font-weight: 600; color: var(--ink); margin-bottom: 10px; line-height: 1.5; }
.req { color: var(--danger); margin-inline-start: 3px; }
.opt { color: var(--muted); font-weight: 400; font-size: 13px; margin-inline-start: 6px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 7px; }
.err { display: none; font-size: 13.5px; color: var(--danger); margin-top: 8px; }
.field.invalid .err { display: block; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.field.invalid .choice { border-color: #E7B5B5; }

input[type=text], input[type=tel], input[type=email], input[type=number], input[type=url], select, textarea {
  width: 100%; min-height: 52px; padding: 12px 15px; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 12px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #98A3B5; }
textarea { resize: vertical; min-height: 110px; line-height: 1.7; }
select {
  appearance: none; padding-inline-start: 40px; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230E213F' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat left 14px center / 18px;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(70, 182, 70, .2); }
input[type=tel], input[type=email], input[type=url] { direction: ltr; text-align: right; }
.counter { font-size: 12px; color: var(--muted); text-align: left; margin-top: 6px; }

/* خيارات: بلاطات واضحة بمساحة لمس كبيرة */
.choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr)); }
.choices.stack { grid-template-columns: 1fr; }
.choice {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 12px 15px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface);
  cursor: pointer; user-select: none; font-size: 15px; line-height: 1.45;
  transition: border-color .15s, background .15s;
}
.choice:hover { border-color: var(--line-strong); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .mark {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong);
  display: grid; place-items: center; transition: all .15s; background: var(--surface);
}
.choice.multi .mark { border-radius: 6px; }
.choice:has(input:checked) { border-color: var(--ink); background: var(--ink-tint); color: var(--ink); font-weight: 500; box-shadow: inset 0 0 0 1px var(--ink); }
.choice:has(input:checked) .mark { border-color: var(--green); background: var(--green); }
.choice:not(.multi):has(input:checked) .mark::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.choice.multi:has(input:checked) .mark::after { content: ''; width: 6px; height: 11px; margin-top: -2px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.choice:has(input:focus-visible), .svc:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }

/* بطاقات الخدمات */
.services { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.svc {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px 14px 15px;
  border: 1.5px solid var(--line); border-radius: 16px; background: var(--surface); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.svc:hover { border-color: var(--line-strong); }
.svc input { position: absolute; opacity: 0; pointer-events: none; }
.svc-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--ink-tint); color: var(--ink); transition: all .15s; }
.svc-icon svg { width: 24px; height: 24px; }
.svc strong { font-size: 15.5px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.svc span.desc { font-size: 13px; color: var(--muted); line-height: 1.55; }
.svc:has(input:checked) { border-color: var(--green); background: var(--green-tint); box-shadow: inset 0 0 0 1px var(--green); }
.svc:has(input:checked) .svc-icon { background: var(--green); color: #fff; }
.svc::after {
  content: ''; position: absolute; top: 12px; inset-inline-end: 12px; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--surface);
}
.svc:has(input:checked)::after {
  border-color: var(--green); background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 13px no-repeat;
}

/* المراجعة */
.review-note { font-size: 14.5px; color: var(--muted); margin-bottom: 18px; }
.review-group { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; overflow: hidden; }
.review-group header { display: flex; justify-content: space-between; align-items: center; background: #F7F9FC; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.review-group header strong { color: var(--ink); font-weight: 600; }
.review-group dl { margin: 0; padding: 4px 16px 14px; }
.review-group dt { font-size: 13px; color: var(--muted); margin-top: 10px; }
.review-group dd { margin: 1px 0 0; white-space: pre-wrap; word-break: break-word; }
.link { background: none; border: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; padding: 6px 4px; font-weight: 500; font-size: 14px; }
.link:hover { color: var(--green-ink); }

/* ── أزرار التنقل ── */
.actions {
  position: sticky; bottom: 0; z-index: 5; display: flex; gap: 10px;
  padding: 14px 12px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--paper) 72%, rgba(242, 244, 248, 0));
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px;
  padding: 12px 22px; border-radius: 14px; border: 1.5px solid transparent;
  font-weight: 600; font-size: 16px; cursor: pointer; text-decoration: none; transition: background .15s, transform .06s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.btn-go { flex: 1; background: var(--ink); color: #fff; }
.btn-go:hover { background: var(--ink-2); }
.btn-wa { flex: 1; background: var(--green); color: var(--ink); }
.btn-wa:hover { background: #3EA83E; }
.btn-quiet { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-quiet:hover { border-color: var(--line-strong); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.actions #prev { flex: 0 0 auto; min-width: 104px; }
.wa-ico { width: 22px; height: 22px; fill: currentColor; flex-shrink: 0; }

/* ── الترحيب ── */
.intro-hero { background: var(--ink); color: #fff; padding: 34px 20px 46px; }
.intro-hero h1 { font-size: 32px; font-weight: 700; line-height: 1.3; }
.intro-hero p { color: var(--on-ink-muted); margin-top: 10px; font-size: 16px; max-width: 46ch; }
.intro-hero .intro-service {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; padding: 6px 14px 6px 12px;
  border-radius: 99px; background: rgba(255, 255, 255, .1); color: #fff; font-size: 14px;
}
.intro-service::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.intro-steps {
  list-style: none; counter-reset: s; margin: -24px 12px 0; padding: 8px 18px; position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 10px 30px -12px rgba(14, 33, 63, .18);
}
.intro-steps li { counter-increment: s; display: grid; grid-template-columns: 40px 1fr; column-gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.intro-steps li:last-child { border-bottom: 0; }
.intro-steps li::before {
  content: counter(s); grid-row: span 2; display: grid; place-items: center; width: 40px; height: 32px; margin-top: 2px;
  background: var(--ink); color: #fff; font-weight: 600; font-size: 15px;
  clip-path: polygon(0 50%, 9px 0, 100% 0, calc(100% - 9px) 50%, 100% 100%, 9px 100%);
}
.intro-steps li:last-child::before { background: var(--green); color: var(--ink); }
.intro-steps strong { color: var(--ink); font-weight: 600; font-size: 16px; }
.intro-steps span { color: var(--muted); font-size: 14px; }
.intro .btn-go { display: flex; width: calc(100% - 24px); margin: 20px 12px 28px; }

/* ── شاشة الإرسال ── */
.done-screen { margin: 24px 12px; padding: 32px 22px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.done-mark { width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 50%; background: var(--green); display: grid; place-items: center; animation: pop .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.done-mark svg { width: 38px; height: 38px; fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.done-screen h1 { font-size: 24px; font-weight: 700; color: var(--ink); }
.done-screen p { color: var(--muted); margin-top: 10px; max-width: 42ch; margin-inline: auto; }
.done-screen p strong { color: var(--ink); }
.done-actions { display: flex; flex-direction: column; gap: 10px; margin: 24px 0 10px; }
.done-actions .btn { width: 100%; }
.staff-box { text-align: start; margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 18px; }
.staff-box label { font-weight: 600; color: var(--ink); font-size: 14px; }
.staff-box textarea { direction: ltr; font-size: 12.5px; margin: 8px 0 12px; }
.staff-box .btn { width: 100%; }

.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none; }

.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translate(-50%, 16px); opacity: 0; z-index: 20;
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 12px; font-size: 14.5px;
  transition: opacity .2s, transform .2s; pointer-events: none; box-shadow: 0 8px 24px rgba(14, 33, 63, .25);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── الشاشات المتوسطة ── */
@media (min-width: 640px) {
  .services { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sheet, .intro-steps { margin-inline: 20px; padding-inline: 28px; }
  .step-head, .intro-hero { padding-inline: 28px; }
  .actions { padding-inline: 20px; }
  .intro .btn-go { width: auto; min-width: 240px; margin-inline: 20px; }
  .done-screen { margin-inline: 20px; padding: 40px; }
  .done-actions { flex-direction: row; }
}

/* ── الحاسوب: لوحة الخطوات الكحلية بجانب الأسئلة ── */
@media (min-width: 980px) {
  .top { height: 68px; padding: 0 max(32px, calc((100vw - 1140px) / 2 + 32px)); }
  .shell { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 40px; max-width: 1140px; margin: 0 auto; padding: 32px 32px 0; align-items: start; }
  .rail {
    display: block; position: sticky; top: 24px; padding: 30px 26px; border-radius: 22px;
    background: var(--ink); color: #fff;
  }
  .rail-title { font-size: 22px; font-weight: 700; }
  .rail-sub { color: var(--on-ink-muted); font-size: 14px; margin-top: 6px; }
  .rail-steps { list-style: none; padding: 0; margin: 26px 0; }
  .rail-steps li { margin: 0; }
  .rail-steps button {
    display: flex; align-items: center; gap: 14px; width: 100%; padding: 9px 10px; margin: 0 -10px; border: 0; border-radius: 10px;
    background: none; color: rgba(255, 255, 255, .55); text-align: start; font-size: 15px; cursor: default;
  }
  .rail-steps button.done { color: rgba(255, 255, 255, .85); cursor: pointer; }
  .rail-steps button.done:hover { background: rgba(255, 255, 255, .07); }
  .rail-steps button.now { color: #fff; font-weight: 600; background: rgba(255, 255, 255, .1); }
  .rail-steps .m {
    flex-shrink: 0; width: 30px; height: 22px; display: grid; place-items: center; font-size: 12px; font-weight: 600;
    background: rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .8);
    clip-path: polygon(0 50%, 7px 0, 100% 0, calc(100% - 7px) 50%, 100% 100%, 7px 100%);
  }
  .rail-steps .done .m { background: var(--green); color: var(--ink); }
  .rail-steps .now .m { background: #fff; color: var(--ink); }
  .rail-foot { color: var(--on-ink-muted); font-size: 13px; border-top: 1px solid rgba(255, 255, 255, .14); padding-top: 18px; }

  .stage { max-width: none; margin: 0; }
  .step-head { background: none; color: var(--ink); padding: 6px 0 22px; }
  .step-count { color: var(--muted); }
  .step-title { font-size: 32px; font-weight: 700; }
  .step-lead { color: var(--muted); font-size: 16px; }
  .chev { display: none; }
  .sheet { margin: 0; padding: 34px 36px 10px; }
  .actions { padding: 18px 0 28px; background: linear-gradient(to top, var(--paper) 75%, rgba(242, 244, 248, 0)); }
  .actions .btn-go, .actions .btn-wa { flex: 0 0 auto; min-width: 220px; margin-inline-start: auto; }
  /* على الحاسوب اللوحة الجانبية كحلية، فيبقى الترحيب فاتحاً لتجنب كتلتين داكنتين */
  .intro-hero { background: none; color: var(--ink); padding: 6px 0 26px; }
  .intro-hero h1 { font-size: 40px; }
  .intro-hero p { color: var(--muted); }
  .intro-hero .intro-service { background: var(--ink-tint); color: var(--ink); }
  .intro-steps { margin: 0; padding-inline: 32px; }
  .intro .btn-go { margin: 26px 0 0; }
  .done-screen { margin: 0; }
}

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