/* Checkout page — embedded Stripe PaymentIntent flow.
   Mobile-first single column. Two-column grid at 768px+. */

.checkout-page {
    max-width: 960px;
    margin: 1rem auto 2rem;
    padding: 0 1rem;
}

/* ── Two-column layout (desktop) ─────────────────────────────────── */
.checkout-columns {
    display: flex;
    flex-direction: column;
}

/* Mobile: payment column first, product column second */
.checkout-col-right { order: 1; }
.checkout-col-left  { order: 2; }

@media (min-width: 768px) {
    .checkout-columns {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2.5rem;
        align-items: start;
    }

    /* Desktop: restore natural order (left=1, right=2) */
    .checkout-col-left  { order: 1; }
    .checkout-col-right { order: 2; }

    .checkout-col-left {
        position: sticky;
        top: 2rem;
    }

    /* Remove bottom borders on desktop — columns provide visual separation */
    .checkout-product,
    .checkout-receive {
        border-bottom: none;
        padding-bottom: 0;
    }
}

/* ── 1. Product display + download button ────────────────────────── */
.checkout-product {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.checkout-thumbnail {
    display: inline-block;
    margin-bottom: 0.75rem;
}

.checkout-thumbnail img {
    max-width: 200px;
    max-height: 360px;
    display: block;
}

.checkout-product-info {
    margin-bottom: 0.5rem;
}

.checkout-product-desc {
    font-size: 1rem;
    line-height: 1.4;
    margin-bottom: 0.25rem;
}

.checkout-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-accent);
}

/* Download button — disabled state (pre-payment) */
.checkout-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1.25rem;
    font-size: 1rem;
    font-family: var(--font-heading);
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.1s;
    margin-top: 0.5rem;
}

.checkout-download-btn--disabled {
    background: #e0e0e0;
    color: #999;
    border: 1px solid #ccc;
    cursor: default;
    pointer-events: none;
}

/* Download button — active state (post-payment) */
.checkout-download-btn--active {
    background: linear-gradient(to bottom, #2e7d32, #1b5e20);
    color: #fff;
    border: 1px solid #1b5e20;
    border-bottom: 3px solid #0d3b0f;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.18), 0 4px 8px rgba(0,0,0,0.06),
                inset 0 1px 0 rgba(255,255,255,0.2);
}

.checkout-download-btn--active:hover {
    background: linear-gradient(to bottom, #388e3c, #2e7d32);
    transform: translateY(-1px);
}

.checkout-download-btn--active:active {
    background: linear-gradient(to bottom, #1b5e20, #0d3b0f);
    transform: translateY(2px);
    border-bottom-width: 1px;
}

/* ── 2. What You'll Receive ──────────────────────────────────────── */
.checkout-receive {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.checkout-section-heading {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.checkout-receive-list {
    list-style: none;
    margin: 0;
    padding: 0;
    color: var(--color-muted);
    font-size: 0.8rem;
    line-height: 1.5;
}

.checkout-receive-list li {
    padding-left: 1.25rem;
    position: relative;
    margin-bottom: 0.2rem;
}

.checkout-receive-list li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    color: #2e7d32;
    font-weight: 700;
}

/* ── 4 + 5. Payment form section ─────────────────────────────────── */
.checkout-form-section {
    margin-bottom: 0.75rem;
}

#checkout-email {
    width: 100%;
    padding: 0.65rem 0.75rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-family: var(--font-sans);
    box-sizing: border-box;
}

#card-element {
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    margin-bottom: 1rem;
    background: #fff;
}

#checkout-pay-btn {
    display: block;
    margin: 0 auto;
    padding: 0.5rem 2rem;
    font-size: 1.1rem;
    font-family: var(--font-heading);
    font-weight: 600;
    /* gradient, border, shadow, hover, active: provided by .btn-primary (components.css) */
}

#checkout-pay-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

#checkout-pay-btn .spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#payment-message {
    color: #df1b41;
    font-size: 0.95rem;
    margin-top: 0.75rem;
    text-align: center;
    min-height: 1.4em;
}

.checkout-trust-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
    color: var(--color-muted);
    font-size: 0.8rem;
    line-height: 1.5;
}

.checkout-trust-list li {
    margin-bottom: 0.2rem;
}

.checkout-privacy-note {
    text-align: center;
    color: var(--color-muted);
    font-size: 0.75rem;
    margin-top: 0.5rem;
    line-height: 1.4;
}

.checkout-contact {
    text-align: center;
    color: var(--color-muted);
    font-size: 0.75rem;
    margin-top: 0.25rem;
    line-height: 1.4;
}

.checkout-loading {
    text-align: center;
    padding: 2rem 0;
    color: var(--color-muted);
}

/* ── 6. Post-payment success state ───────────────────────────────── */
.checkout-success {
    text-align: center;
    padding: 1.5rem 0;
}

.checkout-success-icon {
    width: 48px;
    height: 48px;
    line-height: 48px;
    font-size: 1.5rem;
    background: #2e7d32;
    color: #fff;
    border-radius: 50%;
    margin: 0 auto 0.75rem;
}

.checkout-success-msg {
    font-size: 1rem;
    color: var(--color-text);
    margin: 0 0 0.75rem;
}

.checkout-success-hint {
    font-size: 0.9rem;
    color: var(--color-muted);
    margin: 0;
}

.checkout-success-hint a {
    color: var(--color-accent);
}

/* ── Payment method tabs ─────────────────────────────────────────── */
.checkout-tabs {
    display: flex;
    border-bottom: 2px solid #ddd;
    margin-bottom: 1rem;
}
.checkout-tab {
    flex: 1;
    padding: 0.6rem 0;
    text-align: center;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: #888;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.checkout-tab:hover { color: #555; }
.checkout-tab--active {
    color: var(--color-text);
    border-bottom-color: var(--color-accent);
}
.checkout-tab-panel { display: none; }
.checkout-tab-panel--active { display: block; }

/* ── Shared email field (above tabs) ─────────────────────────────── */
#checkout-email-wrapper { margin-bottom: 1rem; }
#checkout-email-wrapper label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--color-text);
}

/* ── Stripe elements spacing ─────────────────────────────────────── */
#express-checkout-element { margin-top: 0.75rem; }

/* ── PayPal panel ────────────────────────────────────────────────── */
#paypal-button-container { min-height: 44px; }
.paypal-total {
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    margin-top: 0.5rem;
    color: var(--color-muted);
}

/* ── Responsive: Pay button text + PayPal price ──────────────────── */
/* Mobile: price in button, price under PayPal */
#checkout-pay-btn .btn-price { display: inline; }
.paypal-total { display: block; }
/* Desktop (768px+): no price in button, no PayPal price */
@media (min-width: 768px) {
    #checkout-pay-btn .btn-price { display: none; }
    .paypal-total { display: none; }
}

/* ── Payment form hidden after success ───────────────────────────── */
.checkout-form-section--hidden {
    display: none;
}
