/* ================================================================
   Spolton Mortgages — Enquiry / Booking Modal
   ================================================================ */

/* --- Overlay ---------------------------------------------------- */
.spm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 26, 36, .72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 95;
  transition: opacity var(--dur) var(--ease);
}

.spm-modal-overlay[hidden] {
  display: none;
}

/* --- Modal container -------------------------------------------- */
.spm-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  background: #fff;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg), 0 32px 80px rgba(30, 26, 36, .22);
  width: calc(100% - 32px);
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.spm-modal[hidden] {
  display: none;
}

@media (max-width: 540px) {
  .spm-modal {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: none;
    max-height: 92vh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}

/* Prevent body scroll when open */
body.modal-open {
  overflow: hidden;
}

/* --- Modal inner padding --------------------------------------- */
.spm-modal-body {
  padding: 32px 36px 36px;
}

@media (max-width: 540px) {
  .spm-modal-body {
    padding: 28px 20px 32px;
  }
}

/* --- Header ----------------------------------------------------- */
.spm-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}

.spm-modal-title {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: var(--text-xl);
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}

.spm-modal-subtitle {
  font-size: var(--text-sm);
  color: var(--muted);
  margin: 0 0 24px;
  line-height: 1.5;
}

.spm-modal-close {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 2px;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.spm-modal-close:hover {
  background: var(--surface-2);
  color: var(--ink);
}

/* --- Form ------------------------------------------------------- */
.spm-modal-form {
  display: grid;
  gap: 16px;
}

.spm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spm-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 400px) {
  .spm-field-row {
    grid-template-columns: 1fr;
  }
}

.spm-field label,
.spm-field .spm-field-label {
  display: block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate);
  line-height: 1;
}

.spm-field label .spm-required {
  color: var(--brand);
  margin-left: 2px;
}

.spm-field input,
.spm-field select,
.spm-field textarea {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 14px;
  width: 100%;
  transition: border-color var(--dur-fast) var(--ease);
  line-height: 1.5;
  appearance: none;
  -webkit-appearance: none;
}

.spm-field input:focus,
.spm-field select:focus,
.spm-field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.spm-field input.is-invalid,
.spm-field select.is-invalid,
.spm-field textarea.is-invalid {
  border-color: var(--danger);
}

.spm-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236E6878' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.spm-field textarea {
  resize: vertical;
  min-height: 80px;
}

.spm-field-error {
  font-size: var(--text-xs);
  color: var(--danger);
  margin: 0;
  display: none;
}

.spm-field-error.is-visible {
  display: block;
}

/* Contact preference radios */
.spm-radio-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.spm-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--slate);
  cursor: pointer;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.spm-radio-label input[type="radio"] {
  /* restore the native control (the generic .spm-field input rule kills it) */
  appearance: auto;
  -webkit-appearance: auto;
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 50%;
  accent-color: var(--brand);
  cursor: pointer;
  flex-shrink: 0;
}

/* Honeypot — must stay hidden */
.spm-hp {
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
  height: 0;
  width: 0;
  z-index: -1;
  pointer-events: none;
}

/* Submit button */
.spm-modal-submit {
  width: 100%;
  justify-content: center;
  padding: 15px 28px;
  font-size: var(--text-base);
  margin-top: 4px;
}

.spm-modal-submit[disabled] {
  opacity: .6;
  pointer-events: none;
}

/* Form error banner */
.spm-form-error-banner {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(192, 57, 43, .25);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: var(--text-sm);
  display: none;
}

.spm-form-error-banner.is-visible {
  display: block;
}

/* Legal note */
.spm-modal-legal {
  font-size: var(--text-xs);
  color: var(--muted);
  margin: 4px 0 0;
  text-align: center;
  line-height: 1.5;
}

/* --- Success state --------------------------------------------- */
.spm-modal-success {
  padding: 40px 32px 32px;
  text-align: center;
}

.spm-modal-success[hidden] {
  display: none;
}

.spm-modal-success-icon {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  animation: spm-pop .32s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes spm-pop { from { transform: scale(.6); opacity: 0 } to { transform: scale(1); opacity: 1 } }
@media (prefers-reduced-motion: reduce) { .spm-modal-success-icon { animation: none } }

.spm-modal-success-heading {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 8px;
}

.spm-modal-success-msg {
  font-size: var(--text-md);
  color: var(--slate);
  margin: 0 auto 22px;
  line-height: 1.55;
  max-width: 46ch;   /* fits the message on two balanced lines */
  text-wrap: balance;
}

/* What happens next */
.spm-modal-next {
  list-style: none;
  margin: 0 auto 18px;
  padding: 18px 20px;
  max-width: 420px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.spm-modal-next li {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--slate);
}
.spm-modal-next-n {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.spm-modal-success-note {
  font-size: var(--text-xs);
  color: var(--muted);
  margin: 0 auto 22px;
  max-width: 40ch;
  line-height: 1.5;
}

.spm-modal-success-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.spm-modal-success-actions .spm-modal-success-call {
  display: inline-flex;
  width: 100%;
  max-width: 320px;
  justify-content: center;
  text-align: center;
}
.spm-modal-success-actions .spm-modal-success-close {
  display: inline-flex;
  justify-content: center;
  min-width: 140px;
}

@media (max-width: 480px) {
  .spm-modal-success { padding: 32px 20px 26px; }
  .spm-modal-success-heading { font-size: 1.35rem; }
}

/* Slim trust band inside the booking modal (reassure, don't distract) */
.spm-modal-trust { padding: 0 0 14px; margin: 2px 0 16px; border-bottom: 1px solid var(--line); }
.spm-modal-faces { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spm-modal-faces-label { display: flex; flex-direction: column; gap: 1px; font-size: var(--text-sm); font-weight: 700; color: var(--ink); }
.spm-modal-faces-sub { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--slate); }
.spm-modal-faces-sub svg { color: #f5b301; }

/* "Prefer to talk" line under the submit button */
.spm-modal-call { text-align: center; font-size: var(--text-sm); color: var(--slate); margin: 12px 0 0; }
.spm-modal-call a { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--brand-strong); text-decoration: none; }
.spm-modal-call a:hover { text-decoration: underline; }
.spm-modal-call svg { color: var(--brand); }

.spm-modal-fee {
  font-size: var(--text-xs);
  color: var(--muted);
  margin: 12px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
  text-align: center;
  line-height: 1.5;
}

.spm-modal-legal a {
  color: var(--brand-strong, #6b4fd8);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}
