/**
 * EasyAppointments booking wizard — styled to match Easy!Appointments' own
 * booking page (the card, the coloured header with numbered step indicators,
 * the centred light frame titles, the Back/Next command row).
 *
 * E!A's page is Bootstrap-based; this reproduces the look in plain CSS so the
 * widget drops into any Grav theme without pulling Bootstrap in.
 *
 * Retheme by overriding the custom properties rather than fighting selectors:
 *
 *   .ea-widget {
 *       --ea-accent: #b4283c;    header + selected states
 *       --ea-radius: 0;
 *       --ea-shadow: none;
 *   }
 *
 * Turn this file off entirely with `built_in_css: false`.
 */

.ea-widget {
  /* E!A leans on Bootstrap's --bs-primary; this is the equivalent knob. */
  --ea-accent: #2463eb;
  --ea-accent-contrast: #fff;
  --ea-dark: #212529;
  --ea-dark-contrast: #fff;
  --ea-border: #dee2e6;
  --ea-muted: #6c757d;
  --ea-surface: #fff;
  --ea-body: #212529;
  --ea-radius: 0.375rem;
  --ea-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --ea-frame-min-height: 19rem;

  display: block;
  max-width: 46rem;
  margin: 2rem auto;
  background: var(--ea-surface);
  color: var(--ea-body);
  border-radius: var(--ea-radius);
  box-shadow: var(--ea-shadow);
  overflow: hidden;
}

.ea-widget.is-busy {
  opacity: 0.65;
  pointer-events: none;
}

.ea-widget *,
.ea-widget *::before,
.ea-widget *::after {
  box-sizing: border-box;
}

/* -- Header ---------------------------------------------------------------- */

.ea-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--ea-accent);
  color: var(--ea-accent-contrast);
}

.ea-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
  flex: 1 1 12rem;
}

.ea-logo {
  max-height: 56px;
  width: auto;
  flex: none;
}

.ea-brand-text {
  min-width: 0;
}

.ea-company {
  display: block;
  font-size: 1.35rem;
  font-weight: 300;
  line-height: 1.4;
}

/* Live "Service │ Provider" readout, mirroring E!A's header subtitle. */
.ea-selection {
  display: block;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.6);
}

.ea-selection:empty {
  display: none;
}

/* -- Step indicators ------------------------------------------------------- */

.ea-steps {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: none;
}

.ea-step-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 35px;
  height: 35px;
  border-radius: var(--ea-radius);
  background: rgba(0, 0, 0, 0.2);
  transition: all 0.3s linear;
}

.ea-step-dot strong {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
}

.ea-step-dot.is-active {
  width: 45px;
  height: 45px;
  background: #fff;
}

.ea-step-dot.is-active strong {
  font-size: 21px;
  color: var(--ea-accent);
}

/* Steps already completed stay legible so progress reads at a glance. */
.ea-step-dot.is-done {
  background: rgba(255, 255, 255, 0.35);
}

.ea-step-dot.is-done strong {
  color: rgba(255, 255, 255, 0.9);
}

/* -- Frames ---------------------------------------------------------------- */

.ea-frame {
  display: none;
  flex-direction: column;
  padding: 1rem 1.5rem 1.25rem;
}

.ea-frame.is-current {
  display: flex;
}

.ea-frame[hidden] {
  display: none;
}

.ea-frame-title {
  margin: 1.5rem 0 1.75rem;
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1.3;
  text-align: center;
  color: var(--ea-muted);
}

.ea-frame-content {
  flex: 1 1 auto;
  min-height: var(--ea-frame-min-height);
}

.ea-frame-content--narrow {
  max-width: 30rem;
  margin: 0 auto;
  width: 100%;
}

.ea-frame-split {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 40rem) {
  .ea-frame-split {
    grid-template-columns: 1fr 1fr;
  }
}

/* -- Fields ---------------------------------------------------------------- */

.ea-field {
  margin-bottom: 1rem;
}

.ea-label,
.ea-field label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 500;
}

.ea-label {
  font-size: 1.05rem;
}

.ea-hint {
  margin: 0.4rem 0 0;
  color: var(--ea-muted);
  font-size: 0.875rem;
}

.ea-hint:empty {
  display: none;
}

.ea-select,
.ea-input {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--ea-border);
  border-radius: var(--ea-radius);
  background: var(--ea-surface);
  color: inherit;
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
}

