/* =================================================================
   LiV — Dealer-quote form skin (Fluent Forms)
   =================================================================
   Scoped under .frm-fluent-form.liv-style. The `liv-style` class is
   added by inc/liv-contact-form.php to whichever Fluent Form is
   configured as the build/dealer-quote form in LiV Settings.

   Real DOM the CSS targets:
     form.frm-fluent-form.liv-style
       └── fieldset                                      ← grid root
           ├── input[type="hidden"] × N                  hidden (display:none)
           ├── .ff-hpsf-container                        honeypot (display:none)
           ├── .liv-field-header                         row 1 (full width)
           ├── .ff-t-container.ff_columns_total_2        row 2 (full width)
           │     ├── .ff-t-cell.ff-t-column-1            ← LEFT col
           │     │     ├── .liv-field-name
           │     │     ├── .liv-field-email
           │     │     ├── .liv-field-phone
           │     │     ├── .liv-field-state
           │     │     └── .liv-field-city
           │     └── .ff-t-cell.ff-t-column-2            ← RIGHT col
           │           ├── .liv-field-message
           │           └── .liv-field-sla
           ├── .liv-field-agree                          row 3 col 1 (footer band)
           └── .ff_submit_btn_wrapper                    row 3 col 2 (footer band)
   ================================================================= */

/* ----- tokens --------------------------------------------------- */
.frm-fluent-form.liv-style {
  --liv-green:        #8BC53F;
  --liv-green-glow:   rgba(139, 197, 63, 0.40);
  --liv-green-soft:   rgba(139, 197, 63, 0.15);
  --liv-black:        #000;
  --liv-ink:          #0A0A0A;
  --liv-ink-deep:     #070707;
  --liv-inset:        #0E0E0E;
  --liv-charcoal:     #1F1F1F;
  --liv-hairline:     #1B1B1B;
  --liv-border:       #2A2A2A;
  --liv-fg-1:         #FFFFFF;
  --liv-fg-2:         #C7C7C7;
  --liv-fg-3:         #9A9A9A;
  --liv-fg-4:         #6B6B6B;
  --liv-ease:         cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ----- universal box-sizing reset inside the form --------------- */
.frm-fluent-form.liv-style,
.frm-fluent-form.liv-style *,
.frm-fluent-form.liv-style *::before,
.frm-fluent-form.liv-style *::after {
  box-sizing: border-box;
}

/* ----- form shell ---------------------------------------------- */
.frm-fluent-form.liv-style {
  width: 100%;
  max-width: 660px;            /* +10% from the original 600px */
  margin: 0 auto;
  padding: 0;

  background: var(--liv-ink);
  color: var(--liv-fg-1);
  border: 1px solid var(--liv-hairline);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.50);

  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ----- fieldset = grid root (FF always wraps form body in one) -- */
.frm-fluent-form.liv-style > fieldset {
  display: grid !important;
  grid-template-columns: 1fr auto;        /* footer: agree fills, submit sizes to button */
  grid-template-rows: auto auto auto;     /* header / body / footer */
  gap: 0;
  /* FF emits inline border:none!important; padding:0!important; etc on the fieldset already — we don't fight that */
}

/* Suppress the noise so it doesn't grab grid cells */
.frm-fluent-form.liv-style input[type="hidden"],
.frm-fluent-form.liv-style .ff-hpsf-container {
  display: none !important;
}

/* Strip default margins on every FF group wrapper inside our scope */
.frm-fluent-form.liv-style .ff-el-group { margin: 0; padding: 0; }

/* Explicit row/col placement for the four real children of fieldset */
.frm-fluent-form.liv-style .liv-field-header { grid-column: 1 / -1; grid-row: 1; }
.frm-fluent-form.liv-style .ff-t-container   { grid-column: 1 / -1; grid-row: 2; }
.frm-fluent-form.liv-style .liv-field-agree  { grid-column: 1;       grid-row: 3; }
.frm-fluent-form.liv-style .ff_submit_btn_wrapper { grid-column: 2; grid-row: 3; }

/* ----- header (custom-html `liv-field-header`) ------------------ */
.frm-fluent-form.liv-style .liv-field-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--liv-hairline);
}
.frm-fluent-form.liv-style .liv-field-header .liv-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.frm-fluent-form.liv-style .liv-field-header .liv-header-inner > div:first-child > * + * {
  margin-top: 8px;
}
.frm-fluent-form.liv-style .liv-field-header .liv-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--liv-green);
}
.frm-fluent-form.liv-style .liv-field-header .liv-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--liv-green);
  display: inline-block;
  flex-shrink: 0;
}
.frm-fluent-form.liv-style .liv-field-header h3 {
  margin: 0;
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--liv-fg-1);
}
.frm-fluent-form.liv-style .liv-field-header img.liv-logo {
  height: 26px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

/* ----- 2-col container becomes our body grid -------------------- */
.frm-fluent-form.liv-style .ff-t-container.ff_columns_total_2 {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  position: relative;                /* anchor for the vertical divider */
}
/* Kill FF's inline `flex-basis: 50%` + width on the cells */
.frm-fluent-form.liv-style .ff-t-cell {
  flex-basis: auto !important;
  width: auto !important;
  max-width: none !important;
}
/* Vertical divider between the two cells */
.frm-fluent-form.liv-style .ff-t-container.ff_columns_total_2::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: var(--liv-hairline);
  pointer-events: none;
}

