/*
 * WPForms Theme Override Stylesheet
 * Mr Michael Fox — v1.0.5
 *
 * Scoped under .contact-form-wrap so overrides only apply to the
 * contact section form, not any other WPForms instances on the site.
 *
 * WPForms name field actual DOM structure:
 *   .wpforms-field.wpforms-field-name
 *     .wpforms-field-row-block.wpforms-one-half.wpforms-first
 *       input[type="text"] (first name)
 *     .wpforms-field-row-block.wpforms-one-half
 *       input[type="text"] (last name)
 *
 * WPForms injects inline style="background-color:#..." on the submit
 * button from the form builder — requires !important to override.
 */

/* ============================================================
   FORM WRAPPER
   ============================================================ */
.contact-form-wrap {
  background: var(--clr-cream);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  border: 1px solid var(--clr-border);
}

.contact-form-wrap__heading {
  font-family: var(--ff-heading);
  font-size: var(--fs-xl);
  color: var(--clr-navy);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--clr-border);
}

/* Admin/fallback notice */
.contact-form-wrap__notice {
  background: var(--clr-white);
  border: 1px dashed var(--clr-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  color: var(--clr-muted);
  font-size: var(--fs-sm);
  line-height: 1.7;
}
.contact-form-wrap__notice a {
  color: var(--clr-navy);
  text-decoration: underline;
}

/* ============================================================
   WPFORMS CONTAINER — strip default padding/margin
   ============================================================ */
.contact-form-wrap .wpforms-container,
.contact-form-wrap .wpforms-container-full {
  padding: 0;
  margin: 0;
  width: 100%;
}

/* Hide WPForms' own form title/description — theme provides the heading */
.contact-form-wrap .wpforms-title,
.contact-form-wrap .wpforms-description {
  display: none;
}

/* ============================================================
   FIELD CONTAINER & INDIVIDUAL FIELDS
   ============================================================ */
.contact-form-wrap .wpforms-field-container {
  margin: 0;
  padding: 0;
}

.contact-form-wrap .wpforms-field {
  margin-bottom: 1rem !important;
  padding: 0 !important;
  clear: both;
}

/* Clear WPForms floats globally */
.contact-form-wrap .wpforms-field::after {
  content: '';
  display: table;
  clear: both;
}

/* ============================================================
   NAME FIELD — side-by-side first / last
   WPForms floats each .wpforms-field-row-block inside the field.
   .wpforms-first  = first name block (left)
   :not(.wpforms-first) sibling = last name block (right)
   We keep the float model but set both to 50% width with a gap
   via padding, which is the most reliable way to override WPForms.
   ============================================================ */

/* Establish a block formatting context so floats are contained */
.contact-form-wrap .wpforms-field-name {
  display: block !important;
  overflow: hidden; /* clearfix */
}

/* Both half-blocks: float left, 50% wide, no extra margin */
.contact-form-wrap .wpforms-field-name .wpforms-field-row-block {
  float: left !important;
  width: 50% !important;
  margin: 0 !important;
  box-sizing: border-box;
  padding-right: 0.5rem;
}

/* Last-name block: no right padding, small left padding for the gap */
.contact-form-wrap .wpforms-field-name .wpforms-field-row-block:not(.wpforms-first) {
  padding-right: 0 !important;
  padding-left: 0.5rem;
}

/* Sub-labels (First Name / Last Name) sit below each input */
.contact-form-wrap .wpforms-field-name .wpforms-field-sublabel {
  display: block;
  font-size: var(--fs-xs);
  color: var(--clr-muted);
  margin-top: 0.25rem;
}

/* Clearfix after the name field */
.contact-form-wrap .wpforms-field-name::after {
  content: '';
  display: table;
  clear: both;
}

/* Stack on mobile — each block goes full width */
@media (max-width: 540px) {
  .contact-form-wrap .wpforms-field-name .wpforms-field-row-block,
  .contact-form-wrap .wpforms-field-name .wpforms-field-row-block:not(.wpforms-first) {
    float: none !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-bottom: 0.75rem !important;
  }
}

/* ============================================================
   ADDRESS FIELD — row blocks side by side
   ============================================================ */
.contact-form-wrap .wpforms-field-address .wpforms-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.contact-form-wrap .wpforms-field-address .wpforms-field-row .wpforms-one-half {
  float: none !important;
  width: calc(50% - 0.375rem) !important;
  margin: 0 !important;
  box-sizing: border-box;
}
@media (max-width: 540px) {
  .contact-form-wrap .wpforms-field-address .wpforms-field-row .wpforms-one-half {
    width: 100% !important;
  }
}

/* ============================================================
   LABELS
   ============================================================ */
.contact-form-wrap .wpforms-field-label,
.contact-form-wrap label.wpforms-field-label {
  display: block;
  font-family: var(--ff-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--clr-navy);
  margin-bottom: 0.375rem;
  line-height: 1.4;
}

/* Required asterisk — gold */
.contact-form-wrap .wpforms-required-label,
.contact-form-wrap .wpforms-field-label .wpforms-required-label {
  color: var(--clr-gold);
  margin-left: 0.2rem;
}

/* Sub-labels below each name input (e.g. "First Name") */
.contact-form-wrap .wpforms-field-sublabel {
  display: block;
  font-size: var(--fs-xs);
  color: var(--clr-muted);
  margin-top: 0.25rem;
}

/* Description text */
.contact-form-wrap .wpforms-field-description {
  font-size: var(--fs-xs);
  color: var(--clr-muted);
  margin-top: 0.3rem;
  line-height: 1.5;
}

/* ============================================================
   TEXT INPUTS, SELECTS, TEXTAREA
   ============================================================ */
.contact-form-wrap .wpforms-field input[type="text"],
.contact-form-wrap .wpforms-field input[type="email"],
.contact-form-wrap .wpforms-field input[type="tel"],
.contact-form-wrap .wpforms-field input[type="url"],
.contact-form-wrap .wpforms-field input[type="number"],
.contact-form-wrap .wpforms-field input[type="date"],
.contact-form-wrap .wpforms-field input[type="search"],
.contact-form-wrap .wpforms-field input[type="password"],
.contact-form-wrap .wpforms-field select,
.contact-form-wrap .wpforms-field textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--ff-body);
  font-size: var(--fs-sm);
  color: var(--clr-text);
  background-color: var(--clr-white) !important;
  border: 1px solid var(--clr-border) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: none !important;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  line-height: 1.5;
  box-sizing: border-box;
}

