/* ==============================================================
   M1 — Request Modal Dialog & Form Controls
   Directly mirrors the Style Guide Section 07 (.geo-modal) and
   Design System form control standards.
   ============================================================== */

.app-modal {
  /* Three-way min: never wider than 38rem, never wider than container,
     and leaves breathing room against viewport edges on mobile. */
  width: min(38rem, 100%, calc(100vw - 2 * var(--space-4)));
  max-height: calc(100dvh - var(--space-8));
  overflow-y: auto;

  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--modal-shadow);
}

.app-modal:not(:modal) {
  position: static;
  margin-inline: auto;
}

.app-modal::backdrop {
  background: var(--modal-backdrop);
  backdrop-filter: blur(2px);
}

.app-modal__inner {
  position: relative;
  padding: clamp(var(--space-5), 4vw, var(--space-7));
}

/* --- Close Button ------------------------------------------------- */

.app-modal__close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  color: var(--color-ink);
  z-index: 2;
}

.app-modal__close:hover {
  color: var(--color-brand);
}

.app-modal__close-icon {
  width: var(--icon-md);
  height: var(--icon-md);
  stroke-width: var(--icon-stroke);
}

/* --- Header & Typography ------------------------------------------ */

.app-modal__header {
  margin-bottom: var(--space-5);
  padding-right: var(--space-8); /* clearance for absolute close button */
}

.app-modal__heading {
  margin: 0 0 var(--space-2);
  font-size: var(--text-panel-heading);
  line-height: var(--leading-heading);
  color: var(--color-heading-display);
}

.app-modal__text {
  margin: 0;
  font-size: var(--text-body);
  line-height: var(--leading-body);
  color: var(--color-ink-muted);
}

/* --- Form & Controls ---------------------------------------------- */

.app-modal__form {
  margin: 0;
}

.app-modal__form-group {
  margin-bottom: var(--space-5);
}

.app-modal__label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-heading-display);
}

/* Icon + control share one bordered box, same construction as
   .bookinghero__field: the FIELD takes focus, not the bare control,
   so the ring shows which field is active rather than hugging the
   text inside it. Icon moved here from .app-modal__label on purpose
   — it decorates the input, not the caption above it, matching the
   only other icon+field pattern in this system (the booking hero
   search bar) instead of a one-off invented for this form. */
.app-modal__field {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  padding-inline: var(--space-4);
  border: 1px solid var(--color-input-border);
  background: var(--color-surface);
  transition: border-color var(--dur-fast) var(--ease), outline var(--dur-fast) var(--ease);
}

.app-modal__field:focus-within {
  outline: 2px solid var(--color-focus);
  outline-offset: -2px;
  border-color: var(--color-focus);
}

.app-modal__field-icon {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  color: var(--color-ink-muted);
}

.app-modal__input,
.app-modal__select {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  padding-block: var(--space-3);
  border: 0;
  background: transparent;
  color: var(--color-ink);
  font: inherit;
  font-size: var(--text-body);
  line-height: var(--leading-control);
}

.app-modal__input::placeholder {
  color: var(--color-ink-muted);
  opacity: 1;
}

/* Suppressed because the field around it shows focus instead. */
.app-modal__input:focus,
.app-modal__select:focus {
  outline: none;
}

.app-modal__select {
  cursor: pointer;
  appearance: auto;
}

/* --- Optional details disclosure -----------------------------------
   Same [data-disclosure] contract and accordion.css layer as the FAQ
   trigger below it on the page — reused rather than reinvented, so
   the plus/minus toggle behaves exactly like the one already trained
   into this page instead of a one-off. Only type, spacing and the
   rule are set here; the shared layer owns the plus/minus swap.
   ------------------------------------------------------------------ */

.app-modal__disclosure-heading {
  margin: 0 0 var(--space-5);
  font: inherit;
}

.app-modal__disclosure-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-block: var(--space-3);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-heading-display);
}

.app-modal__disclosure-trigger:hover .app-modal__disclosure-label,
.app-modal__disclosure-trigger:focus-visible .app-modal__disclosure-label {
  text-decoration: underline;
  text-underline-offset: var(--link-underline-offset);
}

.app-modal__disclosure-icon {
  width: var(--icon-sm);
  height: var(--icon-sm);
  stroke-width: var(--icon-stroke);
}

.app-modal__disclosure-panel {
  margin: var(--space-5) 0 0;
}

.app-modal__disclosure-panel .app-modal__form-group:last-child {
  margin-bottom: 0;
}

/* --- Footer & Action ---------------------------------------------- */

.app-modal__footer {
  margin-top: var(--space-6);
}

.app-modal__submit {
  width: 100%;
}

/* --- Responsive Adjustments --------------------------------------- */

@media (max-width: 479px) {
  .app-modal__inner {
    padding: var(--space-5) var(--space-4);
  }

  .app-modal__heading {
    padding-right: var(--space-7);
  }
}
