/*
 * Layout only — the host theme owns the look.
 *
 * This sheet deliberately sets no font, no colour and no border on inputs,
 * selects, textareas or buttons: whatever the WordPress theme already applies
 * to its own forms applies here too, so the booking form matches the page it
 * is dropped into instead of carrying a second design. What is left is
 * structure (the grid, the step rail, the message box) and the two states a
 * theme cannot guess: success and error.
 */

.ar-appointment-form {
    display: grid;
    gap: 18px;
}

/* Step rail --------------------------------------------------------------- */

.ar-appointment-steps {
    counter-reset: ar-step;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    list-style: none;
    margin: 0;
    padding: 0;
}

.ar-appointment-steps li {
    /* currentColor at low opacity reads correctly on a light or a dark theme,
       which a fixed grey cannot. */
    border-bottom: 3px solid currentColor;
    font-size: 0.875em;
    font-weight: 600;
    opacity: 0.4;
    padding: 0 0 10px;
}

.ar-appointment-steps li::before {
    counter-increment: ar-step;
    content: counter(ar-step) ". ";
}

.ar-appointment-steps li.is-current,
.ar-appointment-steps li.is-complete {
    opacity: 1;
}

/* Steps ------------------------------------------------------------------- */

/*
 * `display` here must never beat the `hidden` attribute. setStep() hides a step
 * with `fieldset.hidden = true`, which leans on the UA rule `[hidden]{display:none}`
 * at specificity (0,1,0) — a plain `.ar-appointment-form fieldset{display:grid}`
 * is (0,1,1) and silently overrode it, which is why every step used to render
 * at once. Scoping to :not([hidden]) keeps the two from ever competing.
 */
.ar-appointment-form fieldset:not([hidden]) {
    display: grid;
}

/*
 * And a belt for those braces. The steps and the Back / Next / Submit buttons
 * are all hidden through the `hidden` property, and this form is dropped into
 * somebody else's theme — any `.some-wrapper fieldset { display: block }` in
 * it would beat the UA rule the same way ours did. This is the one place the
 * sheet overrides the host on purpose.
 */
.ar-appointment-form [hidden] {
    display: none !important;
}

.ar-appointment-form fieldset {
    border: 0;
    gap: 12px;
    margin: 0;
    padding: 0;
}

.ar-appointment-form legend {
    font-weight: 700;
    padding: 0;
}

.ar-appointment-form label {
    display: grid;
    gap: 6px;
}

/*
 * Inputs and buttons are otherwise left to the theme — border, padding and
 * colour are all its business. The exception is the typeface: a browser does
 * not inherit font into a form control, it substitutes its own system font,
 * which is the other half of the "system UI" look. Family and size only, so
 * everything else the theme sets still stands.
 */
.ar-appointment-form input,
.ar-appointment-form select,
.ar-appointment-form textarea,
.ar-appointment-form button {
    font-family: inherit;
    font-size: inherit;
}

.ar-appointment-form input,
.ar-appointment-form select,
.ar-appointment-form textarea {
    max-width: 100%;
}

.ar-appointment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Message ----------------------------------------------------------------- */

.ar-appointment-message {
    border-left: 4px solid currentColor;
    padding: 12px 14px;
}

.ar-appointment-message.is-success {
    background: rgba(22, 128, 68, 0.08);
    color: #12603a;
}

.ar-appointment-message.is-error {
    background: rgba(180, 35, 35, 0.08);
    color: #8f1f1f;
}

/* A dark theme needs the text lifted off the dark ground; the tinted
   backgrounds above are transparent enough to work on either. */
@media (prefers-color-scheme: dark) {
    .ar-appointment-message.is-success {
        color: #6ee7a8;
    }

    .ar-appointment-message.is-error {
        color: #ff9d9d;
    }
}

@media (max-width: 640px) {
    .ar-appointment-steps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* The honeypot: off-screen rather than display:none, which some bots skip. */
.ar-appointment-trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Booked: the confirmation is all that is left on screen. */
.ar-appointment-form[data-ar-done] .ar-appointment-steps,
.ar-appointment-form[data-ar-done] fieldset,
.ar-appointment-form[data-ar-done] .ar-appointment-actions {
    display: none;
}
