/* ==========================================================
   Payment page – minimalist redesign v2
   ========================================================== */

:root {
    --pg-bg:           #f0f2f5;
    --pg-surface:      #ffffff;
    --pg-border:       #e5e7eb;
    --pg-text:         #111827;
    --pg-muted:        #6b7280;
    --pg-subtle:       #f8fafa;
    --pg-accent:       #049aa6;
    --pg-accent-bg:    #e6f7f8;
    --pg-success-bg:   #f0fdf4;
    --pg-success-bd:   #bbf7d0;
    --pg-success-text: #16a34a;
    --pg-danger:       #dc2626;
    --pg-danger-bg:    #fef2f2;
    --pg-danger-bd:    #fecaca;
    --pg-radius-lg:    1.25rem;
    --pg-radius-md:    0.75rem;
    --pg-radius-sm:    0.5rem;
    --pg-shadow:       0 4px 24px rgba(0, 0, 0, .06);
}

/* ── Base ── */
body {
    background: var(--pg-bg);
    min-height: 100vh;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--pg-text);
    font-size: 1rem;
}

body > .container {
    background: transparent !important;
    max-width: 1200px !important;
    padding: 0 1rem !important;
    margin: 0 auto !important;
}

body > .container > nav {
    padding: 1rem 1.5rem;
}

/* ══════════════════════════════════════
   Split layout (Stripe-checkout style)
   ══════════════════════════════════════ */
.pay-split {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - 76px);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    border-radius: var(--pg-radius-lg);
    overflow: hidden;
    box-shadow: var(--pg-shadow);
}

.pay-split__left {
    flex: 1 1 44%;
    max-width: 44%;
    background: var(--pg-accent, #049aa6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 3rem 3rem 3rem 4rem;
}

.pay-split__left-inner {
    width: 100%;
    max-width: 420px;
}

.pay-split__right {
    flex: 1 1 56%;
    max-width: 56%;
    background: var(--pg-surface);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 3rem 4rem 0 3rem;
}

.pay-split__right-inner {
    flex: 1 0 auto;
    width: 100%;
    max-width: 460px;
}

/* ── Brand logo badge ── */
.brand-badge {
    display: inline-flex;
    background: #fff;
    border-radius: 1rem;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0 1.25rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
}

.brand-badge img {
    max-height: 44px;
    max-width: 150px;
    width: auto;
    object-fit: contain;
}

.pay-split__support {
    color: rgba(255, 255, 255, .75);
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0 0 0.25rem;
}

.pay-split__amount {
    color: #fff;
    font-size: 2.4rem;
    font-weight: 700;
    margin: 0 0 2rem;
    line-height: 1.1;
}

.pay-split__amount span {
    font-size: 1.1rem;
    font-weight: 500;
    opacity: .8;
    margin-left: 0.3rem;
}

/* ══════════════════════════════════════
   Info sections (left panel)
   ══════════════════════════════════════ */
.info-section {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--pg-border);
}

.info-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

/* Section title / toggle */
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pg-muted);
    margin: 0 0 1rem;
    padding: 0;
    border: none;
    background: none;
    cursor: default;
    user-select: none;
}

.section-title[data-toggle="collapse"] {
    cursor: pointer;
}

.section-title[data-toggle="collapse"]:hover {
    color: var(--pg-text);
}

.section-chevron {
    font-size: 0.8rem;
    transition: transform 0.22s ease;
    flex-shrink: 0;
}

.section-title:not(.collapsed) .section-chevron {
    transform: rotate(180deg);
}

/* Payment methods section title (no toggle) */
.pay-methods-title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pg-muted);
    margin: 0 0 1.25rem;
    cursor: default;
}

/* ── Field rows ── */
.info-fields {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-field {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.65rem 0;
    border-bottom: 1px solid #e9ecf0;
    gap: 1rem;
}

.info-field:last-child {
    border-bottom: none;
}

.field-label {
    color: var(--pg-muted);
    font-size: 0.95rem;
    flex-shrink: 0;
}

.field-value {
    font-weight: 500;
    color: var(--pg-text);
    font-size: 0.95rem;
    text-align: right;
    word-break: break-word;
}

/* ── Price summary ── */
.price-summary {
    margin-top: 1rem;
    border: 1px solid var(--pg-border);
    border-radius: var(--pg-radius-sm);
    overflow: hidden;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.125rem;
    background: var(--pg-subtle);
    font-size: 0.95rem;
    color: var(--pg-muted);
    border-bottom: 1px solid var(--pg-border);
}

.price-row:last-child {
    border-bottom: none;
}

.price-row span:last-child {
    font-weight: 500;
    color: var(--pg-text);
}

.price-ttc {
    background: var(--pg-accent-bg);
    padding: 1rem 1.125rem;
}

.price-ttc span:first-child {
    font-weight: 600;
    color: var(--pg-accent);
    font-size: 1rem;
}

.price-ttc strong {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--pg-accent);
}

/* ── Light variants (colored left panel) ── */
.info-fields--light .info-field {
    border-bottom-color: rgba(255, 255, 255, .18);
}

.info-fields--light .field-label {
    color: rgba(255, 255, 255, .65);
}

.info-fields--light .field-value {
    color: #fff;
}

.price-summary--light {
    border-color: rgba(255, 255, 255, .22);
}

.price-summary--light .price-row {
    background: rgba(255, 255, 255, .08);
    border-bottom-color: rgba(255, 255, 255, .14);
    color: rgba(255, 255, 255, .7);
}

.price-summary--light .price-row span:last-child {
    color: #fff;
}