/* Focus state */
.contact-form-wrap .wpforms-field input[type="text"]:focus,
.contact-form-wrap .wpforms-field input[type="email"]:focus,
.contact-form-wrap .wpforms-field input[type="tel"]:focus,
.contact-form-wrap .wpforms-field input[type="url"]:focus,
.contact-form-wrap .wpforms-field input[type="number"]:focus,
.contact-form-wrap .wpforms-field input[type="date"]:focus,
.contact-form-wrap .wpforms-field input[type="search"]:focus,
.contact-form-wrap .wpforms-field input[type="password"]:focus,
.contact-form-wrap .wpforms-field select:focus,
.contact-form-wrap .wpforms-field textarea:focus {
  border-color: var(--clr-navy) !important;
  box-shadow: 0 0 0 3px rgba(13, 31, 60, 0.08) !important;
  outline: none;
}

/* Placeholder */
.contact-form-wrap .wpforms-field input::placeholder,
.contact-form-wrap .wpforms-field textarea::placeholder {
  color: var(--clr-muted);
  opacity: 0.7;
}

/* Textarea */
.contact-form-wrap .wpforms-field textarea {
  min-height: 130px;
  resize: vertical;
}

/* Select — custom chevron */
.contact-form-wrap .wpforms-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230d1f3c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 1rem center !important;
  background-size: 14px !important;
  padding-right: 2.5rem !important;
  cursor: pointer;
}

/* ============================================================
   CHECKBOX & RADIO
   ============================================================ */
.contact-form-wrap .wpforms-field-checkbox li,
.contact-form-wrap .wpforms-field-radio li {
  margin-bottom: 0.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.contact-form-wrap .wpforms-field-checkbox input[type="checkbox"],
.contact-form-wrap .wpforms-field-radio input[type="radio"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--clr-navy);
}

.contact-form-wrap .wpforms-field-checkbox label,
.contact-form-wrap .wpforms-field-radio label {
  font-size: var(--fs-sm);
  color: var(--clr-text);
  font-weight: 400;
  cursor: pointer;
  line-height: 1.5;
}

/* ============================================================
   GDPR / ACCEPTANCE
   ============================================================ */
.contact-form-wrap .wpforms-field-gdpr-checkbox .wpforms-field-label,
.contact-form-wrap .wpforms-field-gdpr-checkbox label {
  font-weight: 400;
  font-size: var(--fs-sm);
  color: var(--clr-muted);
}

/* ============================================================
   FILE UPLOAD
   ============================================================ */
.contact-form-wrap .wpforms-field-file-upload input[type="file"] {
  font-size: var(--fs-sm);
  color: var(--clr-navy);
  padding: 0.5rem 0;
}

/* ============================================================
   SUBMIT BUTTON
   WPForms form builder injects inline style="background-color:..."
   directly on the <button> element. !important is required here
   to override that inline style. This is the correct approach —
   WPForms itself documents using CSS to override builder colours.
   ============================================================ */
.contact-form-wrap .wpforms-submit-container {
  padding: 0 !important;
  margin-top: 0.5rem;
  text-align: left;
}

