/*
 * Supplier Inquiry Modal — MHD-940 Slice C.
 *
 * Vanilla CSS scoped under .mh-siq-* so it can drop into any host page
 * without collision. The component is idempotent and self-contained; the JS
 * side lazy-injects the DOM into <body> so styling has to work regardless
 * of where the host mounts.
 *
 * Backdrop covers the viewport, dialog is a centered card. body.mh-siq-open
 * freezes background scroll while the modal is up.
 */

body.mh-siq-open {
  overflow: hidden;
}

/* Host is toggled via the `hidden` attribute from JS (not a class), so the
   [hidden] selector is the display gate. The z-index has to outrank Leaflet
   controls (~1000) + Shoelace popups (~700–1000) + the fixed site nav
   (99999) that every host page pulls in. */
.mh-siq-host {
  position: fixed;
  inset: 0;
  z-index: 100000;
}

.mh-siq-host[hidden] {
  display: none;
}

.mh-siq-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.mh-siq-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 92vw);
  max-height: 92vh;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #0f172a;
}

.mh-siq-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #475569;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mh-siq-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.mh-siq-close:focus-visible {
  outline: 2px solid #0f766e;
  outline-offset: 2px;
}

.mh-siq-header {
  padding: 22px 24px 12px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.mh-siq-title {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: #0f172a;
}

.mh-siq-subtitle {
  margin: 0;
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
}

.mh-siq-form,
.mh-siq-success {
  padding: 18px 24px 22px 24px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

/* Honeypot — visually hidden, still fillable by bots, never focusable
   by keyboard. Uses off-screen positioning (a11y-safe hidden pattern)
   because display:none prevents form submission on some legacy browsers. */
.mh-siq-hp {
  position: absolute !important;
  left: -10000px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* One field per row — label on top, input below.
   The HTML wraps every field in `.mh-siq-row`; keep that stacked. */
.mh-siq-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

/* Two side-by-side fields (email + phone). Each child is a `.mh-siq-row`
   with its own label-above-input stack. Collapses to single column below
   520px so the two fields never squeeze on mobile. */
.mh-siq-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mh-siq-row-2col .mh-siq-row {
  margin-bottom: 14px;
}

@media (max-width: 520px) {
  .mh-siq-row-2col {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

.mh-siq-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.mh-siq-required {
  color: #dc2626;
  margin-left: 2px;
}

.mh-siq-input,
.mh-siq-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  color: #0f172a;
  font-family: inherit;
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mh-siq-input:focus,
.mh-siq-textarea:focus {
  outline: none;
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.mh-siq-textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.5;
}

.mh-siq-counter {
  align-self: flex-end;
  font-size: 11px;
  color: #94a3b8;
  margin-top: -2px;
}

.mh-siq-counter.is-warn {
  color: #d97706;
}

.mh-siq-counter.is-max {
  color: #dc2626;
}

/* Error banner — JS toggles the `hidden` attribute (err.hidden = true/false).
   Class-level `display: flex` beats the UA's `[hidden] { display: none }` on
   specificity, so we scope the flex to `:not([hidden])` — otherwise the empty
   red banner renders on every open. */
.mh-siq-error:not([hidden]) {
  margin: 4px 0 14px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 13px;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.mh-siq-error::before {
  content: "!";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #dc2626;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  margin-top: 1px;
}

.mh-siq-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.mh-siq-btn {
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.mh-siq-btn-secondary {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #475569;
}

.mh-siq-btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.mh-siq-btn-primary {
  background: #0f766e;
  color: #ffffff;
}

.mh-siq-btn-primary:hover {
  background: #0d5f58;
}

.mh-siq-btn-primary:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.mh-siq-btn:focus-visible {
  outline: 2px solid #0f766e;
  outline-offset: 2px;
}

.mh-siq-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: -2px;
  animation: mh-siq-spin 0.8s linear infinite;
}

.mh-siq-btn.is-loading .mh-siq-spinner {
  display: inline-block;
}

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

.mh-siq-legal {
  margin: 14px 0 0 0;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.5;
}

/* Success panel — same [hidden]-toggle contract as .mh-siq-error above.
   No `display: none` at rest; browser default handles the hidden case. */
.mh-siq-success {
  text-align: center;
  padding: 32px 24px 28px 24px;
}

.mh-siq-success-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px auto;
  border-radius: 50%;
  background: #d1fae5;
  color: #047857;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
}

.mh-siq-success-title {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.mh-siq-success-body {
  margin: 0 0 20px 0;
  font-size: 14px;
  color: #475569;
  line-height: 1.55;
}

.mh-siq-success-actions {
  display: flex;
  justify-content: center;
}
