/* ============================================================
   TH3 Enquiry Form — form.css
   Brand: #282828 bg · #75B557 accent · Poppins typeface
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
.th3ef-wrap {
  --th3-border:     #d0d0d0;
  --th3-input-bg:   #f8f8f8;
  --th3-text:       #1a1a1a;
  --th3-label:      #ffffff;
  --th3-muted:      #6b6b6b;
  --th3-accent:     #75B557;
  --th3-accent-h:   #62a044;
  --th3-accent-rgb: 117, 181, 87;
  --th3-error:      #e05c5c;
  --th3-font:       'Poppins', sans-serif;
  --th3-radius:     12px;
  --th3-radius-sm:  6px;
  --th3-transition: 0.22s ease;

  font-family: var(--th3-font);
  box-sizing: border-box;
}

.th3ef-wrap *, .th3ef-wrap *::before, .th3ef-wrap *::after {
  box-sizing: inherit;
}

/* ── Outer wrap ─────────────────────────────────────────────── */
.th3ef-wrap {
  background: transparent;
  padding: 0;
}

/* ── Card ───────────────────────────────────────────────────── */
.th3ef-card {
  background: transparent;
  max-width: 780px;
  margin: 0 auto;
}

/* ── Form body ──────────────────────────────────────────────── */
.th3ef-form {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Extra top spacing before key sections ───────────────────── */
.th3ef-mt {
  margin-top: 16px;
}

/* ── Rows ───────────────────────────────────────────────────── */
.th3ef-row {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (min-width: 560px) {
  .th3ef-row--2col {
    flex-direction: row;
  }
  .th3ef-row--2col > .th3ef-field {
    flex: 1;
    min-width: 0;
  }
}

/* ── Fields ─────────────────────────────────────────────────── */
.th3ef-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.th3ef-field label,
.th3ef-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--th3-label);
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.th3ef-field--required label::after {
  content: '*';
  color: var(--th3-accent);
  font-size: 16px;
  line-height: 1;
}

.th3ef-label__hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--th3-label);
  letter-spacing: 0.2px;
}

/* ── Inputs & Textarea ──────────────────────────────────────── */
.th3ef-wrap .th3ef-form input[type="text"],
.th3ef-wrap .th3ef-form input[type="email"],
.th3ef-wrap .th3ef-form input[type="tel"],
.th3ef-wrap .th3ef-form textarea {
  background: var(--th3-input-bg) !important;
  border: 1.5px solid var(--th3-border) !important;
  border-radius: var(--th3-radius-sm) !important;
  color: var(--th3-text) !important;
  font-family: var(--th3-font) !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  padding: 13px 16px !important;
  width: 100%;
  outline: none;
  transition: box-shadow var(--th3-transition);
  -webkit-appearance: none;
  appearance: none;
  min-height: 48px;
  color-scheme: light;
}

.th3ef-wrap .th3ef-form input::placeholder,
.th3ef-wrap .th3ef-form textarea::placeholder {
  color: #aaa;
}

/* Override browser autofill background */
.th3ef-wrap .th3ef-form input:-webkit-autofill,
.th3ef-wrap .th3ef-form input:-webkit-autofill:hover,
.th3ef-wrap .th3ef-form input:-webkit-autofill:focus,
.th3ef-wrap .th3ef-form input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0px 1000px var(--th3-input-bg) inset !important;
  box-shadow: 0 0 0px 1000px var(--th3-input-bg) inset !important;
  -webkit-text-fill-color: var(--th3-text) !important;
}

.th3ef-wrap .th3ef-form input:focus,
.th3ef-wrap .th3ef-form textarea:focus {
  box-shadow: 0 0 0 3px rgba(var(--th3-accent-rgb), 0.2);
}

.th3ef-wrap .th3ef-form input.th3ef--invalid,
.th3ef-wrap .th3ef-form textarea.th3ef--invalid {
  border-color: var(--th3-error) !important;
  box-shadow: 0 0 0 3px rgba(224, 92, 92, 0.12);
}

.th3ef-wrap .th3ef-form input.th3ef--valid,
.th3ef-wrap .th3ef-form textarea.th3ef--valid {
  border-color: var(--th3-accent) !important;
  box-shadow: 0 0 0 3px rgba(var(--th3-accent-rgb), 0.12);
}

.th3ef-form textarea {
  resize: vertical;
  min-height: 130px;
}

/* ── Inline error ───────────────────────────────────────────── */
.th3ef-field__error {
  font-size: 12px;
  color: var(--th3-error);
  min-height: 1em;
  display: block;
}

/* ── Select ─────────────────────────────────────────────────── */
.th3ef-select-wrap {
  position: relative;
}

.th3ef-wrap .th3ef-form select {
  background: var(--th3-input-bg) !important;
  border: 1.5px solid var(--th3-border) !important;
  border-radius: var(--th3-radius-sm) !important;
  color: var(--th3-text) !important;
  font-family: var(--th3-font);
  font-size: 14px;
  padding: 13px 40px 13px 16px;
  width: 100%;
  min-height: 48px;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: box-shadow var(--th3-transition);
  color-scheme: light;
}

