/*
 * Wizard Plan Selector — styles for PlanSelector.cshtml
 *
 * Self-contained: loaded by WizardContainer wherever PlanSelector appears, and by nothing else.
 *
 * The screen asks for money at the end of a long wizard, so the visual order deliberately puts
 * WHAT YOU GET above WHAT IT COSTS: a warm hero, the free start as the leading offer, then two
 * equally-weighted plan cards whose price sits on a quiet muted line rather than in the headline.
 * Green is the single accent and is spent only on actions and on the free start.
 *
 * Naming: the selection cards are .ps-plan-card, NOT .plan-card — the dashboard owns a completely
 * different .plan-card (a small pill in its toolbar) in dashboard/styles.css, and sharing the name
 * meant carrying a stack of reset declarations here. The expander inside a card keeps its
 * .plan-card-details / .plan-card-features names because wizard-plan-selector.js measures them.
 */

/* === Container === */
.wizard-payment-container {
    width: 100%;
    max-width: 100%;
    /* Prevent any child (grid, absolute elements, Stripe iframe) from causing
       horizontal scroll on narrow viewports. */
    overflow-x: hidden;
    box-sizing: border-box;
}

/* === Views ===
   Screens are shown one at a time by wizard-plan-selector.js. */
.payment-selection-view,
.payment-checkout-view,
.payment-processing-view,
.payment-success-view,
.payment-error-view {
    display: block;
}

.payment-selection-view.hidden,
.payment-checkout-view.hidden,
.payment-processing-view.hidden,
.payment-success-view.hidden,
.payment-error-view.hidden {
    display: none;
}

/* Navigation this view owns (the wizard's own Back/Continue are hidden on the payment step). */
.ps-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
}

/* width:auto overrides wizard-create.css's mobile `.btn { width: 100% }` — that rule is written
   for .wizard-buttons, which stacks into a column below 600px. This bar stays a row (Back left,
   Continue right), so two full-width buttons would simply overflow it. */
.ps-nav .btn { flex: 0 0 auto; width: auto; }
.ps-nav #psNextBtn { margin-left: auto; }

/* ═══════════════════════════════════════════════════════════
   Hero — "that's everything we need"
   ═══════════════════════════════════════════════════════════ */
.ps-hero {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 0 0 13px;
    animation: ps-rise 420ms cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.ps-hero-art {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    color: #16a34a;
}

.ps-hero-copy { min-width: 0; }

.ps-hero-art svg { width: 100%; height: 100%; overflow: visible; }

/* Soft halo that breathes behind the mark — the only movement once the tick has drawn. */
.ps-hero-halo {
    fill: rgba(22, 163, 74, 0.10);
    transform-origin: 32px 32px;
    animation: ps-breathe 3.6s ease-in-out infinite;
}

.ps-hero-pad {
    opacity: 0.55;
    animation: ps-fade-in 360ms ease-out 120ms backwards;
}

/* Draws itself once, as the screen arrives. */
.ps-hero-tick {
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
    animation: ps-draw 520ms cubic-bezier(0.65, 0, 0.45, 1) 300ms forwards;
}

.ps-hero-spark {
    opacity: 0;
    transform-origin: 52px 20px;
    animation: ps-twinkle 2.6s ease-in-out 900ms infinite;
}

.ps-hero-spark--2 {
    transform-origin: 12px 40.5px;
    animation-delay: 1.7s;
}

.ps-hero-title {
    font-size: 16.5px;
    font-weight: 800;
    line-height: 1.25;
    margin: 0 0 2px;
    color: var(--bs-heading-color);
}

.ps-hero-sub {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--bs-secondary-color);
}

