/**
 * Global: components.css
 * Shared shells, cards, and form primitives used across pages.
 *
 * Loaded on every marketing front-end request (see inc/assets.php).
 * Pattern-specific CSS stays in assets/css/blocks/.
 */

/* ——— Cards & shells ——— */

.is-style-tidal-wave-card,
.tidal-wave-card {
  background: var(--wp--preset--color--surface);
  border: 1px solid var(--wp--preset--color--border);
  border-radius: var(--wp--custom--radius--card);
  box-shadow: var(--wp--custom--shadow--card);
}

.tidal-wave-section-shell {
  border-radius: var(--wp--custom--radius--card);
  overflow: hidden;
}

.tidal-wave-stack > * + * {
  margin-block-start: var(--tidal-wave-block-gap);
}

/*
 * Soft content measure — use for centered stacked copy on mobile.
 * Always width:100% of the padded parent; never a fixed 320px that ignores gutters.
 */
.tidal-wave-measure-sm {
  width: 100%;
  max-width: min(100%, var(--tidal-wave-measure-sm));
  box-sizing: border-box;
  margin-inline: auto;
}

/* ——— Forms (shared) ——— */

.tidal-wave-form-field {
  display: grid;
  gap: 0.45rem;
}

.tidal-wave-form-field label {
  font-weight: 700;
  color: var(--wp--preset--color--primary);
}

.tidal-wave-form-field label span {
  font-weight: 400;
  color: var(--wp--preset--color--ink-soft);
}

.tidal-wave-form-field input,
.tidal-wave-form-field select,
.tidal-wave-form-field textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 2.5rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--wp--preset--color--border);
  border-radius: 12px;
  background: var(--wp--preset--color--surface);
  color: var(--wp--preset--color--ink);
  font: inherit;
}

/*
 * Selects — match Ops dashboard: blue closed value, soft placeholder,
 * custom chevron, and (where supported) styled base-select picker.
 */
