/* WebOrders.Web/wwwroot/css/checkout.css
   Scoped styles for the checkout page (Index.cshtml) and confirmation /
   disabled pages. All colors driven by --wo-* theme vars.

   This stylesheet covers the OUTER page structure (sections, grids, tip
   strip, order-type tiles, summary). Inner partials (delivery, scheduling,
   payment, coupons, gift/loyalty) still use their own styles for now and
   will be re-skinned individually in slices F.1–F.3.                       */

/* ── Page grid ──────────────────────────────────────────────────────── */
.wo-checkout-grid {
    max-width: 760px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

.wo-checkout-grid > h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
}

/* ── Section card ───────────────────────────────────────────────────── */
.wo-checkout-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.wo-checkout-section h2 {
    margin: 0 0 0.85rem;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

.wo-checkout-section .wo-checkout-section-sub {
    color: #6b7280;
    font-size: 0.85rem;
    margin: 0 0 0.75rem;
}


/* ── Grid rows for paired/triple fields ─────────────────────────────── */
.wo-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.wo-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.wo-row-2:last-child,
.wo-row-3:last-child { margin-bottom: 0; }

@media (max-width: 560px) {
    .wo-row-2 { grid-template-columns: 1fr; }
    .wo-row-3 { grid-template-columns: 1fr 1fr; }
}

/* ── Inline label/field (different style than site.css wo-field) ────── */
label.wo-field-block {
    display: block;
    margin-bottom: 0.75rem;
}

label.wo-field-block > span {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #374151;
    margin-bottom: 0.35rem;
}

label.wo-field-block > input,
label.wo-field-block > textarea,
label.wo-field-block > select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font: inherit;
    font-size: 0.95rem;
    background: #fff;
    color: #111827;
    transition: border-color 0.15s, box-shadow 0.15s;
}

label.wo-field-block > input:focus,
label.wo-field-block > textarea:focus,
label.wo-field-block > select:focus {
    outline: 0;
    border-color: var(--wo-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wo-primary) 22%, transparent);
}

label.wo-field-block > textarea {
    min-height: 64px;
    resize: vertical;
}

label.wo-field-block:last-child { margin-bottom: 0; }

/* ── Action row (Back to cart / Place order) ────────────────────────── */
.wo-checkout-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    align-items: center;
}

@media (max-width: 480px) {
    .wo-checkout-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }
    .wo-checkout-actions > * { width: 100%; text-align: center; }
}

/* ── Saved address picker ───────────────────────────────────────────── */
.wo-saved-addrs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.wo-saved-addrs label {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    padding: 0.7rem 0.85rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.wo-saved-addrs label:hover { border-color: #d1d5db; }

.wo-saved-addrs label:has(input:checked) {
    border-color: var(--wo-primary);
    background: color-mix(in srgb, var(--wo-primary) 4%, #fff);
}

.wo-saved-addrs label input[type=radio] {
    accent-color: var(--wo-primary);
    cursor: pointer;
    margin-top: 0.15rem;
    flex: 0 0 auto;
}

.wo-saved-addrs label .muted { color: #6b7280; font-size: 0.9rem; }

/* ── Order-type tiles (pickup / delivery / dine-in / etc) ───────────── */
.wo-order-types {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.55rem;
}

.wo-order-tile {
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    padding: 0.75rem 0.5rem;
    text-align: center;
    cursor: pointer;
    background: #fff;
    color: #111827;
    user-select: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.wo-order-tile:hover { border-color: var(--wo-primary); }

.wo-order-tile.selected {
    border-color: var(--wo-primary);
    background: var(--wo-primary);
    color: var(--wo-primary-text);
}

.wo-order-tile input { display: none; }

/* ── Scheduling toggle ──────────────────────────────────────────────── */
.wo-schedule-toggle {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.wo-schedule-toggle label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    color: #374151;
    font-size: 0.9rem;
}

.wo-schedule-toggle label input[type=radio] {
    accent-color: var(--wo-primary);
    cursor: pointer;
}

/* ── Tip pills ──────────────────────────────────────────────────────── */
#tipOptions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

#tipOptions label {
    padding: 0.5rem 1rem;
    border: 1.5px solid #d1d5db;
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    font-size: 0.9rem;
    color: #111827;
    background: #fff;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

#tipOptions label:hover { border-color: var(--wo-primary); }

#tipOptions label.selected {
    border-color: var(--wo-primary);
    background: var(--wo-primary);
    color: var(--wo-primary-text);
}

#tipOptions input[type=radio] { display: none; }

#customTipBox { margin-top: 0.6rem; }

#customTipBox input {
    width: 110px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font: inherit;
}

#customTipBox input:focus {
    outline: 0;
    border-color: var(--wo-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wo-primary) 22%, transparent);
}

/* ── Summary block ──────────────────────────────────────────────────── */
.wo-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    font-size: 0.95rem;
}

