/* ==========================================================================
   tb-lead-forms.css
   TelcoBridges Lead Forms — scoped styles
   Every selector is scoped under .tb-lead-form. No global selectors.
   One documented !important for the Enfold .main_color override on submit.
   ========================================================================== */


/* --------------------------------------------------------------------------
   Design tokens (CSS custom properties, scoped to .tb-lead-form)
   -------------------------------------------------------------------------- */

.tb-lead-form {
  --tb-lf-font: Inter, -apple-system, sans-serif;
  --tb-lf-mono: 'Fira Code', monospace;

  --tb-lf-blue-dark: #1e4d6b;
  --tb-lf-blue-mid: #2d6187;
  --tb-lf-blue-light: #3a7ca5;
  --tb-lf-orange: #f0943a;
  --tb-lf-orange-dark: #d97e28;
  --tb-lf-teal: #27a98b;

  --tb-lf-text-dark: #1a2535;
  --tb-lf-text-body: #3d4f63;
  --tb-lf-text-light: #697785;
  --tb-lf-white: #fff;
  --tb-lf-off-white: #f5f7f9;
  --tb-lf-gray-100: #e4e9ee;
  --tb-lf-gray-300: #b0bec8;
  --tb-lf-gray-500: #697785;
  --tb-lf-error: #d04040;

  --tb-lf-radius-input: 8px;
  --tb-lf-radius-card: 14px;
  --tb-lf-shadow-sm: 0 2px 8px rgba(30, 77, 107, 0.08);
  --tb-lf-shadow-md: 0 8px 28px rgba(30, 77, 107, 0.13);
  --tb-lf-transition: all 0.2s;
}


/* --------------------------------------------------------------------------
   Container (white card)
   -------------------------------------------------------------------------- */

.tb-lead-form {
  font-family: var(--tb-lf-font);
  max-width: min(520px, 100%);
  margin-left: auto;
  margin-right: auto;
  background: var(--tb-lf-white);
  border-radius: var(--tb-lf-radius-card);
  box-shadow: var(--tb-lf-shadow-sm);
  padding: clamp(20px, 5vw, 32px);
  box-sizing: border-box;
  color: var(--tb-lf-text-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* No card background on any form */
.tb-lead-form {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

/* Multi-step forms get a wider card to accommodate Calendly comfortably */
.tb-lead-form--multi-step {
  max-width: min(620px, 100%);
  transition: max-width 0.3s ease;
}

/* When the Calendly step is visible, expand the card to fit the embed */
.tb-lead-form--multi-step.tb-lead-form--calendly-active {
  max-width: min(700px, 100%);
}

.tb-lead-form *,
.tb-lead-form *::before,
.tb-lead-form *::after {
  box-sizing: border-box;
}


/* --------------------------------------------------------------------------
   Step progress indicators
   -------------------------------------------------------------------------- */

.tb-lead-form__progress {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: clamp(24px, 4vw, 32px);
  padding: 0;
  list-style: none;
}

/* Multi-step forms: right-align the progress indicators */
.tb-lead-form--multi-step .tb-lead-form__progress {
  justify-content: flex-end;
}

/* Individual step */
.tb-lead-form__progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex-shrink: 0;
}

/* Step number circle */
.tb-lead-form__progress-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-family: var(--tb-lf-mono);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  transition: var(--tb-lf-transition);

  /* Default: upcoming step */
  background: transparent;
  border: 2px solid var(--tb-lf-gray-300);
  color: var(--tb-lf-gray-500);
}

/* Active step */
.tb-lead-form__progress-step--active .tb-lead-form__progress-number {
  background: var(--tb-lf-blue-mid);
  border-color: var(--tb-lf-blue-mid);
  color: var(--tb-lf-white);
  box-shadow: 0 2px 8px rgba(45, 97, 135, 0.25);
}

/* Completed step — teal background, hide number, show checkmark */
.tb-lead-form__progress-step--completed .tb-lead-form__progress-number {
  background: var(--tb-lf-teal);
  border-color: var(--tb-lf-teal);
  color: transparent;
  font-size: 0;
  position: relative;
}

.tb-lead-form__progress-step--completed .tb-lead-form__progress-number::after {
  content: '';
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 13px;
  border: solid var(--tb-lf-white);
  border-width: 0 2.5px 2.5px 0;
  transform: translate(-50%, -60%) rotate(45deg);
}

/* Step label (only rendered when text is non-empty) */
.tb-lead-form__progress-label {
  display: block;
  margin-top: 6px;
  font-family: var(--tb-lf-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tb-lf-gray-500);
  transition: var(--tb-lf-transition);
  white-space: nowrap;
}

.tb-lead-form__progress-step--active .tb-lead-form__progress-label {
  color: var(--tb-lf-blue-mid);
}

.tb-lead-form__progress-step--completed .tb-lead-form__progress-label {
  color: var(--tb-lf-teal);
}

/* Connector lines between steps */
.tb-lead-form__progress-connector {
  flex: 1;
  height: 2px;
  min-width: 32px;
  max-width: 64px;
  background: var(--tb-lf-gray-100);
  margin: 0 8px;
  align-self: flex-start;
  margin-top: 15px; /* Vertically center with the 32px circles */
  border-radius: 1px;
  transition: var(--tb-lf-transition);
}

/* Connector between two completed steps or between completed and active */
.tb-lead-form__progress-step--completed + .tb-lead-form__progress-connector,
.tb-lead-form__progress-connector--completed {
  background: var(--tb-lf-teal);
}


/* --------------------------------------------------------------------------
   Form element
   -------------------------------------------------------------------------- */

.tb-lead-form__form {
  margin: 0;
  padding: 0;
}


/* --------------------------------------------------------------------------
   Step panels
   -------------------------------------------------------------------------- */

.tb-lead-form__step--hidden {
  display: none;
}


/* --------------------------------------------------------------------------
   Two-column field grid (lead magnet forms)
   Applied via data-tb-form-id to avoid affecting other forms.
   Collapses to single column below 480px.
   -------------------------------------------------------------------------- */

.tb-lead-form[data-tb-form-id="butler-lead-magnet"] {
  max-width: min(620px, 100%);
}

.tb-lead-form[data-tb-form-id="butler-lead-magnet"] .tb-lead-form__step {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

/* Consent and single-wide fields span both columns */
.tb-lead-form[data-tb-form-id="butler-lead-magnet"] .tb-lead-form__consent {
  grid-column: 1 / -1;
}

@media (max-width: 480px) {
  .tb-lead-form[data-tb-form-id="butler-lead-magnet"] .tb-lead-form__step {
    grid-template-columns: 1fr;
  }
}


/* --------------------------------------------------------------------------
   Form fields
   -------------------------------------------------------------------------- */

.tb-lead-form__field {
  margin-bottom: 20px;
}

/* Labels */
.tb-lead-form__label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--tb-lf-text-dark);
  line-height: 1.4;
}

