/**
 * TGWV Builder — Form tư vấn (tu_van_form)
 * Card trắng bo góc, căn giữa theo max-width, nút gửi căn giữa.
 */

.tgwv-tu-van-form__wrap {
  display: flex;
  justify-content: center;
  width: 100%;
}

.tgwv-tu-van-form__wrap--with-map {
  display: block;
}

.tgwv-tu-van-form__layout {
  display: grid;
  grid-template-columns: minmax(0, var(--tgwv-tvf-max-width, 560px)) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
  width: 100%;
}

.tgwv-tu-van-form__form-col {
  min-width: 0;
}

.tgwv-tu-van-form__wrap--with-map .tgwv-tu-van-card {
  max-width: none;
  width: 100%;
  height: 100%;
}

.tgwv-tu-van-form__map {
  min-width: 0;
  min-height: var(--tgwv-tvf-map-min-height, 420px);
  border-radius: 12px;
  overflow: hidden;
  background: #eef1f5;
}

.tgwv-tu-van-form__map iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: var(--tgwv-tvf-map-min-height, 420px);
  border: 0;
}

@media (max-width: 991.98px) {
  .tgwv-tu-van-form__layout {
    grid-template-columns: 1fr;
  }
}

.tgwv-tu-van-card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 36px 40px;
  box-sizing: border-box;
  width: 100%;
  max-width: var(--tgwv-tvf-max-width, 560px);
  height: auto;
}

@media (max-width: 767.98px) {
  .tgwv-tu-van-card {
    padding: 28px 20px;
  }
}

.tgwv-tu-van-form {
  --tgwv-tvf-title: #6847a2;
  --tgwv-tvf-btn: #6847a2;
  --tgwv-tvf-max-width: 560px;
  --tgwv-tvf-border: #dee2e6;
  --tgwv-tvf-text: #333333;
  --tgwv-tvf-muted: #6c757d;
  --tgwv-tvf-req: #dc3545;
}

.tgwv-tu-van-form__header {
  text-align: center;
  margin-bottom: 28px;
}

.tgwv-tu-van-form__header:only-child,
.tgwv-tu-van-form__inner:first-child {
  margin-top: 0;
}

.tgwv-tu-van-form__title {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--tgwv-tvf-title, #6847a2);
}

.tgwv-tu-van-form__title:last-child {
  margin-bottom: 0;
}

.tgwv-tu-van-form__subtitle {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--tgwv-tvf-muted, #6c757d);
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.tgwv-tu-van-form__inner {
  margin: 0;
}

.tgwv-tu-van-form__field {
  margin-bottom: 18px;
}

.tgwv-tu-van-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 0;
}

@media (max-width: 575.98px) {
  .tgwv-tu-van-form__row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

.tgwv-tu-van-form__label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--tgwv-tvf-text);
}

.tgwv-tu-van-form__req {
  color: var(--tgwv-tvf-req);
}

.tgwv-tu-van-form__input,
.tgwv-tu-van-form__textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--tgwv-tvf-text);
  background: #fff;
  border: 1px solid var(--tgwv-tvf-border);
  border-radius: 6px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tgwv-tu-van-form__input::placeholder,
.tgwv-tu-van-form__textarea::placeholder {
  color: #adb5bd;
}

.tgwv-tu-van-form__input:focus,
.tgwv-tu-van-form__textarea:focus {
  outline: none;
  border-color: var(--tgwv-tvf-btn);
  box-shadow: 0 0 0 3px rgba(104, 71, 162, 0.15);
}

.tgwv-tu-van-form__input.is-invalid,
.tgwv-tu-van-form__textarea.is-invalid {
  border-color: var(--tgwv-tvf-req);
}

.tgwv-tu-van-form__textarea {
  min-height: 100px;
  resize: vertical;
}

.tgwv-tu-van-form__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.tgwv-tu-van-form__msg {
  width: 100%;
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  display: none;
}

.tgwv-tu-van-form__msg.is-visible {
  display: block;
}

.tgwv-tu-van-form__msg.is-success {
  color: #198754;
}

.tgwv-tu-van-form__msg.is-error {
  color: var(--tgwv-tvf-req);
}

.tgwv-tu-van-form__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 180px;
  padding: 12px 32px;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  background: var(--tgwv-tvf-btn, #6847a2);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.tgwv-tu-van-form__btn:hover:not(:disabled) {
  opacity: 0.92;
}

.tgwv-tu-van-form__btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.tgwv-tu-van-form__btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: tgwv-tvf-spin 0.7s linear infinite;
}

.tgwv-tu-van-form.is-loading .tgwv-tu-van-form__btn-spinner {
  display: inline-block;
}

.tgwv-tu-van-form.is-loading .tgwv-tu-van-form__btn-label {
  opacity: 0.85;
}

@keyframes tgwv-tvf-spin {
  to {
    transform: rotate(360deg);
  }
}

.tgwv-tu-van-form__field-error {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--tgwv-tvf-req);
}

.tgwv-tu-van-form__hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Modal thành công */
.tgwv-tu-van-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

.tgwv-tu-van-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 28px 24px 24px;
  border-radius: 12px;
  background-color: #ffffff;
  color: #1e293b;
  text-align: center;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
  animation: tgwvTvfModalIn 0.28s ease-out;
}

@keyframes tgwvTvfModalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.tgwv-tu-van-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.tgwv-tu-van-modal__close:hover,
.tgwv-tu-van-modal__close:focus-visible {
  background-color: #f1f5f9;
  color: #0f172a;
  outline: none;
}

.tgwv-tu-van-modal__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  color: var(--tgwv-tvf-btn, #6847a2);
}

.tgwv-tu-van-modal__title {
  margin: 0 0 10px;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  color: #0f172a;
}

.tgwv-tu-van-modal__message {
  margin: 0 0 20px;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: #475569;
}

.tgwv-tu-van-modal__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  background-color: var(--tgwv-tvf-btn, #6847a2);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.tgwv-tu-van-modal__btn:hover {
  opacity: 0.92;
}

.tgwv-tu-van-modal__btn:focus-visible {
  outline: 2px solid var(--tgwv-tvf-btn, #6847a2);
  outline-offset: 3px;
}

body.tgwv-tu-van-modal--open {
  overflow: hidden;
}
