/* ── Checkout ───────────────────────────────────────────────
   Figma: Your Details desktop 3285:57073, tablet 3285:57684,
   mobile 3285:57274 + 3285:57330; Review Your Order 3285:57467.
   The form (WooCommerce's, woocommerce/checkout/form-checkout.php)
   beside the order summary; the review step on Light Grey.
   ─────────────────────────────────────────────────────────── */

.checkout-wrap {
    padding: 64px var(--pad-x);
    transition: background-color var(--transition);
}

.checkout-wrap:has(.checkout-page.is-reviewing) {
    padding-top: 48px;
    background: var(--color-grey-light);
}

.checkout-wrap__inner {
    max-width: var(--site-max-w);
    margin: 0 auto;
}

.checkout-page__inner {
    display: grid;
    grid-template-columns: minmax(0, 720fr) minmax(0, 500fr);
    align-items: start;
    gap: 60px;
}

.checkout-page.is-reviewing .checkout-page__inner {
    grid-template-columns: minmax(0, 760fr) minmax(0, 440fr);
    gap: 40px;
}

.checkout-page__card {
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding: 24px;
    border-radius: 12px;
    background: var(--color-white);
    box-shadow: 0 0 12px rgb(0 0 0 / 0.12);
}

.checkout-page__card[hidden],
.checkout-page__step[hidden] {
    display: none;
}

.checkout-page__title {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 600;
    line-height: 34px;
}

.checkout-page__step {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.checkout-page__section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkout-page__heading {
    display: flex;
    gap: 8px;
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
    line-height: 25px;
}

.checkout-page__subheading {
    grid-column: 1 / -1;
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    line-height: 20px;
}

/* The fields: two side by side where the design has them */
.checkout-page__fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
}

.checkout-page__fields[hidden] {
    display: none;
}

.checkout-page .form-row {
    display: flex;
    grid-column: 1 / -1;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
}

.checkout-page .form-row-first,
.checkout-page .form-row-last {
    grid-column: auto;
}

.checkout-page #billing_country_field,
.checkout-page #shipping_country_field {
    display: none;
}

.checkout-page .form-row label {
    font-family: var(--font-heading);
    font-weight: 500;
    line-height: 20px;
}

.checkout-page .form-row .required {
    border: 0;
    color: var(--color-error);
    text-decoration: none;
}

.checkout-page .form-row .optional {
    color: rgb(5 5 2 / 0.6);
}

.checkout-page .woocommerce-input-wrapper {
    display: block;
}

.checkout-page .input-text,
.checkout-page textarea,
.checkout-page select {
    width: 100%;
    height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-white);
    box-shadow: 0 0 12px rgb(0 0 0 / 0.1);
    color: var(--color-text);
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 500;
    line-height: 20px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.checkout-page textarea {
    height: 117px;
    resize: vertical;
}

.checkout-page .input-text::placeholder,
.checkout-page textarea::placeholder {
    color: rgb(5 5 2 / 0.6);
    opacity: 1;
}

.checkout-page .input-text:focus,
.checkout-page textarea:focus {
    border-color: var(--color-primary);
    box-shadow: inset 0 0 0 1px var(--color-primary);
}

/* Errors: WooCommerce's (on leaving a field) and checkout.js's */
.checkout-page .woocommerce-invalid .input-text,
.checkout-page .woocommerce-invalid textarea {
    border-color: var(--color-error);
    box-shadow: inset 0 0 0 1px var(--color-error);
}

.checkout-page .checkout-inline-error-message,
.checkout-page__error {
    color: var(--color-error);
    font-size: 12px;
    line-height: 16px;
}

.checkout-page__hint {
    font-family: var(--font-heading);
    font-size: 12px;
    line-height: 16px;
}

/* Billing address same as delivery? */
.checkout-page__same {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 32px;
    margin: 6px 0 0;
    padding: 0;
    border: 0;
}