.ea-select:focus-visible,
.ea-input:focus-visible,
.ea-slot:focus-visible,
.ea-button:focus-visible {
  outline: 0;
  border-color: var(--ea-accent);
  box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--ea-accent) 25%, transparent);
}

textarea.ea-input {
  resize: vertical;
}

.ea-field-row {
  display: grid;
  gap: 0 1rem;
}

@media (min-width: 34rem) {
  .ea-field-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* Honeypot — in the layout but out of sight and out of the tab order. */
.ea-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* -- Time slots ------------------------------------------------------------ */

.ea-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: 0.5rem;
  max-height: 15.5rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.ea-slot {
  padding: 0.45rem 0.25rem;
  border: 1px solid var(--ea-accent);
  border-radius: var(--ea-radius);
  background: transparent;
  color: var(--ea-accent);
  font: inherit;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.ea-slot:hover {
  background: color-mix(in srgb, var(--ea-accent) 10%, transparent);
}

.ea-slot.is-selected {
  background: var(--ea-accent);
  border-color: var(--ea-accent);
  color: var(--ea-accent-contrast);
}

.ea-slots .ea-hint {
  grid-column: 1 / -1;
  margin: 0;
}

/* -- Summary --------------------------------------------------------------- */

.ea-summary {
  margin: 0;
  border: 1px solid var(--ea-border);
  border-radius: var(--ea-radius);
  padding: 1rem 1.25rem;
}

.ea-summary div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--ea-border);
}

.ea-summary div:last-child {
  border-bottom: 0;
}

.ea-summary dt {
  flex: 0 0 9rem;
  color: var(--ea-muted);
  font-size: 0.9375rem;
}

.ea-summary dd {
  flex: 1 1 12rem;
  margin: 0;
  font-weight: 500;
}

/* -- Commands -------------------------------------------------------------- */

.ea-commands {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.ea-button {
  min-width: 120px;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--ea-radius);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  cursor: pointer;
  transition: filter 0.12s ease, background-color 0.12s ease;
}

.ea-button--next,
.ea-button--confirm {
  background: var(--ea-dark);
  color: var(--ea-dark-contrast);
}

.ea-button--confirm {
  background: var(--ea-accent);
  color: var(--ea-accent-contrast);
}

.ea-button--next:hover,
.ea-button--confirm:hover {
  filter: brightness(1.15);
}

.ea-button--back {
  background: transparent;
  border-color: var(--ea-muted);
  color: var(--ea-muted);
}

.ea-button--back:hover {
  background: var(--ea-muted);
  color: #fff;
}

.ea-button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}

/* -- Messages -------------------------------------------------------------- */

.ea-message {
  margin: 0 1.5rem 1.25rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--ea-radius);
  font-size: 0.9375rem;
}

.ea-message:empty {
  display: none;
}

.ea-message--error {
  background: #f8d7da;
  border: 1px solid #f5c2c7;
  color: #842029;
}

.ea-message--info {
  background: #cfe2ff;
  border: 1px solid #b6d4fe;
  color: #084298;
}

.ea-notice {
  padding: 1rem 1.25rem;
  border: 1px solid var(--ea-border);
  border-radius: var(--ea-radius);
}

.ea-notice p:last-child {
  margin-bottom: 0;
}

.ea-notice--success {
  background: #d1e7dd;
  border-color: #badbcc;
  color: #0f5132;
}

.ea-notice--error {
  background: #f8d7da;
  border-color: #f5c2c7;
  color: #842029;
}

/* Success frame replaces the whole card, so give it the card's padding back. */
.ea-widget > .ea-notice--success {
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 3rem 1.5rem;
  text-align: center;
}

.ea-widget > .ea-notice--success strong {
  display: block;
  font-size: 1.25rem;
  font-weight: 400;
  margin-bottom: 0.75rem;
}

/*
 * No `prefers-color-scheme` switch here on purpose.
 *
 * An earlier version flipped the palette to dark automatically, which broke
 * badly: a Grav theme that stays light (Telephasic does) left the widget
 * rendering dark-mode colours inside a light page — most visibly a near-white
 * Next/Confirm button on a white card, invisible to anyone whose OS was set to
 * dark. The widget cannot know the host theme's scheme, so the palette is
 * driven entirely by the plugin's colour settings instead. Sites that do go
 * dark can point those settings at dark values, or override the custom
 * properties from their own stylesheet.
 */