@keyframes ps-rise {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

@keyframes ps-fade-in {
    from { opacity: 0; }
    to   { opacity: 0.55; }
}

@keyframes ps-draw {
    to { stroke-dashoffset: 0; }
}

@keyframes ps-breathe {
    0%, 100% { transform: scale(1);    opacity: 1; }
    50%      { transform: scale(1.09); opacity: 0.7; }
}

@keyframes ps-twinkle {
    0%, 70%, 100% { opacity: 0; transform: scale(0.6); }
    80%           { opacity: 1; transform: scale(1); }
    90%           { opacity: 0.5; transform: scale(0.85); }
}

/* ═══════════════════════════════════════════════════════════
   Free start — the leading offer
   ═══════════════════════════════════════════════════════════
   The lowest-risk way in and the one most people want first, so it leads the screen: accent-tinted
   panel, accent border, a badge and its own call to action. It stays outline-on-tint rather than a
   solid fill so it invites without shouting down the two paid cards below it. */
.ps-free {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 100%;
    padding: 13px 14px 12px;
    margin-bottom: 11px;
    overflow: hidden;
    background: rgba(22, 163, 74, 0.07);
    border: 1.5px solid rgba(22, 163, 74, 0.45);
    border-radius: 14px;
    color: var(--bs-body-color);
    text-align: center;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    animation: ps-rise 440ms cubic-bezier(0.4, 0, 0.2, 1) 60ms backwards;
}

/* A slow sheen crossing the panel — enough to catch the eye without asking for a click. */
.ps-free::after {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 45%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.42), transparent);
    animation: ps-sheen 5.5s ease-in-out 1.2s infinite;
    pointer-events: none;
}

.ps-free:hover {
    background: rgba(22, 163, 74, 0.13);
    border-color: #16a34a;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(22, 163, 74, 0.2);
}

.ps-free:active { transform: translateY(0); box-shadow: none; }

.ps-free:focus-visible {
    outline: none;
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.3);
}

.ps-free-top {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.ps-free-badge {
    padding: 3px 9px;
    border-radius: 20px;
    background: #16a34a;
    color: #fff;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ps-free-main {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.25;
    color: var(--bs-body-color);
}

.ps-free-sub {
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--bs-secondary-color);
}

/* Looks like the button it is — the panel is clickable everywhere, but the eye needs a target. */
.ps-free-cta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    padding: 7px 17px;
    border-radius: 8px;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(22, 163, 74, 0.3);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ps-free-cta svg { transition: transform 0.2s ease; }
.ps-free:hover .ps-free-cta { box-shadow: 0 4px 10px rgba(22, 163, 74, 0.4); }
.ps-free:hover .ps-free-cta svg { transform: translateX(3px); }

@keyframes ps-sheen {
    0%        { left: -60%; }
    35%, 100% { left: 130%; }
}

/* Separates the free start from the paid cards, so the two read as different decisions rather
   than one list of three. */
.ps-choice-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: var(--bs-secondary-color);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.ps-choice-divider::before,
.ps-choice-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--bs-border-color);
}

/* ═══════════════════════════════════════════════════════════
   Plan cards
   ═══════════════════════════════════════════════════════════
   The two plans are peers, not a good/better pair, so they share one neutral treatment and one
   equally confident action. Each card shows what you need to choose — what the plan is, what it
   does, what it costs — and hides its feature list and small print behind one shared toggle
   below (see .plan-card-details and .ps-details-toggle). */
.plan-cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
    /* Ensure grid columns never push the container wider than its parent. */
    min-width: 0;
    /* stretch keeps the two cards identical in height. Both expand together, so neither is ever
       left padding out empty space next to an open neighbour. */
    align-items: stretch;
}

.ps-plan-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
    padding: 14px 13px 13px;
    border-radius: 14px;
    background: var(--bs-body-bg);
    border: 1.5px solid var(--bs-border-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    /* Prevent long feature text from stretching the card beyond the grid column. */
    min-width: 0;
    transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    animation: ps-card-in 440ms cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.plan-cards-grid .ps-plan-card:nth-child(1) { animation-delay: 120ms; }
.plan-cards-grid .ps-plan-card:nth-child(2) { animation-delay: 200ms; }

.ps-plan-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.09);
    border-color: rgba(22, 163, 74, 0.5);
}

.ps-plan-card.is-expanded { border-color: var(--bs-secondary-color); }

@keyframes ps-card-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