.th3ef-wrap .th3ef-form select:focus {
  box-shadow: 0 0 0 3px rgba(var(--th3-accent-rgb), 0.2);
}

.th3ef-select-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--th3-muted);
  width: 12px;
  height: 8px;
  display: flex;
  align-items: center;
}

.th3ef-select-arrow svg {
  width: 100%;
  height: 100%;
}

/* ── Checkbox Group ─────────────────────────────────────────── */
.th3ef-checkgroup {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.th3ef-check {
  display: flex;
  align-items: center;
  gap: 0;
  cursor: pointer;
  user-select: none;
}

.th3ef-check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Hidden raw box — pill-only style */
.th3ef-check__box {
  display: none;
}

.th3ef-check__label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
  color: var(--th3-muted);
  background: var(--th3-input-bg);
  border: 1.5px solid var(--th3-border);
  border-radius: 100px;
  padding: 7px 16px;
  transition: color var(--th3-transition), border-color var(--th3-transition), background var(--th3-transition);
  /* min touch target */
  min-height: 38px;
}

.th3ef-check input:checked ~ .th3ef-check__label {
  color: #ffffff;
  border-color: var(--th3-accent);
  background: rgba(var(--th3-accent-rgb), 0.1);
}

.th3ef-check input:focus ~ .th3ef-check__label {
  outline: 2px solid var(--th3-accent);
  outline-offset: 2px;
}

/* ── Privacy ─────────────────────────────────────────────────── */
.th3ef-privacy {
  font-size: 12px;
  color: var(--th3-muted);
  margin: 0;
  line-height: 1.6;
}

.th3ef-privacy a {
  color: var(--th3-accent);
  text-decoration: none;
}

.th3ef-privacy a:hover {
  text-decoration: underline;
}

/* ── Submit ──────────────────────────────────────────────────── */
.th3ef-submit-row {
  display: flex;
  justify-content: center;
}

.th3ef-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--th3-accent);
  color: #fff;
  font-family: var(--th3-font);
  font-size: 15px;
  font-weight: 600;
  padding: 15px 40px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: background var(--th3-transition), transform var(--th3-transition), box-shadow var(--th3-transition);
  box-shadow: 0 8px 24px rgba(var(--th3-accent-rgb), 0.3);
  min-height: 52px;
}

.th3ef-btn:hover:not(:disabled) {
  background: var(--th3-accent-h);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(var(--th3-accent-rgb), 0.4);
}

.th3ef-btn:active:not(:disabled) {
  transform: translateY(0);
}

.th3ef-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.th3ef-btn__arrow {
  width: 20px;
  height: 20px;
  transition: transform var(--th3-transition);
  flex-shrink: 0;
}

.th3ef-btn:hover:not(:disabled) .th3ef-btn__arrow {
  transform: translateX(3px);
}

/* Spinner */
.th3ef-btn__spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: th3ef-spin 0.6s linear infinite;
  flex-shrink: 0;
}

.th3ef-btn.th3ef--loading .th3ef-btn__spinner { display: block; }
.th3ef-btn.th3ef--loading .th3ef-btn__arrow   { display: none; }

@keyframes th3ef-spin {
  to { transform: rotate(360deg); }
}

/* ── Error summary ───────────────────────────────────────────── */
.th3ef-errors {
  background: rgba(224, 92, 92, 0.1);
  border: 1px solid rgba(224, 92, 92, 0.3);
  border-radius: var(--th3-radius-sm);
  padding: 14px 18px;
  font-size: 13px;
  color: #f08080;
  line-height: 1.6;
}

.th3ef-errors ul {
  margin: 0;
  padding: 0 0 0 18px;
}

.th3ef-errors li + li {
  margin-top: 4px;
}

/* ── Success state ───────────────────────────────────────────── */
.th3ef-success[hidden] {
  display: none;
}

.th3ef-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: clamp(40px, 6vw, 72px) clamp(24px, 5vw, 52px);
  text-align: center;
  animation: th3ef-fadeUp 0.4s ease both;
}

.th3ef-success__tick {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.th3ef-success__message {
  font-size: 17px;
  color: var(--th3-text);
  line-height: 1.65;
  max-width: 460px;
  margin: 0;
}

@keyframes th3ef-fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Honeypot ────────────────────────────────────────────────── */
.th3ef-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* ── Accessibility: respect motion prefs ────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .th3ef-btn,
  .th3ef-btn__arrow,
  .th3ef-check__label,
  .th3ef-form input,
  .th3ef-form textarea,
  .th3ef-form select {
    transition: none;
  }
  .th3ef-success {
    animation: none;
  }
  .th3ef-btn__spinner {
    animation: none;
    border-top-color: transparent;
  }
}

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 559px) {
  .th3ef-btn {
    width: 100%;
  }
  .th3ef-checkgroup {
    gap: 8px;
  }
  .th3ef-form input[type="text"],
  .th3ef-form input[type="email"],
  .th3ef-form input[type="tel"],
  .th3ef-form select,
  .th3ef-form textarea {
    font-size: 16px; /* prevents iOS zoom on focus */
  }
  .th3ef-mt {
    margin-top: 10px;
  }
}
