/* =====================================================================
   form.css — generic styling for stripped QFTAP survey forms
   Works on any form cleaned with strip-survey.js (no class/data hooks;
   relies on element/id selectors that survive stripping).

   Provides: Scheherazade New (Google Font), right-to-left layout,
   and each radio button on the SAME line as its option text.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Scheherazade+New:wght@400;700&display=swap');

:root {
  --accent: #800000;       /* matches the maroon used in the forms */
  --ink:    #1a1a1a;
  --line:   #e3e3e3;
}

/* ---- Right-to-left + Arabic font everywhere -------------------------- */
html { direction: rtl; }

body {
  font-size: 1.15rem;       /* Scheherazade renders small; bump the base */
  line-height: 2;           /* room for tashkeel (diacritics) */
  color: var(--ink);
  text-align: right;
  max-width: 820px;
  margin: 2rem auto;
  padding: 0 1.25rem;
  background: #fafafa;
}

/* Force the Arabic font even if a form carries its own inline fonts */
body, body * {
  font-family: 'Scheherazade New', 'Times New Roman', serif !important;
}

/* ---- Question blocks ------------------------------------------------- */
[id^="question-field-"] {
  margin: 0 0 1.5rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend   { display: block; width: 100%; padding: 0; }

/* Question title: keep number + text flowing on one line (not stacked) */
[id^="question-title-"] {
  font-weight: 700;
  margin: 0 0 .9rem;
}
[id^="question-title-"] div { display: inline; }   /* un-stack inner blocks */

/* ---- Answer options: radio on the SAME line as the option text ------ */
/* The option container is the <div> that directly holds the radio input. */
div:has(> input[type="radio"]) {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: .4rem 0;
  padding: .35rem .5rem;
  border-radius: 6px;
}
div:has(> input[type="radio"]):hover { background: #f4efef; }

input[type="radio"] {
  flex: 0 0 auto;
  width: 1.15em;
  height: 1.15em;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

label { flex: 1 1 auto; cursor: pointer; }
/* Fallback for browsers without :has() — inline flow still keeps the text
   beside the radio instead of dropping it to a new line. */
label div { display: inline; }

/* ---- Submit button -------------------------------------------------- */
button[type="submit"] {
  font-size: 1.1rem;
  margin-top: 1.25rem;
  padding: .65rem 1.8rem;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
button[type="submit"]:hover { opacity: .92; }
