/*
 * IW — Banner CTA + Form (Global). Shortcode [iw_banner_cta_form].
 *
 * Layout: orange gradient bg full-bleed, left = white card form, right =
 * composite image (family + devices). Form chia sẻ JS handler `.iw-lead-form__form`.
 *
 * Design: Figma 407:57371 (desktop) + 407:42546 (mobile).
 */

.iw-banner-cta-form {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  /* Fullwidth breakout — same pattern as banner-cta-t1. */
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background-color: #ff6b17;
  background-image:
    radial-gradient(circle at 88% 78%, rgba(255, 198, 140, 0.35), transparent 42%),
    radial-gradient(circle at 12% 18%, rgba(255, 210, 150, 0.30), transparent 45%),
    linear-gradient(120deg, #ff5a00 0%, #ff6b17 45%, #ff8c3d 100%);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  font-family: inherit;
  -webkit-font-smoothing: antialiased;
}

.iw-banner-cta-form--bg-image {
  background-color: transparent;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.iw-banner-cta-form--bg-image::before { display: none; }

.iw-banner-cta-form--bg-color { background-image: none; }
.iw-banner-cta-form--bg-color::before { display: none; }

.iw-banner-cta-form::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -380px;
  width: 900px;
  height: 900px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 62%);
  pointer-events: none;
}

.iw-banner-cta-form__inner {
  position: relative;
  z-index: 1;
  max-width: var(--iw-container-max);
  margin: 0 auto;
  padding: 40px var(--iw-container-pad-x);
  display: grid;
  grid-template-columns: 530px 1fr;
  gap: 41px;
  align-items: center;
  box-sizing: border-box;
  min-height: 632px;
}

/* ───────── Bare variant: form đứng độc lập, không banner ─────────
   Dùng cho element [iw_form_only]. Wrapper chỉ 1 lớp <div> mang class
   .iw-banner-cta-form (để selector input/submit descendant vẫn match)
   + bọc thẳng <form>. --bare xoá nền cam, full-bleed breakout, glow
   ::before. Card .__form giữ nguyên look (nền trắng, radius, shadow).
   Background (image/color/default) + align là tuỳ chọn của element. */
.iw-banner-cta-form--bare {
  width: auto;
  max-width: 100%;       /* full bề ngang cột chứa; card tự giới hạn max-width */
  margin-left: 0;
  margin-right: 0;
  padding: 0;
  min-height: 0;
  background: none;
  overflow: visible;
}
.iw-banner-cta-form--bare::before { display: none; }

/* Card: giới hạn bề ngang + căn theo align (margin auto). */
.iw-banner-cta-form--bare .iw-banner-cta-form__form {
  max-width: var(--iw-form-only-max, 530px);
}
.iw-banner-cta-form--bare.iw-form-only--left   .iw-banner-cta-form__form { margin-left: 0;    margin-right: auto; }
.iw-banner-cta-form--bare.iw-form-only--center .iw-banner-cta-form__form { margin-left: auto; margin-right: auto; }
.iw-banner-cta-form--bare.iw-form-only--right  .iw-banner-cta-form__form { margin-left: auto; margin-right: 0;    }

/* ── Nền áp THẲNG vào card .__form (card thành hộp cam/ảnh, field trắng nổi
   trên). Scope .--bare nên KHÔNG ảnh hưởng banner. Background-color/image
   nhận từ CSS var inline (set ở template form-only). ── */
