/* ==========================================================================
   Checkout page styles (checkout.html only).
   Layout tokens, buttons, nav, and footer come from styles.css — this file
   only adds what the checkout flow needs. Same 1024/768/640/480 breakpoints.
   ========================================================================== */

.checkout-layout {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 2rem;
    align-items: stretch; /* both columns share the row height */
    text-align: left;
}

/* The column wrappers dissolve (display: contents) so the step card and the
   summary card are the grid items themselves — grid stretch then gives both
   the exact same row height in every browser, with no nested-flex sizing
   quirks. The steps container IS the card; the fieldsets inside are
   chromeless blocks (fieldsets must stay display:block so the floated-legend
   trick keeps the legend inside the card — flexing a fieldset drops its
   legend onto the border). */
.checkout-main, .checkout-summary { display: contents; }
.checkout-steps {
    display: flex;
    flex-direction: column;
}
.checkout-step {
    flex: 1 0 auto;
    min-width: 0;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
}

/* --- Clickable step timeline, pinned to the card bottom --- */
.step-timeline {
    display: flex;
    align-items: center;
    justify-content: center;
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 1.25rem 0 0;
    margin-top: auto;
    border-top: 1px solid var(--border);
}
.step-line { flex: 0 0 56px; height: 2px; background-color: var(--border); margin: 0 0.75rem; }
.step-dot {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    min-height: 44px; /* comfortable touch target */
    cursor: pointer;
    font: inherit;
}
.step-dot-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.9375rem;
    background-color: var(--muted);
    color: var(--text-secondary);
    border: 2px solid var(--border);
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.step-dot-label { font-size: 0.875rem; font-weight: 600; color: var(--text-secondary); }
.step-dot:hover .step-dot-num { border-color: var(--accent-color); }
/* Gentle attention pulse on the shipping step once an accessory is picked */
@keyframes step-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(242, 98, 46, 0.45); transform: scale(1); }
    50% { box-shadow: 0 0 0 8px rgba(242, 98, 46, 0); transform: scale(1.06); }
}
.step-dot.pulse .step-dot-num {
    border-color: var(--accent-color);
    animation: step-pulse 1.6s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
    .step-dot.pulse .step-dot-num { animation: none; }
}
.step-dot.active .step-dot-num { background-color: var(--accent-color); color: #fff; border-color: var(--accent-color); }
.step-dot.active .step-dot-label { color: var(--navy); }

.checkout-card {
    min-width: 0; /* fieldsets default to min-content sizing and can overflow the grid */
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
/* Grid stretch only equalizes the two cards if neither carries a bottom
   margin inside its grid area — a plain .checkout-card reset loses the
   cascade to the 1.5rem above, leaving that card visibly shorter. */
.checkout-main > .checkout-card, .checkout-summary > .checkout-card { margin-bottom: 0; }

.checkout-card legend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 1rem;
    float: left; /* keeps the legend inside the card's flow */
    width: 100%;
}
.checkout-card legend i { color: var(--accent-color); font-size: 1.25rem; }

/* --- Fields --- */
.field { margin-bottom: 1rem; }
.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.field-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}
.field-optional { font-weight: 500; text-transform: none; letter-spacing: 0; }

.checkout-card input[type="text"],
.checkout-card input[type="email"],
.checkout-card input[type="tel"],
.checkout-card select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s;
    background-color: #ffffff;
    min-height: 44px;
    -webkit-appearance: none;
}
.checkout-card input:focus { border-color: var(--accent-color); }
.checkout-card input.invalid { border-color: var(--error); }
.field-note { font-size: 0.8125rem; color: var(--text-secondary); margin-top: 0.375rem; }

/* --- Add-on options --- */
.addon-option {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s;
    margin-bottom: 0.75rem;
}
.addon-option:last-child { margin-bottom: 0; }
.addon-option:hover { border-color: var(--accent-color); }
.addon-option:has(input:checked) { border-color: var(--accent-color); background-color: rgba(242, 98, 46, 0.04); }
.addon-option input {
    accent-color: var(--accent-color);
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.2rem;
    flex-shrink: 0;
}
.addon-body { flex: 1; }
.addon-name { display: block; font-weight: 600; color: var(--navy); }
.addon-desc { display: block; font-size: 0.8125rem; color: var(--text-secondary); line-height: 1.5; margin-top: 0.125rem; }
.addon-price { font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }

/* --- Payment options --- */
.pay-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}
.pay-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.625rem 0.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s;
    text-align: center;
}
.pay-option:hover { border-color: var(--accent-color); }
.pay-option:has(input:checked) { border-color: var(--accent-color); background-color: rgba(242, 98, 46, 0.04); }
.pay-option input { position: absolute; opacity: 0; pointer-events: none; }
.pay-option i { font-size: 1.5rem; color: var(--navy); }
.pay-icons { display: flex; gap: 0.375rem; }
.pay-option:has(input:checked) i { color: var(--accent-color); }
.pay-name { font-size: 0.75rem; font-weight: 600; color: var(--navy); }
.pay-note { font-size: 0.8125rem; color: var(--text-secondary); line-height: 1.5; margin-top: 1rem; clear: both; }

