/*
 * Gravity Forms 2.10.5 -> 3.0.1 appearance shim
 * ---------------------------------------------
 * Restores the handful of rules that GF 3.0.1 dropped or altered in
 * assets/css/dist/theme.min.css and that our forms actually rely on.
 *
 * Derived by diffing the full front-end stylesheet union of GF 2.10.5 against
 * 3.0.1 and keeping only the rules whose selectors match the real rendered DOM
 * of forms 3, 4, 5, 7, 8, 15 and 24. Everything else GF 3.0.1 still ships
 * unchanged, including the whole legacy/ stylesheet set, so nothing else needs
 * to be carried here.
 *
 * Selectors are GF's own, verbatim, so specificity relative to
 * gravity-bootstrap.css stays exactly as it was before the upgrade.
 *
 * Loaded between GF's stylesheets and gravity-bootstrap.css - see the
 * 'gravity-legacy' registration in functions/custom.php.
 *
 * The previous contents of this file (an unused .bs_gform_wrapper-scoped copy
 * of GF's legacy formsmain.min.css) were never enqueued and are redundant:
 * 3.0.1 still ships legacy/formsmain.min.css and we still load it. The old
 * copy is kept at ~/gf-upgrade-snapshot/css-2.10.5/gravity-legacy.css along
 * with the baseline snapshots and the diff that produced this file.
 */

/* ---------------------------------------------------------------------------
 * 1. Consent field description box
 *
 * GF 3.0.1 didn't drop this styling, it moved it: the scrollable terms box is
 * now an inner .gfield_consent_description_text element that GF 2.10.5 never
 * emitted, and the border/max-height/padding moved onto it. Do NOT restyle the
 * outer .gfield_consent_description or the box gets a second border and a
 * nested scroll area.
 *
 * Only two properties actually differ from 2.10.5, so only those are restored:
 * the text was 13.008px (3.0.1 uses 14.4px) and the scrollbar was always
 * present rather than appearing on overflow. Affects the terms box on Book
 * Onsen Facial (form 24).
 * ------------------------------------------------------------------------- */
.gform_wrapper.gravity-theme .gfield_consent_description_text {
  font-size: 13.008px;
  overflow-y: scroll;
}

/* ---------------------------------------------------------------------------
 * 2. Field label display
 *
 * 3.0.1 changed this from inline-block to block. Our labels wrap the required
 * indicator as a trailing child, so block widens the label to the full column
 * and moves the asterisk away from the label text.
 * ------------------------------------------------------------------------- */
.gform_wrapper.gravity-theme .gfield_label {
  display: inline-block;
}

/* ---------------------------------------------------------------------------
 * 3. Required indicator
 *
 * 3.0.1 changed display from inline-block to inline and dropped the leading
 * padding. In 3.0.1 that gap is meant to come from a new rule on
 * .gform-field-label__text, but GF only emits that wrapper for some field
 * types - none of the booking forms' labels have it, so the gap simply
 * vanishes. Restore it only where the wrapper is absent, so the forms that do
 * have it (form 7) don't end up with the gap applied twice.
 * ------------------------------------------------------------------------- */
.gform_wrapper.gravity-theme .gfield_required {
  display: inline-block;
}

.gform_wrapper.gravity-theme
  .gfield_label:not(:has(.gform-field-label__text))
  > .gfield_required {
  padding-inline-start: 0.125em;
}

/* ---------------------------------------------------------------------------
 * 4. Field description
 *
 * 3.0.1 dropped clear:both. Several booking fields put the description below a
 * floated control, where it would otherwise ride up alongside it.
 * ------------------------------------------------------------------------- */
.gform_wrapper.gravity-theme .gfield_description {
  clear: both;
}

