/**
 * The Autospected checkout.
 *
 * Written against WooCommerce's own class names rather than the theme's,
 * because the theme here is Hello Elementor with four addon packs on top and
 * any one of them may rename a wrapper on an update. What cannot be renamed
 * is .form-row and #billing_vin.
 *
 * The one structural decision worth knowing: WooCommerce lays its checkout out
 * with floats - form-row-first floats left, form-row-last floats right - and a
 * float layout falls apart the moment the sequence of halves and wholes is not
 * perfectly regular. That is what put Trim beside the street address and left
 * holes down the middle of the form. Every row here is a grid cell instead, so
 * the order on screen is the order in the markup and there is nothing left for
 * a float to get wrong.
 */

:root {
    --as-accent: #02ADE6;
    --as-accent-dark: #0289b8;
    --as-ink: #10202c;
    --as-dim: #64748b;
    --as-edge: #dfe4ea;
    --as-soft: #f7f9fb;
    --as-radius: 10px;
}

/* ===========================================================  the page  === */

/*
 * Two columns: what the customer fills in on the left, what they are buying on
 * the right, where it stays in view. The add-ons were below a long form
 * before, which meant scrolling past everything to find out what the extras
 * cost and scrolling back to change one.
 */
@media (min-width: 981px) {
    form.checkout.woocommerce-checkout {
        display: grid;
        grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
        column-gap: 34px;
        align-items: start;
    }

    form.checkout.woocommerce-checkout > * {
        grid-column: 2;
        min-width: 0;
    }

    form.checkout.woocommerce-checkout > #customer_details {
        grid-column: 1;
        grid-row: 1 / 200;
    }

    form.checkout.woocommerce-checkout > #order_review_heading {
        margin-top: 0;
    }

    /* the summary follows you down the page rather than scrolling away */
    form.checkout.woocommerce-checkout > #order_review {
        position: sticky;
        top: 24px;
    }
}

/* inside the left column, one thing under another - no second float layer */
#customer_details .col-1,
#customer_details .col-2,
#customer_details .col2-set,
#customer_details .u-column1,
#customer_details .u-column2 {
    float: none;
    width: 100%;
    max-width: none;
    padding: 0;
    margin: 0;
}

#customer_details .col-2 {
    margin-top: 22px;
}

/*
 * "Billing details" is WooCommerce's word for this, and it is the wrong one -
 * none of it is billing, and an underlined title with nothing under it reads
 * like a tab you are supposed to click. Our own section titles say what each
 * group is.
 */
.woocommerce-billing-fields > h3,
#customer_details .col-1 > h3:first-child {
    display: none;
}

/* ==========================================================  the cards  === */

.as-card {
    margin: 0 0 18px;
    border: 1px solid var(--as-edge);
    border-radius: var(--as-radius);
    background: #fff;
    overflow: visible;
}

.as-card-title {
    padding: 12px 18px;
    border-bottom: 1px solid var(--as-edge);
    background: var(--as-soft);
    border-radius: var(--as-radius) var(--as-radius) 0 0;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--as-dim);
    /* plainly a label, not a control */
    cursor: default;
    user-select: none;
}

.as-card-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
    padding: 18px;
    align-items: start;
}

/* every row is a cell; nothing floats, so nothing leaves a hole */
.as-card-body > .form-row,
.as-card-body > p.form-row {
    float: none !important;
    clear: none !important;
    width: auto !important;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
}

.as-card-body > .form-row-wide,
.as-card-body > .form-row-full,
.as-card-body > .notes {
    grid-column: 1 / -1;
}

.as-card-body > .form-row.as-hidden,
.form-row.as-hidden {
    display: none !important;
}

/* -------------------------------------------- Special Instructions ------ */
/*
 * The one box on this page a customer has to compose rather than supply, so
 * it gets room to be written in rather than a single line to squint at.
 */
.as-instructions textarea {
    width: 100%;
    min-height: 92px;
    resize: vertical;
    line-height: 1.5;
}

/*
 * The disclaimer.
 *
 * Quiet, but not hidden. It is what stops "please check the transmission"
 * being read afterwards as a promise that we diagnosed the transmission, so
 * it has to be legible - small grey text a customer squints past would be
 * worse than useless, because it would look like we tried.
 */