/* Required asterisk */
.tb-lead-form__required {
  color: var(--tb-lf-error);
  margin-left: 2px;
}

/* Text inputs */
.tb-lead-form__input {
  display: block;
  width: 100%;
  border: 1px solid var(--tb-lf-gray-100);
  border-radius: var(--tb-lf-radius-input);
  padding: 12px 16px;
  font-family: var(--tb-lf-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--tb-lf-text-dark);
  background: var(--tb-lf-white);
  transition: var(--tb-lf-transition);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.tb-lead-form__input::placeholder {
  color: var(--tb-lf-gray-300);
}

/* Focus state */
.tb-lead-form__input:focus {
  border-color: var(--tb-lf-blue-mid);
  box-shadow: 0 0 0 3px rgba(45, 97, 135, 0.12);
}

/* Error state on field wrapper */
.tb-lead-form__field--error .tb-lead-form__input {
  border-color: var(--tb-lf-error);
  box-shadow: 0 0 0 3px rgba(208, 64, 64, 0.1);
}


/* --------------------------------------------------------------------------
   Textarea
   -------------------------------------------------------------------------- */

.tb-lead-form__textarea {
  display: block;
  width: 100%;
  border: 1px solid var(--tb-lf-gray-100);
  border-radius: var(--tb-lf-radius-input);
  padding: 12px 16px;
  font-family: var(--tb-lf-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--tb-lf-text-dark);
  background: var(--tb-lf-white);
  transition: var(--tb-lf-transition);
  outline: none;
  resize: vertical;
  min-height: 120px;
  -webkit-appearance: none;
  appearance: none;
}

.tb-lead-form__textarea::placeholder {
  color: var(--tb-lf-gray-300);
}

.tb-lead-form__textarea:focus {
  border-color: var(--tb-lf-blue-mid);
  box-shadow: 0 0 0 3px rgba(45, 97, 135, 0.12);
}

.tb-lead-form__field--error .tb-lead-form__textarea {
  border-color: var(--tb-lf-error);
  box-shadow: 0 0 0 3px rgba(208, 64, 64, 0.1);
}


/* --------------------------------------------------------------------------
   Select dropdowns
   -------------------------------------------------------------------------- */

.tb-lead-form__select {
  display: block;
  width: 100%;
  border: 1px solid var(--tb-lf-gray-100);
  border-radius: var(--tb-lf-radius-input);
  padding: 12px 40px 12px 16px;
  font-family: var(--tb-lf-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--tb-lf-text-dark);
  background-color: var(--tb-lf-white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23697785' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px 7px;
  transition: var(--tb-lf-transition);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.tb-lead-form__select:focus {
  border-color: var(--tb-lf-blue-mid);
  box-shadow: 0 0 0 3px rgba(45, 97, 135, 0.12);
}

.tb-lead-form__field--error .tb-lead-form__select {
  border-color: var(--tb-lf-error);
  box-shadow: 0 0 0 3px rgba(208, 64, 64, 0.1);
}


/* --------------------------------------------------------------------------
   Error messages
   -------------------------------------------------------------------------- */

.tb-lead-form__error {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--tb-lf-error);
  min-height: 0;
}

.tb-lead-form__error:empty {
  display: none;
}


/* --------------------------------------------------------------------------
   Consent checkbox
   -------------------------------------------------------------------------- */

.tb-lead-form__consent {
  margin-bottom: 20px;
}

.tb-lead-form__consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  position: relative;
}

/* Hide native checkbox (accessible — screen readers still see it) */
.tb-lead-form__consent-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Custom visible checkbox */
.tb-lead-form__consent-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--tb-lf-gray-300);
  border-radius: 4px;
  background: var(--tb-lf-white);
  transition: var(--tb-lf-transition);
  position: relative;
  margin-top: 1px; /* Align with first line of text */
}