.wo-summary-row.muted {
    color: #6b7280;
    font-size: 0.85rem;
}

.wo-summary-row.discount {
    color: #047857;
    font-weight: 600;
}

.wo-summary-row.total {
    font-weight: 700;
    font-size: 1.1rem;
    border-top: 1px solid #f3f4f6;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    color: #111827;
}

/* ── Cart-warnings banner ───────────────────────────────────────────── */
.wo-cart-warnings {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
}

.wo-cart-warnings[data-blocking="true"] {
    border-left-color: #b91c1c;
    background: #fef2f2;
}

.wo-cart-warnings-title {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    color: #92400e;
    font-weight: 700;
}

.wo-cart-warnings[data-blocking="true"] .wo-cart-warnings-title {
    color: #b91c1c;
}

.wo-cart-warnings-list {
    margin: 0;
    padding-left: 1.25rem;
}

.cart-warning--blocking { color: #b91c1c; }
.cart-warning--info     { color: #92400e; }

/* ── Error banner (TempData CheckoutError) ──────────────────────────── */
.wo-checkout-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
}

/* ── Confirmation + Disabled pages ──────────────────────────────────── */
.wo-confirm-page,
.wo-closed-page {
    max-width: 600px;
    margin: 3rem auto;
    padding: 3rem 1.5rem;
    text-align: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

.wo-confirm-page h1,
.wo-closed-page h1 {
    margin: 0 0 0.5rem;
    font-size: 1.6rem;
    font-weight: 700;
    color: #111827;
}

.wo-confirm-page > p,
.wo-closed-page > p {
    color: #6b7280;
    margin: 0 0 1.25rem;
}

.wo-confirm-check {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.25rem;
    color: #16a34a;
    display: block;
}

.wo-confirm-number {
    display: inline-block;
    padding: 0.85rem 1.75rem;
    background: color-mix(in srgb, var(--wo-primary) 8%, #fff);
    color: var(--wo-primary);
    border-radius: 10px;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin: 0.5rem 0 1.5rem;
}

.wo-confirm-note {
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 1.75rem;
}

/* ── Coupon section ─────────────────────────────────────────────────── */
.wo-coupon-title,
.wo-card-title {
    margin: 0 0 0.85rem;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

.wo-coupon-entry,
.wo-card-entry {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.wo-coupon-input,
.wo-card-input {
    flex: 1;
    padding: 0.65rem 0.85rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font: inherit;
    font-size: 0.95rem;
    background: #fff;
    color: #111827;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: border-color 0.15s, box-shadow 0.15s;
}

    .wo-coupon-input:focus,
    .wo-card-input:focus {
        outline: 0;
        border-color: var(--wo-primary);
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--wo-primary) 22%, transparent);
    }

.wo-coupon-apply,
.wo-card-lookup,
.wo-card-apply {
    padding: 0.65rem 1.1rem;
    flex: 0 0 auto;
}

/* ── Coupon — applied state ─────────────────────────────────────────── */
.wo-coupon-applied {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: color-mix(in srgb, var(--wo-primary) 6%, #fff);
    border: 1.5px solid var(--wo-primary);
    border-radius: 10px;
}

.wo-coupon-applied-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    color: #111827;
}

.wo-coupon-icon,
.wo-card-icon {
    color: var(--wo-primary);
    flex: 0 0 auto;
}

.wo-coupon-applied-code {
    font-weight: 700;
    color: var(--wo-primary);
    letter-spacing: 0.03em;
}

.wo-coupon-applied-description {
    color: #6b7280;
    font-size: 0.9rem;
}

.wo-coupon-applied-savings {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.wo-coupon-remove,
.wo-card-remove {
    background: transparent;
    border: 0;
    color: #b91c1c;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    flex: 0 0 auto;
    transition: background 0.15s;
}

    .wo-coupon-remove:hover,
    .wo-card-remove:hover {
        background: #fef2f2;
    }

/* ── Inline message banner (errors / success) ───────────────────────── */
.wo-coupon-message,
.wo-card-message {
    margin-top: 0.75rem;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    font-size: 0.875rem;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* ── Gift / loyalty — looked-up result panel ────────────────────────── */
.wo-card-lookup-result {
    margin-top: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

    /* Empty-state collapse: when the lookup-result panel contains NO visible
   gift row and NO visible loyalty row, hide it. */
    .wo-card-lookup-result:not(:has([data-gift-row]:not([hidden]))):not(:has([data-loyalty-row]:not([hidden]))) {
        display: none;
    }

.wo-card-owner {
    font-weight: 700;
    color: #111827;
}

.wo-card-balance {
    padding: 0.65rem 0.85rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.wo-card-balance--gift label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
}

.wo-card-balance--loyalty {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.wo-loyalty-program-name {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
}

.wo-loyalty-points input,
.wo-loyalty-bonus input {
    width: 100%;
}

.wo-loyalty-hint {
    display: block;
    color: #6b7280;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* ── Gift / loyalty — applied state ─────────────────────────────────── */
.wo-card-applied {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: color-mix(in srgb, var(--wo-primary) 6%, #fff);
    border: 1.5px solid var(--wo-primary);
    border-radius: 10px;
}

.wo-card-applied-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.wo-card-applied-track {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-weight: 700;
    color: var(--wo-primary);
}

.wo-card-applied-name {
    color: #6b7280;
    font-size: 0.9rem;
}

.wo-card-applied-savings {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.wo-payment-methods {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.6rem;
    margin-bottom: 1rem;
}

@media (max-width: 480px) {
    .wo-payment-methods {
        grid-template-columns: 1fr 1fr;
    }
}

.wo-payment-tile {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 0.9rem;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    color: #111827;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

    .wo-payment-tile:hover {
        border-color: var(--wo-primary);
    }

.wo-payment-tile--selected {
    border-color: var(--wo-primary);
    background: color-mix(in srgb, var(--wo-primary) 8%, #fff);
    color: var(--wo-primary);
}

.wo-payment-tile input[type="radio"] {
    display: none;
}

.wo-payment-icon {
    flex: 0 0 auto;
}

.wo-payment-tile-label {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
}

/* ── Processor body (revealed when the matching radio is selected) ──── */
.wo-payment-body {
    margin-top: 0.6rem;
    padding: 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.wo-payment-field-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #374151;
    margin-bottom: 0.5rem;
}

.wo-payment-hint {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0 0 0.75rem;
}

.wo-payment-status {
    margin-top: 0.5rem;
    color: #047857;
    font-size: 0.875rem;
    font-weight: 600;
}

.wo-payment-error {
    margin-top: 0.5rem;
    padding: 0.55rem 0.75rem;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 0.875rem;
}

/* ── Stripe Elements card iframe wrapper ────────────────────────────── */
.wo-stripe-card {
    padding: 0.85rem 0.95rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

    .wo-stripe-card.StripeElement--focus {
        border-color: var(--wo-primary);
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--wo-primary) 22%, transparent);
    }

    .wo-stripe-card.StripeElement--invalid {
        border-color: #dc2626;
    }

/* ── Authorize.Net launcher button ──────────────────────────────────── */
.wo-authnet-launcher {
    /* Inherits .wo-btn-secondary look from site.css; just align it inline. */
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* ── Checkout two-column layout: sticky order summary on desktop,
      inline (stacked after the form) on phones. Append to checkout.css ── */
.wo-checkout-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
    align-items: start;
}

.wo-checkout-aside {
    position: sticky;
    top: var(--wo-sticky-offset, 80px);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.wo-aside-items .wo-aside-line {
    padding: 8px 0;
    border-bottom: 1px solid var(--wo-border, #e8e8e8);
}

    .wo-aside-items .wo-aside-line:last-of-type {
        border-bottom: none;
    }

.wo-aside-line-main {
    display: flex;
    gap: 8px;
    align-items: baseline;
    font-size: 14px;
}

.wo-aside-qty {
    color: var(--wo-muted, #777);
    white-space: nowrap;
}

.wo-aside-name {
    flex: 1;
    min-width: 0;
}

.wo-aside-price {
    white-space: nowrap;
    font-weight: 600;
}

.wo-aside-mods {
    margin: 2px 0 0 26px;
    font-size: 12.5px;
    color: var(--wo-muted, #777);
    line-height: 1.4;
}

.wo-aside-edit {
    display: inline-block;
    margin-top: 10px;
    font-size: 13px;
}

/* The two-column checkout needs a wider page container than the original
   single-column 760px. :has() scopes it so other pages using
   .wo-checkout-grid (confirmation) keep their width. */
.wo-checkout-grid:has(.wo-checkout-layout) {
    max-width: 1120px;

    /* Phones / narrow: single column, aside flows inline after the form. */
    @media (max-width: 1000px) {
        .wo-checkout-layout {
            grid-template-columns: 1fr;
        }

        .wo-checkout-aside {
            position: static;
        }
    }
}