/* ----- LEFT cell: sub-grid for name/email/phone + state|city ---- */
.frm-fluent-form.liv-style .ff-t-cell.ff-t-column-1 {
  display: grid;
  grid-template-columns: 90px 1fr;
  grid-template-areas:
    "name  name"
    "email email"
    "phone phone"
    "state city";
  column-gap: 8px;
  row-gap: 12px;
  /* !important required: FF v6.2.4 emits
       .frm-fluent-form .ff-t-cell:first-of-type { padding-left: 0 }
     after our CSS, beating our 3-class specificity on source-order. */
  padding: 20px 24px !important;
}
.frm-fluent-form.liv-style .liv-field-name  { grid-area: name; }
.frm-fluent-form.liv-style .liv-field-email { grid-area: email; }
.frm-fluent-form.liv-style .liv-field-phone { grid-area: phone; }
.frm-fluent-form.liv-style .liv-field-state { grid-area: state; }
.frm-fluent-form.liv-style .liv-field-city  { grid-area: city; }

/* ----- RIGHT cell: flex column for message + SLA ---------------- */
.frm-fluent-form.liv-style .ff-t-cell.ff-t-column-2 {
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* !important required: FF v6.2.4 emits
       .frm-fluent-form .ff-t-cell:last-of-type { padding-right: 0 }
     after our CSS, beating our 3-class specificity on source-order. */
  padding: 20px 24px !important;
}
/* Message group needs to flex-grow so the textarea fills column height */
.frm-fluent-form.liv-style .liv-field-message {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.frm-fluent-form.liv-style .liv-field-message .ff-el-input--content {
  flex: 1;
  display: flex;
}
.frm-fluent-form.liv-style .liv-field-message textarea.ff-el-form-control {
  flex: 1;
  width: 100%;
  height: auto;
  min-height: 168px;
  padding: 12px 14px;
  line-height: 1.55;
  resize: none;
}

/* ----- labels --------------------------------------------------- */
.frm-fluent-form.liv-style .ff-el-input--label {
  padding: 0;
  margin: 0 0 6px;
}
.frm-fluent-form.liv-style .ff-el-input--label label,
.frm-fluent-form.liv-style label.ff_item_lbl {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--liv-fg-3);
}
/* FF marks required fields with this class on the LABEL container, and
   appends a "*" via the `.asterisk-right` pseudo. Green-ify both. */
.frm-fluent-form.liv-style .ff-el-input--label.ff-el-is-required.asterisk-right::after {
  color: var(--liv-green);
}
.frm-fluent-form.liv-style .ff-el-input--label .ff-el-is-required,
.frm-fluent-form.liv-style .ff-el-input--label .ff-el-is-required > span {
  color: var(--liv-green);
}

/* ----- inputs / selects / textareas ----------------------------- */
.frm-fluent-form.liv-style input.ff-el-form-control,
.frm-fluent-form.liv-style select.ff-el-form-control,
.frm-fluent-form.liv-style textarea.ff-el-form-control {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  margin: 0;                  /* FF default: margin-bottom: 10px */
  background: var(--liv-inset);
  border: 1px solid var(--liv-border);
  border-radius: 6px;
  color: var(--liv-fg-1);
  font: inherit;
  font-size: 13.5px;
  outline: 0;
  box-shadow: none;
  transition: border-color 140ms var(--liv-ease), box-shadow 140ms var(--liv-ease);
}
.frm-fluent-form.liv-style input.ff-el-form-control::placeholder,
.frm-fluent-form.liv-style textarea.ff-el-form-control::placeholder {
  color: var(--liv-fg-4);
  opacity: 1;
}
.frm-fluent-form.liv-style input.ff-el-form-control:focus,
.frm-fluent-form.liv-style select.ff-el-form-control:focus,
.frm-fluent-form.liv-style textarea.ff-el-form-control:focus {
  border-color: var(--liv-green);
  box-shadow: 0 0 0 3px var(--liv-green-soft);
}