/* Checked state */
.tb-lead-form__consent-checkbox:checked + .tb-lead-form__consent-check {
  background: var(--tb-lf-blue-mid);
  border-color: var(--tb-lf-blue-mid);
}

.tb-lead-form__consent-checkbox:checked + .tb-lead-form__consent-check::after {
  content: '';
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 9px;
  border: solid var(--tb-lf-white);
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -60%) rotate(45deg);
}

/* Focus-visible ring on custom check (keyboard users) */
.tb-lead-form__consent-checkbox:focus-visible + .tb-lead-form__consent-check {
  box-shadow: 0 0 0 3px rgba(45, 97, 135, 0.2);
  border-color: var(--tb-lf-blue-mid);
}

/* Consent text */
.tb-lead-form__consent-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--tb-lf-text-body);
}


/* --------------------------------------------------------------------------
   Actions / submit button
   -------------------------------------------------------------------------- */

.tb-lead-form__actions {
  margin-top: 4px;
}

/* Multi-step forms: right-align the button */
.tb-lead-form--multi-step .tb-lead-form__actions {
  display: flex;
  justify-content: flex-end;
}

.tb-lead-form__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 32px;
  border: none;
  border-radius: var(--tb-lf-radius-input);
  background: linear-gradient(135deg, #1d5a81 0%, #2d6187 15%, #3a7ca5 100%);
  color: var(--tb-lf-white);
  font-family: var(--tb-lf-font);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
  transition: var(--tb-lf-transition);
  position: relative;
  min-height: 48px;
  -webkit-appearance: none;
  appearance: none;
}

/* Multi-step forms: auto-width button */
.tb-lead-form--multi-step .tb-lead-form__submit {
  width: auto;
}

/* Single-step simple forms: auto-width button, centered */
.tb-lead-form[data-tb-form-id="landing-page"] .tb-lead-form__actions,
.tb-lead-form[data-tb-form-id="butler-lead-magnet"] .tb-lead-form__actions,
.tb-lead-form[data-tb-form-id="contact-us"] .tb-lead-form__actions {
  display: flex;
  justify-content: center;
}

.tb-lead-form[data-tb-form-id="landing-page"] .tb-lead-form__submit,
.tb-lead-form[data-tb-form-id="butler-lead-magnet"] .tb-lead-form__submit,
.tb-lead-form[data-tb-form-id="contact-us"] .tb-lead-form__submit {
  width: auto;
}

/* Left-aligned labels for landing-page and contact-us */
.tb-lead-form[data-tb-form-id="landing-page"] .tb-lead-form__label,
.tb-lead-form[data-tb-form-id="contact-us"] .tb-lead-form__label {
  text-align: left;
}

.tb-lead-form__submit:hover {
  background: linear-gradient(135deg, #2d6187 0%, #3a7ca5 55%, #4a8fb5 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(30, 77, 107, 0.25);
}

.tb-lead-form__submit:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(30, 77, 107, 0.2);
}

