/**
 * Contact Form 7 — form tối giản (underline) + Astra
 * Scope: form.astra-cf7-custom (thêm html_class="astra-cf7-custom" vào shortcode).
 * Không dùng .wpcf7 làm root để tránh ảnh hưởng form CF7 khác.
 * Được nạp qua functions.php (astra-cf7-minimal-form).
 * Chiều ngang: 100% container (widget/shortcode Elementor), không giới hạn px cố định.
 */

form.astra-cf7-custom {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

form.astra-cf7-custom .cf7-minimal {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 0;
}

form.astra-cf7-custom .cf7-minimal .cf7-row {
  margin-bottom: 20px;
}

form.astra-cf7-custom .cf7-minimal .cf7-row:last-child {
  margin-bottom: 0;
}

/* Hai cột: Email | Điện thoại */
form.astra-cf7-custom .cf7-minimal .cf7-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 600px) {
  form.astra-cf7-custom .cf7-minimal .cf7-row-2col {
    grid-template-columns: 1fr;
  }
}

form.astra-cf7-custom .cf7-minimal .cf7-field {
  margin: 0;
}

form.astra-cf7-custom .cf7-minimal .cf7-label {
  display: block;
  margin: 0 0 0.35rem;
  font-weight: 600;
  color: #111;
  font-size: 16px;
  line-height: 1.4;
}

/* Reset Astra / theme defaults cho ô nhập */
form.astra-cf7-custom .cf7-minimal .cf7-input,
form.astra-cf7-custom .cf7-minimal .cf7-select,
form.astra-cf7-custom .cf7-minimal .cf7-textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.5rem 0;
  border: none;
  border-bottom: 1px solid #c8c8c8;
  border-radius: 0;
  background: transparent;
  font-size: 16px;
  line-height: 1.5;
  color: #111;
  box-shadow: none;
  transition: border-color 0.2s ease;
}

form.astra-cf7-custom .cf7-minimal .cf7-input:focus,
form.astra-cf7-custom .cf7-minimal .cf7-select:focus,
form.astra-cf7-custom .cf7-minimal .cf7-textarea:focus {
  outline: none;
  border-bottom-color: #7b845e;
}

form.astra-cf7-custom .cf7-minimal .cf7-input::placeholder,
form.astra-cf7-custom .cf7-minimal .cf7-textarea::placeholder {
  color: #999;
  opacity: 1;
}

/* Select + mũi tên */
form.astra-cf7-custom .cf7-minimal .cf7-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 1.75rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.15rem center;
  background-size: 12px auto;
}

form.astra-cf7-custom .cf7-minimal .cf7-select::-ms-expand {
  display: none;
}

/* Textarea — giữ nút resize góc phải dưới */
form.astra-cf7-custom .cf7-minimal .cf7-textarea {
  min-height: 120px;
  resize: vertical;
  padding-top: 0.35rem;
}

/* Message (id your-message): chiều cao ban đầu một dòng — ghi đè min-height 120px; vẫn kéo dọc được */
form.astra-cf7-custom .cf7-minimal textarea#your-message.cf7-textarea {
  min-height: 2.75rem;
  resize: vertical;
}

/* --- Form 2+: cột điện thoại — mã vùng + số (cùng hàng, underline) --- */
form.astra-cf7-custom .cf7-minimal .cf7-phone-stack {
  min-width: 0;
}

form.astra-cf7-custom .cf7-minimal .cf7-phone-inline {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.75rem;
  width: 100%;
}

form.astra-cf7-custom .cf7-minimal .cf7-phone-inline > .wpcf7-form-control-wrap {
  display: block;
  margin: 0;
}

/* Astra đặt .wpcf7-form-control-wrap { width:100% } — tách cột mã vùng / số */
form.astra-cf7-custom .cf7-minimal .cf7-phone-inline > .wpcf7-form-control-wrap:first-of-type {
  flex: 0 0 auto;
  width: auto !important;
  max-width: 6rem;
}

form.astra-cf7-custom .cf7-minimal .cf7-phone-inline > .wpcf7-form-control-wrap:last-of-type {
  flex: 1 1 0;
  min-width: 0;
  width: auto !important;
}

form.astra-cf7-custom .cf7-minimal .cf7-phone-cc {
  flex: 0 0 auto;
  width: 100%;
  min-width: 4.25rem;
  max-width: 6rem;
  padding-right: 1.25rem;
  font-size: 15px;
  border-bottom: none !important;
  box-shadow: none;
}