/*
 * WooCommerce adds its own "(optional)" to any field that is not required, so
 * Ron's label was rendering as "... (Optional) (optional)". His wording is his
 * and stays exactly as he wrote it, so the one WooCommerce bolts on goes
 * instead.
 */
.as-instructions label .optional {
    display: none;
}

.as-instructions .description {
    display: block;
    margin-top: 8px;
    font-size: 12.5px;
    line-height: 1.55;
    color: #5b6675;
}

@media (max-width: 600px) {
    .as-card-body {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
        padding: 15px;
    }

    .as-card-body > .form-row-first,
    .as-card-body > .form-row-last {
        grid-column: 1 / -1;
    }
}

/* ========================================================  the controls  === */

.as-card-body label {
    display: block;
    margin: 0 0 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--as-ink);
    line-height: 1.35;
}

.as-card-body .required {
    color: #c62828;
    text-decoration: none;
    border: 0;
}

.as-card-body .woocommerce-input-wrapper {
    display: block;
    width: 100%;
}

.as-card-body input[type="text"],
.as-card-body input[type="tel"],
.as-card-body input[type="email"],
.as-card-body input[type="number"],
.as-card-body select,
.as-card-body .select2-container .select2-selection--single {
    width: 100%;
    height: auto;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--as-edge);
    border-radius: 8px;
    background-color: #fff;
    font-size: 15px;
    line-height: 1.4;
    color: var(--as-ink);
    box-shadow: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.as-card-body input:focus,
.as-card-body select:focus {
    border-color: var(--as-accent);
    box-shadow: 0 0 0 3px rgba(2, 173, 230, 0.16);
    outline: none;
}

.as-card-body ::placeholder {
    color: #9aa5b1;
}

/* WooCommerce's own error state, in our colours */
.as-card-body .form-row.woocommerce-invalid input,
.as-card-body .form-row.woocommerce-invalid select {
    border-color: #c62828;
}

/* ===============================================================  VIN  ==== */

#billing_vin {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.as-vin-note {
    display: block;
    margin-top: 6px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--as-dim);
}

.as-vin-note[data-tone="busy"] { color: var(--as-accent); }
.as-vin-note[data-tone="good"] { color: #1f7a45; }
.as-vin-note[data-tone="warn"] { color: #a25b06; }

.as-vin-note[data-tone="busy"]::before {
    content: "";
    display: inline-block;
    width: 11px;
    height: 11px;
    margin-right: 7px;
    vertical-align: -1px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: as-spin 0.7s linear infinite;
}

@keyframes as-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .as-vin-note[data-tone="busy"]::before { animation: none; }
}

.form-row.as-just-filled input {
    background-color: #eefaf2;
    transition: background-color 0.7s ease;
}

/* ==============================================  the address suggestions === */

.form-row.as-suggest-host {
    position: relative;
}

ul.as-suggest {
    display: none;
    position: absolute;
    z-index: 100000;
    left: 0;
    right: 0;
    top: 100%;
    margin: 4px 0 0;
    padding: 4px 0;
    list-style: none;
    max-height: 264px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--as-edge);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(16, 32, 44, 0.16);
    -webkit-overflow-scrolling: touch;
}

ul.as-suggest.is-open { display: block; }

ul.as-suggest li {
    margin: 0;
    padding: 9px 14px;
    list-style: none;
    border: 0;
    line-height: 1.35;
    cursor: pointer;
}