.contact-form-wrap .wpforms-submit,
.contact-form-wrap button[type="submit"].wpforms-submit {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  padding: 0.9rem 2rem !important;
  /* Navy — matches --clr-navy: #0d1f3c */
  background-color: #0d1f3c !important;
  color: #ffffff !important;
  font-family: var(--ff-body) !important;
  font-size: var(--fs-sm) !important;
  font-weight: 600 !important;
  letter-spacing: 0.04em !important;
  border: 2px solid #0d1f3c !important;
  border-radius: 9999px !important;
  cursor: pointer !important;
  text-transform: none !important;
  box-shadow: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.15s ease, box-shadow 0.25s ease !important;
  line-height: 1 !important;
}

.contact-form-wrap .wpforms-submit:hover,
.contact-form-wrap button[type="submit"].wpforms-submit:hover {
  background-color: #b8962e !important;
  border-color: #b8962e !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 20px rgba(184, 150, 46, 0.35) !important;
}

.contact-form-wrap .wpforms-submit:active,
.contact-form-wrap button[type="submit"].wpforms-submit:active {
  transform: translateY(0) !important;
  box-shadow: none !important;
}

/* Disabled / processing state */
.contact-form-wrap .wpforms-submit[disabled],
.contact-form-wrap .wpforms-submit.wpforms-processing {
  background-color: #6b7280 !important;
  border-color: #6b7280 !important;
  opacity: 0.75 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

/* ============================================================
   VALIDATION ERRORS
   ============================================================ */
.contact-form-wrap .wpforms-field.wpforms-has-error input,
.contact-form-wrap .wpforms-field.wpforms-has-error select,
.contact-form-wrap .wpforms-field.wpforms-has-error textarea {
  border-color: #c0392b !important;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1) !important;
}

.contact-form-wrap label.wpforms-error,
.contact-form-wrap .wpforms-field-error {
  display: block;
  font-size: var(--fs-xs);
  color: #c0392b;
  font-weight: 500;
  margin-top: 0.3rem;
  line-height: 1.4;
}

/* ============================================================
   SUCCESS CONFIRMATION
   ============================================================ */
.contact-form-wrap .wpforms-confirmation-container-full,
.contact-form-wrap .wpforms-confirmation-container {
  background: var(--clr-white);
  border: 1px solid var(--clr-border);
  border-left: 4px solid var(--clr-gold);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  color: var(--clr-navy);
  font-size: var(--fs-base);
  line-height: 1.7;
}

.contact-form-wrap .wpforms-confirmation-container-full p,
.contact-form-wrap .wpforms-confirmation-container p {
  margin-bottom: 0;
  color: var(--clr-navy);
}

/* ============================================================
   NOTICES & ALERTS
   ============================================================ */
.contact-form-wrap .wpforms-notice,
.contact-form-wrap .wpforms-error-container,
.contact-form-wrap .wpforms-alert {
  background: #fff8f0;
  border: 1px solid #f0c080;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: var(--fs-sm);
  color: var(--clr-text);
  margin-bottom: var(--space-sm);
}
.contact-form-wrap .wpforms-error-container {
  background: #fff5f5;
  border-color: #f0a0a0;
}

/* ============================================================
   HONEYPOT & HIDDEN FIELDS
   ============================================================ */
.contact-form-wrap .wpforms-field-hp,
.contact-form-wrap div.wpforms-field-hidden {
  display: none !important;
}

/* ============================================================
   RECAPTCHA
   ============================================================ */
.contact-form-wrap .wpforms-recaptcha-container {
  margin-top: 0.5rem;
}

/* ============================================================
   MULTI-PAGE PROGRESS BAR
   ============================================================ */
.contact-form-wrap .wpforms-page-indicator {
  margin-bottom: var(--space-md);
}
.contact-form-wrap .wpforms-page-indicator-page-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--clr-navy);
  margin-bottom: 0.5rem;
}
.contact-form-wrap .wpforms-page-indicator-steps {
  font-size: var(--fs-xs);
  color: var(--clr-muted);
  margin-bottom: 0.5rem;
}
.contact-form-wrap .wpforms-page-indicator-page {
  background: var(--clr-border);
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
}
.contact-form-wrap .wpforms-page-indicator-page-progress {
  background: var(--clr-gold);
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Multi-page nav buttons */
.contact-form-wrap .wpforms-page-button {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  border: 2px solid var(--clr-navy);
  background: transparent;
  color: var(--clr-navy);
  transition: all 0.25s ease;
  font-family: var(--ff-body);
}
.contact-form-wrap .wpforms-page-button.wpforms-page-next {
  background: var(--clr-navy);
  color: var(--clr-white);
}
.contact-form-wrap .wpforms-page-button:hover {
  background: var(--clr-gold) !important;
  border-color: var(--clr-gold) !important;
  color: var(--clr-white) !important;
}

/* ============================================================
   DIVIDERS
   ============================================================ */
.contact-form-wrap .wpforms-field-divider {
  border: none;
  border-top: 1px solid var(--clr-border);
  margin: var(--space-sm) 0;
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .contact-form-wrap .wpforms-container { display: none; }
}
