/* Xpertto lead capture — professional CTA banner + modal.
   Stays on-brand with --accent-color (#1d5abd) and listing/guide CTA patterns. */

:root {
  --xlead-primary: var(--accent-color, #1d5abd);
  --xlead-primary-deep: #154a9c;
  --xlead-primary-soft: #e8f0fb;
  --xlead-surface: #eef4ff;
  --xlead-ink: #0a0e1a;
  --xlead-muted: #5b6478;
  --xlead-border: rgba(29, 90, 189, 0.14);
  --xlead-danger: #b91c1c;
  --xlead-success: #0f766e;
  --xlead-success-soft: #ecfdf5;
  --xlead-radius: 14px;
  --xlead-radius-sm: 10px;
  --xlead-shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 10px 28px -18px rgba(29, 90, 189, 0.35);
}

/* —— Inline CTA banner —— */
.xlead-cta-wrap {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.xlead-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 16px 24px;
  margin: 28px 0;
  padding: 20px 22px;
  border: 1px solid var(--xlead-border);
  border-radius: var(--xlead-radius);
  background:
    linear-gradient(135deg, #eef4ff 0%, #f7faff 55%, #ffffff 100%);
  box-shadow: var(--xlead-shadow);
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.xlead-cta::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--xlead-primary);
  border-radius: 4px 0 0 4px;
}

.xlead-cta__lead {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
  flex: 1 1 240px;
}

.xlead-cta__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--xlead-primary);
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(29, 90, 189, 0.7);
}

.xlead-cta__copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.xlead-cta__eyebrow {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--xlead-ink);
  line-height: 1.3;
}

.xlead-cta__sub {
  margin: 0;
  font-size: 0.875rem;
  color: var(--xlead-muted);
  line-height: 1.5;
  max-width: 42ch;
}

.xlead-cta__trust {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.xlead-cta__trust li {
  position: relative;
  padding-left: 14px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #3b4358;
  line-height: 1.35;
}

.xlead-cta__trust li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--xlead-primary);
  opacity: 0.75;
}

.xlead-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 11px 18px;
  border-radius: var(--xlead-radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none !important;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    transform 0.15s ease, box-shadow 0.15s ease;
}

.xlead-btn:disabled,
.xlead-btn[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.xlead-btn--primary {
  background: var(--xlead-primary);
  color: #fff !important;
  box-shadow: 0 0 0 4px rgba(29, 90, 189, 0.1), 0 10px 22px -14px rgba(29, 90, 189, 0.65);
}

.xlead-btn--primary:hover:not(:disabled) {
  background: var(--xlead-primary-deep);
  color: #fff !important;
  transform: translateY(-1px);
}

.xlead-btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--xlead-muted) !important;
  min-height: 36px;
  padding: 6px 8px;
  box-shadow: none;
}

.xlead-btn--ghost:hover:not(:disabled) {
  color: var(--xlead-primary) !important;
  background: var(--xlead-primary-soft);
}

.xlead-btn--block { width: 100%; }

.xlead-btn__arrow {
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.xlead-btn--primary:hover:not(:disabled) .xlead-btn__arrow {
  transform: translateX(2px);
}

.xlead-btn__spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: xlead-spin 0.7s linear infinite;
}

.xlead-btn.is-loading .xlead-btn__spinner { display: inline-block; }
.xlead-btn.is-loading .xlead-btn__arrow { display: none; }

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

.xlead-cta.is-submitted {
  opacity: 0.92;
}

.xlead-cta.is-submitted .xlead-cta__button {
  background: #fff;
  border: 1px solid var(--xlead-border);
  color: var(--xlead-muted) !important;
  box-shadow: none;
  pointer-events: none;
}

.xlead-cta.is-submitted .xlead-btn__arrow { display: none; }

/* —— Mobile —— */
@media (max-width: 767px) {
  .xlead-cta {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 14px;
    margin: 16px 0;
    gap: 12px;
  }

  .xlead-cta__lead {
    gap: 12px;
  }

  .xlead-cta__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .xlead-cta__icon svg {
    width: 18px;
    height: 18px;
  }

  .xlead-cta__eyebrow { font-size: 0.9375rem; }

  .xlead-cta__sub {
    font-size: 0.8125rem;
    line-height: 1.4;
  }

  .xlead-cta__trust {
    gap: 6px 12px;
    margin-top: 6px;
  }

  .xlead-cta .xlead-btn {
    width: 100%;
    margin-top: 0;
    flex: 0 0 auto;
  }

  .xlead-cta--sticky {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    top: auto;
    height: auto;
    z-index: 1040;
    margin: 0;
    padding: 12px 14px;
    gap: 10px;
    box-shadow: 0 14px 36px -14px rgba(15, 23, 42, 0.45);
    /* Sticky bar stays edge-to-edge; wrapper width does not apply here. */
    width: auto;
  }

  .xlead-cta-wrap:has(.xlead-cta--sticky) {
    /* Keep document flow compact when the CTA is fixed to the viewport. */
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    max-width: none;
  }

  .xlead-cta--sticky .xlead-cta__sub,
  .xlead-cta--sticky .xlead-cta__trust { display: none; }
}

