/* Popup đăng ký trang chủ — file viết tay, không qua gulp. Markup: efw/popup-home.php + form-all-sites Template 14.
 * Mọi selector bắt đầu bằng #ags-home-popup để thắng CSS chung của Flatsome / less cũ (button, input, select, label)
 * mà không cần !important. Dùng px tuyệt đối vì root font-size của site co giãn theo màn hình.
 */

@font-face { font-family: "AGS Apercu Pro"; src: url(../landing-ags-talent-ldp-2026/fonts/SVN-Apercu-Pro-Light.woff2) format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "AGS Apercu Pro"; src: url(../landing-ags-talent-ldp-2026/fonts/SVN-Apercu-Pro-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "AGS Apercu Pro"; src: url(../landing-ags-talent-ldp-2026/fonts/SVN-Apercu-Pro-Medium.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "AGS Apercu Pro"; src: url(../landing-ags-talent-ldp-2026/fonts/SVN-Apercu-Pro-Bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }

#ags-home-popup {
  --blue: #00539f;
  --blue-dark: #002e57;
  --blue-50: #e6eef5;
  --red: #ed1941;
  --red-dark: #c91236;
  --text: #1a1c1e;
  --muted: #76777a;
  --line: #e2e2e5;
  --danger: #d4351c;
  --font: "AGS Apercu Pro", "Be Vietnam Pro", system-ui, sans-serif;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);

  /* trên mọi nút chat (Zalo dùng z-index 2147483644 inline) */
  position: fixed; inset: 0; z-index: 2147483645; display: grid; place-items: center; padding: 24px;
  font-family: var(--font); line-height: 1.5; text-align: left; opacity: 0; transition: opacity .35s var(--ease-out);
  overscroll-behavior: contain;
}
#ags-home-popup.is-open { opacity: 1; }
#ags-home-popup[hidden], #ags-home-popup [hidden] { display: none !important; }
#ags-home-popup *, #ags-home-popup *::before, #ags-home-popup *::after { box-sizing: border-box; }

#ags-home-popup .ags-hp__overlay { position: absolute; inset: 0; background: rgba(4, 42, 97, .72); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }

#ags-home-popup .ags-hp__panel {
  position: relative; display: grid; grid-template-columns: 420px minmax(0, 1fr); width: min(940px, 100%);
  max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); overflow: auto; overscroll-behavior: contain;
  border-radius: 24px; background: #fff; box-shadow: 0 40px 80px -20px rgba(0, 20, 60, .5);
  transform: translateY(16px) scale(.97); transition: transform .45s var(--ease-spring);
}
#ags-home-popup.is-open .ags-hp__panel { transform: none; }

/* ---------- Nút đóng ---------- */
#ags-home-popup .ags-hp__close {
  position: absolute; top: 14px; right: 14px; z-index: 2; display: grid; place-items: center;
  width: 40px; min-width: 0; height: 40px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 50%;
  background: #fff; color: var(--blue); box-shadow: 0 4px 14px rgba(0, 20, 60, .18); line-height: 1; cursor: pointer;
  transition: background-color .25s, color .25s, transform .35s var(--ease-spring);
}
#ags-home-popup .ags-hp__close:hover { background: var(--red); color: #fff; transform: rotate(90deg); }
#ags-home-popup .ags-hp__close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

/* ---------- Banner + nội dung ---------- */
#ags-home-popup .ags-hp__banner { position: relative; min-height: 100%; margin: 0; overflow: hidden; background: var(--blue-dark); }
#ags-home-popup .ags-hp__banner img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: 50% 50%; }
#ags-home-popup .ags-hp__body { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 40px 36px; }
#ags-home-popup .ags-hp__title {
  margin: 0; padding: 0 24px; font-family: var(--font); font-weight: 700; font-size: 28px; line-height: 1.2; letter-spacing: normal;
  text-transform: uppercase; text-align: center; color: var(--blue);
}
#ags-home-popup .ags-hp__title .accent { color: var(--red); }
#ags-home-popup .ags-hp__sub { margin: -4px 0 6px; font-weight: 500; font-size: 17px; line-height: 1.4; text-align: center; color: var(--blue); }
#ags-home-popup .ags-hp__sub .accent { color: var(--red); }

/* ---------- Form (Template 14) ---------- */
#ags-home-popup .form-all-sites { width: 100%; margin: 0; padding: 0; }
#ags-home-popup form { display: flex; flex-direction: column; gap: 12px; width: 100%; margin: 0; padding: 0; }
#ags-home-popup .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#ags-home-popup .field { display: flex; flex-direction: column; width: 100%; margin: 0; }
#ags-home-popup .control { position: relative; margin: 0; }
#ags-home-popup .control input, #ags-home-popup .control select {
  width: 100%; height: 48px; min-height: 0; margin: 0; padding: 0 16px; border: 1px solid var(--line); border-radius: 4px;
  background: #fff none; box-shadow: none; outline: none; appearance: none; -webkit-appearance: none;
  font-family: var(--font); font-weight: 400; font-size: 16px; line-height: 46px; color: var(--text);
  transition: border-color .25s, box-shadow .25s;
}
#ags-home-popup .control input::placeholder { color: var(--muted); opacity: 1; }
#ags-home-popup .control select { padding-right: 48px; background-image: none !important; cursor: pointer; } /* bỏ mũi tên của theme, dùng ::after */
#ags-home-popup .control select:invalid { color: var(--muted); }
#ags-home-popup .control select option { color: var(--text); }
#ags-home-popup .control--select::after {
  content: ""; position: absolute; right: 19px; top: 17px; width: 9px; height: 9px; pointer-events: none;
  border: solid var(--blue); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
