/* ============================================================
   Quickstop Super Deli — Checkout Page Styles
   Matches the retro-modern "brutal" design system.
   ============================================================ */

:root {
    --deli-red: #D62828;
    --deli-yellow: #F7B32B;
    --deli-cream: #FFF8E7;
    --deli-dark: #1A1A1A;
    --deli-brown: #5C4033;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--deli-cream);
    color: var(--deli-dark);
}

/* ── Navigation (shared with menu.html) ── */

nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 248, 231, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 3px solid var(--deli-dark);
}

.logo-text {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
    color: var(--deli-red);
    letter-spacing: 2px;
    text-decoration: none;
}
.logo-text span { color: var(--deli-dark); }

.nav-links { display: flex; gap: 2rem; align-items: center; }
.nav-links a {
    text-decoration: none;
    color: var(--deli-dark);
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s;
}
.nav-links a:hover { color: var(--deli-red); }

.back-btn {
    background: var(--deli-yellow);
    color: var(--deli-dark) !important;
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    box-shadow: 3px 3px 0 var(--deli-dark);
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: 700 !important;
}
.back-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--deli-dark);
}

/* ── Page Header ── */

.page-header {
    padding: 7rem 2rem 3rem;
    text-align: center;
    background: var(--deli-red);
    position: relative;
}
.page-header::before {
    content: 'CHECKOUT';
    position: absolute;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 12rem;
    color: rgba(0,0,0,0.1);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    white-space: nowrap;
}
.page-header h1 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 4rem;
    color: var(--deli-cream);
    position: relative; z-index: 1;
}
.page-header p {
    color: rgba(255, 248, 231, 0.8);
    font-size: 1.1rem;
    position: relative; z-index: 1;
}

/* ── Main Layout ── */

.checkout-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* ── Empty Cart Message ── */

.empty-cart {
    text-align: center;
    padding: 4rem 2rem;
}
.empty-cart h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}
.empty-cart p {
    color: var(--deli-brown);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}
.empty-cart a {
    display: inline-block;
    background: var(--deli-red);
    color: white;
    padding: 1rem 2rem;
    border: 2px solid var(--deli-dark);
    border-radius: 4px;
    box-shadow: 4px 4px 0 var(--deli-dark);
    text-decoration: none;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.25rem;
    letter-spacing: 1px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.empty-cart a:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--deli-dark);
}

/* ── Section Cards ── */

.checkout-section {
    background: white;
    border: 2px solid var(--deli-dark);
    border-radius: 8px;
    box-shadow: 4px 4px 0 var(--deli-dark);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.section-header {
    background: var(--deli-dark);
    color: var(--deli-cream);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-number {
    background: var(--deli-red);
    color: white;
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.section-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.4rem;
    letter-spacing: 1px;
}

.section-body { padding: 1.5rem; }

/* ── Cart Review ── */

.review-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}
.review-item:last-child { border-bottom: none; }

.review-item-info { flex: 1; }
.review-item-name {
    font-weight: 700;
    margin-bottom: 0.15rem;
}
.review-item-details {
    color: var(--deli-brown);
    font-size: 0.85rem;
}
.review-item-qty {
    font-size: 0.85rem;
    color: var(--deli-brown);
    margin-top: 0.15rem;
}
.review-item-price {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.2rem;
    color: var(--deli-red);
    margin-left: 1rem;
    white-space: nowrap;
}
.review-edit-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--deli-red);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
}
.review-edit-link:hover { text-decoration: underline; }

/* ── Form Elements ── */

.form-row {
    margin-bottom: 1rem;
}
.form-row:last-child { margin-bottom: 0; }

.form-row label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
}
.form-row label .required {
    color: var(--deli-red);
}