.price-ttc--light {
    background: rgba(255, 255, 255, .16) !important;
}

.price-ttc--light span:first-child {
    color: rgba(255, 255, 255, .9) !important;
}

.price-ttc--light strong {
    color: #fff !important;
}

/* ══════════════════════════════════════
   Payment method cards (right panel)
   ══════════════════════════════════════ */
.method-card {
    border: 1px solid var(--pg-border);
    border-radius: var(--pg-radius-md);
    margin-bottom: 0.75rem;
    overflow: hidden;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.method-card:last-child {
    margin-bottom: 0;
}

.method-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
}

/* Method header (the clickable row) */
.method-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.125rem 1.375rem;
    background: var(--pg-surface);
    cursor: pointer;
    text-decoration: none;
    color: var(--pg-text);
    transition: background 0.15s ease;
    border: none;
    width: 100%;
}

.method-header:hover,
.method-header:focus {
    background: var(--pg-subtle);
    color: var(--pg-text);
    text-decoration: none;
    outline: none;
}

.method-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
    font-size: 1rem;
}

.method-header img {
    width: 44px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 4px;
}

.method-chevron {
    font-size: 0.8rem;
    color: var(--pg-muted);
    transition: transform 0.22s ease;
    flex-shrink: 0;
}

.method-header:not(.collapsed) .method-chevron {
    transform: rotate(90deg);
}

/* Method body (expanded area) */
.method-body {
    padding: 1.25rem;
    border-top: 1px solid var(--pg-border);
    background: #fafafa;
}

.method-desc {
    color: var(--pg-muted);
    font-size: 0.9rem;
    line-height: 1.55;
    margin-bottom: 1.125rem;
}

.method-logos {
    margin-bottom: 1.125rem;
}

.method-logos img {
    height: 26px;
    width: auto;
}

/* ── Balance breakdown grid ── */
.balance-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.125rem;
}

.balance-cell {
    background: var(--pg-surface);
    border: 1px solid var(--pg-border);
    border-radius: var(--pg-radius-sm);
    padding: 0.75rem 0.625rem;
    text-align: center;
}

.balance-cell span {
    display: block;
    font-size: 0.68rem;
    color: var(--pg-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.375rem;
    line-height: 1.3;
}

.balance-cell strong {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--pg-text);
}

.balance-cell--positive {
    background: var(--pg-success-bg);
    border-color: var(--pg-success-bd);
}

.balance-cell--positive strong {
    color: var(--pg-success-text);
}

.balance-cell--negative {
    background: var(--pg-danger-bg);
    border-color: var(--pg-danger-bd);
}

.balance-cell--negative strong {
    color: var(--pg-danger);
}

/* ══════════════════════════════════════
   CTA button
   ══════════════════════════════════════ */
.btn-pay {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.8rem 1.5rem;
    background: var(--pg-accent);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.2s ease;
    line-height: 1;
}

.btn-pay:hover:not(:disabled) {
    filter: brightness(0.9);
}

.btn-pay:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
}

.btn-pay .spinner-border {
    display: none;
    width: 0.9rem;
    height: 0.9rem;
    border-width: 2px;
    vertical-align: middle;
}

.btn-pay:disabled .spinner-border {
    display: inline-block;
}

/* ── Inline errors ── */
.method-error {
    margin: 0.75rem 0 0;
    color: var(--pg-danger);
    font-size: 0.85rem;
    text-align: center;
}

/* ── Full-panel error (404) ── */
.pay-error {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 1rem 1.25rem;
    background: var(--pg-danger-bg);
    border: 1px solid var(--pg-danger-bd);
    border-radius: var(--pg-radius-md);
    color: var(--pg-danger);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ── Back link ── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--pg-muted);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.15s ease;
}

.back-link:hover {
    color: var(--pg-text);
    text-decoration: none;
}

.back-link--light {
    color: rgba(255, 255, 255, .75);
    margin-bottom: 1rem;
}

.back-link--light:hover {
    color: #fff;
}

/* ── Footer row (bottom of right panel) ── */
.pay-split__footer {
    width: 100%;
    max-width: 460px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--pg-border);
    flex-wrap: wrap;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.footer-link {
    color: var(--pg-muted);
    font-size: 0.78rem;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.footer-link:hover {
    color: var(--pg-text);
    text-decoration: none;
}

.footer-sep {
    color: var(--pg-border);
    font-size: 0.78rem;
}

.mth-payment {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.mth-payment img {
    height: 20px;
    width: auto;
    opacity: 0.65;
}

/* Hide the original site footer on payment page */
footer {
    display: none;
}

/* ══════════════════════════════════════
   Responsive
   ══════════════════════════════════════ */
@media (max-width: 900px) {
    .pay-split {
        flex-direction: column;
        min-height: auto;
    }

    .pay-split__left,
    .pay-split__right {
        flex: 1 1 auto;
        max-width: 100%;
        justify-content: flex-start;
    }

    .pay-split__left {
        padding: 2rem 1.75rem;
    }

    .pay-split__right {
        padding: 2rem 1.75rem 0;
        align-items: stretch;
    }

    .pay-split__left-inner,
    .pay-split__right-inner,
    .pay-split__footer {
        max-width: 100%;
    }
}

@media (max-width: 576px) {
    .balance-grid {
        grid-template-columns: 1fr;
    }

    .info-field {
        flex-direction: column;
        gap: 0.1rem;
    }

    .field-value {
        text-align: left;
    }

    .price-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.1rem;
    }

    .price-ttc strong {
        font-size: 1rem;
    }

    .pay-split__amount {
        font-size: 1.8rem;
    }
}
