/* FEAT-003 — Apply popup modal styles */

.tljb-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: tljb-modal-fade-in 0.25s ease;
}
.tljb-modal[hidden] {
  display: none;
}
.tljb-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  cursor: pointer;
}
.tljb-modal__card {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 1.5rem;
  padding: 36px 32px 28px;
  max-width: 720px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 32px 64px -16px rgba(15, 23, 42, 0.5);
  animation: tljb-modal-scale-in 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}
.tljb-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.tljb-modal__close:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}
.tljb-modal__intro {
  margin-bottom: 18px;
  padding-right: 36px;
}
.tljb-modal__title {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 8px;
  line-height: 1.3;
}
.tljb-modal__subtitle {
  font-size: 14px;
  color: #475569;
  line-height: 1.55;
  margin: 0;
}
.tljb-modal__warning {
  padding: 16px;
  background: #fef3c7;
  border-radius: 12px;
  border: 1px solid #fde68a;
  color: #78350f;
  font-size: 14px;
  line-height: 1.5;
}
.tljb-modal__warning p {
  margin: 8px 0 0;
}

/* CF7 form styling inside modal */
.tljb-modal .wpcf7 {
  margin: 0;
}
.tljb-modal .wpcf7 form {
  margin: 0;
  padding: 0;
}
.tljb-modal .wpcf7 p {
  margin: 0 0 12px;
}
.tljb-modal .wpcf7-form-control-wrap {
  display: block;
}
.tljb-modal .wpcf7 label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

/* 2-column grid layout from 540px+ (tablet/desktop) */
@media (min-width: 540px) {
  .tljb-modal .wpcf7 form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 18px;
    row-gap: 8px;
    align-items: start;
  }
  .tljb-modal .wpcf7 form > p {
    margin: 0 0 6px;
  }
  /* Tỉnh / Thành phố (5th visible field) + submit + response span full width */
  .tljb-modal .wpcf7 form > p:nth-of-type(5),
  .tljb-modal .wpcf7 form > p:last-of-type,
  .tljb-modal .wpcf7-response-output {
    grid-column: 1 / -1;
  }
  /* Hidden field spans (job-id/title/market/source-url) stay invisible + no grid space */
  .tljb-modal .wpcf7 form > .wpcf7-form-control-wrap {
    display: none;
  }
}
.tljb-modal .wpcf7 input[type="text"],
.tljb-modal .wpcf7 input[type="tel"],
.tljb-modal .wpcf7 input[type="email"],
.tljb-modal .wpcf7 input[type="number"],
.tljb-modal .wpcf7 textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: #0f172a;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}
.tljb-modal .wpcf7 input::placeholder,
.tljb-modal .wpcf7 textarea::placeholder {
  color: #94a3b8;
}
.tljb-modal .wpcf7 input:focus,
.tljb-modal .wpcf7 textarea:focus {
  outline: none;
  border-color: #0b4bd8;
  box-shadow: 0 0 0 3px rgba(11, 75, 216, 0.18);
}
.tljb-modal .wpcf7 input.wpcf7-submit,
.tljb-modal .wpcf7 button[type="submit"] {
  width: 100%;
  margin-top: 8px;
  padding: 14px 24px;
  background: linear-gradient(135deg, #0b4bd8, #1e6fff);
  color: #fff !important;
  border: none;
  border-radius: 99px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 8px 20px -8px rgba(11, 75, 216, 0.6);
}
.tljb-modal .wpcf7 input.wpcf7-submit:hover,
.tljb-modal .wpcf7 button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -10px rgba(11, 75, 216, 0.7);
}
.tljb-modal .wpcf7 input.wpcf7-submit:active {
  transform: scale(0.98);
}
.tljb-modal .wpcf7-response-output {
  margin: 12px 0 0 !important;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
}
.tljb-modal .wpcf7-not-valid-tip {
  font-size: 12px;
  margin-top: 4px;
  color: #ef4444;
}
.tljb-modal .wpcf7 input.wpcf7-not-valid,
.tljb-modal .wpcf7 textarea.wpcf7-not-valid {
  border-color: #ef4444;
}
.tljb-modal .wpcf7-spinner {
  display: none;
}

