/* ═══════════════════════════════════════════════
   طلب ميزات خاصة — نظام خدام الوحي
   Mobile-first، بهوية الصفحة الأم (زمردي + ذهبي)
═══════════════════════════════════════════════ */
:root {
  --em-950: #022c22;
  --em-900: #064e3b;
  --em-700: #047857;
  --em-600: #059669;
  --em-50:  #ecfdf5;
  --gold:   #f59e0b;
  --ink:    #0f172a;
  --ink-2:  #475569;
  --ink-3:  #94a3b8;
  --line:   #e2e8f0;
  --bg:     #f8fafc;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --bar: 52px;
  --action: 68px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
body {
  font-family: 'Cairo', system-ui, sans-serif;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
a, button, input, textarea, label { touch-action: manipulation; font-family: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ── الشريط العلوي ── */
.qf-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  height: calc(var(--bar) + var(--safe-top));
  padding: var(--safe-top) 0.5rem 0;
  color: #fff;
  background: var(--em-950);
}
.qf-bar-title { flex: 1; text-align: center; font-size: 1rem; font-weight: 800; }
.qf-bar-btn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  color: #d1fae5;
  text-decoration: none;
  border-radius: 50%;
}
.qf-bar-btn:active { background: rgba(255, 255, 255, 0.12); }

/* ── المحتوى ── */
.qf {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 0 calc(var(--action) + var(--safe-bottom) + 1.5rem);
}
.qf-hero {
  padding: 1.5rem 1.1rem 1.3rem;
  color: #fff;
  background: linear-gradient(160deg, var(--em-950), var(--em-900));
  border-radius: 0 0 26px 26px;
}
.qf-tag {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.25rem 0.8rem;
  font-size: 0.75rem; font-weight: 800;
  color: #fde68a;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}
.qf-hero h1 { margin: 0.7rem 0 0.3rem; font-size: clamp(1.6rem, 7vw, 2.4rem); font-weight: 900; line-height: 1.3; }
.qf-hero h1 span { color: var(--gold); }
.qf-hero p { font-size: 0.92rem; color: #a7f3d0; max-width: 34rem; }

.qf-steps { display: flex; gap: 0.4rem; margin-top: 1.1rem; list-style: none; }
.qf-steps li {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.45rem 0.3rem;
  font-size: 0.78rem; font-weight: 700;
  color: #6ee7b7;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  transition: background 0.25s, color 0.25s;
}
.qf-steps b {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}
.qf-steps li.is-on { color: var(--em-950); background: var(--gold); }
.qf-steps li.is-on b { background: rgba(2, 44, 34, 0.18); }

.qf-panel { padding: 1.3rem 1rem 0; animation: qf-in 0.28s ease-out; }
@keyframes qf-in { from { opacity: 0; transform: translateY(10px); } }
.qf-h { font-size: 1.15rem; font-weight: 900; color: var(--em-950); margin-bottom: 0.8rem; }

/* عدد المدارس */
.qf-schools {
  display: flex; align-items: center; justify-content: space-between; gap: 0.8rem;
  padding: 0.8rem 0.95rem;
  margin-bottom: 0.8rem;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 16px;
}
.qf-schools b { display: block; font-size: 0.92rem; font-weight: 800; color: var(--em-950); }
.qf-schools small { font-size: 0.75rem; color: var(--ink-2); }
.qf-stepper { display: flex; align-items: center; gap: 0.2rem; flex-shrink: 0; }
.qf-stepper button {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  font-size: 0.85rem;
  color: var(--em-700);
  background: var(--em-50);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}
.qf-stepper button:active { transform: scale(0.94); }
.qf-stepper output { min-width: 2.2rem; text-align: center; font-size: 1.2rem; font-weight: 900; font-variant-numeric: tabular-nums; }

.qf-item-price {
  flex-shrink: 0;
  font-size: 0.74rem; font-weight: 800;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fef3c7;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}
.qf-review .is-total dt, .qf-review .is-total dd { font-weight: 900; color: var(--em-700); font-size: 1rem; }

/* عدد الطلاب + تحديد الكل + الاشتراك السنوي */
.qf-sizebox { margin-bottom: 1rem; }
.qf-h--sub { font-size: 1rem; margin-top: 1.4rem; }
.qf-curbox { display: grid; gap: 0.35rem; margin-bottom: 0.8rem; }
.qf-curbox > span { font-size: 0.85rem; font-weight: 800; color: var(--em-900); }
.qf-seg button { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.35; min-height: 56px; }
.qf-seg small { font-size: 0.68rem; font-weight: 700; color: #b45309; }
.qf-tools {
  position: sticky;
  top: calc(var(--bar) + var(--safe-top) + 6px);
  z-index: 20;
  display: flex; gap: 0.5rem;
  margin-bottom: 1rem;
}
.qf-tools .qf-search { position: static; flex: 1; min-width: 0; margin: 0; }
.qf-all {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 0.4rem;
  height: 48px;
  padding: 0 0.9rem;
  font-size: 0.82rem; font-weight: 800;
  color: var(--em-700);
  background: #fff;
  border: 1.5px solid var(--em-600);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  white-space: nowrap;
}
.qf-all[aria-pressed="true"] { color: #fff; background: var(--em-600); }
.qf-all:active { transform: scale(0.96); }
.qf-annual {
  display: flex; gap: 0.6rem; align-items: flex-start;
  padding: 0.85rem 1rem;
  margin-top: 0.4rem;
  font-size: 0.85rem; color: var(--ink-2);
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 16px;
}
.qf-annual i { color: #b45309; margin-top: 0.3rem; }
.qf-annual b { color: #92400e; }

/* بحث */
.qf-search {
  position: sticky;
  top: calc(var(--bar) + var(--safe-top) + 6px);
  z-index: 20;
  display: flex; align-items: center; gap: 0.6rem;
  height: 48px;
  padding: 0 1rem;
  margin-bottom: 1rem;
  color: var(--ink-3);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}
.qf-search:focus-within { border-color: var(--em-600); }
.qf-search input {
  flex: 1; min-width: 0; height: 100%;
  font-size: 16px;
  color: var(--ink);
  background: transparent;
  border: 0; outline: 0;
}

/* مجموعات الميزات */
.qf-group { margin-bottom: 1.2rem; }
.qf-group-head {
  display: flex; align-items: center; gap: 0.6rem;
  margin-bottom: 0.55rem;
  font-size: 0.95rem; font-weight: 800; color: var(--em-900);
}
.qf-group-head i {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  font-size: 0.85rem;
  color: var(--em-700);
  background: var(--em-50);
  border-radius: 10px;
}
.qf-group-head small { margin-inline-start: auto; font-size: 0.72rem; font-weight: 700; color: var(--ink-3); }
.qf-list { display: grid; gap: 0.5rem; grid-template-columns: minmax(0, 1fr); }

.qf-item {
  position: relative;
  display: flex; align-items: center; gap: 0.75rem;
  min-height: 52px;
  padding: 0.6rem 0.9rem;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.12s;
}
.qf-item:active { transform: scale(0.985); }
.qf-item input { position: absolute; opacity: 0; pointer-events: none; }
.qf-check {
  flex-shrink: 0;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  font-size: 0.72rem;
  color: transparent;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  transition: all 0.18s;
}
.qf-item-name { flex: 1; min-width: 0; font-size: 0.92rem; font-weight: 700; line-height: 1.5; }
.qf-item:has(input:checked) { background: var(--em-50); border-color: var(--em-600); }
.qf-item:has(input:checked) .qf-check { color: #fff; background: var(--em-600); border-color: var(--em-600); }
.qf-item:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }

.qf-empty { padding: 1.5rem 1rem; text-align: center; color: var(--ink-2); font-size: 0.9rem; }

/* النموذج */
.qf-form { display: grid; gap: 1rem; }
.qf-field { display: grid; gap: 0.35rem; }
.qf-field > span { font-size: 0.85rem; font-weight: 800; color: var(--em-900); }
.qf-field em { color: #dc2626; font-style: normal; }
.qf-field input,
.qf-field textarea {
  width: 100%;
  min-height: 50px;
  padding: 0.7rem 0.95rem;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  outline: 0;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.qf-field textarea { resize: vertical; line-height: 1.7; }
.qf-field input:focus,
.qf-field textarea:focus { border-color: var(--em-600); box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.14); }
.qf-field input.is-bad { border-color: #dc2626; }

.qf-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; }
.qf-seg button {
  min-height: 48px;
  padding: 0.3rem;
  font-size: 0.82rem; font-weight: 700;
  color: var(--ink-2);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
}
.qf-seg button[aria-checked="true"] { color: var(--em-900); background: var(--em-50); border-color: var(--em-600); }
.qf-error { min-height: 1.4rem; font-size: 0.85rem; font-weight: 700; color: #dc2626; }

/* المراجعة */
.qf-review { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.qf-review h3 {
  padding: 0.6rem 1rem;
  font-size: 0.8rem; font-weight: 800;
  color: var(--em-900);
  background: var(--em-50);
}
.qf-review ul { list-style: none; padding: 0.4rem 1rem; }
.qf-review li {
  display: flex; gap: 0.6rem;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  border-bottom: 1px solid #f1f5f9;
}
.qf-review li:last-child { border: 0; }
.qf-review li i { color: var(--em-600); margin-top: 0.35rem; font-size: 0.75rem; }
.qf-review dl { padding: 0.4rem 1rem; }
.qf-review dl div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; font-size: 0.9rem; border-bottom: 1px solid #f1f5f9; }
.qf-review dl div:last-child { border: 0; }
.qf-review dt { color: var(--ink-2); flex-shrink: 0; }
.qf-review dd { font-weight: 700; text-align: end; overflow-wrap: anywhere; }
.qf-note { margin-top: 0.9rem; font-size: 0.82rem; color: var(--ink-2); }
.qf-note i { color: var(--gold); }

/* ── شريط الإجراء السفلي ── */
.qf-action {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 60;
  display: flex; align-items: center; gap: 0.5rem;
  height: calc(var(--action) + var(--safe-bottom));
  padding: 0 max(0.9rem, env(safe-area-inset-right, 0px)) var(--safe-bottom) max(0.9rem, env(safe-area-inset-left, 0px));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06);
}
.qf-count { flex: 1; min-width: 0; font-size: 0.8rem; color: var(--ink-2); line-height: 1.3; }
.qf-count b { display: block; font-size: 1.2rem; font-weight: 900; color: var(--em-700); white-space: nowrap; font-variant-numeric: tabular-nums; }
.qf-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 48px;
  padding: 0 1.3rem;
  font-size: 0.95rem; font-weight: 800;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  background: var(--em-600);
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.12s, opacity 0.2s;
}
.qf-btn:active { transform: scale(0.96); }
.qf-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.qf-btn--ghost { color: var(--ink-2); background: #f1f5f9; padding: 0 1rem; }
.qf-btn--wa { background: #16a34a; }

/* ── شاشات أوسع ── */
@media (min-width: 640px) {
  .qf-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qf-hero { padding: 2.2rem 1.6rem 1.8rem; }
  .qf-panel { padding-inline: 1.4rem; }
}
@media (min-width: 900px) {
  .qf-hero { margin-top: 1.2rem; border-radius: 26px; }
  .qf-action { inset-inline: auto; left: 50%; transform: translateX(-50%); width: 880px; bottom: 1rem; border: 1px solid var(--line); border-radius: 20px; }
  .qf-form { grid-template-columns: 1fr 1fr; }
  .qf-form > :nth-child(n+3) { grid-column: 1 / -1; }
}
@media (max-width: 360px) {
  .qf-btn { padding: 0 0.8rem; font-size: 0.86rem; }
  .qf-count b { font-size: 1.05rem; }
  .qf-count > span { font-size: 0.7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .qf-panel { animation: none; }
  html { scroll-behavior: auto; }
}
