/* ===================================================
   client-intake-app — نموذج بيانات المشروع
   RTL / Mobile-First / بدون مكتبات خارجية
   ألوان متناسقة مع "واجهة برو"
   =================================================== */

/* ---- المتغيرات اللونية (مطابقة لواجهة برو) ---- */
:root {
  --navy: #0f2a43;
  --navy-soft: #1c3d5a;
  --white: #ffffff;
  --gray-light: #f4f6f8;
  --gray: #6b7785;
  --gray-border: #e2e6ea;
  --whatsapp: #25d366;
  --whatsapp-dark: #1da851;
  --danger: #d64545;
  --text: #1f2a36;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 6px 20px rgba(15, 42, 67, 0.08);
  --max-width: 720px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: "Segoe UI", Tahoma, "Geeza Pro", "Noto Sans Arabic", system-ui, -apple-system, Arial, sans-serif;
  color: var(--text);
  background: var(--gray-light);
  line-height: 1.7;
  font-size: 16px;
}

a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }

/* ---- الحاويات ---- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 18px;
}
.container-narrow { max-width: 640px; }

/* ===================================================
   شريط التقدم العلوي
   =================================================== */
.topbar {
  background: linear-gradient(135deg, var(--navy), var(--navy-soft));
  color: #fff;
  padding: 22px 0 18px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.brand { font-size: 1.3rem; font-weight: 800; }
.brand span { color: var(--whatsapp); }
.topbar-sub { color: rgba(255,255,255,.8); font-size: .9rem; margin-bottom: 16px; }

.progress {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 12px;
}
.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  text-align: center;
}
.progress-step .dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.7);
  font-weight: 700;
  font-size: .9rem;
  border: 2px solid transparent;
  transition: all .2s ease;
}
.progress-step .label { font-size: .72rem; color: rgba(255,255,255,.65); }
.progress-step.is-active .dot { background: var(--whatsapp); color: #fff; }
.progress-step.is-active .label { color: #fff; font-weight: 700; }
.progress-step.is-done .dot { background: var(--whatsapp-dark); color: #fff; }
.progress-step.is-done .label { color: rgba(255,255,255,.9); }

.progress-bar {
  height: 6px;
  background: rgba(255,255,255,.18);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar span {
  display: block;
  height: 100%;
  width: 20%;
  background: var(--whatsapp);
  border-radius: 99px;
  transition: width .3s ease;
}

/* ===================================================
   النموذج والخطوات
   =================================================== */
main { padding: 24px 0 40px; }

#intakeForm {
  background: var(--white);
  border: 1px solid var(--gray-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 20px;
}

.step { display: none; animation: fade .25s ease; }
.step.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.step-title { color: var(--navy); font-size: 1.25rem; margin-bottom: 4px; }
.step-lead { color: var(--gray); font-size: .92rem; margin-bottom: 20px; }

/* ---- الحقول ---- */
.field { margin-bottom: 18px; border: none; }
.field > label,
.field > legend {
  display: block;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 7px;
  font-size: .95rem;
}
.req { color: var(--danger); }
.opt { color: var(--gray); font-weight: 400; font-size: .82rem; }

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="file"],
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-border);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}
textarea { resize: vertical; }

input:focus, textarea:focus {
  outline: none;
  border-color: var(--whatsapp);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, .15);
}
input:disabled, textarea:disabled {
  background: var(--gray-light);
  cursor: not-allowed;
  color: var(--gray);
}
input.invalid, textarea.invalid { border-color: var(--danger); }

/* ---- خيارات الراديو كبطاقات ---- */
.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.choice-grid-2 { grid-template-columns: 1fr 1fr; max-width: 280px; }

.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: #fff;
  font-size: .92rem;
  transition: all .15s ease;
}
.choice input { accent-color: var(--whatsapp); width: 18px; height: 18px; flex-shrink: 0; }
.choice:hover { border-color: var(--navy-soft); }
.choice:has(input:checked) {
  border-color: var(--whatsapp);
  background: rgba(37, 211, 102, .07);
  font-weight: 700;
}

/* ===================================================
   المنتجات الديناميكية
   =================================================== */
.product-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 12px; }

.product-item {
  border: 1.5px solid var(--gray-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--gray-light);
  position: relative;
}
.product-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.product-item-head .idx { font-weight: 700; color: var(--navy); font-size: .9rem; }
.product-item .field { margin-bottom: 10px; }
.product-item .field:last-child { margin-bottom: 0; }
.product-item input,
.product-item textarea { background: #fff; }

.remove-product {
  background: transparent;
  border: none;
  color: var(--danger);
  font-weight: 700;
  cursor: pointer;
  font-size: .85rem;
  padding: 2px 6px;
}
.remove-product:hover { text-decoration: underline; }

.row-2 { display: grid; grid-template-columns: 1fr; gap: 10px; }

/* ===================================================
   صندوق المراجعة
   =================================================== */
.review-box {
  border: 1.5px solid var(--gray-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: var(--gray-light);
  font-size: .9rem;
  white-space: pre-wrap;
  line-height: 1.9;
  color: var(--text);
  max-height: 360px;
  overflow-y: auto;
}
.review-box .rv-group { font-weight: 800; color: var(--navy); margin-top: 12px; display: block; }
.review-box .rv-group:first-child { margin-top: 0; }
.review-box .rv-empty { color: var(--gray); }

/* ===================================================
   الملاحظات والتنبيهات
   =================================================== */
.note {
  background: rgba(37, 211, 102, .08);
  border: 1px solid rgba(37, 211, 102, .3);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: .85rem;
  color: var(--navy);
  margin-top: 6px;
}
.form-alert {
  background: rgba(214, 69, 69, .08);
  border: 1px solid rgba(214, 69, 69, .35);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: .9rem;
  font-weight: 600;
  margin: 16px 0 0;
}

/* ===================================================
   الأزرار
   =================================================== */
.btn {
  display: inline-block;
  padding: 13px 26px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform .15s ease, background .2s ease, color .2s ease, border-color .2s ease;
  text-align: center;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--whatsapp); color: #fff; }
.btn-primary:hover { background: var(--whatsapp-dark); }
.btn-outline { background: transparent; color: var(--navy); border-color: var(--gray-border); }
.btn-outline:hover { border-color: var(--navy); }
.btn-sm { padding: 9px 18px; font-size: .9rem; }

.form-nav {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  border-top: 1px solid var(--gray-border);
  padding-top: 20px;
}
.form-nav .btn { flex: 1; }

/* ===================================================
   الفوتر
   =================================================== */
.site-footer {
  text-align: center;
  color: var(--gray);
  font-size: .8rem;
  padding: 20px 0 30px;
}

/* ===================================================
   نقاط التجاوب (Tablet / Desktop)
   =================================================== */
@media (min-width: 600px) {
  .row-2 { grid-template-columns: 2fr 1fr; }
  .choice-grid { grid-template-columns: repeat(3, 1fr); }
  .progress-step .label { font-size: .8rem; }
}