ul.as-suggest li:hover,
ul.as-suggest li.is-on { background: #eef8fd; }

.as-suggest-main { display: block; font-size: 14px; color: var(--as-ink); }
.as-suggest-rest { display: block; font-size: 12.5px; color: var(--as-dim); }

/* the old Google widget, on the rare project that still has it */
.pac-container { z-index: 100000 !important; }

/* =========================================================  the calendar === */

.as-datepicker.ui-datepicker {
    width: 288px;
    padding: 10px;
    border: 1px solid var(--as-edge);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(16, 32, 44, 0.18);
    font-size: 14px;
    z-index: 100001 !important;
}

.as-datepicker .ui-datepicker-header {
    position: relative;
    padding: 2px 0 8px;
    text-align: center;
}

.as-datepicker .ui-datepicker-title {
    font-weight: 600;
    color: var(--as-ink);
}

.as-datepicker .ui-datepicker-prev,
.as-datepicker .ui-datepicker-next {
    position: absolute;
    top: 0;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    text-indent: -9999px;
    overflow: hidden;
}

.as-datepicker .ui-datepicker-prev { left: 0; }
.as-datepicker .ui-datepicker-next { right: 0; }

.as-datepicker .ui-datepicker-prev:hover,
.as-datepicker .ui-datepicker-next:hover { background: var(--as-soft); }

/* arrows drawn rather than loaded, so there is no sprite to go missing */
.as-datepicker .ui-datepicker-prev::after,
.as-datepicker .ui-datepicker-next::after {
    content: "";
    position: absolute;
    top: 9px;
    left: 10px;
    width: 8px;
    height: 8px;
    border-top: 2px solid var(--as-dim);
    border-right: 2px solid var(--as-dim);
    text-indent: 0;
}

.as-datepicker .ui-datepicker-prev::after { transform: rotate(-135deg); }
.as-datepicker .ui-datepicker-next::after { transform: rotate(45deg); }

.as-datepicker .ui-datepicker-prev.ui-state-disabled { opacity: 0.3; cursor: default; }

.as-datepicker table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.as-datepicker th {
    padding: 6px 0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--as-dim);
    border: 0;
    background: none;
}

.as-datepicker td {
    padding: 1px;
    border: 0;
    background: none;
}

.as-datepicker td a,
.as-datepicker td span {
    display: block;
    padding: 7px 0;
    border-radius: 7px;
    text-align: center;
    text-decoration: none;
    color: var(--as-ink);
    line-height: 1;
}

.as-datepicker td a:hover { background: #eef8fd; }

.as-datepicker td.ui-datepicker-today a { box-shadow: inset 0 0 0 1px var(--as-accent); }

.as-datepicker td .ui-state-active,
.as-datepicker td a.ui-state-active {
    background: var(--as-accent);
    color: #fff;
}

.as-datepicker td.ui-datepicker-unselectable span,
.as-datepicker td.ui-state-disabled span {
    color: #c3cbd3;
}

.as-datepicker .ui-datepicker-other-month a,
.as-datepicker .ui-datepicker-other-month span { color: #c3cbd3; }

/* ==========================================================  the add-ons === */

/* they live in the right-hand column now, so they read as part of the price */
.autospected-addons {
    margin-bottom: 16px;
}

/* ====================================================  the sign-up button === */

/*
 * WooCommerce keeps the register button disabled until the password is strong
 * enough, but leaves it looking exactly the same either way - so it reads as a
 * dead button rather than a locked one.
 */
.woocommerce-form-register button[type="submit"],
.woocommerce-form-register .woocommerce-form-register__submit {
    background-color: #c8cdd3;
    border-color: #c8cdd3;
    color: #ffffff;
    cursor: not-allowed;
    transition: background-color 0.18s ease, box-shadow 0.18s ease;
}

.woocommerce-form-register button[type="submit"]:not([disabled]),
.woocommerce-form-register .woocommerce-form-register__submit:not([disabled]) {
    background-color: var(--as-accent);
    border-color: var(--as-accent);
    color: #ffffff;
    cursor: pointer;
}

.woocommerce-form-register button[type="submit"]:not([disabled]):hover,
.woocommerce-form-register .woocommerce-form-register__submit:not([disabled]):hover {
    background-color: var(--as-accent-dark);
    border-color: var(--as-accent-dark);
    box-shadow: 0 2px 10px rgba(2, 173, 230, 0.35);
}

.woocommerce-form-register button[type="submit"]:not([disabled]):focus-visible {
    outline: 3px solid rgba(2, 173, 230, 0.45);
    outline-offset: 2px;
}

.woocommerce-password-hint,
.woocommerce-password-strength {
    font-size: 12.5px;
    line-height: 1.5;
}

/* =========================================  what was booked, shown back  === */

.autospected-booked {
    margin: 26px 0;
}

.autospected-booked h2 {
    font-size: 17px;
    margin: 0 0 10px;
}

.autospected-booked-table th {
    width: 34%;
    text-align: left;
    color: var(--as-dim);
    font-weight: 600;
}