form.astra-cf7-custom .cf7-minimal .cf7-phone-cc:focus {
  border-bottom: none !important;
  box-shadow: none;
}

form.astra-cf7-custom .cf7-minimal .cf7-phone-input {
  flex: 1 1 0;
  min-width: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

/* Radio — lưới 2 cột (First|Second, Third|Fourth, Fifth|Other) */
form.astra-cf7-custom .cf7-minimal .cf7-radio-field {
  margin: 0;
}

form.astra-cf7-custom .cf7-minimal .cf7-label-radio-group {
  display: block;
  margin: 0 0 0.75rem;
}

form.astra-cf7-custom .cf7-minimal .cf7-radio-2col-wrap .wpcf7-form-control-wrap {
  width: 100%;
  display: block;
}

form.astra-cf7-custom .cf7-minimal .cf7-radio-2col-wrap .wpcf7-radio {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 1.5rem;
  align-items: start;
  width: 100%;
}

form.astra-cf7-custom .cf7-minimal .cf7-radio-2col-wrap .wpcf7-list-item {
  margin: 0 !important;
  display: block;
  min-width: 0;
}

form.astra-cf7-custom .cf7-minimal .cf7-radio-2col-wrap .wpcf7-list-item label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 16px;
  line-height: 1.45;
  font-weight: 400;
  color: #111;
}

/* Radio — tùy chọn "Other" + ô free_text cùng hàng */
form.astra-cf7-custom .cf7-minimal .cf7-radio-2col-wrap .wpcf7-list-item.has-free-text {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  min-width: 0;
}

form.astra-cf7-custom .cf7-minimal .cf7-radio-2col-wrap .wpcf7-list-item.has-free-text label {
  flex: 0 0 auto;
  min-width: 0;
  white-space: nowrap;
}

form.astra-cf7-custom .cf7-minimal .cf7-radio-2col-wrap .wpcf7-free-text {
  flex: 1 1 0;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.35rem 0;
  border: none;
  border-bottom: 1px solid #c8c8c8;
  border-radius: 0;
  background: transparent;
  font-size: 16px;
  line-height: 1.5;
  color: #111;
  box-shadow: none;
  transition: border-color 0.2s ease;
}

form.astra-cf7-custom .cf7-minimal .cf7-radio-2col-wrap .wpcf7-free-text:focus {
  outline: none;
  border-bottom-color: #7b845e;
}

/* Radio tròn — ghi đè Astra .wpcf7 input[type=radio] (width/height khác nhau) */
form.astra-cf7-custom .cf7-minimal .cf7-radio-2col-wrap input[type="radio"] {
  flex: 0 0 18px;
  box-sizing: border-box;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  margin: 0 !important;
  padding: 0 !important;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid #bbb;
  border-radius: 50% !important;
  background: #fff !important;
  cursor: pointer;
  vertical-align: middle;
  line-height: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

form.astra-cf7-custom .cf7-minimal .cf7-radio-2col-wrap input[type="radio"]:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(123, 132, 94, 0.35);
}

form.astra-cf7-custom .cf7-minimal .cf7-radio-2col-wrap input[type="radio"]:checked {
  border-color: #7b845e !important;
  background-color: #fff !important;
  box-shadow: inset 0 0 0 4px #7b845e;
}

@media (max-width: 600px) {
  form.astra-cf7-custom .cf7-minimal .cf7-radio-2col-wrap .wpcf7-radio {
    grid-template-columns: 1fr;
  }
}

/* Checkbox acceptance — dạng tròn */
form.astra-cf7-custom .cf7-minimal .cf7-acceptance-wrap {
  margin: 0;
}

form.astra-cf7-custom .cf7-minimal .cf7-acceptance-wrap .wpcf7-list-item {
  margin: 0;
}

form.astra-cf7-custom .cf7-minimal .cf7-acceptance-wrap label {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  font-size: 16px;
  line-height: 1.5;
  color: #111;
  font-weight: 600;
}

/*
 * Astra compatibility/contact-form-7.min.css: input:not([type=submit]) { width:100%; padding:.75em }
 * và input[type=checkbox] { width:1.4em; height:1.2em } — gây méo. Ghi đè tường minh.
 */
form.astra-cf7-custom .cf7-minimal .cf7-acceptance-wrap input[type="checkbox"] {
  flex: 0 0 20px;
  align-self: center;
  box-sizing: border-box;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
  aspect-ratio: 1 / 1;
  margin: 0 !important;
  padding: 0 !important;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid #bbb;
  border-radius: 50% !important;
  background: #fff;
  cursor: pointer;
  vertical-align: middle;
  line-height: 0;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

form.astra-cf7-custom .cf7-minimal .cf7-acceptance-wrap input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(123, 132, 94, 0.35);
}