/* Payment method lives inside the summary card, above the submit button:
   strip the nested card chrome and go 2x2 to fit the narrower column. */
.pay-fieldset {
    background: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    margin: 0 0 1.25rem;
    min-width: 0;
}
.pay-fieldset .pay-options {
    grid-template-columns: repeat(2, 1fr);
    clear: both; /* the legend is a 100%-wide float; the grid must drop below it */
}
.pay-option { position: relative; min-width: 0; } /* anchor the hidden radios; let options shrink */

/* --- Order summary --- */
.summary-card { min-width: 0; margin-bottom: 0; }
.summary-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 1rem;
}
.summary-title i { color: var(--accent-color); font-size: 1.25rem; }
.summary-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.9375rem;
    color: var(--text-primary);
    padding: 0.375rem 0;
    font-variant-numeric: tabular-nums;
}
.summary-discount { color: var(--success); font-weight: 600; }

/* Hover/focus tooltip on the discount label */
.has-tip { position: relative; cursor: help; border-bottom: 1px dotted currentColor; }
.has-tip .tip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 250px;
    padding: 0.625rem 0.75rem;
    background-color: var(--navy);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.5;
    border-radius: var(--radius);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s;
    pointer-events: none;
    z-index: 10;
}
.has-tip:hover .tip, .has-tip:focus .tip { opacity: 1; visibility: visible; }
.summary-change { font-size: 0.8125rem; margin: -0.25rem 0 0.5rem; }
.summary-change a { color: var(--text-secondary); }
.summary-change a:hover { color: var(--accent-color); }
.summary-divider { border: none; border-top: 1px solid var(--border); margin: 0.75rem 0; }
.summary-total { font-size: 1.125rem; font-weight: 800; color: var(--navy); }
.summary-note { font-size: 0.8125rem; color: var(--text-secondary); line-height: 1.5; margin: 0.5rem 0 1.25rem; }
.summary-sats { margin: -0.125rem 0 0; text-align: right; font-variant-numeric: tabular-nums; } /* sits tight under the total amount; the tax note below carries the bottom spacing */
@keyframes sats-flash { from { color: var(--success); } to { color: var(--text-secondary); } }
.sats-flash { animation: sats-flash 1.2s ease-out; }
/* Delivery-window note under the total: centered, accent color, truck icon */
.summary-delivery {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--accent-color);
    font-weight: 600;
}
.summary-delivery i { font-size: 1.125rem; }

.summary-trust {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 1rem;
}
.summary-trust i { color: var(--accent-color); font-size: 1.125rem; flex-shrink: 0; }
.summary-card .message { margin-top: 1rem; }
.summary-card .message.info {
    display: block;
    color: var(--navy);
    background-color: rgba(3, 33, 63, 0.06);
}

/* --- Reservation perks (reserve.html, which shares this stylesheet) --- */
.reserve-perks {
    list-style: none;
    margin: 1.25rem 0 1.5rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.reserve-perks li {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    background-color: var(--muted);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    color: var(--navy);
    line-height: 1.5;
}
.reserve-perks i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: 50%;
    background-color: rgba(242, 98, 46, 0.12);
    color: var(--accent-color);
    font-size: 1.25rem;
}

/* --- Post-payment thanks panel (?thanks=1) --- */
.checkout-thanks {
    max-width: 560px;
    margin: 0 auto;
    text-align: center;
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 3rem 2rem;
}
.checkout-thanks i { font-size: 3rem; color: var(--accent-color); }
.checkout-thanks h2 { font-size: 1.5rem; font-weight: 700; color: var(--navy); margin: 1rem 0 0.75rem; }
.checkout-thanks p { color: var(--text-secondary); line-height: 1.6; margin-bottom: 1.5rem; }

/* --- Responsive --- */
@media (max-width: 1024px) {
    .checkout-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .pay-options { grid-template-columns: repeat(2, 1fr); }
    .field-row { grid-template-columns: 1fr; }
    .checkout-card { padding: 1.25rem 1rem; }
    .checkout-thanks { padding: 2rem 1.25rem; }
    .step-line { flex-basis: 32px; margin: 0 0.5rem; }
}

@media (max-width: 480px) {
    .checkout-layout { gap: 1.25rem; }
    /* Keep the two labeled steps on one row on small phones */
    .step-line { flex-basis: 20px; margin: 0 0.375rem; }
    .step-dot { padding: 0.25rem; gap: 0.375rem; min-width: 0; }
    .step-dot-num { width: 1.75rem; height: 1.75rem; font-size: 0.875rem; flex-shrink: 0; }
    .step-dot-label { font-size: 0.75rem; white-space: normal; text-align: left; line-height: 1.2; }
}
