.d4ca-wpforms,
.d4ca-wpforms * {
    box-sizing: border-box;
}

.d4ca-wpforms .wpforms-container {
    max-width: 100%;
}

.d4ca-wpforms input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="hidden"]),
.d4ca-wpforms select,
.d4ca-wpforms textarea {
    max-width: 100% !important;
}

/* WPForms' "Layout" field (side-by-side rows, e.g. Name+Email on one row,
   Phone+Select on the next) wraps each row in its own .wpforms-layout-row.
   Outer Field Margin (see widgets/class-wpforms-widget.php) only ever
   targets individual .wpforms-field elements inside a row's column — it
   has no way to reach the row wrapper itself — so a Layout field's rows
   sat flush against each other regardless of that setting, even though
   the same field spacing looked correct everywhere else on the form
   (reported live, v1.27.6: rows squeezed together, e.g. Name/Email right
   on top of Phone/Interested In). Fixed by feeding the row-to-row gap
   from that same control's Bottom value via a custom property, so a
   Layout field's rows automatically match whatever spacing is already
   configured for every other field, with nothing new to set. */
.d4ca-wpforms .wpforms-layout-row + .wpforms-layout-row {
    margin-top: var(--d4ca-row-gap, 20px) !important;
}

/* Baseline background/text colour for dropdowns, overridable by the
   Select Fields Background/Text Color controls (see
   widgets/class-wpforms-widget.php). WPForms' own "Classic" select style
   ships its own CSS — `.wpforms-field-select-style-classic select` —
   that sets its own background/text colour WITH `!important` already on
   it. Unlike a plain <input type="text">, which has no equivalent
   WPForms theme CSS and so just shows the browser's default white, a
   <select> with the Classic style always has *something* opinionated
   behind it, which is why it can look visibly different from the text
   inputs next to it with zero D4 configuration involved.

   Since WPForms' own rule is already `!important`, matching `!important`
   here isn't enough on its own — with both sides `!important`,
   specificity decides the tie, so this selector is deliberately written
   to out-specify theirs rather than just out-`!important` them:
   `.d4ca-wpforms.d4ca-wpforms` repeats the same class to double its
   specificity weight, and the rule also names WPForms' own
   `.wpforms-field-select-style-classic` class directly so it wins even
   if their actual selector turns out to be more specific than it looks.

   The Select Fields Background/Text Color controls (Normal and Focus)
   now carry `!important` on their own output too (widgets/class-wpforms-
   widget.php) — v1.26.3 originally assumed Elementor's per-instance
   generated CSS always carries `!important` already, but Elementor's
   COLOR control doesn't add it unless a plugin's selector template asks
   for it, so this baseline's `!important` was silently beating an
   explicitly-set Background colour every time (reported live on
   thetanningrooms.com, v1.27.3). With both sides now `!important` and
   equal specificity, the tie goes to source order, and the per-instance
   control's CSS loads after this stylesheet (Elementor enqueues each
   page's generated post CSS last), so a value set in the Style panel
   correctly wins; leaving Background/Text Color unset still falls back
   to this baseline. */
.d4ca-wpforms.d4ca-wpforms select:not([multiple]),
.d4ca-wpforms.d4ca-wpforms .wpforms-field-select-style-classic select:not([multiple]) {
    background-color: #fff !important;
    color: #2c3338 !important;
}

.d4ca-wpforms-button-full-yes .d4ca-wpforms button.wpforms-submit {
    width: 100% !important;
}

/* Submit button icon (see widgets/class-wpforms-widget.php). An uploaded
   SVG is rendered as a mask-image pseudo-element directly on WPForms' own
   real <button> — a per-instance <style> tag sets that up, this stylesheet
   only needs to be there to size/position/colour it via the Icon
   controls — so it's genuinely part of the button, not a separate
   element, and needs none of the rules below.

   The rules below are the fallback used only for a font-library icon
   (Font Awesome etc.), which can't be expressed as a mask-image: WPForms
   gives no way to inject real markup inside its own <button>, only two
   action hooks that echo beside it, so that icon is a DOM sibling,
   absolutely positioned over the button's edge rather than truly inside
   it. It sits above the button (z-index) but ignores clicks
   (pointer-events: none) so the button underneath stays fully clickable
   through it. Only applies when an icon is actually set (the
   "has-btn-icon" modifier), so a form with no icon is completely
   unaffected. If the icon overlaps the button's own text, increase the
   button's Padding on that side (see Icon Spacing's description above) —
   there's no way to reserve that space automatically without fighting the
   Padding control. */
.d4ca-wpforms-has-btn-icon .wpforms-submit-container {
    position: relative;
    display: inline-block;
}

.d4ca-wpforms-button-full-yes.d4ca-wpforms-has-btn-icon .wpforms-submit-container {
    display: block;
    width: 100%;
}

.d4ca-wpforms-btn-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    line-height: 1;
    pointer-events: none;
    z-index: 1;
}

.d4ca-wpforms-btn-icon-before {
    left: 16px;
}

.d4ca-wpforms-btn-icon-after {
    right: 16px;
}

.d4ca-wpforms-btn-icon i,
.d4ca-wpforms-btn-icon svg {
    display: block;
}

