/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, sans-serif; background: #f0f0f0; color: #222; line-height: 1.5; }

/* ── UI Shell ── */
#ui-shell { max-width: 720px; margin: 0 auto; padding: 2rem 1rem; }

header { margin-bottom: 2rem; }
header h1 { font-size: 2rem; font-weight: 700; color: #222; }
.subtitle { color: #555; margin-top: .25rem; }
.privacy-note {
  margin-top: .75rem;
  padding: .5rem .75rem;
  background: #e8f5e9;
  border-left: 4px solid #43a047;
  border-radius: 4px;
  font-size: .9rem;
  color: #2e7d32;
}

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card h2 { font-size: 1.1rem; margin-bottom: 1rem; color: #333; }
.hidden { display: none !important; }

/* ── Drop zone ── */
#drop-zone {
  border: 2px dashed #aaa;
  border-radius: 6px;
  padding: 2rem;
  text-align: center;
  color: #666;
  transition: border-color .2s, background .2s;
}
#drop-zone.drag-over { border-color: #1976d2; background: #e3f2fd; }
#drop-zone p { margin-bottom: .75rem; }

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: .5rem 1.25rem;
  border: 2px solid #555;
  border-radius: 5px;
  background: #fff;
  color: #333;
  font-size: .95rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.btn:hover { background: #f0f0f0; }
.btn-primary { background: #1976d2; color: #fff; border-color: #1976d2; }
.btn-primary:hover { background: #1565c0; }

/* ── Options ── */
.option-row {
  margin-bottom: .85rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.option-row label { cursor: pointer; display: flex; align-items: center; gap: .4rem; }
.option-row select { padding: .3rem .5rem; border-radius: 4px; border: 1px solid #ccc; }

/* ── Options groups ── */
.options-group {
  background: #f7f8ff;
  margin-bottom: 1rem;
  padding: 0.6rem 0.75rem 0.25rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
}
.options-group-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
  margin-bottom: 0.4rem;
}
.options-group .option-row {
  margin-bottom: 0.5rem;
}

/* ── Validation box ── */
.validation-box {
  padding: .75rem .9rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: .9rem;
}
.validation-box--ok {
  background: #e8f5e9;
  border-left: 4px solid #2e7d32;
  color: #2e7d32;
}
.validation-box--warn {
  background: #fff8e1;
  border-left: 4px solid #ffb300;
  color: #795548;
}
.validation-box--error {
  background: #ffebee;
  border-left: 4px solid #c62828;
  color: #b71c1c;
}
#validation-details {
  margin-top: .4rem;
  padding-left: 1.1rem;
}
#validation-details li { margin-bottom: .15rem; }

/* ── Misc ── */
.muted { color: #888; font-size: .85rem; }

/* ── Print hint ── */
.print-hint {
  font-size: 0.8em;
  color: #888;
  margin-top: 0.4em;
}

/* ── Questionnaire preview (screen) ── */
#questionnaire-output { max-width: 720px; margin: 0 auto 3rem; padding: 0 1rem; }
.q-document { background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.q-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #222;
  padding-bottom: .5rem;
}

/* Groups & repeats */
.q-group { border-left: 4px solid #1976d2; padding-left: 1rem; margin: 1.25rem 0; }
.q-group-header { font-weight: 600; font-size: 1.05rem; color: #1976d2; margin-bottom: .5rem; }
.q-repeat { border-left: 4px solid #e65100; padding-left: 1rem; margin: 1.25rem 0; }
.q-repeat-header { font-weight: 600; color: #e65100; margin-bottom: .5rem; }

/* Individual question */
.q-item {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eee;
}
.q-header { display: flex; align-items: baseline; gap: .4rem; margin-bottom: .2rem; }
.q-number { font-weight: 700; font-size: .95rem; color: #555; }
.q-varname { font-size: .85rem; color: #555; font-family: monospace; }
.q-required { color: #c62828; font-weight: 700; font-size: 1rem; }
.q-label { font-size: 1rem; font-weight: 500; margin-bottom: .35rem; }
.q-routing { font-size: 0.90rem; color: #6a1b9a; margin: .25rem 0; }
.q-hint { font-size: 0.9rem; color: #1565c0; margin: .25rem 0; font-style: italic; }
.q-constraint { font-size: 0.9rem; color: #bf360c; margin: .25rem 0; }

/* Invisible / technical questions */
.q-item--invisible { opacity: 0.65; background: #fafafa; }
.q-item--invisible .q-label,
.q-item--invisible .q-routing,
.q-item--invisible .q-hint,
.q-item--invisible .q-constraint { color: #555; }

/* Answer areas */
.q-answer { margin-top: .5rem; }
.q-answer-line { border-bottom: 1px solid #aaa; margin-bottom: .6rem; height: 1.6rem; }
.q-answer-line--short { max-width: 200px; }
.q-answer-date { font-size: 1rem; letter-spacing: .05em; }

/* Choices */
.q-choices { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 1.5rem; }
.q-choices li { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; break-inside: avoid; }
.choice-circle {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1.5px solid #444;
  display: inline-block;
  flex-shrink: 0;
}
.choice-square {
  width: 13px; height: 13px;
  border: 1.5px solid #444;
  display: inline-block;
  flex-shrink: 0;
}

/* ── Feedback link ── */
.feedback-link-row {
  text-align: right;
  margin-bottom: 0.25rem;
}
.feedback-link-row a {
  font-size: 0.8rem;
  color: #666;
  text-decoration: underline dotted;
  cursor: pointer;
}
.feedback-link-row a:hover { color: #333; }

/* ── Feedback modal ── */
.feedback-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.feedback-modal.open { display: flex; }
.feedback-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}
.feedback-modal-dialog {
  position: relative;
  background: #ffffff;
  border-radius: 8px;
  padding: 1rem 1.1rem 1rem;
  width: 95%;
  max-width: 380px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  font-size: 0.9rem;
  z-index: 1;
}
.feedback-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.feedback-modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 0.2rem;
  line-height: 1;
}
.feedback-label { display: block; margin-bottom: 0.4rem; }
.feedback-label select,
.feedback-label input,
.feedback-label textarea {
  width: 100%;
  box-sizing: border-box;
  font-size: 0.85rem;
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
  border: 1px solid #ccc;
}
.feedback-submit { margin-top: 0.25rem; width: 100%; }
.feedback-status { margin-top: 0.3rem; font-size: 0.8rem; }

/* ── Footer ── */
footer.site-footer {
  margin-top: 3rem;
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: #bbb;
}
footer.site-footer a {
  color: inherit;
  text-decoration: underline;
}

/* ── Print overrides ── */
@media print {
  .feedback-modal    { display: none !important; }
  .feedback-link-row { display: none !important; }
  footer.site-footer { display: none !important; }
}

/* ── Overview box ── */
.overview-box {
  margin-top: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 6px;
  background: #f5f5f5;
  border-left: 4px solid #1976d2;
  font-size: 0.9rem;
  color: #333;
}

#overview-summary {
  font-weight: 600;
}