.ps-plan-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: rgba(22, 163, 74, 0.1);
    color: #16a34a;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ps-plan-icon svg { width: 17px; height: 17px; }
.ps-plan-card:hover .ps-plan-icon { transform: scale(1.08) rotate(-4deg); }

/* The name and description carry the decision, so they are sized to be read rather than
   scanned — which is also what gives the cards their presence on the screen. */
.ps-plan-name {
    font-size: 15.5px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--bs-body-color);
}

.ps-plan-desc {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--bs-body-color);
    opacity: 0.82;
}

/* Price, in full, on one quiet line: amount and period, then how it is billed underneath. Never
   the headline — but never hidden either, and never abbreviated. */
.ps-plan-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 4px;
    margin-top: 1px;
    padding-top: 8px;
    border-top: 1px dashed var(--bs-border-color);
}

.ps-plan-price-amount {
    font-size: 14px;
    font-weight: 700;
    color: var(--bs-secondary-color);
}

.ps-plan-price-period {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--bs-secondary-color);
    opacity: 0.85;
}

.ps-plan-price-note {
    flex-basis: 100%;
    margin-top: 2px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--bs-secondary-color);
    opacity: 0.85;
}

/* Plan action — the accent on the screen, so the next step is unambiguous. The price is shown
   once, on the card's price line, and never repeated on the button. */
.ps-plan-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    /* min-height keeps the two actions on the same line even if one label ever wraps — the cards
       stretch to a common height, but the buttons inside them would not otherwise agree. */
    min-height: 38px;
    padding: 10px 8px;
    border: none;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.2;
    cursor: pointer;
    /* auto pins the button to the bottom of a stretched card, so both actions sit on the same
       line even when one plan's description wraps to more lines than the other's. */
    margin-top: auto;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #fff;
    box-shadow: 0 2px 4px rgba(22, 163, 74, 0.3);
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.ps-plan-btn svg { flex-shrink: 0; transition: transform 0.2s ease; }

.ps-plan-btn:hover {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(22, 163, 74, 0.4);
}

.ps-plan-btn:hover svg { transform: translateX(2px); }
.ps-plan-btn:active { transform: translateY(0); }

.ps-plan-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.35);
}

/* === Expandable details (both cards open together — see .ps-details-toggle) ===
   Animates to the content's exact height, which wizard-plan-selector.js measures and writes to
   the inline height; it gives both cards the SAME height so the two lists stay row-aligned and
   the actions never drift apart. A max-height guess would either clip long feature lists or make
   the easing land early; the grid 0fr→1fr trick resolves to 0 here because this box's height is
   definite. */
.plan-card-details {
    height: 0;
    overflow: hidden;
    transition: height 320ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Measured for the open height, so its own spacing must be inside the measured box. */
.plan-card-details-inner {
    padding-top: 9px;
    border-top: 1px solid var(--bs-border-color);
}

.plan-card-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.plan-card-features li {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    font-size: 11.5px;
    color: var(--bs-body-color);
    line-height: 1.35;
    padding-top: 5px;
    /* Features fade in behind the expanding box so the reveal reads as one motion. */
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 240ms ease, transform 240ms ease;
}

.ps-plan-card.is-expanded .plan-card-features li {
    opacity: 1;
    transform: none;
}

.ps-plan-card.is-expanded .plan-card-features li:nth-child(1) { transition-delay: 70ms; }
.ps-plan-card.is-expanded .plan-card-features li:nth-child(2) { transition-delay: 115ms; }
.ps-plan-card.is-expanded .plan-card-features li:nth-child(3) { transition-delay: 160ms; }
.ps-plan-card.is-expanded .plan-card-features li:nth-child(4) { transition-delay: 205ms; }
.ps-plan-card.is-expanded .plan-card-features li:nth-child(5) { transition-delay: 250ms; }
.ps-plan-card.is-expanded .plan-card-features li:nth-child(6) { transition-delay: 295ms; }

/* Payment small print — quieter than the features, and only revealed with them. */
.plan-card-fineprint {
    list-style: none;
    padding: 8px 0 0;
    margin: 8px 0 0;
    border-top: 1px dashed var(--bs-border-color);
}

.plan-card-fineprint li {
    position: relative;
    padding-left: 10px;
    font-size: 10px;
    line-height: 1.4;
    color: var(--bs-secondary-color);
}

.plan-card-fineprint li + li { margin-top: 4px; }

.plan-card-fineprint li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.6;
}

