/* =========================================================
   שאלון התאמה לקליניקה – עיצוב
   כל הצבעים מרוכזים במשתני ה-CSS למטה (:root)
   ========================================================= */

:root {
  /* --- פלטת צבעים --- */
  --bg:            #fffdf8;  /* רקע ראשי */
  --green-light:   #acd2be;  /* ירוק בהיר – הדגשות, רקעי כרטיסים, מצב פעיל */
  --green-dark:    #7e9f89;  /* ירוק כהה – כפתורים, כותרות משנה, פס התקדמות */
  --green-hover:   #6f9179;  /* אותו ירוק, מעט כהה יותר – למצב hover של כפתורים */
  --green-darker:  #5b7765;  /* גוון כהה לטקסט ירוק על רקע בהיר ולפוקוס */
  --on-green:      #12241a;  /* צבע הטקסט על גבי כפתורים ירוקים (ניגודיות 5.5:1) */
  --text:          #1c1c1c;  /* טקסט ראשי */
  --text-soft:     #4a4a4a;  /* טקסט משני */
  --placeholder:   #767676;  /* טקסט דהוי בתוך שדות */
  --line:          #e2ded3;  /* קווי הפרדה ומסגרות */
  --white:         #ffffff;
  --error:         #b3261e;  /* אדום להודעות שגיאה (ניגודיות תקינה) */
  --error-bg:      #fdf1f0;

  /* --- מידות --- */
  --radius:        16px;
  --radius-lg:     22px;
  --shadow:        0 4px 14px rgba(0, 0, 0, .06);
  --shadow-btn:    0 6px 16px rgba(126, 159, 137, .35);
  --maxw:          720px;
}

/* ---------- איפוס בסיסי ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0 0 48px;
  background: var(--bg);
  color: var(--text);
  font-family: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  direction: rtl;
}

/* טקסט מוסתר – זמין לקוראי מסך בלבד */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- ראש הדף / לוגו ---------- */
.site-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 26px 20px 10px;
}

/* השורה שמתחת ללוגו – שם ותפקיד.
   letter-spacing שולט במרווח בין האותיות:
   ערך שלילי = צפוף יותר, ערך חיובי = מרווח יותר */
.site-tagline {
  margin: 12px 0 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--green-darker);
  text-align: center;
  letter-spacing: -0.15px;
}

/* גודל הלוגו – לשינוי, ערוך את max-width בלבד */
.logo {
  max-width: 330px;
  max-height: 160px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* מוצג רק אם קובץ הלוגו חסר */
.logo-fallback {
  font-size: 24px;
  font-weight: 600;
  color: var(--green-darker);
  letter-spacing: .5px;
}

/* ---------- מבנה עמוד ---------- */
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 18px;
}

.screen { display: none; }
.screen.is-active { display: block; animation: fade .28s ease; }

@keyframes fade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- כרטיסים ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 34px 26px;
  margin-top: 18px;
}

.card--center { text-align: center; }

.title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 14px;
  color: var(--text);
}

.subtitle {
  font-size: 17px;
  color: var(--text-soft);
  margin: 0 0 26px;
}

.note {
  font-size: 14.5px;
  color: var(--text-soft);
  margin: 20px 0 0;
}

/* ---------- פס התקדמות ---------- */
.progress { margin: 22px 0 6px; }

.progress__list {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

/* הקו המחבר בין העיגולים */
.progress__list::before {
  content: "";
  position: absolute;
  top: 17px;
  right: 6%;
  left: 6%;
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  z-index: 0;
}

.progress__step {
  position: relative;
  z-index: 1;
  flex: 1;
  text-align: center;
}

.progress__dot {
  width: 36px;
  height: 36px;
  margin: 0 auto 6px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--line);
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, border-color .2s, color .2s, transform .2s;
}

.progress__label {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.3;
  display: block;
}

/* עיגול שהושלם – ירוק בהיר */
.progress__step.is-done .progress__dot {
  background: var(--green-light);
  border-color: var(--green-light);
  color: #23402f;
}

/* העיגול הפעיל – ירוק כהה ומודגש */
.progress__step.is-active .progress__dot {
  background: var(--green-dark);
  border-color: var(--green-darker);
  color: var(--on-green);
  transform: scale(1.12);
  box-shadow: 0 0 0 4px rgba(126, 159, 137, .22);
}

.progress__step.is-active .progress__label {
  color: var(--green-darker);
  font-weight: 600;
}

/* ---------- עמוד בשאלון ---------- */
.step { display: none; }
.step.is-active { display: block; animation: fade .28s ease; }

.step__head {
  background: var(--green-light);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 18px 0 4px;
}

.step__index {
  font-size: 13px;
  font-weight: 600;
  color: #23402f;
  opacity: .85;
  display: block;
}

.step__title {
  font-size: 21px;
  font-weight: 600;
  color: #1f3a2b;
  margin: 2px 0 0;
}

/* ---------- מצב תצוגה (?preview) – כל העמודים אחד מתחת לשני ---------- */
.preview-all .step { display: block; }

.preview-banner {
  background: var(--green-light);
  border: 1px dashed var(--green-darker);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-top: 18px;
  display: grid;
  gap: 4px;
}
.preview-banner strong { font-size: 16px; color: #1f3a2b; }
.preview-banner span { font-size: 14px; color: #23402f; }

/* ---------- שדות ---------- */
.field {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-top: 14px;
}

.field__label {
  display: block;
  font-size: 16.5px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 10px;
}

.field__required { color: var(--green-darker); margin-inline-start: 3px; }

.field__hint {
  display: block;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--text-soft);
  margin-top: 2px;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  font-family: inherit;
  font-size: 16px; /* 16px ומעלה – מונע זום אוטומטי באייפון */
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  transition: border-color .18s, box-shadow .18s, background .18s;
  direction: rtl;
}

textarea { min-height: 110px; resize: vertical; line-height: 1.6; }

/* טקסט דהוי בתוך המשבצת – נעלם בהקלדה */
::placeholder { color: var(--placeholder); opacity: 1; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green-dark);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(126, 159, 137, .22);
}