/* ---------------------------------------------------------------------------
 * 5. Date field calendar toggle
 *
 * New in 3.0.1. Under 2.10.5 the calendar trigger was an <img> that jQuery UI
 * injected after the input; 3.0.1 renders a real <button> in the markup with a
 * dashicon inside it.
 *
 * Neither part is styled here: GF only styles this button under
 * .gform_legacy_markup_wrapper or via the theme framework stylesheets, and our
 * forms are gravity-theme with gform-theme--no-framework, so the button would
 * otherwise render with default browser chrome. The dashicon needs the core
 * 'dashicons' stylesheet, which GF does not enqueue on the front end for date
 * fields - that dependency is declared on the 'gravity-legacy' handle in
 * functions/custom.php.
 *
 * Mirrors GF's own legacy-markup treatment: strip the button chrome and leave a
 * bare calendar glyph beside the input, as it looked before the upgrade.
 * ------------------------------------------------------------------------- */
.gform_wrapper.gravity-theme .ginput_container_date button.gform-datepicker-toggle {
  background: none;
  border: none;
  box-shadow: none;
  color: #607382;
  cursor: pointer;
  line-height: 1;
  margin: 0 0 0 4px;
  vertical-align: middle;
  width: auto;
}

.gform_wrapper.gravity-theme
  .ginput_container_date
  button.gform-datepicker-toggle
  .gform-datepicker-toggle-icon {
  display: inline-block;
  font-size: 20px;
  height: 24px;
  width: 24px;
}

/* ---------------------------------------------------------------------------
 * 6. Calendar day grid sizing
 *
 * GF 3.0 replaced the jQuery UI datepicker with a WhatSock-based widget, so
 * these rules in gravity-bootstrap.css (lines 651-664) no longer match anything
 * - the popup is .gform-datepicker-calendar, not .ui-datepicker:
 *
 *   .template-checkout .ui-datepicker                        { padding: 4px }
 *   .template-checkout .ui-datepicker .ui-datepicker-header  { padding: 8px 0 }
 *   .template-checkout .ui-datepicker,
 *   .template-checkout .ui-datepicker .ui-datepicker-header select,
 *   .template-checkout .ui-datepicker .ui-datepicker-calendar td,
 *   .template-checkout .ui-datepicker-calendar th span       { font-size: 1.2rem }
 *
 * .template-checkout is a body class, so those did apply to the old popup
 * (jQuery UI appended it to <body>). GF 3.0's default is 0.8125rem, which is
 * why the calendar text came out smaller after the upgrade.
 *
 * ONLY the font size of the day grid is restored, and only on desktop (GF
 * shrinks cells to 20px at <=640px). Nothing structural is touched:
 *
 * The whole popup is a single <table>. .yearSelector and .monthSelector are
 * <tr> rows in it, and the nav arrows are <td class="nav prev btn year"> cells,
 * so the two-row header is GF's layout, not a bug. Any attempt to re-flow them
 * (display:inline-block, width:auto on the selects, etc.) destroys the table
 * and scatters the arrows down the page. Leave the header alone.
 *
 * Targets td.day / th.week specifically so the nav and selector cells keep
 * GF's own sizing.
 * ------------------------------------------------------------------------- */
.template-checkout .gform-datepicker-calendar table.calendar td.day,
.template-checkout .gform-datepicker-calendar table.calendar th.week span {
  font-size: 1.05rem !important;
}

/* ---------------------------------------------------------------------------
 * 7. Read-only date input
 *
 * The date inputs are set readonly (see js/page.*.js) so a date can only come
 * from the calendar - typing a single digit left the field with a value GF 3.0
 * parsed as NaN/NaN/NaN on blur. Bootstrap greys out .form-control[readonly],
 * so restore the normal field appearance for these inputs only; the other
 * readonly text fields on these forms should keep the grey.
 * ------------------------------------------------------------------------- */
.bs_gform_wrapper input.datepicker[readonly],
.gform_wrapper.gravity-theme input.datepicker[readonly] {
  background-color: #fff;
  cursor: pointer;
}