.plan-check-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    color: var(--bs-secondary-color);
    margin-top: 2px;
}

/* === Shared details toggle === */
.ps-details-row {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.ps-details-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    border: 1px solid var(--bs-border-color);
    border-radius: 20px;
    background: none;
    color: var(--bs-secondary-color);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.ps-details-toggle:hover {
    color: var(--bs-body-color);
    border-color: var(--bs-secondary-color);
    background: var(--bs-secondary-bg);
}

.ps-details-toggle:focus-visible {
    outline: none;
    color: var(--bs-body-color);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.25);
}

.ps-details-toggle-chevron {
    flex-shrink: 0;
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.ps-details-toggle[aria-expanded="true"] .ps-details-toggle-chevron { transform: rotate(180deg); }

/* ═══════════════════════════════════════════════════════════
   Checkout
   ═══════════════════════════════════════════════════════════ */
.checkout-form {
    display: flex;
    flex-direction: column;
    gap: 11px;
    width: 100%;
    box-sizing: border-box;
}

.checkout-lead {
    margin: 0 0 1px;
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--bs-secondary-color);
    text-align: center;
}

.checkout-plan-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
}

/* Neutral for both plans — on the checkout screen the plan is already decided, so the pill is
   a reminder rather than a choice competing for attention. */
.checkout-plan-pill--continuous,
.checkout-plan-pill--full {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color);
}

.checkout-plan-price {
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--bs-body-color);
    white-space: nowrap;
}

/* Cardholder name field — mirrors Stripe's Input appearance so the two inputs look like a
   coherent set. Colours/radii match buildStripeAppearance(). */
.checkout-field-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.checkout-field-label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    line-height: 1.3;
}

.checkout-field-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    color: #1f2937;
    font-size: 14px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.checkout-field-input::placeholder { color: #9ca3af; }

.checkout-field-input:focus {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

.checkout-field-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f3f4f6;
}

.checkout-element-wrapper {
    /* Stripe injects an iframe here; give it room to breathe.
       Stripe renders its own border inside the element. */
    min-height: 56px;
    border-radius: 8px;
}

.checkout-error-msg {
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #dc2626;
    font-size: 13px;
    line-height: 1.45;
}

.checkout-error-msg.hidden { display: none; }

/* Submit button — one accent for both plans; the plan is already chosen by this point. */
.checkout-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(22, 163, 74, 0.3);
}

.checkout-submit-btn:hover {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(22, 163, 74, 0.4);
}

.checkout-submit-btn:active { transform: translateY(0); }

.checkout-submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* === Trust line below submit button ===
   Selected plan pill + price on the left, then lock · cancel · Stripe wordmark. One compact row,
   so no separate header block is needed. */
.checkout-trust-line {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    padding: 6px 0 2px;
    color: var(--bs-secondary-color);
}

.checkout-trust-cancel {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--bs-secondary-color);
    letter-spacing: 0.01em;
}

.checkout-trust-sep {
    font-size: 12px;
    opacity: 0.6;
    margin: 0 2px;
}

.stripe-lock-icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    opacity: 0.7;
}