/* Success + Error states share layout */
.tljb-modal__success,
.tljb-modal__error {
  text-align: center;
  padding: 8px 0;
}
.tljb-modal__success-icon,
.tljb-modal__error-icon {
  margin: 0 auto 16px;
  display: inline-flex;
  border-radius: 50%;
  padding: 14px;
}
.tljb-modal__success-icon {
  color: #10b981;
  background: #d1fae5;
}
.tljb-modal__error-icon {
  color: #ef4444;
  background: #fee2e2;
}
.tljb-modal__success .tljb-modal__title,
.tljb-modal__error .tljb-modal__title {
  margin-bottom: 10px;
}
.tljb-modal__hotline-mini {
  font-size: 13px;
  color: #64748b;
  margin: 12px 0 0;
}
.tljb-modal__hotline-mini a {
  color: #0b4bd8;
  font-weight: 700;
  text-decoration: none;
}
.tljb-modal__hotline-mini a:hover {
  text-decoration: underline;
}
.tljb-modal__success-btn {
  margin-top: 20px;
  padding: 12px 32px;
  background: #0b4bd8;
  color: #fff;
  border: none;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  min-width: 140px;
  transition: background 0.2s ease, transform 0.15s ease;
}
.tljb-modal__success-btn:hover {
  background: #093ab0;
  transform: translateY(-1px);
}
.tljb-modal__error-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.tljb-modal__error-back {
  padding: 12px 28px;
  background: #fff;
  color: #0f172a;
  border: 1.5px solid #cbd5e1;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  min-width: 120px;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.tljb-modal__error-back:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

/* Triggers (button styling reuse) */
.tljb-apply-trigger {
  cursor: pointer;
}

/* Animations */
@keyframes tljb-modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes tljb-modal-scale-in {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Mobile */
@media (max-width: 640px) {
  .tljb-modal {
    padding: 12px;
    align-items: flex-end;
  }
  .tljb-modal__card {
    padding: 28px 20px 22px;
    max-height: 92vh;
    border-radius: 1.5rem 1.5rem 0 0;
    animation: tljb-modal-slide-up 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  }
  .tljb-modal__title {
    font-size: 19px;
  }
}
@keyframes tljb-modal-slide-up {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}

/* ENH-020 — Quiz form (inline CF7 in /quiz/ step) shares CF7 styling with apply modal.
   .quiz-form wraps CF7 output directly trên page-quiz.php step "form". */
.quiz-form {
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 32px 28px;
  background: #fff;
  border-radius: 1.5rem;
  box-shadow: 0 12px 32px -16px rgba(15, 23, 42, 0.18);
}
.quiz-form .wpcf7 {
  margin: 0;
}
.quiz-form .wpcf7 form {
  margin: 0;
  padding: 0;
}
.quiz-form .wpcf7 p {
  margin: 0 0 12px;
}
.quiz-form .wpcf7-form-control-wrap {
  display: block;
}
.quiz-form .wpcf7 label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
@media (min-width: 540px) {
  .quiz-form .wpcf7 form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 18px;
    row-gap: 8px;
    align-items: start;
  }
  .quiz-form .wpcf7 form > p {
    margin: 0 0 6px;
  }
  /* tinh-thanh (5th) + submit + response output span full width */
  .quiz-form .wpcf7 form > p:nth-of-type(5),
  .quiz-form .wpcf7 form > p:last-of-type,
  .quiz-form .wpcf7-response-output {
    grid-column: 1 / -1;
  }
  /* Hidden CF7 fields take no grid space */
  .quiz-form .wpcf7 form > .wpcf7-form-control-wrap {
    display: none;
  }
}
.quiz-form .wpcf7 input[type="text"],
.quiz-form .wpcf7 input[type="tel"],
.quiz-form .wpcf7 input[type="email"],
.quiz-form .wpcf7 input[type="number"],
.quiz-form .wpcf7 textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: #0f172a;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}
.quiz-form .wpcf7 input::placeholder,
.quiz-form .wpcf7 textarea::placeholder {
  color: #94a3b8;
}
.quiz-form .wpcf7 input:focus,
.quiz-form .wpcf7 textarea:focus {
  outline: none;
  border-color: #0b4bd8;
  box-shadow: 0 0 0 3px rgba(11, 75, 216, 0.18);
}
.quiz-form .wpcf7 input.wpcf7-submit,
.quiz-form .wpcf7 button[type="submit"] {
  width: 100%;
  margin-top: 8px;
  padding: 14px 24px;
  background: linear-gradient(135deg, #0b4bd8, #1e6fff);
  color: #fff !important;
  border: none;
  border-radius: 99px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 8px 20px -8px rgba(11, 75, 216, 0.6);
}
.quiz-form .wpcf7 input.wpcf7-submit:hover,
.quiz-form .wpcf7 button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -10px rgba(11, 75, 216, 0.7);
}
.quiz-form .wpcf7 input.wpcf7-submit:active {
  transform: scale(0.98);
}
.quiz-form .wpcf7-response-output {
  margin: 12px 0 0 !important;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
}
.quiz-form .wpcf7-not-valid-tip {
  font-size: 12px;
  margin-top: 4px;
  color: #ef4444;
}
.quiz-form .wpcf7 input.wpcf7-not-valid,
.quiz-form .wpcf7 textarea.wpcf7-not-valid {
  border-color: #ef4444;
}
.quiz-form .wpcf7-spinner {
  display: none;
}
@media (max-width: 540px) {
  .quiz-form {
    padding: 24px 18px 20px;
    border-radius: 1.25rem;
  }
}

/* ENH-020 — Contact page CF7 wrapper (page-contact.php) — same CF7 internals as quiz-form */
.c-form--cf7 .wpcf7 { margin: 0; }
.c-form--cf7 .wpcf7 form { margin: 0; padding: 0; }
.c-form--cf7 .wpcf7 p { margin: 0 0 12px; }
.c-form--cf7 .wpcf7-form-control-wrap { display: block; }
.c-form--cf7 .wpcf7 label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}
@media (min-width: 540px) {
  .c-form--cf7 .wpcf7 form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 18px;
    row-gap: 8px;
  }
  /* chu-de (4th) + tin-nhan (5th textarea) + submit + response span full */
  .c-form--cf7 .wpcf7 form > p:nth-of-type(4),
  .c-form--cf7 .wpcf7 form > p:nth-of-type(5),
  .c-form--cf7 .wpcf7 form > p:last-of-type,
  .c-form--cf7 .wpcf7-response-output {
    grid-column: 1 / -1;
  }
  .c-form--cf7 .wpcf7 form > .wpcf7-form-control-wrap {
    display: none;
  }
}
.c-form--cf7 .wpcf7 input[type="text"],
.c-form--cf7 .wpcf7 input[type="tel"],
.c-form--cf7 .wpcf7 input[type="email"],
.c-form--cf7 .wpcf7 textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.c-form--cf7 .wpcf7 input:focus,
.c-form--cf7 .wpcf7 textarea:focus {
  outline: none;
  border-color: #0b4bd8;
  box-shadow: 0 0 0 3px rgba(11, 75, 216, 0.18);
}
.c-form--cf7 .wpcf7 input.wpcf7-submit {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #0b4bd8, #1e6fff);
  color: #fff !important;
  border: none;
  border-radius: 99px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 8px 20px -8px rgba(11, 75, 216, 0.6);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.c-form--cf7 .wpcf7 input.wpcf7-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -10px rgba(11, 75, 216, 0.7);
}
.c-form--cf7 .wpcf7-spinner { display: none; }

/* ===== Loading khi bấm gửi form trong modal (CF7 tự thêm .submitting lúc gửi AJAX) ===== */
.tljb-modal__body .wpcf7-form { position: relative; }
/* Lớp phủ mờ + chữ "Đang gửi…" che form trong lúc gửi */
.tljb-modal__body .wpcf7-form.submitting::after {
  content: "Đang gửi thông tin…";
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  font-weight: 600;
  color: #0b4bd8;
}
/* Vòng xoay loading phía trên dòng chữ */
.tljb-modal__body .wpcf7-form.submitting::before {
  content: "";
  position: absolute;
  top: calc(50% - 42px);
  left: calc(50% - 20px);
  z-index: 7;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(11, 75, 216, 0.22);
  border-top-color: #0b4bd8;
  border-radius: 50%;
  animation: tljbSpin 0.7s linear infinite;
}
@keyframes tljbSpin {
  to { transform: rotate(360deg); }
}
/* Khóa nút submit khi đang gửi để tránh bấm 2 lần */
.tljb-modal__body .wpcf7-form.submitting input[type="submit"],
.tljb-modal__body .wpcf7-form.submitting .wpcf7-submit {
  opacity: 0.55;
  cursor: wait;
  pointer-events: none;
}