.form-row input,
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--deli-dark);
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    background: var(--deli-cream);
    transition: border-color 0.2s;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: none;
    border-color: var(--deli-red);
    background: white;
}
.form-row input.error,
.form-row select.error {
    border-color: var(--deli-red);
    background: rgba(214, 40, 40, 0.05);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--deli-brown);
    margin-top: 0.3rem;
}
.form-error {
    font-size: 0.8rem;
    color: var(--deli-red);
    margin-top: 0.3rem;
    font-weight: 600;
    display: none;
}
.form-error.visible { display: block; }

/* ── Toggle Buttons (Pickup/Delivery, ASAP/Scheduled) ── */

.toggle-group {
    display: flex;
    gap: 0;
    border: 2px solid var(--deli-dark);
    border-radius: 6px;
    overflow: hidden;
}
.toggle-btn {
    flex: 1;
    padding: 0.85rem 1rem;
    background: var(--deli-cream);
    border: none;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.15rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    text-align: center;
    color: var(--deli-brown);
}
.toggle-btn + .toggle-btn {
    border-left: 2px solid var(--deli-dark);
}
.toggle-btn.active {
    background: var(--deli-red);
    color: white;
}
.toggle-btn:hover:not(.active) {
    background: rgba(214, 40, 40, 0.1);
}
.toggle-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Delivery Section ── */

.delivery-fields { margin-top: 1rem; }

.address-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    display: none;
}
.address-status.visible { display: flex; }
.address-status.success {
    background: rgba(34, 139, 34, 0.1);
    border: 2px solid forestgreen;
    color: forestgreen;
}
.address-status.fail {
    background: rgba(214, 40, 40, 0.1);
    border: 2px solid var(--deli-red);
    color: var(--deli-red);
}
.address-status.loading {
    background: rgba(247, 179, 43, 0.15);
    border: 2px solid var(--deli-yellow);
    color: var(--deli-brown);
}

.delivery-minimum-note {
    background: var(--deli-yellow);
    color: var(--deli-dark);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border: 2px solid var(--deli-dark);
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 0.75rem;
}

/* ── Schedule Section ── */

.schedule-fields { margin-top: 1rem; }
.schedule-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ── Order Summary ── */

.summary-line {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 1rem;
}
.summary-line.total {
    border-top: 3px solid var(--deli-dark);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    font-weight: 700;
    font-size: 1.2rem;
}
.summary-line.total .summary-value {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.6rem;
    color: var(--deli-red);
}
.summary-label { color: var(--deli-brown); }
.summary-value { font-weight: 600; }
.summary-line.fee { color: var(--deli-brown); font-size: 0.95rem; }

/* ── Payment Section ── */

#clover-iframe-container {
    min-height: 60px;
    border-radius: 6px;
    background: white;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 2px solid #e0e0e0;
}

.clover-field {
    margin-bottom: 1rem;
}
.clover-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--deli-dark);
    margin-bottom: 0.35rem;
}
.clover-field > div {
    border: 2px solid #ccc;
    border-radius: 6px;
    padding: 0.75rem;
    background: white;
    min-height: 44px;
    transition: border-color 0.2s;
}
.clover-field > div:focus-within,
.clover-field > div:hover {
    border-color: var(--deli-yellow);
}

.clover-half-row {
    display: flex;
    gap: 1rem;
}
.clover-field-half {
    flex: 1;
}

.card-error-message {
    color: var(--deli-red);
    font-size: 0.85rem;
    min-height: 1.2em;
    margin-top: 0.25rem;
}

.payment-placeholder {
    text-align: center;
    padding: 2rem;
    color: var(--deli-brown);
}
.payment-placeholder p {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.payment-secure-note {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--deli-brown);
    margin-top: 0.5rem;
}

/* ── Place Order Button ── */