.tb-lead-form__submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Loading state — hide text, show spinner */
.tb-lead-form__submit--loading .tb-lead-form__submit-text {
  visibility: hidden;
}

.tb-lead-form__submit--loading .tb-lead-form__submit-spinner {
  display: block;
}

/* Submit text label */
.tb-lead-form__submit-text {
  transition: var(--tb-lf-transition);
}

/* Enfold .main_color override — documented !important (prevents theme link color on button) */
.main_color .tb-lead-form__submit,
.main_color .tb-lead-form__submit:hover {
  color: #fff !important;
}


/* --------------------------------------------------------------------------
   Spinner
   -------------------------------------------------------------------------- */

.tb-lead-form__submit-spinner {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  margin-left: -10px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--tb-lf-white);
  border-radius: 50%;
  animation: tb-lf-spin 0.65s linear infinite;
}

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


/* --------------------------------------------------------------------------
   Turnstile container
   -------------------------------------------------------------------------- */

.tb-lead-form__turnstile {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}


/* --------------------------------------------------------------------------
   Status messages
   -------------------------------------------------------------------------- */

.tb-lead-form__status {
  font-size: 14px;
  line-height: 1.5;
  padding: 0;
  text-align: center;
  border-radius: var(--tb-lf-radius-input);
  transition: var(--tb-lf-transition);
}

.tb-lead-form__status:not(:empty) {
  padding: 12px;
  margin-top: 12px;
}


/* --------------------------------------------------------------------------
   Success state
   -------------------------------------------------------------------------- */

.tb-lead-form__success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(24px, 5vw, 40px) 0;
}

/* Teal circle with embedded SVG checkmark */
.tb-lead-form__success::before {
  content: '';
  display: block;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
  border-radius: 50%;
  background: var(--tb-lf-teal)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3E%3Cpath d='M6 12.5l4 4 8-9' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat center / 28px 28px;
}


/* --------------------------------------------------------------------------
   Calendly embed step
   -------------------------------------------------------------------------- */

.tb-lead-form__calendly-container {
  min-height: 700px;
  height: 700px;
}

/* Calendly iframe inserted by widget.js — ensure it fills the container */
.tb-lead-form__calendly-container iframe {
  min-width: 100%;
  border: none;
}


/* --------------------------------------------------------------------------
   get-in-touch — compact, placeholder-only variant
   Scoped entirely via data-tb-form-id. Does not affect other forms.
   -------------------------------------------------------------------------- */

/* Visually hide labels — screen readers still announce them */
.tb-lead-form[data-tb-form-id="get-in-touch"] .tb-lead-form__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Compact field spacing */
.tb-lead-form[data-tb-form-id="get-in-touch"] .tb-lead-form__field {
  margin-bottom: 10px;
}

/* Compact inputs */
.tb-lead-form[data-tb-form-id="get-in-touch"] .tb-lead-form__input,
.tb-lead-form[data-tb-form-id="get-in-touch"] .tb-lead-form__textarea {
  padding: 10px 14px;
  font-size: 14px;
}

/* Shorter textarea */
.tb-lead-form[data-tb-form-id="get-in-touch"] .tb-lead-form__textarea {
  min-height: 80px;
}

/* Compact consent spacing */
.tb-lead-form[data-tb-form-id="get-in-touch"] .tb-lead-form__consent {
  margin-bottom: 14px;
}

.tb-lead-form[data-tb-form-id="get-in-touch"] .tb-lead-form__consent-text {
  font-size: 12px;
}

/* Pill-shaped full-width submit button */
.tb-lead-form[data-tb-form-id="get-in-touch"] .tb-lead-form__actions {
  margin-top: 6px;
}

.tb-lead-form[data-tb-form-id="get-in-touch"] .tb-lead-form__submit {
  border-radius: 999px;
  padding: 12px 32px;
  min-height: 44px;
}

/* Compact disclosure */
.tb-lead-form[data-tb-form-id="get-in-touch"] .tb-lead-form__disclosure {
  font-size: 11px;
  margin-top: 12px;
}


/* --------------------------------------------------------------------------
   Disclosure / privacy footer
   -------------------------------------------------------------------------- */

.tb-lead-form__disclosure {
  font-size: 12px;
  line-height: 1.5;
  color: var(--tb-lf-text-light);
  text-align: center;
  margin: 16px 0 0;
}

.tb-lead-form__disclosure a {
  color: inherit;
  text-decoration: none;
  transition: var(--tb-lf-transition);
}

.tb-lead-form__disclosure a:hover {
  text-decoration: underline;
}