/* Optional fully custom checkbox/radio appearance. */
.d4ca-custom-choice-yes .d4ca-wpforms input[type="checkbox"],
.d4ca-custom-choice-yes .d4ca-wpforms input[type="radio"] {
    -webkit-appearance: none !important;
    appearance: none !important;
    position: relative;
    display: inline-grid !important;
    place-content: center;
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin: 0 8px 0 0 !important;
    padding: 0 !important;
    border: 1px solid #b8bcc2;
    background: #fff;
    color: #fff;
    vertical-align: middle;
    cursor: pointer;
    box-shadow: none;
    transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.d4ca-custom-choice-yes .d4ca-wpforms input[type="checkbox"] {
    border-radius: 3px;
}

.d4ca-custom-choice-yes .d4ca-wpforms input[type="checkbox"]:checked::after {
    content: "";
    width: 32%;
    height: 58%;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-5%, -8%);
    transform-origin: center;
}

.d4ca-custom-choice-yes .d4ca-wpforms input[type="radio"] {
    border-radius: 50%;
}

.d4ca-custom-choice-yes .d4ca-wpforms input[type="radio"]:checked::after {
    content: "";
    width: 44%;
    height: 44%;
    border-radius: 50%;
    background: currentColor;
}

.d4ca-custom-choice-yes .d4ca-wpforms input[type="checkbox"]:focus-visible,
.d4ca-custom-choice-yes .d4ca-wpforms input[type="radio"]:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Optional fully custom select-arrow styling (see widgets/class-wpforms-widget.php
   Style > Select Fields). appearance:none strips the browser's own
   chevron — which differs across OS/browser and can't otherwise be
   recoloured or resized.

   v1.27.4 fix: this previously drew the replacement arrow with a ::after
   pseudo-element on the <select> itself. <select> is a replaced form
   control, and per spec Chrome/Safari/Edge generate no ::before/::after
   box on it at all — Firefox is the only engine with any support for
   that, and it's inconsistent even there — so the arrow never actually
   painted in most browsers regardless of what Arrow Color/Size/Offset
   were set to (reported live, v1.27.4: "Custom Dropdown Arrow" on with a
   configured colour/size, nothing rendering). Fixed by drawing the
   chevron as the select's own background-image instead, no
   pseudo-element involved. Still fully driven by the same
   --d4ca-select-arrow-* custom properties the controls already set, so
   no control changes were needed. Excludes [multiple] list boxes, which
   never had a dropdown arrow to replace.

   v1.27.5: v1.27.4's shape (two triangular gradients, each filled solid
   across half their box) rendered as a solid filled downward triangle
   (▼), not a chevron (reported live — "change arrow style to chevron").
   Replaced with a genuine open, two-stroke chevron (˅): each arm is now a
   thin diagonal BAND within its gradient box (transparent either side of
   a narrow colour band at 45°/135°), not a half-filled box, and the two
   boxes sit edge-to-edge so the strokes meet at a point with no gap.
   Stroke weight scales with Arrow Size (floor'd via max() so it stays
   visible at the smallest slider setting) rather than being a separate
   control. */
.d4ca-custom-select-yes .d4ca-wpforms select:not([multiple]) {
    --d4ca-select-arrow-color: #495057;
    --d4ca-select-arrow-size: 5px;
    --d4ca-select-arrow-offset: 16px;
    --d4ca-select-arrow-weight: max(1.3px, calc(var(--d4ca-select-arrow-size) * 0.26));
    --d4ca-select-arrow-len: calc(var(--d4ca-select-arrow-size) * 2.2);
    -webkit-appearance: none !important;
    appearance: none !important;
    background-repeat: no-repeat !important;
    background-image:
        linear-gradient(45deg, transparent calc(50% - var(--d4ca-select-arrow-weight)), var(--d4ca-select-arrow-color) calc(50% - var(--d4ca-select-arrow-weight)), var(--d4ca-select-arrow-color) calc(50% + var(--d4ca-select-arrow-weight)), transparent calc(50% + var(--d4ca-select-arrow-weight))),
        linear-gradient(135deg, transparent calc(50% - var(--d4ca-select-arrow-weight)), var(--d4ca-select-arrow-color) calc(50% - var(--d4ca-select-arrow-weight)), var(--d4ca-select-arrow-color) calc(50% + var(--d4ca-select-arrow-weight)), transparent calc(50% + var(--d4ca-select-arrow-weight))) !important;
    background-position:
        right calc(var(--d4ca-select-arrow-offset) + var(--d4ca-select-arrow-len) / 2) top calc(50% - var(--d4ca-select-arrow-len) / 2),
        right calc(var(--d4ca-select-arrow-offset) - var(--d4ca-select-arrow-len) / 2) top calc(50% - var(--d4ca-select-arrow-len) / 2) !important;
    background-size: var(--d4ca-select-arrow-len) var(--d4ca-select-arrow-len) !important;
    padding-right: calc(var(--d4ca-select-arrow-offset) * 2 + var(--d4ca-select-arrow-len)) !important;
}

/* Keep WPForms honeypots inaccessible if delayed JS momentarily misses its inline style. */
.d4ca-wpforms .wpforms-field > label[aria-hidden="true"] + input[aria-hidden="true"][tabindex="-1"] {
    position: absolute !important;
    left: -99999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}


/* D4 WPForms focus compatibility.
 * Keep WPForms Modern's built-in blue focus accent from sitting over the
 * Elementor focus styles. Scoped to D4 WPForms only.
 */
.d4ca-wpforms {
    --wpforms-field-focus-color: transparent;
}

.d4ca-wpforms input:focus,
.d4ca-wpforms input:focus-visible,
.d4ca-wpforms select:focus,
.d4ca-wpforms select:focus-visible,
.d4ca-wpforms textarea:focus,
.d4ca-wpforms textarea:focus-visible {
    outline: none !important;
}