.checkout-page__same legend {
    width: 100%;
    margin-bottom: 10px;
    font-family: var(--font-heading);
    font-weight: 500;
    line-height: 20px;
}

.checkout-page__same label {
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 20.8px;
    cursor: pointer;
}

.checkout-page__same input {
    display: grid;
    place-content: center;
    width: 25px;
    height: 25px;
    margin: 0;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: var(--color-white);
    box-shadow: 0 0 9px rgb(0 0 0 / 0.1);
    cursor: pointer;
    appearance: none;
}

.checkout-page__same input:checked {
    border-color: var(--color-primary);
    background: var(--color-primary);
}

.checkout-page__same input:checked::after {
    content: "";
    width: 12px;
    height: 7px;
    border-bottom: 2px solid var(--color-white);
    border-left: 2px solid var(--color-white);
    transform: translateY(-2px) rotate(-45deg);
}

.checkout-page__same input:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.checkout-page__billing {
    margin-top: 16px;
}

.checkout-page__actions--step {
    display: none;
}

.checkout-page__small {
    margin-top: -20px;
    color: rgb(0 0 0 / 0.5);
    font-family: var(--font-heading);
    font-size: 12px;
    line-height: 16px;
    text-align: center;
}

.checkout-page__small a {
    color: inherit;
}

/* WooCommerce's messages ("Please enter…", the postcode check) */
.checkout-page .woocommerce-NoticeGroup,
.checkout-wrap .woocommerce-error,
.checkout-wrap .woocommerce-info,
.checkout-wrap .woocommerce-message {
    margin: 0;
}

.checkout-wrap .woocommerce-error,
.checkout-wrap .woocommerce-info,
.checkout-wrap .woocommerce-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 24px;
    padding: 12px 16px;
    border-radius: 8px;
    list-style: none;
    font-family: var(--font-heading);
    font-weight: 500;
    line-height: 20px;
}

.checkout-wrap .woocommerce-error {
    background: #FFEBEE; /* Feedback/Error Tint */
    color: var(--color-error-dark);
}

.checkout-wrap .woocommerce-info,
.checkout-wrap .woocommerce-message {
    background: var(--color-grey-light);
}

.checkout-wrap .woocommerce-error a {
    color: inherit;
}

/* ── Review Your Order ──────────────────────────────────────── */
.checkout-page__review {
    gap: 24px;
    padding: 32px;
}

.checkout-page__review-head {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkout-page__review .checkout-page__title {
    color: var(--color-secondary);
}

.checkout-page__intro {
    color: var(--color-text-muted);
    font-size: 12px;
}

.checkout-page__review-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.checkout-review {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-grey);
}

.checkout-review__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.checkout-review__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 16px;
    line-height: 20px;
}

.checkout-review__number {
    padding: 2px 8px;
    border-radius: 100px;
    background: var(--color-secondary);
    color: var(--color-white);
    font-size: 12px;
    line-height: 16px;
}

.checkout-review__edit {
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-primary);
    font-family: var(--font-heading);
    font-size: 12px;
    line-height: 16px;
    cursor: pointer;
}

.checkout-review__edit:hover {
    text-decoration: underline;
}

.checkout-review__rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 24px;
}

.checkout-review__row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-wrap: anywhere;
}

.checkout-review__label {
    color: var(--color-text-muted);
    font-family: var(--font-heading);
    font-size: 12px;
    line-height: 16px;
}

.checkout-review__value {
    line-height: 20.8px;
    white-space: pre-line;
}