/* select chevron — replace browser default */
.frm-fluent-form.liv-style select.ff-el-form-control {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239A9A9A' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
.frm-fluent-form.liv-style select.ff-el-form-control option {
  background: var(--liv-ink);
  color: var(--liv-fg-1);
}

/* ----- SLA microcopy under the message --------------------------
   The clock icon is drawn via a ::before pseudo-element (CSS-only),
   not from inline SVG in the Custom HTML field — Fluent Forms'
   admin-save sanitizer rejects <svg> tags and hangs the save spinner.
   Keep the FF field contents to plain text:
     <p>Avg. response: <b>under 2 hours</b> on weekdays</p>

   Layout: the <p> is plain block flow (NOT flex) so all text nodes
   wrap as natural inline content. The clock icon is an inline-block
   ::before pseudo that sits on the first text line. Using flex on the
   <p> turned every text node into its own flex item separated by gap,
   which made the line read as three disjointed chunks.
   ----------------------------------------------------------------- */
.frm-fluent-form.liv-style .liv-field-sla p {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.04em;
  line-height: 1.5;
  color: var(--liv-fg-3);
}
.frm-fluent-form.liv-style .liv-field-sla p::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;        /* nudge icon down to optical-center on the text baseline */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238BC53F' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9'/><polyline points='12 7 12 12 15 14'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
}
.frm-fluent-form.liv-style .liv-field-sla b {
  color: var(--liv-fg-1);
  font-weight: 600;
}

/* ----- footer band: agree (col 1) + submit (col 2) on row 3 ----- */
.frm-fluent-form.liv-style .liv-field-agree,
.frm-fluent-form.liv-style .ff_submit_btn_wrapper {
  background: var(--liv-ink-deep);
  border-top: 1px solid var(--liv-hairline);
  padding: 16px 24px;
}
.frm-fluent-form.liv-style .liv-field-agree {
  display: flex;
  align-items: center;
}
.frm-fluent-form.liv-style .ff_submit_btn_wrapper {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-left: 0;
}

/* ----- agreement checkbox custom skin ---------------------------
   FF v6.2.4 ships an aggressive "modern checkbox" pattern in
   fluent-forms-public.css that we need to undo:
     1. `.ff-el-form-check input { opacity: 0; position: absolute;
        z-index: -1; }` — HIDES the real checkbox so they can render a
        styled <span> in its place. We want the real checkbox visible
        and styled via appearance:none. Need to undo opacity / position
        / z-index, all explicit and with !important since FF's selector
        ties our specificity and loads after main.css.
     2. `.ff-el-form-check label > span { background:#fff; border:1px;
        padding:12px 20px; … }` — turns the agreement text into a
        white pill-button. Reset to plain inline text.
   ---------------------------------------------------------------- */

/* Hide FF's outer label (Container Field title) — Part A step 5 blanks
   the label text but FF still emits the wrapper div */
.frm-fluent-form.liv-style .liv-field-agree > .ff-el-input--label {
  display: none;
}
.frm-fluent-form.liv-style .liv-field-agree .ff-el-form-check {
  display: block;
  margin: 0 !important;       /* FF: margin: 0 0 10px */
  padding: 0;
  position: static;            /* FF: position: relative */
  width: auto !important;      /* FF: width: auto !important */
  float: none !important;      /* FF: float: none !important */
}
.frm-fluent-form.liv-style .liv-field-agree .ff-el-form-check-label {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 0;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--liv-fg-2);
  line-height: 1.5;
}
/* Override 1: un-hide the real checkbox input and pull it back into flow. */
.frm-fluent-form.liv-style .liv-field-agree input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  background: transparent;
  border: 1px solid var(--liv-border);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 140ms var(--liv-ease), border-color 140ms var(--liv-ease), box-shadow 140ms var(--liv-ease);
  /* The reset-from-FF declarations: */
  opacity: 1 !important;       /* FF: opacity: 0 */
  position: relative !important; /* FF: position: absolute */
  inset: auto !important;       /* clear top/right/bottom/left from FF */
  z-index: auto !important;     /* FF: z-index: -1 */
  outline: 0;
  vertical-align: baseline;     /* FF on .ff-el-form-check-input: vertical-align:middle */
  top: auto;                    /* FF on .ff-el-form-check-input: top:-2px */
}
/* Override 2: kill the FF "button-chip" span inside the label.
   Targets <span> AND the more specific FF subselector .ff_span. */