#ags-home-popup .control input:hover, #ags-home-popup .control select:hover { border-color: #c3cfdd; }
#ags-home-popup .control input:focus, #ags-home-popup .control select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 83, 159, .12); }
#ags-home-popup .field.is-valid .control input, #ags-home-popup .field.is-valid .control select { border-color: #7fb8a0; }
#ags-home-popup .control input.error, #ags-home-popup .control select.error { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(212, 53, 28, .1); }
#ags-home-popup .field.is-invalid .control { animation: agsHpShake .4s; }
/* !important: CSS của form-all-sites ẩn label.error bằng !important */
#ags-home-popup label.error { display: block !important; width: 100%; margin: 4px 0 0; font-family: var(--font); font-weight: 400; font-size: 13px; line-height: 1.4; text-transform: none; color: var(--danger); }

#ags-home-popup .field label.consent { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; margin: 0; font-weight: 400; font-size: 13px; line-height: 1.5; text-transform: none; color: var(--muted); cursor: pointer; }
#ags-home-popup .consent input[type="checkbox"] { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--blue); cursor: pointer; }
#ags-home-popup .consent span { flex: 1; min-width: 0; margin: 0; font: inherit; color: inherit; text-transform: none; }
#ags-home-popup .consent a { color: var(--blue); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
#ags-home-popup .consent a:hover { color: var(--red); }
#ags-home-popup .consent label.error { order: 3; flex-basis: 100%; padding-left: 28px; }
#ags-home-popup .field.is-invalid .consent input[type="checkbox"] { outline: 2px solid var(--danger); outline-offset: 2px; }
#ags-home-popup .fas-col-3 { display: flex; justify-content: center; width: 100%; margin: 0; padding: 0; }

/* ---------- Nút gửi / nút đóng lời cảm ơn ---------- */
#ags-home-popup .form-card__submit, #ags-home-popup .ags-hp__btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; align-self: center; isolation: isolate; overflow: hidden;
  width: auto; min-width: 220px; min-height: 44px; height: auto; margin: 4px 0 0; padding: 10px 28px; border: 0; border-radius: 22px;
  background: var(--red); color: #fff; font-family: var(--font); font-weight: 700; font-size: 17px; line-height: 1.2;
  text-transform: none; letter-spacing: normal; cursor: pointer;
  transition: transform .35s var(--ease-spring), box-shadow .35s var(--ease-out), background-color .25s;
}
#ags-home-popup .form-card__submit:hover, #ags-home-popup .ags-hp__btn:hover { background: var(--red-dark); color: #fff; transform: translateY(-2px); box-shadow: 0 10px 24px -8px rgba(237, 25, 65, .7); }
#ags-home-popup .form-card__submit:disabled { opacity: .7; cursor: progress; }
#ags-home-popup .form-card__submit::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
  transform: translateX(-120%); animation: agsHpShine 4.5s var(--ease-out) infinite 1.5s;
}
#ags-home-popup :focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

/* ---------- Lời cảm ơn ---------- */
#ags-home-popup .ags-hp__success { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: auto 0; padding: 24px 0; text-align: center; outline: none; }
#ags-home-popup .ags-hp__success .ags-hp__sub { margin: 0; line-height: 1.5; }
#ags-home-popup .ags-hp__success-icon { width: 64px; height: 64px; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
#ags-home-popup .ags-hp__success-icon circle { fill: var(--red); stroke: none; }
#ags-home-popup .ags-hp__success-icon path { stroke: #fff; }
/* Gửi thành công: ẩn banner, popup thu còn 1 cột chỉ có lời cảm ơn (desktop + mobile) */
#ags-home-popup.is-success .ags-hp__panel { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; width: min(520px, 100%); }
#ags-home-popup.is-success .ags-hp__banner { display: none; }
#ags-home-popup.is-success .ags-hp__body { padding-top: 48px; padding-bottom: 32px; }

/* Popup mở: khoá cuộn trang; khung thử thách reCAPTCHA phải nổi trên popup */
html.ags-hp-open, html.ags-hp-open body { overflow: hidden; }
html.ags-hp-open body > div:has(iframe[src*="recaptcha"][src*="bframe"]) { z-index: 2147483647 !important; }

@keyframes agsHpShine { 0% { transform: translateX(-120%); } 30%, 100% { transform: translateX(120%); } }
@keyframes agsHpShake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

@media (max-width: 760px) {
  #ags-home-popup { padding: 12px; }
  #ags-home-popup .ags-hp__panel {
    grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; align-content: start;
    max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); border-radius: 20px;
  }
  /* tỉ lệ 16:9 bằng padding-top: aspect-ratio trong grid bị Safari tính cao 0 */
  #ags-home-popup .ags-hp__banner { min-height: 0; height: 0; padding-top: 56.25%; }
  #ags-home-popup .ags-hp__body { gap: 10px; padding: 18px 16px 20px; }
  #ags-home-popup .ags-hp__title { padding: 0; font-size: 21px; }
  #ags-home-popup .ags-hp__sub { margin-bottom: 2px; font-size: 15px; }
  #ags-home-popup form { gap: 10px; }
  #ags-home-popup .control input, #ags-home-popup .control select { height: 44px; line-height: 42px; }
  #ags-home-popup .control--select::after { top: 15px; }
  #ags-home-popup .field label.consent { font-size: 12px; }
  #ags-home-popup .ags-hp__close { top: 8px; right: 8px; width: 36px; height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  #ags-home-popup, #ags-home-popup .ags-hp__panel { transition: none; }
  #ags-home-popup .form-card__submit::after, #ags-home-popup .field.is-invalid .control { animation: none; }
}