/* שדה לקריאה בלבד (גיל מחושב) */
input[readonly] {
  background: #f4f2ec;
  color: var(--text-soft);
  cursor: default;
}
input[readonly]:focus { box-shadow: none; border-color: var(--line); }

/* טקסט דהוי כל עוד לא נבחרה אפשרות ב-select */
select:has(option[value=""]:checked) { color: var(--placeholder); }
select option { color: var(--text); }

select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a4a4a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  background-size: 18px;
  padding-inline-start: 40px;
}

/* ---------- בחירה: radio / checkbox ---------- */
.options { display: grid; gap: 10px; }

.option {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color .16s, background .16s;
}

.option:hover { border-color: var(--green-light); }

.option input { flex: 0 0 auto; margin: 3px 0 0; width: 19px; height: 19px; accent-color: var(--green-dark); cursor: pointer; }

.option span { font-size: 16px; line-height: 1.5; }

/* מצב נבחר – רקע ירוק בהיר */
.option.is-checked {
  background: var(--green-light);
  border-color: var(--green-dark);
}

.option:focus-within {
  border-color: var(--green-dark);
  box-shadow: 0 0 0 3px rgba(126, 159, 137, .22);
}

/* שדה "אחר" שנפתח מתחת לרשימת הבחירה */
.other-box { margin-top: 10px; }
.other-box[hidden] { display: none; }

/* צ'קבוקס ההסכמה */
.consent { align-items: flex-start; }
.consent span { font-size: 15px; color: var(--text-soft); }

/* ---------- תיבת הדגשה (התזכורת בתחתית עמוד 6) ---------- */
.callout {
  background: var(--green-light);
  border: 1.5px solid var(--green-dark);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-top: 16px;
  display: grid;
  gap: 5px;
  text-align: center;
}
.callout strong { font-size: 17.5px; color: #1f3a2b; }
.callout span   { font-size: 15px; color: #23402f; line-height: 1.55; }

/* ---------- הודעות שגיאה ---------- */
.error {
  display: block;
  color: var(--error);
  font-size: 14.5px;
  margin-top: 8px;
}
.error[hidden] { display: none; }

.field.has-error { border-color: var(--error); }
.field.has-error input:not([type="radio"]):not([type="checkbox"]),
.field.has-error select,
.field.has-error textarea { border-color: var(--error); }

.form-alert {
  background: var(--error-bg);
  border: 1px solid var(--error);
  color: var(--error);
  border-radius: 12px;
  padding: 13px 16px;
  margin-top: 16px;
  font-size: 15.5px;
}
.form-alert[hidden] { display: none; }

/* ---------- כפתורים ---------- */
.btn {
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  border-radius: 999px;
  border: 2px solid transparent;
  padding: 15px 30px;
  cursor: pointer;
  transition: transform .14s, box-shadow .14s, background .16s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  line-height: 1.2;
}

.btn:focus-visible { outline: 3px solid var(--green-darker); outline-offset: 3px; }

/* הכפתור הראשי – ירוק מלא עם טקסט כהה (ניגודיות תקינה לפי WCAG AA) */
.btn--primary {
  background: var(--green-dark);
  color: var(--on-green);
  box-shadow: var(--shadow-btn);
}
.btn--primary:hover { background: var(--green-hover); transform: translateY(-2px); }
.btn--primary:active { transform: translateY(0); }

.btn--ghost {
  background: var(--white);
  color: var(--green-darker);
  border-color: var(--green-light);
  box-shadow: var(--shadow);
}
.btn--ghost:hover { background: var(--green-light); color: #23402f; }

.btn--lg { font-size: 19px; padding: 17px 40px; }

.btn[hidden] { display: none; }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* שורת הניווט בין העמודים */
.nav-row {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin-top: 26px;
}

.nav-row .btn { flex: 1 1 0; }

/* ---------- מסך טעינה ---------- */
.spinner {
  width: 46px;
  height: 46px;
  margin: 0 auto 20px;
  border: 4px solid var(--green-light);
  border-top-color: var(--green-dark);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- מסך תודה ---------- */
.check-badge {
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--green-light);
  color: #1f3a2b;
  font-size: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- מובייל ---------- */
@media (max-width: 620px) {
  body { font-size: 16px; }
  .page { padding: 0 12px; }
  .card { padding: 26px 18px; border-radius: var(--radius); }
  .title { font-size: 23px; }
  .subtitle { font-size: 16px; }
  .field { padding: 15px 15px; }
  .logo { max-width: 260px; max-height: 120px; }
  .site-tagline { font-size: 14.5px; margin-top: 10px; }

  /* פס ההתקדמות – עיגולים קטנים יותר, כותרות מוסתרות חוץ מהפעילה */
  .progress__dot { width: 30px; height: 30px; font-size: 13.5px; }
  .progress__list::before { top: 14px; }
  /* במובייל מוצגת רק הכותרת של העמוד הפעיל, בתוך רוחב העמודה שלו */
  .progress__label { display: none; }
  .progress__step.is-active .progress__label {
    display: block;
    font-size: 11.5px;
    padding: 0 2px;
  }

  /* בעמודים הצרים – כפתורי הניווט אחד ליד השני, גדולים */
  .nav-row { gap: 10px; }
  .btn { padding: 14px 20px; font-size: 16px; }
  .btn--lg { font-size: 17px; padding: 16px 24px; }
}

/* כיבוד העדפת "פחות תנועה" */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