.tidal-wave-form-field select {
  display: flex;
  align-items: center;
  height: 2.5rem;
  min-height: 2.5rem;
  /* Zero block padding + height-matched line-height keeps closed text optically centered. */
  padding: 0 2.25rem 0 0.85rem;
  border: 1px solid var(--wp--preset--color--border);
  background-color: var(--wp--preset--color--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%230B4093' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 0.75rem auto;
  color: var(--wp--preset--color--primary);
  color-scheme: light;
  font-weight: 600;
  line-height: 2.5rem;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.tidal-wave-form-field select:has(> option[value=""]:checked),
.tidal-wave-form-field select.is-showing-placeholder {
  color: var(--wp--preset--color--ink-soft);
  font-weight: 500;
}

.tidal-wave-form-field select:disabled {
  color: var(--wp--preset--color--ink-soft);
  cursor: not-allowed;
  opacity: 0.85;
}

.tidal-wave-form-field select option {
  color: var(--wp--preset--color--primary);
  background-color: var(--wp--preset--color--surface);
  color-scheme: light;
  font-weight: 500;
}

.tidal-wave-form-field select option[value=""] {
  color: var(--wp--preset--color--ink-soft);
  font-weight: 500;
}

.tidal-wave-form-field select option:not([value=""]):hover,
.tidal-wave-form-field select option:not([value=""]):focus {
  color: var(--wp--preset--color--accent-strong);
  background-color: rgba(var(--tidal-wave-green-rgb), 0.14);
}

.tidal-wave-form-field textarea {
  min-height: 7rem;
  resize: vertical;
}

.tidal-wave-form-field input:focus,
.tidal-wave-form-field select:focus,
.tidal-wave-form-field textarea:focus {
  outline: 2px solid rgba(var(--tidal-wave-blue-rgb), 0.18);
  outline-offset: 0;
  border-color: var(--wp--preset--color--primary);
  box-shadow: none;
}

@supports (appearance: base-select) {
  .tidal-wave-form-field select,
  .tidal-wave-form-field select::picker(select) {
    appearance: base-select;
    -webkit-appearance: base-select;
  }

  .tidal-wave-form-field select {
    display: flex;
    align-items: center;
    line-height: 1.25;
  }

  .tidal-wave-form-field select::picker(select) {
    box-sizing: border-box;
    height: fit-content;
    min-height: 0;
    max-height: min(20rem, 70dvh);
    overflow-x: hidden;
    overflow-y: auto;
    margin-top: 0.25rem;
    padding: 0.35rem;
    border: 1px solid var(--wp--preset--color--border);
    border-radius: 12px;
    background: var(--wp--preset--color--surface);
    color: var(--wp--preset--color--primary);
    box-shadow: 0 10px 24px rgba(var(--tidal-wave-blue-dark-rgb), 0.14);
    color-scheme: light;
    position-area: block-end span-inline-end;
    position-try-fallbacks: flip-block;
  }

  .tidal-wave-form-field select::picker-icon {
    display: none;
  }

  .tidal-wave-form-field select option {
    padding: 0.55rem 0.75rem;
    border: none;
    border-radius: 8px;
    background: var(--wp--preset--color--surface);
    color: var(--wp--preset--color--primary);
    font-weight: 600;
    outline: none !important;
    box-shadow: none;
  }

  .tidal-wave-form-field select option:focus,
  .tidal-wave-form-field select option:focus-visible,
  .tidal-wave-form-field select option:checked {
    outline: none !important;
    border: none;
    box-shadow: none;
  }

  /* Hide empty placeholder in the open list; closed field still shows it */
  .tidal-wave-form-field select::picker(select) option[value=""] {
    display: none;
    height: 0;
    min-height: 0;
    max-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: none;
    visibility: hidden;
  }

  .tidal-wave-form-field select option:not([value=""]):hover,
  .tidal-wave-form-field select option:not([value=""]):focus {
    background: rgba(var(--tidal-wave-green-rgb), 0.14) !important;
    color: var(--wp--preset--color--accent-strong) !important;
  }

  .tidal-wave-form-field select option:not([value=""]):checked {
    background: rgba(var(--tidal-wave-blue-rgb), 0.08) !important;
    color: var(--wp--preset--color--primary-dark) !important;
  }

  .tidal-wave-form-field select option:not([value=""]):checked:hover,
  .tidal-wave-form-field select option:not([value=""]):checked:focus {
    background: rgba(var(--tidal-wave-green-rgb), 0.14) !important;
    color: var(--wp--preset--color--accent-strong) !important;
  }

  .tidal-wave-form-field select:has(> option[value=""]:checked),
  .tidal-wave-form-field select.is-showing-placeholder {
    color: var(--wp--preset--color--ink-soft) !important;
    font-weight: 500;
  }
}

.tidal-wave-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.tidal-wave-form-note,
.tidal-wave-result-note {
  margin: 0;
  color: var(--wp--preset--color--ink-soft);
  font-size: 0.95rem;
  line-height: 1.45;
}

.tidal-wave-checkbox-option > span,
.tidal-wave-radio-option > span {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--wp--preset--color--ink);
  font: inherit;
  line-height: 1.45;
}

.tidal-wave-checkbox-option > .tidal-wave-form-note,
.tidal-wave-radio-option > .tidal-wave-form-note {
  color: var(--wp--preset--color--ink-soft);
  font-size: 0.95rem;
  line-height: 1.45;
}

.tidal-wave-bin-types legend,
.tidal-wave-notification-preferences legend,
.tidal-wave-recurring-payment-consent legend,
.tidal-wave-date-options legend {
  float: none;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  font-weight: 700;
  font-size: inherit;
  line-height: 1.35;
  color: var(--wp--preset--color--primary);
}

.tidal-wave-optional-mark {
  font-weight: 400;
  color: var(--wp--preset--color--ink-soft);
}

/* ——— Checkboxes & radios (theme-wide) ——— */

.tidal-wave-checkbox-option,
.tidal-wave-radio-option {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--wp--preset--color--border);
  border-radius: 12px;
  background: var(--wp--preset--color--surface);
  color: var(--wp--preset--color--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.tidal-wave-checkbox-option:has(input:checked),
.tidal-wave-radio-option:has(input:checked) {
  border-color: var(--wp--preset--color--primary);
  box-shadow: 0 0 0 1px var(--wp--preset--color--primary);
  background: color-mix(in srgb, var(--wp--preset--color--surface) 92%, var(--wp--preset--color--primary));
}

.tidal-wave-checkbox-option:has(input:focus-visible),
.tidal-wave-radio-option:has(input:focus-visible) {
  outline: 2px solid var(--wp--preset--color--accent);
  outline-offset: 2px;
}

.tidal-wave-checkbox-option input[type="checkbox"],
.tidal-wave-radio-option input[type="radio"],
.tidal-wave-bin-types__option input[type="checkbox"],
.tidal-wave-date-option input[type="radio"],
.tidal-wave-intake-form input[type="checkbox"],
.tidal-wave-service-details-form input[type="checkbox"],
.tidal-wave-service-details-form input[type="radio"],
.tidal-wave-date-step input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0.15rem 0 0;
  flex-shrink: 0;
  border: 2px solid var(--wp--preset--color--primary);
  background-color: var(--wp--preset--color--surface);
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.tidal-wave-checkbox-option input[type="checkbox"],
.tidal-wave-bin-types__option input[type="checkbox"],
.tidal-wave-intake-form input[type="checkbox"],
.tidal-wave-service-details-form input[type="checkbox"] {
  border-radius: 0.28rem;
}

.tidal-wave-radio-option input[type="radio"],
.tidal-wave-date-option input[type="radio"],
.tidal-wave-service-details-form input[type="radio"],
.tidal-wave-date-step input[type="radio"] {
  border-radius: 50%;
}

.tidal-wave-checkbox-option input[type="checkbox"]:checked,
.tidal-wave-bin-types__option input[type="checkbox"]:checked,
.tidal-wave-intake-form input[type="checkbox"]:checked,
.tidal-wave-service-details-form input[type="checkbox"]:checked {
  background-color: var(--wp--preset--color--primary);
  border-color: var(--wp--preset--color--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10' fill='none'%3E%3Cpath d='M1.5 5.2L4.4 8.1L10.5 1.5' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 0.7rem auto;
}

.tidal-wave-radio-option input[type="radio"]:checked,
.tidal-wave-date-option input[type="radio"]:checked,
.tidal-wave-service-details-form input[type="radio"]:checked,
.tidal-wave-date-step input[type="radio"]:checked {
  border-color: var(--wp--preset--color--primary);
  background-color: var(--wp--preset--color--surface);
  box-shadow: inset 0 0 0 0.28rem var(--wp--preset--color--primary);
}

.tidal-wave-checkbox-option input[type="checkbox"]:focus-visible,
.tidal-wave-radio-option input[type="radio"]:focus-visible,
.tidal-wave-bin-types__option input[type="checkbox"]:focus-visible,
.tidal-wave-date-option input[type="radio"]:focus-visible,
.tidal-wave-intake-form input[type="checkbox"]:focus-visible,
.tidal-wave-service-details-form input[type="checkbox"]:focus-visible,
.tidal-wave-service-details-form input[type="radio"]:focus-visible,
.tidal-wave-date-step input[type="radio"]:focus-visible {
  outline: 2px solid var(--wp--preset--color--accent);
  outline-offset: 2px;
}

.tidal-wave-checkbox-option input:disabled,
.tidal-wave-radio-option input:disabled,
.tidal-wave-radio-option.is-disabled {
  cursor: not-allowed;
}

.tidal-wave-radio-option.is-disabled {
  opacity: 0.72;
  background: color-mix(in srgb, var(--wp--preset--color--surface) 88%, var(--wp--preset--color--border));
}