/* Stripe wordmark — Stripe's brand purple, distinctive enough to be recognisable. */
.stripe-wordmark {
    height: 14px;
    width: auto;
    color: #635bff;
    flex-shrink: 0;
    vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════
   Buttons shared by the success / error screens
   ═══════════════════════════════════════════════════════════ */
.payment-buttons {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
    gap: 8px;
}

.payment-btn {
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.payment-btn--primary {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(22, 163, 74, 0.3);
}

.payment-btn--primary:hover {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(22, 163, 74, 0.4);
}

.payment-btn--primary:active { transform: translateY(0); }

.payment-btn--primary:disabled {
    background: #86efac;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Full-width button variant */
.payment-btn--pay {
    width: 100%;
    padding: 11px 20px;
    font-size: 16px;
}

.payment-btn--secondary {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color);
    box-shadow: none;
}

.payment-btn--secondary:hover {
    background: var(--bs-tertiary-bg);
    transform: translateY(-1px);
}

.payment-buttons--error { gap: 8px; }

.payment-buttons--error .payment-btn--secondary {
    flex: 0 0 auto;
    width: auto;
}

/* ═══════════════════════════════════════════════════════════
   Processing
   ═══════════════════════════════════════════════════════════ */
.payment-processing-state {
    text-align: center;
    padding: 36px 14px;
}

.payment-spinner {
    width: 38px;
    height: 38px;
    border: 3px solid var(--bs-border-color);
    border-top: 3px solid #16a34a;
    border-radius: 50%;
    margin: 0 auto 14px;
    animation: payment-spin 1s linear infinite;
}

@keyframes payment-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.payment-processing-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--bs-heading-color);
}