.iw-banner-cta-form--bare.iw-banner-cta-form--bg-color .iw-banner-cta-form__form {
  background: var(--iw-form-bg-color, #ff6b17);
}
.iw-banner-cta-form--bare.iw-banner-cta-form--bg-image .iw-banner-cta-form__form {
  background-color: transparent;
  background-image: var(--iw-form-bg-image, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
/* Màu chữ sáng — dùng khi card có nền màu/ảnh tối. Title + label + privacy
   → trắng; input vẫn nền trắng chữ tối (không đổi). */
.iw-banner-cta-form--bare.iw-form-only--text-light .iw-banner-cta-form__title { color: #ffffff; }
.iw-banner-cta-form--bare.iw-form-only--text-light .iw-banner-cta-form__label { color: #ffffff; }
.iw-banner-cta-form--bare.iw-form-only--text-light .iw-banner-cta-form__privacy { color: rgba(255, 255, 255, 0.85); }
.iw-banner-cta-form--bare.iw-form-only--text-light .iw-banner-cta-form__privacy-link { color: #ffffff; text-decoration: underline; }
/* Text lỗi đỏ chìm trên nền màu/ảnh → trắng + đậm cho nổi. */
.iw-banner-cta-form--bare.iw-form-only--text-light .iw-lead-form__error { color: #ffffff; font-weight: 600; }

/* Chữ sáng → ép nút submit về xanh blue (override màu variant của scheme,
   để nút nổi bật trên nền màu/ảnh). Hover: nền trắng + chữ/viền xanh. */
.iw-banner-cta-form--bare.iw-form-only--text-light .iw-banner-cta-form__submit {
  background: #4564ed;
  border-color: #4564ed;
  color: #ffffff;
}
.iw-banner-cta-form--bare.iw-form-only--text-light .iw-banner-cta-form__submit:hover {
  background: #ffffff;
  border-color: #4564ed;
  color: #4564ed;
}

.iw-banner-cta-form--bare.iw-banner-cta-form--bg-default .iw-banner-cta-form__form {
  background-color: #ff6b17;
  background-image:
    radial-gradient(circle at 88% 78%, rgba(255, 198, 140, 0.35), transparent 42%),
    radial-gradient(circle at 12% 18%, rgba(255, 210, 150, 0.30), transparent 45%),
    linear-gradient(120deg, #ff5a00 0%, #ff6b17 45%, #ff8c3d 100%);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* ─────────────────────────── Left: white form card ─────────────────────────── */

.iw-banner-cta-form__left {
  width: 100%;
  min-width: 0;
}

.iw-banner-cta-form__form {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  padding: 32px 40px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow:
    0 2px 32px -4px rgba(16, 24, 40, 0.04),
    0 4px 16px 10px rgba(16, 24, 40, 0.02),
    0 4px 4px -8px rgba(0, 0, 0, 0.02);
  box-sizing: border-box;
}

/* Specificity (0,0,2,0) để thắng `.iw-prose h2` (0,0,1,1) khi form chèn trong
   body bài viết — nếu không, prose đè margin-top/color/font-size của title. */
.iw-banner-cta-form .iw-banner-cta-form__title {
  margin: 0;
  font-family: inherit;
  font-weight: 700;
  font-size: 32px;
  line-height: 1.1;
  text-align: center;
  color: #0f172a;
}

.iw-banner-cta-form__fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.iw-banner-cta-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.iw-banner-cta-form__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.iw-banner-cta-form__label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-family: inherit;
  font-weight: 510;
  font-size: 14px;
  line-height: 20px;
  color: #3d3d3d;
}

.iw-banner-cta-form__req {
  color: #ff2156;
  font-weight: 400;
}

/* Input + select — bump specificity to beat Flatsome `input[type=text]`
   (0,1,1) and theme's select base styles. */
.iw-banner-cta-form .iw-banner-cta-form__input,
.iw-banner-cta-form select.iw-banner-cta-form__input {
  width: 100%;
  height: 48px; /* đồng bộ chiều cao với Select2 selection (48px) */
  margin: 0;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #d1d1d1;
  border-radius: 8px;
  box-shadow: none;
  font-family: inherit;
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
  color: #3d3d3d;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}

.iw-banner-cta-form .iw-banner-cta-form__input:focus {
  border-color: var(--iw-accent, #4564ed);
  outline: 0;
  /* Focus glow theo accent của scheme (color-mix → khỏi cần token rgb riêng). */
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--iw-accent, #4564ed) 15%, transparent);
}

.iw-banner-cta-form .iw-banner-cta-form__input::placeholder { color: #888888; }

/* Native select arrow (used khi Select2 chưa init / fallback). */
.iw-banner-cta-form select.iw-banner-cta-form__input--select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'><path d='M5 7.5L10 12.5L15 7.5' stroke='%233d3d3d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px 20px;
}

/* Submit button — nền variant (theo color scheme), full width. */
.iw-banner-cta-form .iw-banner-cta-form__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 13px 24px;
  background: var(--iw-cta-bg, #4564ed);
  color: var(--iw-cta-fg, #ffffff);
  font-family: inherit;
  font-weight: 510;
  font-size: 16px;
  line-height: 22px;
  /* Border cùng màu nền (vô hình) lúc thường để hover đổi nền trắng + border
     variant mà không nhảy layout. */
  border: 1px solid var(--iw-cta-bg, #4564ed);
  box-sizing: border-box;
  border-radius: 8px;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.12s;
  text-transform: none;
}

/* Hover: nền trắng, border + chữ theo accent của scheme. */
.iw-banner-cta-form .iw-banner-cta-form__submit:hover {
  background: #ffffff;
  border-color: var(--iw-accent, #4564ed);
  color: var(--iw-accent, #4564ed);
}
.iw-banner-cta-form .iw-banner-cta-form__submit:active { transform: translateY(1px); }
.iw-banner-cta-form .iw-banner-cta-form__submit[disabled] { opacity: 0.7; cursor: wait; }

.iw-banner-cta-form__feedback {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  color: #3d3d3d;
}
.iw-banner-cta-form__feedback:empty { display: none; }

.iw-banner-cta-form__privacy {
  margin: 0;
  font-family: inherit;
  font-weight: 400;
  font-size: 12px;
  line-height: 1.5;
  color: #888888;
  text-align: left;
}

/* Specificity (0,0,2,0) để thắng `.iw-prose a` (0,0,1,1) khi chèn trong body. */
.iw-banner-cta-form .iw-banner-cta-form__privacy-link {
  font-weight: 700;
  color: #888888;
  text-decoration: none;
}
.iw-banner-cta-form .iw-banner-cta-form__privacy-link:hover { color: var(--iw-accent, #4564ed); }

/* ─────────────────────────── Right: composite image ─────────────────────────── */

.iw-banner-cta-form__right {
  position: absolute;
  top: 0;
  right: -20%;
  bottom: -10%;
  z-index: -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.iw-banner-cta-form__picture {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  line-height: 0;
}

.iw-banner-cta-form__image {
  display: block;
  height: 587px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

/* ─────────────────────────── Select2 override ─────────────────────────── */

/* Select2 (load qua location-modal) áp lên select[data-iw-extra]. Override
   để khớp input native (border #d1d1d1, h ~48, color #3d3d3d). */
.iw-banner-cta-form .select2-container--default .select2-selection--single {
  height: 48px;
  border: 1px solid #d1d1d1;
  border-radius: 8px;
  background: #ffffff;
}
.iw-banner-cta-form .select2-container--default .select2-selection--single .select2-selection__rendered {
  padding: 12px;
  line-height: 24px;
  color: #3d3d3d;
  font-size: 16px;
}
.iw-banner-cta-form .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #888888;
}
.iw-banner-cta-form .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 46px;
  right: 8px;
}
/* Chevron tường minh thay triangle mặc định Select2 (hay mất/mờ). Khớp mũi
   tên của native select fallback (stroke #3d3d3d). */
.iw-banner-cta-form .select2-container--default .select2-selection--single .select2-selection__arrow b {
  border: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'><path d='M5 7.5L10 12.5L15 7.5' stroke='%233d3d3d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px 20px;
}
/* Mở dropdown → lật mũi tên. */
.iw-banner-cta-form .select2-container--open .select2-selection--single .select2-selection__arrow b {
  transform: translate(-50%, -50%) rotate(180deg);
}

/* ─────────────────────────── Mobile ─────────────────────────── */

@media (max-width: 991px) {
  /* :not(--bare) → đừng gán nền cam cho form-only (nền của nó nằm ở card). */
  .iw-banner-cta-form:not(.iw-banner-cta-form--bare) {
    background-image:
      radial-gradient(circle at 50% 110%, rgba(255, 200, 140, 0.45), transparent 55%),
      linear-gradient(160deg, #ff5a00 0%, #ff6b17 50%, #ff8c3d 100%);
  }
  .iw-banner-cta-form::before { display: none; }

  .iw-banner-cta-form__inner {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 24px 12px 0;
    max-width: none;
    min-height: 0;
  }

  .iw-banner-cta-form__form {
    padding: 24px 20px;
  }

  .iw-banner-cta-form .iw-banner-cta-form__title {
    font-size: 24px;
    line-height: 1.2;
  }

  .iw-banner-cta-form__row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .iw-banner-cta-form__right {
    position: static;
    right: auto;
    z-index: auto;
    width: 100%;
    justify-content: center;
    margin-top: 16px;
  }

  .iw-banner-cta-form__picture { justify-content: center; }

  .iw-banner-cta-form__image {
    height: 260px;
    width: auto;
    max-width: 120%;
    object-fit: contain;
  }

  /* Ẩn ảnh trên mobile (<992px) — form đứng 1 mình. */
  .iw-banner-cta-form--no-img-mobile .iw-banner-cta-form__right {
    display: none;
  }
}

/* Ẩn ảnh trên desktop (≥992px) — chỉ ẩn cột ảnh, GIỮ nguyên grid 530px 1fr:
   form đứng yên cột trái (cố định), phải để trống (như design 407:4015). */
@media (min-width: 992px) {
  .iw-banner-cta-form--no-img-desktop .iw-banner-cta-form__right {
    display: none;
  }
}
