/* =========================================================
   4TRONICS | TELTONIKA — reskin do formulário renderizado pelo motor PHP
   (functions/core.php monta o <form>; aqui só estilizamos
   as classes que ele já emite, sem tocar no motor)
   ========================================================= */

#form-form {
  display: grid !important;
  grid-template-columns: 1fr;
  gap: 16px !important;
}

#form-form > div:has(#nome),
#form-form > div:has(#empresa),
#form-form > div:has(fieldset),
#form-form > div:has(#descricao),
#form-form > .btn-custom-primary {
  grid-column: 1 / -1;
}

@media (min-width: 600px) {
  #form-form { grid-template-columns: 1fr 1fr; }
}

/* ---------- Labels e inputs ---------- */
#form-form label,
#form-form fieldset legend {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--navy);
  margin-bottom: 6px;
}

#form-form .form-control {
  display: block;
  width: 100%;
  font: 400 .95rem/1.4 var(--font);
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  padding: 12px 14px;
  border-radius: 10px;
  transition: border-color .2s, background-color .2s, box-shadow .2s;
}
#form-form .form-control::placeholder { color: #9AA3BD; }
#form-form textarea.form-control { resize: vertical; min-height: 96px; }
#form-form .form-control:hover { border-color: var(--line-strong); }
#form-form .form-control:focus {
  outline: none;
  background: var(--white);
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 26, 119, .14);
}
#form-form.was-validated .form-control:invalid { border-color: #C0392B; }

/* ---------- Finalidade da compra (radio em segmento) ---------- */
#form-form fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
#form-form fieldset legend {
  grid-column: 1 / -1;
  float: none;
  width: auto;
}
#form-form fieldset .form-check {
  position: relative;
  margin: 0;
  padding: 0;
  min-height: 46px;
}
#form-form fieldset .form-check-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
#form-form fieldset .form-check label {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 46px;
  padding: 6px 4px;
  margin: 0;
  font-size: .85rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}
#form-form fieldset .form-check:hover label { border-color: var(--blue); color: var(--blue); }
#form-form fieldset .form-check-input:checked + label { background: var(--blue); border-color: var(--blue); color: var(--white); }
#form-form fieldset .form-check-input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
#form-form.was-validated fieldset .form-check-input:invalid + label { border-color: #C0392B; }

@media (max-width: 420px) {
  #form-form fieldset { grid-template-columns: 1fr; }
}

/* ---------- Botão de envio ---------- */
#form-form .btn-custom-primary {
  width: 100%;
  min-height: 56px;
  margin-top: 4px;
  font-size: 1.02rem;
  color: var(--white);
  background: var(--blue);
}
#form-form .btn-custom-primary:hover:not(:disabled) { background: var(--navy); box-shadow: var(--shadow); }
#form-form .btn-custom-primary:disabled { opacity: .65; cursor: progress; }

.spinner-border {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  vertical-align: -0.125em;
  border: .2em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border .75s linear infinite;
  margin-right: 8px;
}
.spinner-border-sm { width: .85rem; height: .85rem; border-width: .15em; }
@keyframes spinner-border { to { transform: rotate(360deg); } }

/* ---------- Mensagens de retorno (sucesso / erro) ---------- */
#formulario .alert {
  margin-bottom: 16px;
  padding: 14px 16px;
  font-size: .9rem;
  line-height: 1.5;
  border-left: 3px solid;
  border-radius: 0 8px 8px 0;
}
#formulario .alert strong { display: block; margin-bottom: 4px; }
#formulario .alert-success { background: #eef6ee; border-color: #3f8f4f; color: #204a29; }
#formulario .alert-danger { background: #fdeeee; border-color: #c0392b; color: #7a2318; }
