/* ==========================================================================
   Form đăng ký chung (Contact Form 7) trong popup #dang-ky và khối CTA [timona_cta_dang_ky].
   Lớp designer: .form-group, .form-label, .form-input, .form-select, .form-submit-btn (components.css),
   .leadgen-* (style.css). Tệp này chỉ bổ sung phần CF7 và gỡ kiểu input/nút mặc định của Flatsome.
   ========================================================================== */

.timona-form-dang-ky {
  --tm-loi: #dc2626;
  --tm-loi-nen: #fef2f2;
  --tm-dung: #16a34a;
  --tm-dung-nen: #f0fdf4;
}

.timona-form-dang-ky .wpcf7 { margin: 0; }

.timona-form-dang-ky .wpcf7-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0;
}

.timona-form-dang-ky .wpcf7-form > p { margin: 0; } /* phòng khi autop còn bật */

/* Nhóm nhãn + ô (nhãn bọc ô, không cần id) */
.timona-form-dang-ky label.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  font-weight: 400;
  cursor: default;
}

.timona-form-dang-ky .form-label {
  display: block;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-title);
}

.timona-form-dang-ky .wpcf7-form-control-wrap { display: block; position: relative; }

/* Ô nhập: gỡ chiều cao, bóng, lề mặc định của Flatsome để ra đúng .form-input của designer */
.timona-form-dang-ky .form-input,
.timona-form-dang-ky .form-select {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 10px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  box-shadow: none;
  font-family: inherit;
  font-size: 16px;
  line-height: normal;
  color: var(--color-text-title);
  max-width: none;
}

.timona-form-dang-ky .form-select {
  padding-right: 36px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23002058' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
}

.timona-form-dang-ky .form-input::placeholder { color: #94a3b8; opacity: 1; }

.timona-form-dang-ky .form-input:focus,
.timona-form-dang-ky .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 32, 96, 0.12);
  outline: none;
}

/* Nút gửi (CF7 in <input type="submit">) */
.timona-form-dang-ky .wpcf7-submit.form-submit-btn {
  display: block;
  width: 100%;
  height: auto;
  margin: 8px 0 0;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary, #002058) 0%, var(--color-royal-blue, #0b4a9e) 100%);
  color: #ffffff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: normal;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 32, 96, 0.25);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
}

.timona-form-dang-ky .wpcf7-submit.form-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 32, 96, 0.35);
}

.timona-form-dang-ky .wpcf7-submit.form-submit-btn:focus-visible {
  outline: 3px solid var(--color-accent-gold);
  outline-offset: 2px;
}

.timona-form-dang-ky .wpcf7-form.submitting .wpcf7-submit { opacity: 0.7; cursor: wait; }

/* Vòng quay chờ của CF7: đặt giữa, dưới nút */
.timona-form-dang-ky .wpcf7-spinner { display: none; }
.timona-form-dang-ky .wpcf7-form.submitting .wpcf7-spinner { display: block; margin: 4px auto 0; }

/* Lỗi nhập */
.timona-form-dang-ky .wpcf7-not-valid-tip {
  position: static;
  display: block;
  margin-top: 6px;
  padding: 0;
  background: none;
  border: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--tm-loi);
  width: auto;
  top: auto;
  left: auto;
  opacity: 1;
}

.timona-form-dang-ky .form-input.wpcf7-not-valid,
.timona-form-dang-ky .form-select.wpcf7-not-valid {
  border-color: var(--tm-loi);
  background-color: var(--tm-loi-nen);
}

.timona-form-dang-ky .form-input.wpcf7-not-valid:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

/* Thông báo chung dưới form */
.timona-form-dang-ky .wpcf7 form .wpcf7-response-output {
  margin: 0;
  padding: 10px 14px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  line-height: 1.5;
}

.timona-form-dang-ky .wpcf7 form.invalid .wpcf7-response-output,
.timona-form-dang-ky .wpcf7 form.unaccepted .wpcf7-response-output,
.timona-form-dang-ky .wpcf7 form.failed .wpcf7-response-output,
.timona-form-dang-ky .wpcf7 form.aborted .wpcf7-response-output,
.timona-form-dang-ky .wpcf7 form.spam .wpcf7-response-output {
  border-color: var(--tm-loi);
  background: var(--tm-loi-nen);
  color: var(--tm-loi);
}