form.astra-cf7-custom .cf7-minimal .cf7-acceptance-wrap input[type="checkbox"]:checked {
  background-color: #7b845e !important;
  border-color: #7b845e;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M10 3L4.5 8.5 2 6' stroke='%23fff' stroke-width='1.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
}

form.astra-cf7-custom .cf7-minimal .cf7-terms-link {
  text-decoration: underline;
  color: inherit;
}

form.astra-cf7-custom .cf7-minimal .cf7-terms-link:hover,
form.astra-cf7-custom .cf7-minimal .cf7-terms-link:focus {
  color: #7b845e;
}

form.astra-cf7-custom .cf7-minimal .cf7-row-acceptance {
  margin-top: 20px;
  margin-bottom: 20px;
}

/* Nút Submit — pill, olive */
/* CP7 có thể render submit + .wpcf7-spinner trực tiếp trong .cf7-row-submit (không bọc .wpcf7-form-control-wrap) */
form.astra-cf7-custom .cf7-minimal .cf7-row-submit {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 24px;
  margin-bottom: 0;
}

/* Spinner là sibling của <input type="submit"> — không thể bọc trong input; chồng lên giữa nút, không chiếm chỗ flex */
form.astra-cf7-custom .cf7-minimal .cf7-row-submit .wpcf7-spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
  opacity: 0.95;
  background-color: rgba(255, 255, 255, 0.35);
}

form.astra-cf7-custom .cf7-minimal .cf7-row-submit .wpcf7-spinner::before {
  background-color: #fff;
}

/* Khi submit nằm trong .wpcf7-form-control-wrap (Astra: block + width 100%) */
form.astra-cf7-custom .cf7-minimal .cf7-row-submit .wpcf7-form-control-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

form.astra-cf7-custom .cf7-minimal input[type="submit"].cf7-submit,
form.astra-cf7-custom .cf7-minimal .cf7-submit {
  display: inline-block;
  min-width: 160px;
  margin: 0 auto;
  padding: 0.85rem 2.5rem;
  border: none;
  border-radius: 999px;
  background-color: #7b845e;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
  text-transform: none;
}

form.astra-cf7-custom .cf7-minimal input[type="submit"].cf7-submit:hover,
form.astra-cf7-custom .cf7-minimal .cf7-submit:hover {
  background-color: #6a7350;
}

form.astra-cf7-custom .cf7-minimal input[type="submit"].cf7-submit:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(123, 132, 94, 0.45);
}

form.astra-cf7-custom .cf7-minimal input[type="submit"].cf7-submit:active {
  transform: translateY(1px);
}

/* CF7 thêm class submitting lên form — ẩn chữ nút để spinner nằm rõ giữa pill */
form.astra-cf7-custom.submitting .cf7-minimal .cf7-row-submit input[type="submit"].cf7-submit {
  color: transparent;
}

/* Thông báo — chỉ trong form có html_class astra-cf7-custom */
form.astra-cf7-custom .wpcf7-response-output {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: 4px;
}

form.astra-cf7-custom .cf7-minimal .wpcf7-not-valid-tip {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: #c00;
}

form.astra-cf7-custom .cf7-minimal .wpcf7-not-valid {
  border-bottom-color: #c00 !important;
}

/* Form 2 — nội dung (không gồm khung ngoài / tiêu đề trang): textarea ngắn-dài, Other, checkbox, thanh toán */
form.astra-cf7-custom .cf7-minimal .cf7-textarea-short {
  min-height: 4.5rem;
}

form.astra-cf7-custom .cf7-minimal .cf7-textarea-long {
  min-height: 11rem;
}

form.astra-cf7-custom .cf7-minimal .cf7-field-other-line {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.35rem 0.75rem;
  margin: 0;
}

form.astra-cf7-custom .cf7-minimal .cf7-label-inline-other {
  flex: 0 0 auto;
  font-weight: 600;
  font-size: 16px;
  color: #111;
  line-height: 1.4;
  margin-bottom: 0.35rem;
}

form.astra-cf7-custom .cf7-minimal .cf7-field-other-line > .wpcf7-form-control-wrap {
  flex: 1 1 12rem;
  min-width: 0;
  width: auto !important;
}

form.astra-cf7-custom .cf7-minimal .cf7-input-other-line {
  width: 100%;
}

