/*------------------------------------------------------------------*\
    VISIT FORM — "Reservar Visita" (Elementor Pro Form)

    Collapsed (default): only the E-mail field is visible, with the submit
    button embedded inside it as a single pill. Focusing the e-mail reveals
    the remaining fields (Nome, Telefone, Tipologia, Data). The JS module
    (`modules/visit-form.js`) toggles `.is-expanded` and sets the e-mail's
    right padding from the measured button width.

    Scoped under the form widget's custom class `.rb-visit-form` (set in
    Elementor → Advanced → CSS Classes). Targets Elementor Forms markup:
    `.elementor-field-group.elementor-field-type-<type>` + `.elementor-field-textual`.
    Colours come from the shared tokens in `helpers/vars.css`.

    Mobile-first (base = mobile, `min-width` for desktop, no max-width).
    No-op on pages without `.rb-visit-form`.
\*------------------------------------------------------------------*/

/* The fields wrapper is the positioning context for the embedded submit. */
.rb-visit-form .elementor-form-fields-wrapper {
    position: relative;
}

/* Force every field label to screen-reader-only — the design is placeholder
   driven, and a visible label would push the input down and misalign the
   embedded button. Keeps the label accessible (not display:none). */
.rb-visit-form .elementor-field-label {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Field visuals — all textual fields + select + date ───────────── */
.rb-visit-form .elementor-field-textual {
    width: 100%;
    height: 52px;
    padding: 0 20px;
    background: transparent;
    border: 1px solid var(--color-border-light);
    border-radius: 14px;
    color: var(--input-text);
    font-family: var(--font-secondary);
    font-size: .9rem;
    line-height: 1.2;
    box-shadow: none;
    transition: border-color .2s ease, background .2s ease;
}

.rb-visit-form .elementor-field-textual::placeholder {
    color: var(--input-placeholder);
    opacity: 1;
}

.rb-visit-form .elementor-field-textual:focus {
    border-color: var(--neutral-400);
    outline: none;
}

/* Select shares the same shell; hide the native arrow, recolour Elementor's. */
.rb-visit-form select.elementor-field-textual {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}
.rb-visit-form .elementor-select-wrapper .elementor-select-arrow {
    color: var(--input-placeholder);
}

/* Native date control: make its calendar UI legible on the dark shell. */
.rb-visit-form input[type="date"].elementor-field-textual {
    color-scheme: dark;
}

/* ── E-mail field = the pill that hosts the embedded button ───────── */
.rb-visit-form .elementor-field-type-email {
    width: 100%;
    padding-top: 0;
}
.rb-visit-form .elementor-field-type-email .elementor-field-textual {
    border-radius: 999px;       /* full pill */
    /* Room for the embedded button so typed text never runs under it. The JS
       overrides this inline from the button's measured width; this literal is
       the pre-JS fallback. */
    padding-right: 180px;
}

/* ── Embedded submit button (top-right, inside the e-mail pill) ────── */
.rb-visit-form .elementor-field-type-submit,
.rb-visit-form .e-form__buttons {
    position: absolute;
    top: 0;
    right: 0;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    height: 52px;
    display: flex;
    align-items: center;
    z-index: 2;
}
.rb-visit-form .elementor-field-type-submit .elementor-button,
.rb-visit-form .e-form__buttons .elementor-button {
    width: auto;
    /* Mobile: compact button — content height + vertical padding, vertically
       centred inside the pill by the container's `align-items`. Desktop
       overrides to a taller fixed height in the min-width block below. */
    height: auto;
    margin-right: 5px;        /* inset from the pill edge */
    padding: 10px 24px;
    border: 0;
    border-radius: 999px;
    background: var(--neutral-500);
    color: var(--input-text);
    font-family: var(--font-secondary);
    font-size: .8rem;
    font-weight: var(--font-medium);
    line-height: 1;
    letter-spacing: .02em;
    white-space: nowrap;
    cursor: pointer;
    transition: background .2s ease;
}
.rb-visit-form .elementor-field-type-submit .elementor-button:hover,
.rb-visit-form .e-form__buttons .elementor-button:hover {
    background: var(--neutral-400);
}

.rb-visit-form .elementor-form .elementor-button.elementor-size-md {
    min-height: 37px;
}

/* ── Collapsible fields — everything that isn't e-mail or submit ───── */
/* Collapsed by default (the reference's initial state). The JS adds
   `.is-expanded` on e-mail focus to reveal them; `display: none` also keeps
   them out of the tab order / accessibility tree while hidden. */
.rb-visit-form:not(.is-expanded)
  .elementor-field-group:not(.elementor-field-type-email):not(.elementor-field-type-submit):not(.e-form__buttons) {
    display: none;
}


/*------------------------------------------------------------------*\
    RESPONSIVE — slightly larger pill on desktop.
\*------------------------------------------------------------------*/

@media (min-width: 1024px) {
    .rb-visit-form .elementor-field-textual {
        height: 60px;
        font-size: .95rem;
    }
    .rb-visit-form .elementor-field-type-submit,
    .rb-visit-form .e-form__buttons {
        height: 60px;
    }
    .rb-visit-form .elementor-field-type-submit .elementor-button,
    .rb-visit-form .e-form__buttons .elementor-button {
        height: 50px;
        padding: 0 30px;
        font-size: .85rem;
    }
}