.payment-processing-state p {
    font-size: 14px;
    color: var(--bs-secondary-color);
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════
   Success
   ═══════════════════════════════════════════════════════════ */
.payment-success-view {
    text-align: center;
    padding: 18px 14px 10px;
}

.payment-success-animation {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
}

.payment-success-svg {
    position: relative;
    width: 80px;
    height: 80px;
}

.payment-success-circle {
    stroke: #16a34a;
    stroke-width: 2;
    stroke-miterlimit: 10;
    fill: none;
    stroke-dasharray: 157;
    stroke-dashoffset: 157;
    animation: payment-stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.payment-success-check {
    stroke: #16a34a;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    stroke-dasharray: 36;
    stroke-dashoffset: 36;
    animation: payment-stroke 0.35s cubic-bezier(0.65, 0, 0.45, 1) 0.65s forwards;
}

@keyframes payment-stroke {
    100% { stroke-dashoffset: 0; }
}

/* Confetti — eight pieces thrown outward from the tick, firing as it completes. Purely
   decorative and inert; the burst is the point, not the shapes. */
.ps-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.ps-confetti i {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 7px;
    height: 7px;
    margin: -3.5px 0 0 -3.5px;
    border-radius: 1.5px;
    opacity: 0;
    animation: ps-confetti-pop 900ms cubic-bezier(0.2, 0.7, 0.3, 1) 0.8s backwards;
}

.ps-confetti i:nth-child(1) { background: #16a34a; --ps-cx:  54px; --ps-cy: -40px; --ps-cr:  200deg; animation-delay: 0.80s; }
.ps-confetti i:nth-child(2) { background: #facc15; --ps-cx: -56px; --ps-cy: -32px; --ps-cr: -180deg; animation-delay: 0.84s; }
.ps-confetti i:nth-child(3) { background: #38bdf8; --ps-cx:  44px; --ps-cy:  46px; --ps-cr:  260deg; animation-delay: 0.88s; }
.ps-confetti i:nth-child(4) { background: #fb7185; --ps-cx: -42px; --ps-cy:  48px; --ps-cr: -240deg; animation-delay: 0.82s; }
.ps-confetti i:nth-child(5) { background: #22c55e; --ps-cx:   4px; --ps-cy: -62px; --ps-cr:  160deg; animation-delay: 0.90s; }
.ps-confetti i:nth-child(6) { background: #a78bfa; --ps-cx:  64px; --ps-cy:   8px; --ps-cr: -140deg; animation-delay: 0.86s; }
.ps-confetti i:nth-child(7) { background: #fbbf24; --ps-cx: -64px; --ps-cy:   6px; --ps-cr:  220deg; animation-delay: 0.92s; }
.ps-confetti i:nth-child(8) { background: #34d399; --ps-cx:  -6px; --ps-cy:  62px; --ps-cr: -200deg; animation-delay: 0.94s; }

@keyframes ps-confetti-pop {
    0%   { opacity: 0; transform: translate(0, 0) scale(0.4) rotate(0deg); }
    18%  { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--ps-cx), var(--ps-cy)) scale(1) rotate(var(--ps-cr)); }
}

.payment-success-view h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--bs-heading-color);
}

.payment-success-text {
    font-size: 14px;
    color: var(--bs-secondary-color);
    margin-bottom: 16px;
    line-height: 1.5;
}

/* === Success promo ===
   The plan is already generating when this screen appears, so the space is spent telling the user
   what they now have (and, on the free start, what a plan would add). Left-aligned inside the
   otherwise centred success view — it is a list to read, not a headline to glance at. */
.ps-promo {
    text-align: left;
    padding: 13px 14px 12px;
    margin-bottom: 14px;
    border-radius: 10px;
    background: rgba(22, 163, 74, 0.06);
    border: 1px solid rgba(22, 163, 74, 0.28);
    animation: ps-promo-in 380ms cubic-bezier(0.4, 0, 0.2, 1) 0.5s backwards;
}

/* Comes in just behind the tick animation, so the two read as one beat. */
@keyframes ps-promo-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

/* Only the block matching the choice is shown — stated here rather than relying on the wizard's
   global .hidden, since this stylesheet is loaded on its own wherever PlanSelector is hosted. */
.ps-promo.hidden { display: none; }

.ps-promo-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--bs-body-color);
    margin-bottom: 8px;
}

.ps-promo-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ps-promo-list li {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--bs-body-color);
}

.ps-promo-list li + li { margin-top: 6px; }

.ps-promo-list .plan-check-icon {
    width: 13px;
    height: 13px;
    margin-top: 3px;
    color: #16a34a;
}

.ps-promo-foot {
    margin: 9px 0 0;
    padding-top: 8px;
    border-top: 1px dashed rgba(22, 163, 74, 0.3);
    font-size: 12px;
    line-height: 1.45;
    color: var(--bs-secondary-color);
}

/* === Finish block ===
   The button, the one line explaining why there is nothing left to do, and the countdown that
   presses the button if nobody else does. */
.ps-finish {
    margin-top: 2px;
}

.ps-finish-note {
    margin: 0 0 10px;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--bs-body-color);
}

.ps-autoredirect {
    margin-top: 9px;
    /* Nothing to show until the countdown is actually running (wizard-plan-selector.js adds
       .is-running), so an aborted or never-started timer leaves no stray text behind. Toggled by
       display rather than opacity: this is the only thing telling the user the screen is about to
       move on, and it must never depend on a transition having run. */
    display: none;
}

.ps-autoredirect.is-running { display: block; }

.ps-autoredirect-track {
    display: block;
    height: 3px;
    border-radius: 2px;
    background: var(--bs-border-color);
    overflow: hidden;
}

.ps-autoredirect-bar {
    display: block;
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, #16a34a, #22c55e);
    transform: scaleX(1);
    transform-origin: left center;
}

.ps-autoredirect.is-running .ps-autoredirect-bar {
    animation: ps-drain var(--ps-redirect-duration, 10s) linear forwards;
}

@keyframes ps-drain {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

.ps-autoredirect-text {
    display: block;
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--bs-secondary-color);
}

/* ═══════════════════════════════════════════════════════════
   Error
   ═══════════════════════════════════════════════════════════ */
.payment-error-view {
    text-align: center;
    padding: 20px 14px 14px;
}

.payment-error-view h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--bs-heading-color);
}

.payment-state-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}

.payment-state-icon svg { width: 26px; height: 26px; }

.payment-state-icon--error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

.payment-message-box {
    padding: 12px;
    border-radius: 8px;
    margin-top: 8px;
    margin-bottom: 14px;
    text-align: center;
}

.payment-message-box p {
    margin: 0 0 6px;
    font-size: 14px;
}

.payment-message-box p:last-child { margin-bottom: 0; }

.payment-message-box--error {
    background-color: #fee2e2;
    border: 1px solid #ef4444;
    color: #b91c1c;
}