.place-order-btn {
    width: 100%;
    padding: 1.25rem;
    background: var(--deli-yellow);
    color: var(--deli-dark);
    border: 3px solid var(--deli-dark);
    border-radius: 8px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
    letter-spacing: 2px;
    cursor: pointer;
    box-shadow: 5px 5px 0 var(--deli-dark);
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}
.place-order-btn:hover:not(:disabled) {
    transform: translate(-2px, -2px);
    box-shadow: 7px 7px 0 var(--deli-dark);
}
.place-order-btn:active:not(:disabled) {
    transform: translate(0, 0);
    box-shadow: 5px 5px 0 var(--deli-dark);
}
.place-order-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.place-order-btn .btn-total {
    background: var(--deli-dark);
    color: var(--deli-yellow);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 1.3rem;
}

/* ── Global Error ── */

.global-error {
    background: rgba(214, 40, 40, 0.1);
    border: 2px solid var(--deli-red);
    color: var(--deli-red);
    padding: 1rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    margin-top: 1rem;
    display: none;
}
.global-error.visible { display: block; }

/* ── Confirmation Screen ── */

.confirmation {
    display: none;
    text-align: center;
    padding: 2rem 0;
}
.confirmation.visible { display: block; }

.confirm-icon {
    width: 80px; height: 80px;
    background: var(--deli-yellow);
    border: 3px solid var(--deli-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2.5rem;
    box-shadow: 4px 4px 0 var(--deli-dark);
}

.confirm-order-number {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 3rem;
    color: var(--deli-red);
    margin-bottom: 0.25rem;
}

.confirm-message {
    font-size: 1.1rem;
    color: var(--deli-brown);
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* Status Tracker */
.status-tracker {
    background: white;
    border: 2px solid var(--deli-dark);
    border-radius: 8px;
    box-shadow: 4px 4px 0 var(--deli-dark);
    padding: 1.5rem;
    margin: 1.5rem auto;
    max-width: 500px;
    text-align: left;
}

.status-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    color: var(--deli-brown);
    font-size: 0.95rem;
}
.status-step.active {
    color: var(--deli-dark);
    font-weight: 700;
}
.status-step.done {
    color: forestgreen;
}

.status-dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid var(--deli-brown);
    flex-shrink: 0;
}
.status-step.active .status-dot {
    background: var(--deli-red);
    border-color: var(--deli-red);
    box-shadow: 0 0 0 3px rgba(214, 40, 40, 0.25);
}
.status-step.done .status-dot {
    background: forestgreen;
    border-color: forestgreen;
}

.estimated-time {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2rem;
    color: var(--deli-dark);
    margin: 1rem 0;
}

.confirm-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}
.confirm-actions a {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--deli-dark);
    border-radius: 4px;
    box-shadow: 3px 3px 0 var(--deli-dark);
    text-decoration: none;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 1px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.confirm-actions a:hover {
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 var(--deli-dark);
}
.confirm-actions .btn-primary {
    background: var(--deli-red);
    color: white;
}
.confirm-actions .btn-secondary {
    background: white;
    color: var(--deli-dark);
}

/* ── Footer ── */

footer {
    background: var(--deli-dark);
    border-top: 4px solid var(--deli-yellow);
    padding: 3rem 2rem;
    text-align: center;
}
.footer-logo-img { height: 150px; width: auto; margin-bottom: 1.5rem; }
footer p { color: rgba(255, 248, 231, 0.6); font-size: 0.9rem; }
footer a { color: var(--deli-yellow); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ── Spinner ── */

.spinner {
    width: 20px; height: 20px;
    border: 3px solid rgba(0,0,0,0.15);
    border-top-color: var(--deli-dark);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */

@media (max-width: 600px) {
    .page-header { padding: 6rem 1rem 2rem; }
    .page-header h1 { font-size: 2.5rem; }
    .page-header::before { font-size: 6rem; }
    .checkout-container { padding: 1.5rem 1rem 3rem; }
    .section-body { padding: 1rem; }
    .schedule-row { grid-template-columns: 1fr; }
    nav { padding: 0.75rem 1rem; }
    .nav-links { gap: 1rem; }
    .nav-links a:not(.back-btn) { display: none; }
    .confirm-order-number { font-size: 2.25rem; }
}