@media (min-width: 768px) {
  .xlead-cta {
    justify-content: space-between;
  }

  .xlead-cta__button {
    flex: 0 0 auto;
    white-space: nowrap;
    margin-left: auto;
  }
}

/* —— Modal —— */
.xlead-modal {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: none;
}

.xlead-modal.is-open { display: block; }

.xlead-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 26, 0.48);
  backdrop-filter: blur(2px);
}

.xlead-modal__panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  width: min(520px, calc(100vw - 24px));
  max-height: min(90vh, 740px);
  overflow: hidden;
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(29, 90, 189, 0.08);
  box-shadow: 0 28px 64px -28px rgba(15, 23, 42, 0.55);
  padding: 0;
}

.xlead-modal__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: 16px 22px 12px;
  border-bottom: 1px solid #eef2f7;
  margin: 0;
  background: #fff;
  z-index: 2;
}

.xlead-modal__brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--xlead-primary-soft);
  color: var(--xlead-primary);
}

.xlead-modal__brand-text {
  flex: 1 1 auto;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--xlead-primary-deep);
  text-transform: uppercase;
}

.xlead-modal__close {
  margin-left: auto;
}

.xlead-modal__head {
  margin-bottom: 6px;
}

.xlead-modal__head h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--xlead-ink);
}

.xlead-modal__intro {
  margin: 0 0 18px;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--xlead-muted);
}

body.xlead-modal-open { overflow: hidden; }

/* Form shell: scrollable fields + sticky submit footer */
.xlead-form-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.xlead-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.xlead-form__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 14px 22px 8px;
  -webkit-overflow-scrolling: touch;
}

.xlead-form__footer {
  flex: 0 0 auto;
  padding: 12px 22px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #eef2f7;
  background: #fff;
  box-shadow: 0 -8px 24px -18px rgba(15, 23, 42, 0.35);
  z-index: 2;
}

.xlead-form__footer .xlead-btn {
  margin: 0;
}

/* —— Form fields —— */
.xlead-field { margin-bottom: 14px; }

.xlead-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 550;
  color: #374151;
}

.xlead-field input[type="text"],
.xlead-field input[type="tel"],
.xlead-field select,
.xlead-field textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 11px 13px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--xlead-ink);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.xlead-field textarea {
  min-height: 112px;
  resize: vertical;
}

.xlead-field input:focus,
.xlead-field select:focus,
.xlead-field textarea:focus {
  outline: none;
  border-color: var(--xlead-primary);
  box-shadow: 0 0 0 4px rgba(29, 90, 189, 0.12);
}

.xlead-field .xlead-hint {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--xlead-muted);
}

.xlead-error-text {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--xlead-danger);
}

.xlead-error-text:empty { display: none; }

.xlead-field.has-error input,
.xlead-field.has-error select,
.xlead-field.has-error textarea {
  border-color: var(--xlead-danger);
  box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.08);
}

.xlead-mobile-row {
  display: flex;
  gap: 8px;
}

.xlead-mobile-row .xlead-mobile-code {
  flex: 0 0 74px;
  text-align: center;
  background: #f8fafc;
  color: var(--xlead-muted);
  font-weight: 600;
}

.xlead-mobile-row input[type="tel"] { flex: 1 1 auto; }

.xlead-note {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--xlead-muted);
}

.xlead-form-error {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: var(--xlead-radius-sm);
  background: #fef2f2;
  color: var(--xlead-danger);
  font-size: 0.8125rem;
}

/* —— Success —— */
.xlead-success {
  flex: 1 1 auto;
  overflow: auto;
  text-align: center;
  padding: 22px;
}

.xlead-success.xlead-hidden {
  display: none !important;
}

.xlead-success__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--xlead-success-soft);
  color: var(--xlead-success);
}

.xlead-success h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: var(--xlead-ink);
}

.xlead-success p {
  margin: 0 0 14px;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--xlead-muted);
}

.xlead-success__ref {
  display: inline-block;
  margin-bottom: 18px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--xlead-primary-soft);
  color: var(--xlead-primary-deep);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.xlead-hidden { display: none !important; }