form.astra-cf7-custom .cf7-minimal .cf7-checkbox-field {
  margin: 0;
}

form.astra-cf7-custom .cf7-minimal .cf7-label-checkbox-group {
  display: block;
  margin: 0 0 0.75rem;
}

form.astra-cf7-custom .cf7-minimal .cf7-checkbox-1col-wrap .wpcf7-form-control-wrap {
  width: 100%;
  display: block;
}

form.astra-cf7-custom .cf7-minimal .cf7-checkbox-1col-wrap .wpcf7-checkbox {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

form.astra-cf7-custom .cf7-minimal .cf7-checkbox-1col-wrap .wpcf7-list-item {
  margin: 0 !important;
  display: block;
}

form.astra-cf7-custom .cf7-minimal .cf7-checkbox-1col-wrap .wpcf7-list-item label {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 16px;
  line-height: 1.45;
  font-weight: 400;
  color: #111;
}

/* Checkbox — tùy chọn "Other" + ô free_text cùng hàng */
form.astra-cf7-custom .cf7-minimal .cf7-checkbox-1col-wrap .wpcf7-list-item.has-free-text {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  min-width: 0;
}

form.astra-cf7-custom .cf7-minimal .cf7-checkbox-1col-wrap .wpcf7-list-item.has-free-text label {
  flex: 0 0 auto;
  min-width: 0;
  white-space: nowrap;
}

form.astra-cf7-custom .cf7-minimal .cf7-checkbox-1col-wrap .wpcf7-free-text {
  flex: 1 1 0;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.35rem 0;
  border: none;
  border-bottom: 1px solid #c8c8c8;
  border-radius: 0;
  background: transparent;
  font-size: 16px;
  line-height: 1.5;
  color: #111;
  box-shadow: none;
  transition: border-color 0.2s ease;
}

form.astra-cf7-custom .cf7-minimal .cf7-checkbox-1col-wrap .wpcf7-free-text:focus {
  outline: none;
  border-bottom-color: #7b845e;
}

form.astra-cf7-custom .cf7-minimal .cf7-checkbox-1col-wrap input[type="checkbox"] {
  flex: 0 0 18px;
  box-sizing: border-box;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  margin: 0.15rem 0 0 !important;
  padding: 0 !important;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid #bbb;
  border-radius: 3px !important;
  background: #fff !important;
  cursor: pointer;
  vertical-align: top;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

form.astra-cf7-custom .cf7-minimal .cf7-checkbox-1col-wrap input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(123, 132, 94, 0.35);
}

form.astra-cf7-custom .cf7-minimal .cf7-checkbox-1col-wrap input[type="checkbox"]:checked {
  border-color: #7b845e !important;
  background-color: #7b845e !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M10 3L4.5 8.5 2 6' stroke='%23fff' stroke-width='1.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
}

form.astra-cf7-custom .cf7-minimal .cf7-payment-section {
  margin: 0;
  padding: 1rem 0 0;
}

form.astra-cf7-custom .cf7-minimal .cf7-payment-heading {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  font-weight: 700;
  color: #3d2f24;
  line-height: 1.4;
}

/* Khối bọc ảnh QR: không nền, căn giữa theo chiều ngang */
form.astra-cf7-custom .cf7-minimal .cf7-qr-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 200px;
  margin: 0 auto 1rem;
  background: transparent;
  border-radius: 4px;
}

form.astra-cf7-custom .cf7-minimal .cf7-qr-placeholder img {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
  margin: 0;
  object-fit: contain;
  border-radius: 4px;
}

/* Ảnh QR đặt trực tiếp trong section (không bọc div) — căn giữa */
form.astra-cf7-custom .cf7-minimal .cf7-payment-section img.cf7-qr-image {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
  margin: 0 auto 1rem;
  border-radius: 4px;
}

form.astra-cf7-custom .cf7-minimal .cf7-qr-placeholder-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #888;
  letter-spacing: 0.05em;
}

form.astra-cf7-custom .cf7-minimal .cf7-payment-details {
  margin: 0 0 1rem;
  font-size: 15px;
  line-height: 1.55;
  color: #222;
}

form.astra-cf7-custom .cf7-minimal .cf7-payment-line {
  margin: 0 0 0.5rem;
}

form.astra-cf7-custom .cf7-minimal .cf7-payment-line:last-child {
  margin-bottom: 0;
}

form.astra-cf7-custom .cf7-minimal .cf7-payment-warning {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

 form.astra-cf7-custom #phone-cc {
  border-bottom: none !important;
 }