/* IT Traders — form validation, phone control and submission states.
   Loaded after site.css on every page that carries a form. */

/* ---------- country code + phone ---------- */

.phone-field {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;              /* the error message drops to its own line */
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}

/* In the floating widget there is no .form-group to hang the message on, so it
   lands inside .phone-field — force it onto a full-width row of its own. */
.phone-field > .field-error {
  flex: 1 0 100%;
  margin-top: 0;
}

.phone-field > input {
  flex: 1 1 0;
  /* width:100% from the base input styles would resolve to a full-row
     flex-basis and push the input below the country code once the row wraps. */
  width: auto;
  min-width: 0;                 /* lets the input shrink instead of overflowing */
}

.phone-cc {
  flex: 0 0 auto;
  width: auto;
  padding: 0.875rem 0.6rem;
  border: 2px solid var(--gray-300);
  border-radius: 0.5rem;
  background: var(--gray-50);
  color: var(--gray-700);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: var(--transition);
}

.phone-cc:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
  outline: none;
}

/* the compact widget version */
.qw-form .phone-cc {
  padding: 0.65rem 0.4rem;
  border-width: 1px;
  border-color: var(--gray-200);
  border-radius: 10px;
  font-size: 0.82rem;
}

.qw-form .phone-cc:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.14);
}

/* ---------- invalid state ---------- */

.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid,
.qw-form input.is-invalid,
.qw-form textarea.is-invalid {
  border-color: var(--error);
  background: #FEF2F2;
}

.form-input.is-invalid:focus,
.form-select.is-invalid:focus,
.form-textarea.is-invalid:focus,
.qw-form input.is-invalid:focus,
.qw-form textarea.is-invalid:focus {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.field-error {
  display: block;
  margin-top: 0.4rem;
  color: var(--error);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.45;
}

.qw-form .field-error {
  margin-top: 0.25rem;
  font-size: 0.75rem;
}

/* ---------- form-level status banner ---------- */

.form-status {
  margin-bottom: 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.5;
}

.form-status--error {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #B91C1C;
}

.form-status--pending {
  background: var(--sky-50);
  border-color: var(--sky-200);
  color: var(--sky-800);
}

.qw-form .form-status {
  margin-bottom: 0.6rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.78rem;
}

/* ---------- success state (replaces the form) ---------- */

.form-success {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 1.5rem 1.25rem;
  background: linear-gradient(135deg, var(--sky-50), #FFFFFF);
  border: 1px solid var(--sky-200);
  border-radius: 1rem;
}

.form-success svg {
  flex-shrink: 0;
  margin-top: 0.1rem;
  color: var(--success);
}

.form-success p {
  margin: 0;
  color: var(--gray-800);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.6;
}

.quote-widget .form-success {
  padding: 1rem 0.9rem;
  border-radius: 12px;
}

.quote-widget .form-success p {
  font-size: 0.88rem;
}

/* ---------- honeypot ----------
   Off-screen rather than display:none — some bots skip hidden inputs, and
   this one only works if they fill it in. */

.hp-field {
  position: absolute !important;
  left: -9999px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ---------- mobile ---------- */

@media (max-width: 480px) {
  .phone-cc {
    padding: 0.875rem 0.45rem;
    font-size: 0.88rem;
  }
}