.payment-action-text {
    font-weight: 500;
    margin-top: 6px;
}

/* ═══════════════════════════════════════════════════════════
   Schedule screen (the _ScheduleFields partial in bare-block mode)
   ═══════════════════════════════════════════════════════════
   Hosted here as one of this view's own screens rather than as a numbered wizard step, so it gets
   the same breathing room as the screens around it — the partial's own field styling comes from
   wizard-create.css and is shared with the plan editor. */
.wizard-payment-container .ps-screen[data-ps-screen="schedule"] {
    animation: ps-rise 340ms cubic-bezier(0.4, 0, 0.2, 1);
}

.wizard-payment-container .ps-screen[data-ps-screen="schedule"].hidden {
    display: none;
}

/* ═══════════════════════════════════════════════════════════
   Dark mode
   ═══════════════════════════════════════════════════════════ */
[data-bs-theme="dark"] .ps-hero-art { color: #4ade80; }
[data-bs-theme="dark"] .ps-hero-halo { fill: rgba(34, 197, 94, 0.14); }

[data-bs-theme="dark"] .ps-free {
    background: rgba(22, 163, 74, 0.11);
    border-color: rgba(22, 163, 74, 0.5);
}

[data-bs-theme="dark"] .ps-free:hover {
    background: rgba(22, 163, 74, 0.18);
    border-color: #22c55e;
}

/* The light sheen would read as a grey smear on a dark panel. */
[data-bs-theme="dark"] .ps-free::after {
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.10), transparent);
}

[data-bs-theme="dark"] .ps-plan-icon {
    background: rgba(34, 197, 94, 0.16);
    color: #4ade80;
}

