/* ==========================================================================
   Enquiry forms - Request a Quote (.qq-quote) + Ask a Question (.ask-form-wrap)
   --------------------------------------------------------------------------
   Redesign 2026-11-12 (owner's mock-up from claude.ai, adapted): numbered
   sections, model cards, segmented "I am a", soft-filled inputs, tinted header
   and footer bands, submit button in each form's colour, pressed trigger button
   with a notch pointing at the open panel. Loaded after style.css (header.php).
   Markup: product.php (quote) + includes/ask-form.php (question).
   Changes from the mock-up: brand colours from style.css; smaller model cards
   (some products have 20+ models); "I am a" starts with nothing picked; the
   promo "Code applied" line is written by product.php's script, naming the
   ticked promo models, only when the code really matches.
   ========================================================================== */

:root {
  --enq-teal: var(--accent);
  --enq-teal-dark: var(--accent-d);
  --enq-teal-darker: #13705f;
  --enq-orange: var(--cta);
  --enq-orange-dark: var(--cta-d);
  --enq-orange-darker: #c24c1c;

  --enq-text: var(--ink);
  --enq-text-muted: #4a5753;
  --enq-text-subtle: #6b7a75;
  --enq-border: #dbe2df;
  --enq-border-hover: #c4cfcb;
  --enq-field-bg: #f6f8f7;
  --enq-footer-bg: #f7f9f8;

  --enq-pad-x: 40px;
  /* Trigger button's bottom edge -> the notch's bottom edge; the panel covers its lower half. */
  --enq-notch-offset: 42px;
}

/* ---- Theme per panel ---- */
.qq-form-wrap.qq-quote {
  --enq-accent: var(--enq-orange);
  --enq-accent-hover: var(--enq-orange-dark);
  --enq-accent-text: #b8461a;
  --enq-accent-tint: #fdf0ea;
  --enq-accent-tint-border: #f6dccf;
  --enq-accent-ring: rgba(232, 98, 44, 0.18);
}
.qq-form-wrap.ask-form-wrap {
  --enq-accent: var(--enq-teal);
  --enq-accent-hover: var(--enq-teal-dark);
  --enq-accent-text: var(--enq-teal-darker);
  --enq-accent-tint: #e8f5f2;
  --enq-accent-tint-border: #cfe8e2;
  --enq-accent-ring: rgba(29, 151, 131, 0.18);
}

/* ---- Trigger buttons: pressed + notch while their panel is open ---- */
.enquiry-btns .btn { position: relative; }
.enquiry-btns .qq-toggle[aria-expanded="true"],
.enquiry-btns [data-ask-toggle][aria-expanded="true"] { box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.22); }
.enquiry-btns .qq-toggle[aria-expanded="true"] { background: var(--enq-orange-darker); border-color: var(--enq-orange-darker); }
.enquiry-btns [data-ask-toggle][aria-expanded="true"] { background: var(--enq-teal-darker); border-color: var(--enq-teal-darker); color: #fff; }
.enquiry-btns .qq-toggle[aria-expanded="true"]::after,
.enquiry-btns [data-ask-toggle][aria-expanded="true"]::after {
  content: ""; position: absolute; z-index: 0; left: 50%; bottom: calc(var(--enq-notch-offset) * -1);
  width: 18px; height: 18px; margin-left: -9px; border-radius: 2px; transform: rotate(45deg); pointer-events: none;
}
.enquiry-btns .qq-toggle[aria-expanded="true"]::after { background: var(--enq-orange); }
.enquiry-btns [data-ask-toggle][aria-expanded="true"]::after { background: var(--enq-teal); }

/* ---- Panel shell ---- */
.qq-form-wrap {
  position: relative; z-index: 1; /* over the lower half of the notch */
  padding: 0; background: #fff; border: 0; border-top: 5px solid var(--enq-accent); border-radius: 12px;
  box-shadow: 0 1px 2px rgba(20, 40, 35, 0.06), 0 12px 32px rgba(20, 40, 35, 0.1);
  overflow: hidden; color: var(--enq-text);
}

/* Header */
.qq-form-wrap .qq-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin: 0;
  padding: 26px var(--enq-pad-x) 24px; background: var(--enq-accent-tint); border-bottom: 1px solid var(--enq-accent-tint-border);
  border-radius: 0;
}
.qq-form-wrap .qq-kicker { margin: 0 0 6px; font-size: 0.85rem; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--enq-accent-text); }
.qq-form-wrap .qq-title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.9rem; line-height: 1.15; letter-spacing: 0.3px; text-transform: uppercase; }
.qq-form-wrap .qq-sub { margin: 8px 0 0; font-size: 1rem; color: var(--enq-text-muted); }
.qq-form-wrap .qq-x {
  flex: none; display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; padding: 0 0 3px;
  border-radius: 50%; border: 1px solid var(--enq-accent-tint-border); background: #fff; color: var(--enq-text);
  font-size: 1.8rem; line-height: 1; cursor: pointer; transition: background-color 0.15s;
}
.qq-form-wrap .qq-x:hover { background: var(--enq-accent-tint); color: var(--enq-text); border-color: var(--enq-accent-tint-border); }
.qq-form-wrap .qq-x:focus-visible { outline: 3px solid var(--enq-accent-ring); outline-offset: 2px; }