/* The payment methods (only shown when there's a choice) and the button */
.checkout-pay {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkout-pay__methods {
    display: flex;
    flex-direction: column;
    gap: 8px;
    list-style: none;
}

.checkout-pay__methods.is-single {
    display: none;
}

.checkout-pay__methods > li {
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.checkout-pay__methods label {
    font-family: var(--font-heading);
    font-weight: 500;
    cursor: pointer;
}

.checkout-pay__methods .payment_box {
    margin-top: 8px;
    color: var(--color-text-muted);
    font-size: 14px;
}

.checkout-pay__place {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkout-pay__terms {
    color: var(--color-text-muted);
    font-family: var(--font-heading);
    font-size: 12px;
    line-height: 16px;
    text-align: center;
}

.checkout-page .blockUI.blockOverlay {
    border-radius: 12px;
}

/* ── Payment (the order-pay page, woocommerce/checkout/order-receipt.php):
   the review card on its own, with the card gateway's box in it ── */
.checkout-wrap:has(.checkout-page--pay) {
    padding-top: 48px;
    background: var(--color-grey-light);
}

.checkout-page--pay {
    max-width: 760px;
    margin: 0 auto;
}

.checkout-review__row--item {
    flex-direction: row;
    justify-content: space-between;
    gap: 16px;
}

.checkout-review__row--item .checkout-review__value:last-child {
    flex-shrink: 0;
    font-weight: 600;
}

/* Blink's box is a frame from its own site: only its size and edge are ours */
.checkout-page__gateway iframe {
    width: 100% !important;
    max-width: 450px;
    border: 0 !important;
    border-radius: 8px !important;
}

/* ── Tablet: the summary first, then the form ───────────────── */
/* The plugin's note under the date field: the step already says it */
[data-checkout-date] .description,
[data-checkout-date] small {
    display: none;
}

/* ── Delivery date calendar ─────────────────────────────────
   The Order Delivery Date plugin's pop-up (jQuery UI's datepicker, put at
   the end of the page): in the site's look, over its own theme and the
   plugin's colour settings. Available dates green, the chosen one Deep
   Green; the rest greyed out.
   ─────────────────────────────────────────────────────────── */
#ui-datepicker-div {
    z-index: 50 !important; /* over the checkout, under the sticky header */
    width: 300px;
    max-width: calc(100vw - 2 * var(--pad-x));
    margin-top: 6px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-white);
    box-shadow: 0 6px 18px rgb(0 0 0 / 0.15);
    color: var(--color-text);
    font-family: var(--font-body);
}

#ui-datepicker-div .ui-datepicker-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    margin-bottom: 8px;
    padding: 0;
    border: 0;
    background: none;
}

#ui-datepicker-div .ui-datepicker-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    line-height: 20px;
}

/* Previous / next month: a chevron in a round button */
#ui-datepicker-div .ui-datepicker-prev,
#ui-datepicker-div .ui-datepicker-next {
    position: absolute;
    top: 2px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: none;
    cursor: pointer;
}

#ui-datepicker-div .ui-datepicker-prev {
    left: 0;
}

#ui-datepicker-div .ui-datepicker-next {
    right: 0;
}

#ui-datepicker-div .ui-datepicker-prev:hover,
#ui-datepicker-div .ui-datepicker-next:hover {
    background: var(--color-grey-light);
}

/* One chevron, drawn here: whatever the plugin and jQuery UI put in the
   button (an icon, a glyph, the word "Prev") is hidden. */
#ui-datepicker-div .ui-datepicker-prev,
#ui-datepicker-div .ui-datepicker-next {
    overflow: hidden;
    color: transparent;
    font-size: 0;
}

#ui-datepicker-div .ui-datepicker-prev *,
#ui-datepicker-div .ui-datepicker-next * {
    display: none !important;
}

#ui-datepicker-div .ui-datepicker-prev::before,
#ui-datepicker-div .ui-datepicker-next::before {
    content: none !important;
}

#ui-datepicker-div .ui-datepicker-prev::after,
#ui-datepicker-div .ui-datepicker-next::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    border: solid var(--color-text);
    border-width: 0 2px 2px 0;
    translate: -30% -50%;
    rotate: 135deg;
}

#ui-datepicker-div .ui-datepicker-next::after {
    translate: -70% -50%;
    rotate: -45deg;
}

