/* The add form. Tokens (colours, header height) come from ../styles.css. */

.form-page { height: auto; min-height: 100%; background: var(--panel); }

.form-page #topbar { position: sticky; top: 0; }

.back {
  margin-inline-start: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  font-size: 13.5px;
  text-decoration: none;
  background: var(--bg);
}
.back:hover { background: var(--panel); }
.back svg { width: 16px; height: 16px; }

.form-wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 18px 6px;
  margin-bottom: 14px;
}
.section h2 { font-size: 16px; margin: 0 0 14px; }

details.section { padding: 0; }
details.section > summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 600;
  font-size: 15px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
details.section > summary::-webkit-details-marker { display: none; }
/* Physical borders on purpose: logical ones flip under RTL. Closed points
   left (the reading direction), open points down. */
details.section > summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(135deg);
  transition: transform .15s;
}
details.section[open] > summary::before { transform: rotate(45deg); }
/* English text runs left to right, so closed points right instead. */
html[lang="en"] details.section:not([open]) > summary::before { transform: rotate(-45deg); }
details.section > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 12px; }
.section-body { padding: 0 18px 6px; }

.note {
  margin: 0 0 16px;
  padding: 10px 12px;
  background: var(--panel);
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}
.note a { color: var(--accent); font-weight: 600; white-space: nowrap; }

/* ---------- fields ---------- */

.field { margin: 0 0 16px; padding: 0; border: 0; position: relative; min-width: 0; }
.field > label, .field > legend {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  padding: 0;
}
.req { color: var(--accent); }
.private { font-weight: 400; color: var(--muted); font-size: 12.5px; }

.field input[type="text"], .field input[type="tel"], .field select, .field textarea {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 44px;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
/* Phone and link fields are LTR, but on the Hebrew page their placeholders and
   values sit at the right edge like everything else. */
html[lang="he"] .field input[dir="ltr"] { text-align: right; }

.field [aria-invalid="true"], .field[aria-invalid="true"] .pill { border-color: var(--accent); }

.hint { margin: 5px 0 0; font-size: 12.5px; color: var(--muted); }
.field-error { margin: 5px 0 0; font-size: 13px; color: var(--accent); font-weight: 600; }

.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { position: relative; cursor: pointer; }
.pill input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pill span {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 14.5px;
  background: var(--bg);
}
.pill input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pill input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-weak); }

/* ---------- address suggestions ---------- */

.places-anchor { position: relative; }
.places {
  position: absolute;
  inset-inline: 0;
  top: 100%;
  z-index: 50;
  margin: 4px 0 0;
  padding: 4px 0;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  max-height: 320px;
  overflow-y: auto;
}
.places [role="option"] {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  cursor: pointer;
}
.places [role="option"][aria-selected="true"], .places [role="option"]:hover { background: var(--panel); }
.places-main { font-size: 14.5px; }
.places-sub { font-size: 12.5px; color: var(--muted); }
.places-loading { padding: 9px 12px; font-size: 13.5px; color: var(--muted); }
.places-credit { padding: 6px 12px 4px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); margin-top: 4px; }

/* ---------- duplicates ---------- */

.dupes {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid #f0d9a8;
  background: #fff8e8;
  border-radius: 8px;
  font-size: 13.5px;
}
.dupes p { margin: 0 0 6px; font-weight: 600; }
.dupes p.muted { margin: 6px 0 0; font-weight: 400; color: var(--muted); }
.dupes ul { margin: 0; padding-inline-start: 18px; }
.dupes li { margin: 2px 0; }
.dupes a { color: var(--accent); }

/* ---------- submit ---------- */

/* Hidden by clipping, not by an offset: pushed 9999px toward the start, it
   made the English (LTR text in an RTL page) form scroll sideways. */
.hp { position: absolute; top: 0; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

#captcha { margin: 4px 0 12px; min-height: 0; }

.status { margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; font-size: 14px; background: var(--bg); border: 1px solid var(--border); }
.status.error { border-color: var(--accent); background: var(--accent-weak); color: var(--accent-dark); }
.status.info { background: #eef4fd; border-color: #c9dbf5; color: #1d3f72; }

#submit, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  padding: 0 28px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
#submit { width: 100%; }
#submit:hover, .button:hover { background: var(--accent-dark); }
#submit:disabled { background: var(--border-strong); cursor: not-allowed; }
.secondary {
  height: 46px;
  padding: 0 22px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.privacy { margin: 18px 2px 0; font-size: 12px; line-height: 1.6; color: var(--muted); }

.done { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 28px 22px; text-align: center; }
.done h2 { margin: 0 0 8px; font-size: 20px; outline: none; }
.done p { margin: 0 0 20px; color: var(--muted); }
.done-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  details.section > summary::before { transition: none; }
}

/* English: the form's text reads left to right inside the (Hebrew) layout.
   The header's back link keeps its place and its arrow. */
html[lang="en"] :is(.form-wrap, .brand) { direction: ltr; }

/* ---------- update page ---------- */

.current .eyebrow { margin: 0 0 2px; font-size: 12px; color: var(--muted); }
.current h2 { margin: 0 0 10px; color: var(--accent); }
.current dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0 0 12px; font-size: 14px; }
.current dt { color: var(--muted); }
.current dd { margin: 0; }
.current .badge {
  display: inline-block; margin: -4px 0 10px; padding: 2px 8px; border-radius: 999px;
  background: #eef4fd; color: #1d3f72; font-size: 11.5px; font-weight: 600;
}

fieldset.kinds { padding-bottom: 14px; }
fieldset.kinds legend { font-size: 16px; font-weight: 700; margin-bottom: 12px; padding: 0; }
/* The section card's own padding pushes a legend down; keep it inside the card. */
fieldset.kinds legend { float: inline-start; width: 100%; }
fieldset.kinds .pills { clear: both; }

details.nested { border: 0; padding: 0; margin: 4px 0 0; }
details.nested > summary { padding: 8px 0; }
details.nested .section-body { padding: 0; }