/* Form body - :not([hidden]) so the Ask form's step 2 stays hidden until shown */
.qq-form-wrap form:not([hidden]) { display: flex; flex-direction: column; gap: 22px; margin: 0; padding: 28px var(--enq-pad-x) 0; }
.qq-form-wrap form > * { margin: 0; }
.qq-form-wrap.ask-form-wrap form:not([hidden]) { gap: 18px; padding-top: 26px; }

/* Numbered section headings (quote form) */
.qq-form-wrap .qq-step {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; color: var(--enq-text);
}
.qq-form-wrap .qq-step::after { content: ""; flex: 1; height: 1px; background: #e6ebe9; margin-left: 6px; }
.qq-form-wrap .qq-step-n {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--enq-accent); color: #fff; font-family: var(--font-body); font-size: 0.8rem; font-weight: 700;
}
.qq-form-wrap .qq-step:not(:first-child) { margin-top: 10px; }

/* Field rows */
.qq-form-wrap .field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px 24px; }
.qq-form-wrap .field { display: flex; flex-direction: column; gap: 8px; min-width: 0; margin: 0; }

/* Labels + legends */
.qq-form-wrap .field > label,
.qq-form-wrap fieldset > legend { font-size: 0.92rem; font-weight: 700; color: var(--enq-text-muted); text-transform: none; }
.qq-form-wrap .field > label .muted { font-weight: 400; }