/* Can't go back past this month */
#ui-datepicker-div .ui-state-disabled.ui-datepicker-prev,
#ui-datepicker-div .ui-state-disabled.ui-datepicker-next {
    opacity: 0.3;
    cursor: default;
}

#ui-datepicker-div .ui-state-disabled.ui-datepicker-prev:hover,
#ui-datepicker-div .ui-state-disabled.ui-datepicker-next:hover {
    background: none;
}

#ui-datepicker-div table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 3px;
    font-size: 14px;
}

#ui-datepicker-div th {
    padding: 4px 0;
    border: 0;
    color: var(--color-text-muted);
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

/* The plugin colours the cells themselves (Appearance → Available Dates):
   cleared, so only the rounded date shows. */
#ui-datepicker-div td {
    padding: 0;
    border: 0 !important;
    background: none !important;
}

#ui-datepicker-div td a,
#ui-datepicker-div td span,
#ui-datepicker-div td a.ui-state-highlight {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--color-text);
    font-weight: 400;
    text-align: center;
    text-decoration: none;
}

/* Available */
#ui-datepicker-div td a.ui-state-default {
    background: var(--color-mint) !important;
    font-weight: 700;
}

#ui-datepicker-div td a.ui-state-default:hover,
#ui-datepicker-div td a.ui-state-hover {
    background: var(--color-primary) !important;
    color: var(--color-white);
}

/* Chosen */
#ui-datepicker-div td a.ui-state-active {
    border: 0 !important;
    background: var(--color-secondary) !important;
    color: var(--color-white);
    outline: none;
}

/* Not available: weekends, holidays, too soon, past */
#ui-datepicker-div td.ui-datepicker-unselectable span,
#ui-datepicker-div td.ui-state-disabled span {
    background: none !important;
    color: var(--color-border);
    opacity: 1;
    cursor: default;
}

/* Today, when it can't be picked: a ring, so it's still easy to find */
#ui-datepicker-div td.ui-datepicker-today span {
    box-shadow: inset 0 0 0 1px var(--color-border);
}

/* Clear */
#ui-datepicker-div .ui-datepicker-buttonpane {
    display: flex;
    justify-content: flex-end;
    margin: 8px 0 0;
    padding: 8px 0 0;
    border-top: 1px solid var(--color-border);
    background: none;
}

#ui-datepicker-div .ui-datepicker-buttonpane button {
    float: none;
    margin: 0;
    padding: 6px 14px;
    border: 1px solid var(--color-secondary);
    border-radius: 99px;
    background: none;
    box-shadow: none;
    color: var(--color-secondary);
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    opacity: 1;
    cursor: pointer;
}

#ui-datepicker-div .ui-datepicker-buttonpane button:hover {
    background: var(--color-grey-light);
}

@media (max-width: 1024px) {
    .checkout-wrap {
        padding-top: 48px;
    }

    .checkout-page__inner,
    .checkout-page.is-reviewing .checkout-page__inner {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }

    .checkout-page__aside {
        order: -1;
    }
}

/* ── Mobile: Your Details in two steps ──────────────────────── */
@media (max-width: 767px) {
    .checkout-wrap {
        padding-top: 24px;
    }

    .checkout-page__card {
        gap: 24px;
        padding: 20px 16px;
    }

    .checkout-page__title {
        font-size: 28px;
        line-height: 32px;
    }

    .checkout-page__step {
        gap: 24px;
    }

    .checkout-page__heading {
        font-size: 18px;
        line-height: 23px;
    }

    .checkout-page__fields {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .checkout-page .form-row-first,
    .checkout-page .form-row-last {
        grid-column: 1 / -1;
    }

    .checkout-page__actions--step {
        display: block;
    }

    .checkout-page__small {
        margin-top: -12px;
    }

    .checkout-page__review {
        padding: 20px 16px;
    }

    /* The order summary and vehicle after the form, not before */
    .checkout-page__aside {
        order: 0;
    }
}