[data-bs-theme="dark"] .ps-plan-card:hover {
    border-color: rgba(74, 222, 128, 0.55);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] .checkout-field-label { color: #cbd5e1; }

[data-bs-theme="dark"] .checkout-field-input {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .checkout-field-input::placeholder { color: #64748b; }

[data-bs-theme="dark"] .checkout-field-input:focus {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

[data-bs-theme="dark"] .checkout-field-input:disabled { background: #0f172a; }

[data-bs-theme="dark"] .checkout-error-msg {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

[data-bs-theme="dark"] .stripe-wordmark { color: #7c74ff; }

[data-bs-theme="dark"] .payment-success-circle,
[data-bs-theme="dark"] .payment-success-check {
    stroke: #4ade80;
}

[data-bs-theme="dark"] .ps-promo {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(74, 222, 128, 0.32);
}

[data-bs-theme="dark"] .ps-promo-list .plan-check-icon { color: #4ade80; }

[data-bs-theme="dark"] .payment-state-icon--error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(220, 38, 38, 0.15) 100%);
}

[data-bs-theme="dark"] .payment-message-box--error {
    background-color: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #fca5a5;
}

[data-bs-theme="dark"] .payment-btn--primary {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
}

[data-bs-theme="dark"] .payment-btn--primary:disabled {
    background: #166534;
    opacity: 0.5;
}

/* ═══════════════════════════════════════════════════════════
   Reduced motion — every decoration stops; nothing that carries meaning is lost.
   The countdown bar is the one exception: it IS the information, so it snaps to
   empty rather than animating, and the countdown text carries the rest.
   ═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .ps-hero,
    .ps-hero-halo,
    .ps-hero-pad,
    .ps-hero-tick,
    .ps-hero-spark,
    .ps-free,
    .ps-free::after,
    .ps-free-cta,
    .ps-free-cta svg,
    .ps-plan-card,
    .ps-plan-icon,
    .ps-plan-btn,
    .ps-plan-btn svg,
    .plan-card-details,
    .plan-card-features li,
    .ps-details-toggle,
    .ps-details-toggle-chevron,
    .ps-confetti i,
    .ps-promo,
    .wizard-payment-container .ps-screen[data-ps-screen="schedule"] {
        animation: none !important;
        transition: none !important;
    }

    .ps-hero-tick { stroke-dashoffset: 0; }
    .ps-hero-pad  { opacity: 0.55; }
    .ps-confetti  { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   Mobile — ≤ 540 px
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 540px) {

    .wizard-payment-container { padding: 0; }

    .ps-hero { margin-bottom: 12px; }
    .ps-hero-art { width: 50px; height: 50px; }
    .ps-hero-title { font-size: 17px; }
    .ps-hero-sub { font-size: 12.5px; }

    .ps-free {
        padding: 14px 14px 12px;
        margin-bottom: 10px;
    }

    .ps-free-main { font-size: 15.5px; }
    .ps-free-sub  { font-size: 12px; }
    .ps-free-cta  { font-size: 13px; padding: 7px 15px; }

    .ps-choice-divider {
        margin-bottom: 10px;
        font-size: 11px;
    }

    .plan-cards-grid {
        gap: 8px;
        margin-bottom: 10px;
    }

    .ps-plan-card {
        padding: 12px 10px 10px;
        gap: 6px;
    }

    .ps-plan-icon { width: 28px; height: 28px; border-radius: 8px; }
    .ps-plan-icon svg { width: 15px; height: 15px; }

    .ps-plan-name { font-size: 15px; }
    .ps-plan-desc { font-size: 12px; }

    .ps-plan-price-amount { font-size: 13px; }
    .ps-plan-price-note { font-size: 10.5px; }

    .ps-plan-btn {
        font-size: 12px;
        padding: 9px 6px;
        gap: 3px;
    }

    .plan-card-features li {
        font-size: 11px;
        line-height: 1.3;
        padding-top: 4px;
    }

    .plan-check-icon { width: 11px; height: 11px; }

    /* Checkout */
    .checkout-lead { font-size: 12.5px; }
    .checkout-element-wrapper { min-height: 48px; }

    .checkout-submit-btn {
        font-size: 14px;
        padding: 12px 14px;
        min-height: 44px;
    }

    .checkout-trust-line { gap: 4px; }
    .checkout-trust-cancel { font-size: 11px; }
    .stripe-lock-icon { width: 12px; height: 12px; }
    .stripe-wordmark { height: 12px; }

    /* Buttons */
    .payment-btn { font-size: 14px; min-height: 44px; }
    .payment-buttons { margin-top: 8px; }

    /* Processing / success / error */
    .payment-processing-state { padding: 28px 8px; }

    .payment-success-view { padding: 14px 8px 8px; }

    .payment-success-animation,
    .payment-success-svg {
        width: 64px;
        height: 64px;
    }

    .payment-success-animation { margin-bottom: 13px; }
    .payment-success-view h3 { font-size: 18px; }

    .ps-promo {
        padding: 12px 12px 10px;
        margin-bottom: 12px;
    }

    .ps-promo-list li { font-size: 12px; }
    .ps-promo-foot { font-size: 11.5px; }
    .ps-finish-note { font-size: 12.5px; }

    .payment-error-view { padding: 16px 8px 10px; }
    .payment-error-view h3 { font-size: 16px; }

    .payment-message-box {
        padding: 10px;
        margin-bottom: 10px;
    }

    .payment-message-box p { font-size: 13px; }

    .payment-buttons--error {
        flex-direction: column;
        gap: 8px;
    }

    .payment-buttons--error .payment-btn--secondary { width: 100%; }
}

/* ═══════════════════════════════════════════════════════════
   Mobile — ≤ 380 px  (very small phones)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 380px) {

    .ps-plan-card {
        padding: 10px 8px 8px;
        gap: 5px;
    }

    .ps-plan-name { font-size: 14px; }
    .ps-plan-desc { font-size: 11.5px; }

    .ps-plan-btn {
        font-size: 11px;
        padding: 8px 4px;
    }

    /* Two plan actions side by side stop fitting their labels below this width. */
    .ps-plan-btn svg { display: none; }

    .plan-card-features li { font-size: 10.5px; }

    .ps-free { padding: 13px 12px 11px; }
    .ps-free-main { font-size: 14.5px; }

    .checkout-submit-btn {
        font-size: 13.5px;
        padding: 11px 12px;
    }
}