/* Inputs */
.qq-form-wrap input[type="text"],
.qq-form-wrap input[type="email"],
.qq-form-wrap input[type="tel"],
.qq-form-wrap textarea {
  width: 100%; box-sizing: border-box; height: 50px; padding: 0 16px; font: inherit; font-size: 16px; color: var(--enq-text);
  background: var(--enq-field-bg); border: 1px solid var(--enq-border); border-radius: 8px; outline: none;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.qq-form-wrap textarea { height: 120px; padding: 14px 16px; resize: vertical; }
.qq-form-wrap input:hover, .qq-form-wrap textarea:hover { border-color: var(--enq-border-hover); }
.qq-form-wrap input[type="text"]:focus,
.qq-form-wrap input[type="email"]:focus,
.qq-form-wrap input[type="tel"]:focus,
.qq-form-wrap textarea:focus { background: #fff; border-color: var(--enq-accent); box-shadow: 0 0 0 3px var(--enq-accent-ring); }
.qq-form-wrap input:user-invalid, .qq-form-wrap textarea:user-invalid { border-color: #c0392b; }

/* ---- Model + accessory cards (smaller than the mock-up: some products have 20+ models) ---- */
/* Cards sized to their code (flex, no wrapping inside a card): fixed grid columns squashed
   long codes like "MC. 1471SUT" onto two lines (12.11.26). */
.qq-form-wrap fieldset.qq-models {
  display: flex; flex-direction: row; flex-wrap: wrap; align-items: stretch; gap: 10px;   /* row: .field is a column */
  min-width: 0; margin: 0; padding: 0; border: 0; columns: auto;
}
.qq-form-wrap fieldset.qq-models:not(.qq-customer-type):not(.qq-accessories) > .qq-model-check {
  flex: 0 1 auto; min-width: 124px; white-space: nowrap;
}
.qq-form-wrap fieldset.qq-accessories { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.qq-form-wrap fieldset.qq-models > legend { float: none; width: auto; margin: 0; padding: 0 0 10px; }
.qq-form-wrap .qq-model-check {
  display: flex; align-items: center; gap: 10px; min-height: 52px; margin: 0; padding: 0 14px; box-sizing: border-box;
  border: 1.5px solid var(--enq-border); border-radius: 10px; background: #fff;
  font-size: 1rem; font-weight: 800; color: var(--enq-text); cursor: pointer; user-select: none; break-inside: auto;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s, color 0.15s;
}
.qq-form-wrap .qq-accessories .qq-model-check { min-height: 52px; padding: 10px 14px; font-size: 0.95rem; font-weight: 400; align-items: center; }
.qq-form-wrap .qq-model-check:hover { border-color: var(--enq-border-hover); }
.qq-form-wrap .qq-model-check input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: none; width: 22px; height: 22px; margin: 0;
  border: 1.5px solid #b9c4c0; border-radius: 6px; background: #fff center / 14px 14px no-repeat; cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s;
}
.qq-form-wrap .qq-model-check input[type="checkbox"]:checked {
  border-color: var(--enq-accent); background-color: var(--enq-accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E");
}
/* style.css gives every focused input a teal outline - here focus shows as the ring on the
   card or field instead (a clicked checkbox kept a green frame, 12.11.26) */
.qq-form-wrap input:focus, .qq-form-wrap textarea:focus { outline: none; }
.qq-form-wrap .qq-model-check input[type="checkbox"]:focus:not(:checked) { border-color: #b9c4c0; }
.qq-form-wrap .qq-model-check input[type="checkbox"]:focus:checked { border-color: var(--enq-accent); }
.qq-form-wrap .qq-model-check input:focus-visible { outline: none; }
.qq-form-wrap .qq-model-check:has(input:checked) { border-color: var(--enq-accent); background: var(--enq-accent-tint); color: var(--enq-accent-text); }
.qq-form-wrap .qq-model-check:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--enq-accent-ring); }
/* PROMO as a tag on the card's top edge - inside the card it overflowed the narrow cards (12.11.26) */
.qq-form-wrap fieldset.qq-models:not(.qq-customer-type) .qq-model-check { position: relative; }
.qq-form-wrap .qq-model-check .promo-pill {
  position: absolute; top: -9px; right: 10px; padding: 1px 7px; font-size: 0.62rem; line-height: 1.5;
  box-shadow: 0 0 0 2px #fff;
}
.qq-form-wrap fieldset.qq-models:has(.promo-pill) { padding-top: 9px; } /* room for the tags on the first row */

/* ---- "I am a" - segmented toggle; nothing picked until the visitor chooses ---- */
/* flex-direction: row - .field (column) was stacking the two options full-width (12.11.26) */
/* Segmented toggle as in the mock-up: one grey track (.qq-seg) holding both options, the
   chosen one raised in white. Nothing chosen to start with. (12.11.26) */
.qq-form-wrap fieldset.qq-customer-type { display: block; padding: 0; margin: 4px 0 6px; border: 0; }
.qq-form-wrap fieldset.qq-customer-type > legend { padding-bottom: 10px; }
.qq-form-wrap .qq-seg {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 10px; background: #eef2f0;
}
.qq-form-wrap .qq-customer-type .qq-model-check {
  position: relative; min-height: 42px; padding: 0 22px; border: 0; border-radius: 7px;
  background: transparent; box-shadow: none; font-size: 1rem; font-weight: 700; color: #5b6b66;
}
.qq-form-wrap .qq-customer-type .qq-model-check:hover { color: var(--enq-text); background: rgba(255, 255, 255, 0.5); }
.qq-form-wrap .qq-customer-type input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.qq-form-wrap .qq-customer-type .qq-model-check:has(input:checked) {
  background: #fff; color: var(--enq-text); box-shadow: 0 1px 3px rgba(20, 40, 35, 0.15);
}
.qq-form-wrap .qq-customer-type .qq-model-check:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--enq-accent-ring); }

/* ---- Promo code ---- */
/* Sits right under the model cards (12.11.26), in a light orange box so it reads as part of choosing */
.qq-form-wrap .field.qq-promo {
  flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 18px;
  padding: 14px 16px; border-radius: 10px; background: #fdf0ea; border: 1px solid #f6dccf;
}
.qq-form-wrap .qq-promo input[type="text"] { background-color: #fff; }
.qq-form-wrap .qq-promo > label { flex: 0 0 100%; }
.qq-form-wrap .qq-promo input { width: 260px; max-width: 100%; padding-right: 44px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
.qq-form-wrap .qq-promo-status { font-size: 0.92rem; font-weight: 700; color: var(--enq-teal-dark); }
.qq-form-wrap .qq-promo-status.is-hint { font-weight: 400; color: var(--enq-text-subtle); }
.qq-form-wrap .qq-promo > .muted { font-size: 0.92rem; }
.qq-form-wrap .qq-promo > .muted a { color: var(--enq-teal-dark); }
.qq-form-wrap .qq-promo.is-applied input {
  border-color: #7cc7b9; background-color: #eef8f6;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23177a6a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 20px 20px;
}

/* ---- Footer band + buttons ---- */
.qq-form-wrap .form-status:empty { display: none; }
.qq-form-wrap .form-status { order: 98; }
.qq-form-wrap .qq-actions {
  order: 99; display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: 12px;
  margin: 8px calc(var(--enq-pad-x) * -1) 0; padding: 20px var(--enq-pad-x); background: var(--enq-footer-bg); border-top: 1px solid #e6ebe9;
}
.qq-form-wrap .qq-actions button[type="submit"] { background: var(--enq-accent); border-color: var(--enq-accent); color: #fff; }
.qq-form-wrap .qq-actions button[type="submit"]:hover:not(:disabled) { background: var(--enq-accent-hover); border-color: var(--enq-accent-hover); }
.qq-form-wrap .qq-actions button[type="submit"]:disabled { opacity: 0.6; cursor: default; }
.qq-form-wrap .qq-actions .qq-cancel,
.qq-form-wrap .qq-actions .qq-close { background: transparent; border: 1px solid #d5ddda; color: var(--enq-text-muted); box-shadow: none; text-decoration: none; }
.qq-form-wrap .qq-actions .qq-cancel:hover,
.qq-form-wrap .qq-actions .qq-close:hover { background: #eef2f0; color: var(--enq-text); }
.qq-form-wrap .qq-actions .qq-close { min-height: 48px; padding: 0 22px; border-radius: 8px; font: inherit; font-weight: 700; cursor: pointer; }
.qq-form-wrap .qq-foot-note { margin-left: auto; font-size: 0.85rem; color: var(--enq-text-subtle); }

/* ---- Phones ---- */
@media (max-width: 640px) {
  .qq-form-wrap { --enq-pad-x: 18px; }
  .qq-form-wrap .qq-title { font-size: 1.5rem; }
  .qq-form-wrap .qq-actions .btn, .qq-form-wrap .qq-actions .qq-close { flex: 1; }
  .qq-form-wrap .qq-foot-note { flex: 0 0 100%; margin-left: 0; text-align: center; }
  .qq-form-wrap .qq-seg { display: flex; }
  .qq-form-wrap fieldset.qq-customer-type .qq-model-check { flex: 1; justify-content: center; }
  /* the notch only lines up when the enquiry bar is one row */
  .enquiry-btns .btn[aria-expanded="true"]::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .qq-form-wrap *, .enquiry-btns .btn { transition: none !important; }
}