.timona-form-dang-ky .wpcf7 form.sent .wpcf7-response-output {
  border-color: var(--tm-dung);
  background: var(--tm-dung-nen);
  color: #166534;
}

/* Theme Options > Custom CSS của site có luật chung có !important cho mọi input/select/nút gửi
   (viền cam #ffaf15, chữ xám, nút 1.5rem). Chỉ ghi đè trong form đăng ký, cũng bằng !important. */
.timona-form-dang-ky .form-input,
.timona-form-dang-ky .form-select {
  border: 1.5px solid #cbd5e1 !important;
  border-radius: var(--radius-sm) !important;
  color: var(--color-text-title) !important;
}

.timona-form-dang-ky .form-input:focus,
.timona-form-dang-ky .form-select:focus { border-color: var(--color-primary) !important; }

.timona-form-dang-ky .form-input.wpcf7-not-valid,
.timona-form-dang-ky .form-select.wpcf7-not-valid { border-color: var(--tm-loi) !important; }

.timona-form-dang-ky input.wpcf7-submit.form-submit-btn {
  border: 0 !important;
  border-radius: var(--radius-md) !important;
  color: #ffffff !important;
  font-size: 16px !important;
  line-height: 1.35 !important;
  min-height: 0 !important;
}

.timona-cta-dang-ky .form-input,
.timona-cta-dang-ky .form-select {
  border-radius: 6px !important;
  color: #0f172a !important;
}

.timona-cta-dang-ky input.wpcf7-submit.form-submit-btn {
  padding: 12px !important;
  border-radius: 6px !important;
  font-size: 15.5px !important;
}

/* Custom CSS của site ẩn vòng quay CF7 (.wpcf7-spinner {display:none}); form chung hiện lại khi đang gửi. */
.timona-form-dang-ky .wpcf7-form.submitting .wpcf7-spinner { display: block !important; }

/* ---------- Popup ---------- */
.timona-popup-dang-ky .modal-window {
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.timona-popup-dang-ky .modal-window:focus { outline: none; }

.timona-popup-dang-ky .modal-title {
  margin: 0 0 4px;
  padding-right: 44px; /* chừa chỗ nút × */
  color: #ffffff;
  line-height: 1.6;
}

.timona-popup-dang-ky .modal-subtitle { margin: 0; }

/* Nút × là <button>: gỡ kiểu nút mặc định của Flatsome */
.timona-popup-dang-ky .modal-close-cross {
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  text-transform: none;
  letter-spacing: 0;
}

.timona-popup-dang-ky .modal-close-cross:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* ---------- Khối CTA: ô không nhãn như designer, nút cam ---------- */
.timona-cta-dang-ky { margin: 0 0 30px; }

.timona-cta-dang-ky .wpcf7-form { gap: 12px; }

.timona-cta-dang-ky .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;
}

.timona-cta-dang-ky label.form-group { gap: 0; }

.timona-cta-dang-ky .form-input,
.timona-cta-dang-ky .form-select {
  border-radius: 6px;
  font-size: 15.5px;
  color: #0f172a;
}

.timona-cta-dang-ky .wpcf7-submit.form-submit-btn {
  margin-top: 4px;
  border-radius: 6px;
  background: linear-gradient(135deg, #ff7700 0%, #ea580c 100%);
  font-family: var(--font-brand);
  font-size: 15.5px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.35);
}

.timona-cta-dang-ky .wpcf7-submit.form-submit-btn:hover {
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.45);
}

@media (max-width: 768px) {
  .timona-cta-dang-ky .leadgen-banner-card {
    grid-template-columns: 1fr;
    padding: 26px 18px;
    gap: 22px;
  }
  .timona-cta-dang-ky .leadgen-form-col { padding: 20px 16px; }
  .timona-popup-dang-ky .modal-form-body { padding: 18px 18px 22px; gap: 14px; }
  .timona-form-dang-ky .wpcf7-form { gap: 14px; }
  /* Khối CTA giữ khoảng 12px; ô và nút theo mobile.css của designer (bo 10px, nút cao 48px, chữ 16px). */
  .timona-cta-dang-ky .wpcf7-form { gap: 12px; }
  .timona-cta-dang-ky .form-input,
  .timona-cta-dang-ky .form-select { border-radius: 10px !important; }
  .timona-cta-dang-ky input.wpcf7-submit.form-submit-btn {
    min-height: 48px !important;
    border-radius: 10px !important;
    font-size: 16px !important;
  }
}
