/**
 * TheAnhLive DC — Lead form (Khám shop) SoT
 * Classes: .tal-lead-form, .tal-lead-field, .tal-lead-chip, .tal-lead-thanks
 * Enqueued site-wide when shortcode present; tokens align with --tal-dc-*
 */

.tal-lead-form,
.tal-lead-thanks {
  --tal-lead-text: var(--tal-dc-text, #0B1F3A);
  --tal-lead-muted: var(--tal-dc-muted, #455A74);
  --tal-lead-accent: var(--tal-dc-accent, #0F62FE);
  --tal-lead-line: #E6ECF4;
  --tal-lead-bg: #F6F8FC;
  --tal-lead-radius: 12px;
  font-family: inherit;
  color: var(--tal-lead-text);
}

.tal-lead-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.tal-lead-form__head {
  margin: 0 0 2px;
}

.tal-lead-form__title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--tal-lead-text);
  letter-spacing: -0.02em;
}

.tal-lead-form__sub {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--tal-lead-muted);
}

.tal-lead-form__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.tal-lead-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--tal-lead-text);
}

/* Keep 2-col inputs on the same baseline when labels wrap */
.tal-lead-form__row > .tal-lead-field {
  min-height: 100%;
}

.tal-lead-field__hint {
  font-weight: 500;
  color: var(--tal-lead-muted);
  font-size: 12.5px;
}

/* Beat Flatsome `input { height: 2.507em; padding: 0 .75em }` */
.tal-lead-field input[type="text"],
.tal-lead-field input[type="url"],
.tal-lead-field input[type="tel"],
.tal-lead-field input[type="email"],
.tal-lead-field select,
.tal-lead-field textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  height: auto !important;
  min-height: 48px;
  padding: 12px 14px !important;
  font: inherit;
  font-size: 15px !important;
  font-weight: 500;
  line-height: 1.4 !important;
  color: var(--tal-lead-text);
  background: #fff;
  border: 1px solid var(--tal-lead-line);
  border-radius: var(--tal-lead-radius);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.tal-lead-field select {
  background-color: #fff;
  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='%23455A74' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px !important;
  cursor: pointer;
}

.tal-lead-field textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5 !important;
}

.tal-lead-field input::placeholder,
.tal-lead-field textarea::placeholder {
  color: #8A9BB0;
  opacity: 1;
}

.tal-lead-field input:hover,
.tal-lead-field select:hover,
.tal-lead-field textarea:hover {
  border-color: #C9D5E6;
}

.tal-lead-field input:focus,
.tal-lead-field select:focus,
.tal-lead-field textarea:focus {
  border-color: var(--tal-lead-accent);
  box-shadow: 0 0 0 3px rgba(15, 98, 254, .18);
  background: #fff;
}

.tal-lead-chips {
  margin: 0;
  padding: 0;
  border: 0;
}

.tal-lead-chips__legend {
  display: block;
  margin: 0 0 10px;
  padding: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--tal-lead-text);
}

.tal-lead-chips__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tal-lead-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 10px 14px;
  min-height: 42px;
  box-sizing: border-box;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--tal-lead-text);
  background: var(--tal-lead-bg);
  border: 1px solid var(--tal-lead-line);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.tal-lead-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tal-lead-chip:hover {
  border-color: #C9D5E6;
  background: #EEF3FA;
}

.tal-lead-chip:has(input:focus-visible) {
  box-shadow: 0 0 0 3px rgba(15, 98, 254, .18);
}

.tal-lead-chip:has(input:checked) {
  color: #fff;
  background: var(--tal-lead-accent);
  border-color: var(--tal-lead-accent);
  box-shadow: 0 6px 16px rgba(15, 98, 254, .22);
}

/* Fallback when :has() unsupported — sibling via JS not required; modern browsers OK */
@supports not selector(:has(*)) {
  .tal-lead-chip input:checked + .tal-lead-chip__text {
    /* text stays; parent can't style — accept degraded */
  }
}

.tal-lead-form__note {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--tal-lead-muted);
}

.tal-lead-form__note a {
  color: var(--tal-lead-accent);
  font-weight: 600;
  text-decoration: none;
}

.tal-lead-form__note a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tal-lead-form__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 14px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--tal-lead-accent) !important;
  color: #fff !important;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(15, 98, 254, .28);
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.tal-lead-form__submit:hover,
.tal-lead-form__submit:focus-visible {
  background: #0A52D9 !important;
  box-shadow: 0 12px 28px rgba(15, 98, 254, .34);
  outline: none;
}

.tal-lead-form__submit:active {
  transform: translateY(1px);
}

/* Thank-you state */
.tal-lead-thanks {
  padding: 28px 24px;
  border: 1px solid var(--tal-lead-line);
  border-radius: 16px;
  background: linear-gradient(180deg, #F0F5FF 0%, #fff 100%);
}

.tal-lead-thanks__title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 800;
  color: var(--tal-lead-text);
}

.tal-lead-thanks__body {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--tal-lead-muted);
}

.tal-lead-thanks .tal-lead-form__submit {
  width: auto;
  min-width: 220px;
}

.tal-lead-form .tal-hp {
  position: absolute !important;
  left: -9999px !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

@media (max-width: 680px) {
  .tal-lead-form__row {
    grid-template-columns: 1fr;
  }

  .tal-lead-form__title {
    font-size: 20px;
  }

  .tal-lead-chip {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tal-lead-field input,
  .tal-lead-field select,
  .tal-lead-field textarea,
  .tal-lead-chip,
  .tal-lead-form__submit {
    transition: none;
  }
}