.frm-fluent-form.liv-style .liv-field-agree .ff-el-form-check label > span,
.frm-fluent-form.liv-style .liv-field-agree .ff-el-form-check label span.ff_span {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  width: auto !important;
  display: inline !important;   /* FF: display: inline-block */
  color: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  text-align: left !important;
  vertical-align: baseline !important;
  white-space: normal !important;
  line-height: inherit !important;
}
.frm-fluent-form.liv-style .liv-field-agree input[type="checkbox"]:checked {
  background: var(--liv-green);
  border-color: var(--liv-green);
}
.frm-fluent-form.liv-style .liv-field-agree input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
}
.frm-fluent-form.liv-style .liv-field-agree input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 3px var(--liv-green-soft);
}
.frm-fluent-form.liv-style .liv-field-agree a {
  color: var(--liv-fg-1);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ----- submit pill ---------------------------------------------- */
.frm-fluent-form.liv-style .ff-btn-submit,
.frm-fluent-form.liv-style button.ff-btn-submit,
.frm-fluent-form.liv-style .ff-btn-submit.ff-btn-md {
  /* !important required: FF emits an inline `<style>` block
     `.fluent_form_N .ff-btn-submit{ background-color:...; color:#fff }`
     that would otherwise override our pill colors. */
  display: inline-flex !important;
  align-items: center;
  gap: 12px;
  width: auto;
  padding: 12px 16px 12px 22px;
  background: var(--liv-green) !important;
  color: var(--liv-black) !important;
  border: 0 !important;
  border-radius: 999px !important;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 8px 24px var(--liv-green-glow);
  transition:
    transform 140ms var(--liv-ease),
    box-shadow 140ms var(--liv-ease),
    background-color 140ms var(--liv-ease);
}
.frm-fluent-form.liv-style .ff-btn-submit::after {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--liv-black) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238BC53F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><line x1='5' y1='12' x2='19' y2='12'/><polyline points='12 5 19 12 12 19'/></svg>") center / 12px no-repeat;
  display: inline-block;
  flex-shrink: 0;
}
.frm-fluent-form.liv-style .ff-btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px var(--liv-green-glow);
  background: var(--liv-green) !important;
  color: var(--liv-black) !important;
}
.frm-fluent-form.liv-style .ff-btn-submit:disabled,
.frm-fluent-form.liv-style .ff-btn-submit[disabled] {
  background: var(--liv-charcoal) !important;
  color: var(--liv-fg-4) !important;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* ----- validation messages -------------------------------------- */
.frm-fluent-form.liv-style .error,
.frm-fluent-form.liv-style .text-danger,
.frm-fluent-form.liv-style .error-text {
  color: #FF7373 !important;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  margin-top: 6px;
}

/* ----- success confirmation (FF's default message) ------------- */
.frm-fluent-form.liv-style .ff-message-success {
  background: var(--liv-ink) !important;
  color: var(--liv-fg-1) !important;
  border: 1px solid var(--liv-green) !important;
  border-radius: 12px !important;
  padding: 32px !important;
  text-align: center;
  font-family: "Manrope", system-ui, sans-serif !important;
  font-size: 14px !important;
  line-height: 1.6;
  max-width: 660px;            /* match form max-width */
  margin: 0 auto;
}

/* ----- responsive (≤ 560px: collapse to one column) ------------- */
@media (max-width: 560px) {
  .frm-fluent-form.liv-style > fieldset {
    grid-template-columns: 1fr;
  }
  .frm-fluent-form.liv-style .liv-field-header,
  .frm-fluent-form.liv-style .ff-t-container,
  .frm-fluent-form.liv-style .liv-field-agree,
  .frm-fluent-form.liv-style .ff_submit_btn_wrapper {
    grid-column: 1;
    grid-row: auto;
  }

  /* Container collapses to one column */
  .frm-fluent-form.liv-style .ff-t-container.ff_columns_total_2 {
    grid-template-columns: 1fr;
  }
  .frm-fluent-form.liv-style .ff-t-container.ff_columns_total_2::before {
    display: none;                                 /* no vertical divider when stacked */
  }
  /* horizontal divider between the two cells when stacked */
  .frm-fluent-form.liv-style .ff-t-cell.ff-t-column-2 {
    border-top: 1px solid var(--liv-hairline);
  }

  /* Left cell — state + city stay side-by-side even on mobile */
  .frm-fluent-form.liv-style .ff-t-cell.ff-t-column-1 {
    grid-template-columns: 90px 1fr;
  }

  /* Footer stacks: agree row above submit row */
  .frm-fluent-form.liv-style .ff_submit_btn_wrapper {
    justify-content: stretch;
    padding-left: 24px;
    padding-top: 0;
  }
  .frm-fluent-form.liv-style .liv-field-agree {
    padding-bottom: 8px;
  }
  .frm-fluent-form.liv-style .ff-btn-submit {
    width: 100%;
    justify-content: space-between;
  }
}
