/* Auto-dealerships lead form (hero embed + legacy popup support) */

#autoDealersLeadGate:not(.adl-embed) {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10060;
  font-family: var(--ip-font, 'DM Sans', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif);
  padding: 16px;
}

#autoDealersLeadGate:not(.adl-embed).is-open {
  display: flex;
}

#autoDealersLeadGate.adl-embed {
  position: relative;
  inset: auto;
  display: block;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  z-index: 1;
  padding: 0;
  font-family: var(--ip-font, 'DM Sans', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif);
}

.adl-box {
  background: #fff;
  padding: 28px 26px 22px;
  border-radius: 20px;
  width: 480px;
  max-width: 100%;
  max-height: min(90vh, 860px);
  overflow-y: auto;
  text-align: left;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.05);
  animation: adlIn 0.28s ease-out;
  position: relative;
}

.adl-box-embed {
  width: 100%;
  max-width: none;
  max-height: none;
  overflow: visible;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.05);
  animation: none;
}

.adl-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.adl-field-grid .adl-field {
  margin-bottom: 0;
}

@media (max-width: 560px) {
  .adl-field-grid {
    grid-template-columns: 1fr;
  }
}

@keyframes adlIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.adl-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: rgba(0, 0, 0, 0.06);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  color: #777;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.adl-close:hover {
  background: rgba(220, 38, 38, 0.12);
  border: 1.5px solid rgba(220, 38, 38, 0.35);
  color: rgba(220, 38, 38, 0.9);
}

.adl-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, #2a65f6, #5b8def);
  border-radius: 14px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#adlFormStep {
  text-align: left;
}

.adl-embed #adlFormStep {
  text-align: left;
}

#adlFormStep form {
  text-align: left;
}

.adl-intro {
  margin: 0 0 18px;
  padding: 0 0 14px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
}

#adlTitle {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
  line-height: 1.25;
  text-align: left;
}

.adl-sub {
  font-size: 13px;
  color: #64748b;
  line-height: 1.45;
  margin: 0;
  max-width: 36em;
  text-align: left;
}

.adl-disclaimer {
  display: none;
}

.adl-field {
  margin-bottom: 14px;
}

.adl-field label,
.adl-field legend {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

/* Must beat .adl-field label { display:block } so checkbox + text stay side by side */
.adl-field label.adl-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
}

.adl-req {
  color: #2a65f6;
}

.adl-opt {
  color: #94a3b8;
  font-weight: 400;
}

.adl-input,
.adl-select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  color: #0f172a;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  background: #f8fafc;
  font-family: inherit;
  box-sizing: border-box;
}

.adl-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.adl-input:focus,
.adl-select:focus {
  border-color: #2a65f6;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(42, 101, 246, 0.1);
}

.adl-input.invalid,
.adl-select.invalid {
  border-color: #ef4444 !important;
  background: #fff5f5 !important;
}

.adl-input.valid {
  border-color: #22c55e !important;
  background: #f0fdf4 !important;
}

.adl-check-field {
  margin: 0 0 14px;
  padding: 0;
  border: none;
  background: none;
}

.adl-check {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  line-height: 1.2;
}

.adl-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  display: inline-block;
  vertical-align: middle;
  margin: 0;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 1.5px solid #94a3b8;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  position: relative;
  box-sizing: border-box;
}

.adl-check input[type="checkbox"]:checked {
  background: #2a65f6;
  border-color: #2a65f6;
}

.adl-check input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.adl-check span {
  margin: 0;
  padding: 0;
  line-height: 1.2;
}

.adl-radio-field {
  border: none;
  padding: 0;
  margin: 0 0 12px;
}

.adl-radio-field legend {
  margin-bottom: 8px;
}

.adl-radio-row {
  display: flex;
  gap: 10px;
}

.adl-radio {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.adl-radio:has(input:checked) {
  border-color: #2a65f6;
  background: #eef4ff;
  color: #1e52e8;
}

.adl-radio input {
  accent-color: #2a65f6;
  margin: 0;
}

.adl-phone-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.adl-country-wrap {
  position: relative;
  flex-shrink: 0;
}

.adl-country-select {
  height: 100%;
  min-height: 44px;
  padding: 11px 28px 11px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #222;
  background: #f8fafc;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
}

.adl-country-select:focus {
  border-color: #2a65f6;
  background: #fff;
}

.adl-country-arrow {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 10px;
  color: #888;
}

.adl-phone-input {
  flex: 1;
  min-width: 0;
}

/* Honeypot — visually hidden but present in DOM for bots */
.adl-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.adl-error {
  margin: 6px 0 0;
  font-size: 11px;
  color: #ef4444;
  text-align: left;
  display: none;
}

.adl-error.is-visible {
  display: block;
}

.adl-submit {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #2a65f6, #4d7bf3);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  letter-spacing: 0.2px;
  margin-top: 4px;
  font-family: inherit;
}

.adl-submit:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.adl-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

#adlSuccessStep {
  text-align: center;
  padding: 12px 0 4px;
}

.adl-success-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.adl-success-msg {
  font-size: 14px;
  color: #475569;
  line-height: 1.55;
  margin: 0 0 22px;
}

.adl-success-btn {
  padding: 10px 28px;
  background: #f1f5f9;
  color: #333;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.adl-success-btn:hover {
  background: #e2e8f0;
}

@media (max-width: 520px) {
  .adl-box {
    padding: 24px 18px 18px;
  }

  .adl-radio-row {
    flex-direction: column;
  }
}
