/* =========================================================
   S4E Contact Form — contact-form.css
   Dùng #s4e-contact-form-wrap để tăng specificity,
   ghi đè Astra theme + Spectra plugin.
   ========================================================= */

/* ── Wrapper ── */
#s4e-contact-form-wrap {
  width: 100%;
  position: relative;
}

/* ── Form ── */
#s4e-contact-form-wrap .s4e-cf-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
}

/* ── Field wrapper ── */
#s4e-contact-form-wrap .s4e-cf-field {
  flex: 1 1 160px;
  min-width: 120px;
  position: relative;
  margin: 0;
  padding: 0;
}

#s4e-contact-form-wrap .s4e-cf-submit-wrap {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
}

/* ── Input & Select — reset hoàn toàn ── */
#s4e-contact-form-wrap .s4e-cf-input,
#s4e-contact-form-wrap .s4e-cf-select {
  box-sizing: border-box;
  display: block;
  width: 100%;
  height: 52px;
  min-height: unset;
  max-height: unset;
  border: none;
  border-radius: 0;
  background: #fff;
  outline: none;
  box-shadow: none;
  padding: 0 24px;
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
  color: #333;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

#s4e-contact-form-wrap .s4e-cf-input:focus,
#s4e-contact-form-wrap .s4e-cf-select:focus {
  outline: none;
  box-shadow: none;
  border: none;
}

#s4e-contact-form-wrap .s4e-cf-input::placeholder {
  color: #888;
  opacity: 1;
}

/* ── Select riêng ── */
#s4e-contact-form-wrap .s4e-cf-select {
  cursor: pointer;
  padding-right: 40px;
  color: #888;
}

#s4e-contact-form-wrap .s4e-cf-select.has-value {
  color: #333;
}

/* Mũi tên dropdown */
#s4e-contact-form-wrap .s4e-cf-select-wrap::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cg clip-path='url(%23clip0_13023_2210)'%3E%3Cpath d='M6 9L12 15L18 9' stroke='%23111827' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0_13023_2210'%3E%3Crect width='24' height='24' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  pointer-events: none;
}

/* ── Error (tuyệt đối, không đẩy layout) ── */
#s4e-contact-form-wrap .s4e-cf-err {
  position: absolute;
  bottom: -18px;
  left: 24px;
  font-size: 11px;
  color: #e53935;
  line-height: 1.3;
  white-space: nowrap;
  margin: 0;
  padding: 0;
}

#s4e-contact-form-wrap .s4e-cf-input.is-invalid,
#s4e-contact-form-wrap .s4e-cf-select.is-invalid {
  outline: 1px solid rgba(229, 57, 53, 0.5);
  outline-offset: -1px;
}

/* ── Submit button — reset hoàn toàn ── */
#s4e-contact-form-wrap .s4e-cf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 30px;
  margin: 0;
  background: #28a745;
  color: #fff;
  font-weight: 500;
  border: none;
  box-shadow: none;
  font-size: 18px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
}

#s4e-contact-form-wrap .s4e-cf-btn:hover:not(:disabled) {
  background: #218838;
  color: #fff;
  text-decoration: none;
  box-shadow: none;
}

#s4e-contact-form-wrap .s4e-cf-btn:focus {
  outline: none;
  box-shadow: none;
}

#s4e-contact-form-wrap .s4e-cf-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ── Spinner ── */
#s4e-contact-form-wrap .s4e-cf-spinner {
  display: none;
  width: 14px;
  height: 14px;
  min-height: unset;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: s4eSpin 0.7s linear infinite;
}

#s4e-contact-form-wrap .s4e-cf-btn.loading .s4e-cf-spinner {
  display: inline-block;
}

@keyframes s4eSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Toast (ngoài wrap, dùng class trực tiếp) ── */
.s4e-cf-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  padding: 12px 20px;
  border-radius: 4px;
  font-size: 14px;
  color: #fff;
  max-width: 340px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 0.25s,
    transform 0.25s;
}

.s4e-cf-toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.s4e-cf-toast.success {
  background: #28a745;
}
.s4e-cf-toast.error {
  background: #e53935;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  #s4e-contact-form-wrap .s4e-cf-form {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  #s4e-contact-form-wrap .s4e-cf-btn {
    width: 100%;
    justify-content: center;
  }

  #s4e-contact-form-wrap .s4e-cf-err {
    position: static;
    display: block;
    white-space: normal;
    padding: 2px 0 0;
  }
  #s4e-contact-form-wrap .s4e-cf-field {
    flex: 1 1 auto;
  }
}
