/**
 * Stepped deal builder - inline multi-step form.
 *
 * Lives below the product description in place of the add-ons form.
 * Sticky footer keeps the running total and Next in view.
 */

/* The wizard replaces the visible add-ons form */
.mcf-wizard-enabled form.cart {
    display: none;
}

/* Flat option cards on non-deal products: our cards replace the
   native add-ons UI, which stays in the DOM as the source of truth. */
.wc-pao-addons-container.mcf-options-replaced {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.mcf-options {
    margin: 4px 0 18px;
}

.mcf-options .mcf-wizard__group {
    margin: 0 0 18px;
}

/* Mobile: the wizard's sticky footer owns the bottom edge. Retire the
   scroll-to-top button (no job on a short page with a pinned footer)
   and tuck a smaller cart pill just above the footer. */
@media (max-width: 781px) {
    body.mcf-wizard-enabled .eotb-scroll-top {
        display: none;
    }

    body.mcf-wizard-enabled .eotb-floating-cart {
        width: 46px;
        height: 46px;
        right: 10px;
        bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    }
}

.mcf-wizard--inline {
    margin: 16px 0 28px;
    border: 1px solid var(--wp--preset--color--border-color, #e0e0e0);
    border-radius: 8px;
    background: var(--wp--preset--color--base, #ffffff);
    /* no overflow:hidden - hover tooltips extend past the panel */
}

.mcf-wizard__header {
    border-radius: 7px 7px 0 0;
}

.mcf-wizard__footer {
    border-radius: 0 0 7px 7px;
}

/* Header - sticks below the site header while scrolling a step, so
   the customer always sees where they are (wizard.js tracks the site
   header's live bottom edge into --mcf-wizard-top). */
.mcf-wizard__header {
    position: sticky;
    top: var(--mcf-wizard-top, 64px);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: var(--wp--preset--color--packaging, #edd9c2);
    border-bottom: 1px solid var(--wp--preset--color--border-color, #e0e0e0);
}

/* The kraft header deepened to #c6a17f - the red eyebrow lost its
   contrast there. Dark brown reads clearly on the tan. */
.mcf-wizard__step-label {
    margin: 0 0 2px;
    color: var(--wp--preset--color--heading, #2c1810);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.mcf-wizard__title {
    margin: 0;
    color: #ffffff;
    font-family: var(--wp--preset--font-family--outfit, "Outfit", sans-serif);
    font-size: 22px;
    font-weight: 600;
    line-height: 1.2;
}

.mcf-wizard__dots {
    display: flex;
    gap: 6px;
}

.mcf-wizard__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(44, 24, 16, 0.3);
}

.mcf-wizard__dot--active {
    background: var(--wp--preset--color--heading, #2c1810);
}

/* In-step group jumps land below the sticky site header. */
.mcf-wizard__group {
    scroll-margin-top: 120px;
}

/* Option blurb: the product's full short description - customers
   must be able to see everything that is on an item before choosing. */
.mcf-wizard__option-blurb {
    display: block;
    margin-top: 2px;
    color: var(--wp--preset--color--body-text, #5a5a5a);
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.4;
    text-align: left;
}

/* Day-availability notice */
/* Informational, not an error - ordering ahead is supported. */
.mcf-wizard__notice {
    margin: 0;
    padding: 10px 18px;
    background: #e8f5ea;
    color: var(--wp--preset--color--primary, #377237);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

/* Body */
.mcf-wizard__body {
    padding: 16px 18px 8px;
}

.mcf-wizard__group {
    margin: 0 0 22px;
}

.mcf-wizard__group-title {
    margin: 0 0 4px;
    color: var(--wp--preset--color--heading, #2c1810);
    font-family: var(--wp--preset--font-family--outfit, "Outfit", sans-serif);
    font-size: 17px;
    font-weight: 600;
}

.mcf-wizard__required {
    color: var(--wp--preset--color--secondary, #9b1c1f);
}

.mcf-wizard__group-description {
    margin: 0 0 10px;
    color: var(--wp--preset--color--body-text, #5a5a5a);
    font-size: 13px;
}

.mcf-wizard__options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

@media (min-width: 600px) {
    .mcf-wizard__options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 782px) {
    .mcf-wizard__options {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .mcf-wizard__option {
        padding: 8px 10px;
        gap: 8px;
    }

    .mcf-wizard__option img {
        width: 48px;
        height: 48px;
    }

    .mcf-wizard__option-label {
        font-size: 14px;
    }

    .mcf-wizard__option-price {
        font-size: 12px;
    }

    .mcf-wizard__option-tick {
        width: 16px;
        height: 16px;
    }
}

/* Small groups span their whole row instead of leaving orphan cells:
   a two-option group renders two across. */
@media (min-width: 782px) {
    .mcf-wizard__options[data-count="2"] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Collapsed long lists: overflow options hide behind Show all */
.mcf-wizard__options--collapsed .mcf-wizard__option--overflow {
    display: none;
}

.mcf-wizard__show-all {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 10px 14px;
    background: var(--wp--preset--color--section-bg, #f8f8f8);
    border: 1px dashed var(--wp--preset--color--border-color, #e0e0e0);
    border-radius: 5px;
    color: var(--wp--preset--color--primary, #377237);
    font-family: var(--wp--preset--font-family--outfit, "Outfit", sans-serif);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.mcf-wizard__show-all:hover,
.mcf-wizard__show-all:focus {
    color: var(--wp--preset--color--secondary, #9b1c1f);
    border-color: var(--wp--preset--color--secondary, #9b1c1f);
}

/* Option rows */
.mcf-wizard__option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    background: var(--wp--preset--color--base, #ffffff);
    border: 1px solid var(--wp--preset--color--border-color, #e0e0e0);
    border-radius: 5px;
    text-align: left;
    cursor: pointer;
}

/* Desktop hover tooltip with the item description */
@media (hover: hover) and (min-width: 782px) {
    .mcf-wizard__option[data-blurb]:hover::after,
    .mcf-wizard__option[data-blurb]:focus-visible::after {
        content: attr(data-blurb);
        position: absolute;
        top: calc(100% + 8px);
        left: 50%;
        transform: translateX(-50%);
        z-index: 30;
        width: min(280px, 74vw);
        padding: 10px 12px;
        background: rgba(26, 26, 26, 0.95);
        color: #ffffff;
        border-radius: 6px;
        font-size: 13px;
        font-weight: 400;
        line-height: 1.45;
        text-align: left;
        white-space: normal;
        pointer-events: none;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    }

    .mcf-wizard__option[data-blurb]:hover::before,
    .mcf-wizard__option[data-blurb]:focus-visible::before {
        content: "";
        position: absolute;
        top: calc(100% + 2px);
        left: 50%;
        transform: translateX(-50%);
        z-index: 30;
        border: 6px solid transparent;
        border-bottom-color: rgba(26, 26, 26, 0.95);
        pointer-events: none;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .mcf-wizard__option {
        transition: border-color 0.15s ease, background-color 0.15s ease;
    }
}

.mcf-wizard__option:hover,
.mcf-wizard__option:focus-visible {
    border-color: var(--wp--preset--color--primary, #377237);
}

.mcf-wizard__option--selected {
    background: var(--wp--preset--color--primary-light, #e8f5ea);
    border-color: var(--wp--preset--color--primary, #377237);
}

.mcf-wizard__option img {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: 4px;
    object-fit: cover;
}

.mcf-wizard__option-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}

.mcf-wizard__option-label {
    color: var(--wp--preset--color--heading, #2c1810);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
}

.mcf-wizard__option-price {
    color: var(--wp--preset--color--body-text, #5a5a5a);
    font-size: 13px;
}

.mcf-wizard__option--selected .mcf-wizard__option-price {
    color: var(--wp--preset--color--primary, #377237);
    font-weight: 600;
}

/* Desktop cards: title / image / description stacked, with a proper
   food-photo presence (the 56px thumbnail undersold the pizzas).
   The body span becomes display:contents so its children join the
   card's flex column and can be reordered around the image. Mobile
   keeps the compact row layout. */
@media (min-width: 782px) {
    .mcf-wizard__option {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 12px;
    }

    .mcf-wizard__option-body {
        display: contents;
    }

    .mcf-wizard__option-label {
        order: 1;
        min-height: 2.6em; /* two title lines - images align across the row */
        padding-right: 28px; /* clear of the selection tick */
        font-size: 15px;
        font-weight: 600;
    }

    .mcf-wizard__option-price {
        order: 2;
        margin-top: -4px;
    }

    .mcf-wizard__option img {
        order: 3;
        width: 100%;
        height: 150px;
        border-radius: 5px;
    }

    .mcf-wizard__option-blurb {
        order: 4;
    }

    .mcf-wizard__option-tick {
        position: absolute;
        top: 12px;
        right: 12px;
    }

    /* Selection reads at a glance: solid green frame (shadow ring -
       no border-width change, so nothing shifts). */
    .mcf-wizard__option--selected {
        border-color: var(--wp--preset--color--primary, #377237);
        box-shadow: 0 0 0 2px var(--wp--preset--color--primary, #377237);
    }
}

.mcf-wizard__option-tick {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    border: 2px solid var(--wp--preset--color--border-color, #e0e0e0);
    border-radius: 50%;
}

.mcf-wizard__option--selected .mcf-wizard__option-tick {
    border-color: var(--wp--preset--color--primary, #377237);
    background:
        radial-gradient(circle at center,
            var(--wp--preset--color--primary, #377237) 0 45%,
            transparent 50%);
}

/* Review summary */
.mcf-wizard__summary {
    margin: 0;
}

.mcf-wizard__summary dt {
    margin: 12px 0 2px;
    color: var(--wp--preset--color--heading, #2c1810);
    font-family: var(--wp--preset--font-family--outfit, "Outfit", sans-serif);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mcf-wizard__summary dd {
    margin: 0;
    color: var(--wp--preset--color--body-text, #5a5a5a);
    font-size: 15px;
    line-height: 1.5;
}

/* Footer - sticky so the total and Next stay in view on long steps */
.mcf-wizard__footer {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--wp--preset--color--border-color, #e0e0e0);
    background: var(--wp--preset--color--base, #ffffff);
    box-shadow: 0 -4px 12px rgba(44, 24, 16, 0.06);
}

.mcf-wizard__back {
    padding: 12px 16px;
    background: transparent;
    border: 1px solid var(--wp--preset--color--border-color, #e0e0e0);
    border-radius: 5px;
    color: var(--wp--preset--color--heading, #2c1810);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.mcf-wizard__total {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
}

.mcf-wizard__total-label {
    color: var(--wp--preset--color--body-text, #5a5a5a);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mcf-wizard__total-amount {
    color: var(--wp--preset--color--secondary, #9b1c1f);
    font-family: var(--wp--preset--font-family--outfit, "Outfit", sans-serif);
    font-size: 20px;
    font-weight: 700;
}

.mcf-wizard__next {
    padding: 13px 22px;
    background: var(--wp--preset--color--primary, #377237);
    border: none;
    border-radius: 5px;
    color: #ffffff;
    font-family: var(--wp--preset--font-family--outfit, "Outfit", sans-serif);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.mcf-wizard__next:hover:not(:disabled),
.mcf-wizard__next:focus:not(:disabled) {
    background: var(--wp--preset--color--secondary, #9b1c1f);
}

.mcf-wizard__next:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.mcf-wizard__next--cart {
    background: var(--wp--preset--color--secondary, #9b1c1f);
}

.mcf-wizard__next--cart:hover:not(:disabled),
.mcf-wizard__next--cart:focus:not(:disabled) {
    background: var(--wp--preset--color--primary, #377237);
}

/* PAO's live grand total, rescued from the clipped native container -
   a tidy receipt card above the buy row: muted line items, strong
   green subtotal bar. */
.mcf-options__totals {
    margin: 0 0 16px;
}

.mcf-options__totals .product-addon-totals {
    background: var(--wp--preset--color--base, #ffffff);
    border: 1px solid var(--wp--preset--color--border-color, #e0e0e0);
    border-radius: 5px;
    overflow: hidden;
}

.mcf-options__totals ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

#product-addons-total.mcf-options__totals li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 11px 16px;
    border-bottom: 1px solid var(--wp--preset--color--section-bg, #f8f8f8);
    color: var(--wp--preset--color--body-text, #5a5a5a);
    font-size: 14px;
    line-height: 1.4;
}

.mcf-options__totals .wc-pao-col1 {
    color: var(--wp--preset--color--heading, #2c1810);
}

.mcf-options__totals .wc-pao-col1 strong {
    font-weight: 500;
}

.mcf-options__totals .wc-pao-col2 {
    white-space: nowrap;
}

#product-addons-total.mcf-options__totals li.wc-pao-subtotal-line {
    padding: 13px 16px;
    background: #e8f5ea;
    border-bottom: none;
}

.mcf-options__totals .wc-pao-subtotal-line .price {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    width: 100%;
    margin: 0;
    color: var(--wp--preset--color--primary, #377237);
    font-family: var(--wp--preset--font-family--outfit, "Outfit", sans-serif);
    font-size: 17px;
    font-weight: 700;
}
