/*
 * Pricing Page Styles
 * Tier cards with entitlement metadata and FAQ section.
 */

/* === Pricing Page Header === */
.pricing-page {
    padding: var(--space-xl) 0;
}
.pricing-header {
    margin-bottom: var(--space-2xl);
}

/* === Pricing Highlights === */
/* Requirement: highlight cards must stay in one row across breakpoints.
   Approach: use a non-wrapping horizontal track and allow x-scroll when cards exceed viewport width.
   Assumption: card copy stays concise so fixed-width cards remain readable on mobile. */
.pricing-highlights {
    margin-bottom: var(--space-2xl);
}
.pricing-highlights__track {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--space-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2px 2px var(--space-xs);
    scrollbar-width: thin;
    /* Requirement: horizontal scroll areas need visual hints that more content exists off-screen.
       Approach: CSS mask-image fades edges to signal scrollable overflow.
       Note: -webkit- prefix required for Safari; standard mask-image for Chrome/Firefox. */
    -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
}
.pricing-highlight-card {
    flex: 0 0 240px;
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-hairline);
    background: var(--bg-surface);
}
.pricing-highlight-card__media {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--color-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pricing-highlight-card__image {
    width: 24px;
    height: 24px;
    object-fit: contain;
}
.pricing-highlight-card__icon {
    display: inline-flex;
    width: 24px;
    height: 24px;
    color: var(--color-text);
}
.pricing-highlight-card__icon svg {
    width: 100%;
    height: 100%;
}
.pricing-highlight-card__body {
    min-width: 0;
}
.pricing-highlight-card__title {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--color-text);
    line-height: var(--line-height-tight);
}
.pricing-highlight-card__desc {
    margin-top: 4px;
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    line-height: var(--line-height);
}

/* === Pricing Cards Grid === */
.pricing-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
    align-items: stretch;
    gap: var(--space-lg);
    margin-bottom: var(--space-3xl);
    max-width: 1180px;
    margin-left: auto;
    margin-right: auto;
}

/* Requirement: locked-video purchase context must remain visible between gate and checkout.
   Approach: add one compact strip above the cards and keep card-level eligibility notes unchanged. */
.pricing-unlock-context {
    max-width: 1180px;
    margin: 0 auto var(--space-lg);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-xs) var(--space-md);
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    border: 1px solid rgba(255, 77, 77, 0.28);
    border-radius: var(--radius-lg);
    /* Requirement: only pricing CTAs and gate scrims may use gradients in the public design system.
       Logic: keep the unlock context as a flat status strip with an accent border so it reads as state, not decoration. */
    background: var(--bg-surface);
    color: var(--color-text);
    overflow-wrap: anywhere;
}
.pricing-unlock-context__kicker {
    color: var(--color-accent);
    font-size: var(--font-size-xs);
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}
.pricing-unlock-context__title {
    min-width: 0;
    font-size: var(--font-size-base);
    line-height: var(--line-height-tight);
}
.pricing-unlock-context__meta {
    grid-row: 1 / span 2;
    grid-column: 2;
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    text-align: right;
}

.pricing-cards__empty {
    grid-column: 1 / -1;
}

.pricing-card {
    --pricing-card-pad: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    min-height: 100%;
    /* Requirement: pricing cards should use the same flat elevated surface as video cards.
       Logic: use hierarchy, border, and contained badges for emphasis instead of decorative card gradients. */
    background: var(--bg-surface);
    border: 1px solid var(--border-hairline);
    border-radius: var(--card-radius);
    padding: var(--pricing-card-pad);
    position: relative;
    isolation: isolate;
    overflow: hidden;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.3);
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base), background var(--transition-base);
}
.pricing-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 77, 77, 0.35);
    box-shadow: 0 22px 54px rgba(0, 0, 0, 0.4);
}

/* Requirement: price, benefits panel, and CTA must sit on the same horizontal line across all cards
   so tiers compare at a glance, even when one card has more header copy than its neighbours.
   Approach: cards become subgrid items spanning the header/meta/actions rows of the shared grid;
   browsers without subgrid keep the flex fallback above (cards stay equal height, rows self-size). */
@supports (grid-template-rows: subgrid) {
    .pricing-card {
        display: grid;
        grid-template-rows: subgrid;
        grid-row: span 3;
        row-gap: var(--space-md);
    }
}

.pricing-card--popular {
    border-color: rgba(255, 77, 77, 0.55);
    box-shadow: 0 0 0 1px rgba(255, 77, 77, 0.14), var(--shadow-lg);
}
.pricing-card--popular:hover {
    box-shadow: 0 0 0 1px rgba(255, 77, 77, 0.22), 0 28px 70px rgba(255, 77, 77, 0.26);
}
.pricing-card__badge,
.pricing-card--current .pricing-card__current-badge {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    left: auto;
    transform: none;
    z-index: 2;
    max-width: calc(100% - var(--space-xl));
    overflow: hidden;
    text-overflow: ellipsis;
    background: linear-gradient(135deg, var(--color-accent-warm), var(--accent));
    color: #fff;
    font-size: var(--font-size-xs);
    font-weight: 700;
    padding: 5px 18px;
    border-radius: var(--radius-full);
    box-shadow: 0 12px 30px rgba(255, 77, 77, 0.34);
    white-space: nowrap;
}

.pricing-card--current {
    border-color: rgba(76, 175, 80, 0.78);
}

.pricing-card--locked-for-video {
    opacity: 0.72;
}

/* Requirement: the "unlocks this video" eligibility note must read as a status marker, not a wall
   of accent-colored text competing with the price.
   Approach: tinted status panel with a leading ✓/✕ glyph; long video titles wrap inside the panel. */
.pricing-card__unlock-note {
    margin-top: var(--space-md);
    display: flex;
    align-items: flex-start;
    gap: var(--space-xs);
    padding: 6px 10px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    line-height: var(--line-height);
    font-weight: 600;
    overflow-wrap: anywhere;
}
.pricing-card__unlock-note::before {
    font-weight: 800;
    flex-shrink: 0;
}

.pricing-card__unlock-note--ok {
    color: var(--color-success);
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.28);
}
.pricing-card__unlock-note--ok::before {
    content: "✓";
}

.pricing-card__unlock-note--blocked {
    color: var(--color-warning);
    background: rgba(255, 193, 7, 0.08);
    border: 1px solid rgba(255, 193, 7, 0.28);
}
.pricing-card__unlock-note--blocked::before {
    content: "✕";
}
.pricing-card--current .pricing-card__current-badge {
    background: var(--color-success);
    box-shadow: 0 12px 30px rgba(76, 175, 80, 0.22);
}

/* Card Header */
/* Requirement: pricing cards should scan like purchase options, not tall empty panels.
   Approach: keep badges inside the card, left-align the value stack, and let entitlement panels occupy equal-height space. */
.pricing-card__header {
    min-height: 0;
    text-align: left;
    margin: calc(-1 * var(--pricing-card-pad)) calc(-1 * var(--pricing-card-pad)) 0;
    padding: var(--pricing-card-pad) var(--pricing-card-pad) var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(0, 0, 0, 0.08);
}
/* Requirement: all tier names and prices must start at the same height; the corner badge may not
   push the popular/current card's content down like it used to.
   Approach: keep header padding uniform and clear the absolutely-positioned badge with
   name-only end padding, so long tier names wrap under the badge instead of behind it. */
.pricing-card--popular .pricing-card__name,
.pricing-card--current .pricing-card__name {
    padding-inline-end: 6.5rem;
}
/* Requirement: the recommended tier header carries a flat accent tint (no decorative gradients
   allowed outside pricing CTAs and gate scrims) so it reads as the featured option. */
.pricing-card--popular .pricing-card__header {
    background: rgba(255, 77, 77, 0.06);
    border-bottom-color: rgba(255, 77, 77, 0.22);
}
.pricing-card__name {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--space-md);
    color: var(--color-text);
    letter-spacing: 0;
    line-height: var(--line-height-tight);
}
.pricing-card__price {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: var(--space-xs);
}
.pricing-card__amount {
    font-size: 3.25rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
}
.pricing-card__interval {
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
}
.pricing-card__price-meta {
    margin-top: var(--space-sm);
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--space-sm);
    flex-wrap: wrap;
}
.pricing-card__list-price {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    text-decoration: line-through;
}
.pricing-card__discount {
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--color-success);
    background: rgba(76, 175, 80, 0.12);
    border: 1px solid rgba(76, 175, 80, 0.35);
    border-radius: var(--radius-full);
    padding: 2px 8px;
}

/* Requirement: limited-time campaign line names the promo and ticks a live countdown for urgency.
   Approach: accent-tinted chip row in the card header; the ticker in main.js hides expired campaigns. */
.pricing-card__campaign {
    margin: var(--space-sm) 0 0;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
    padding: 2px 10px;
    font-size: var(--font-size-xs);
    line-height: var(--line-height-tight);
    color: var(--color-accent);
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.32);
    border-radius: var(--radius-full);
}

.pricing-card__campaign-label {
    font-weight: 700;
}

.pricing-card__campaign-countdown {
    font-variant-numeric: tabular-nums;
}
.pricing-card__duration-summary {
    /* Requirement: every tier shows its subscription length once, as a chip on the price line
       (the duplicate duration row in the entitlement panel was removed). */
    margin-top: var(--space-sm);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-full);
    padding: 4px 10px;
    max-width: 100%;
    flex-wrap: wrap;
}
.pricing-card__duration-summary-label {
    color: var(--color-text-secondary);
}
.pricing-card__duration-summary-value {
    color: var(--color-warning);
    font-weight: 700;
}
.pricing-card__description {
    margin-top: var(--space-sm);
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    line-height: var(--line-height);
    max-width: 30rem;
}
.pricing-card__savings {
    margin-top: var(--space-sm);
    display: inline-flex;
    align-items: center;
    font-size: var(--font-size-xs);
    color: var(--color-success);
    font-weight: 600;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.24);
    border-radius: var(--radius-full);
    padding: 4px 10px;
}

/* Entitlement metadata (benefits-only panel; the duration row now lives in the header chip) */
.pricing-card__meta {
    flex: 1 1 auto;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}
/* Requirement: visible categories are a purchase driver on the membership plan page.
   Approach: make the existing entitlement data scan like an included-benefits panel with
   stable card dimensions, without changing the helpers that decide what each tier can watch. */
.pricing-card__category-showcase {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 132px;
    overflow: hidden;
    padding: var(--space-md);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--card-radius);
    background: rgba(255, 255, 255, 0.045);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.pricing-card--popular .pricing-card__category-showcase {
    border-color: rgba(255, 77, 77, 0.42);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 12px 28px rgba(255, 77, 77, 0.12);
}
.pricing-card__category-showcase--empty {
    background: rgba(255, 255, 255, 0.04);
}
.pricing-card__category-header,
.pricing-card__category-list,
.pricing-card__category-empty {
    position: relative;
    z-index: 1;
}
.pricing-card__category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}
.pricing-card__category-kicker {
    flex: 1 1 10rem;
    min-width: min(100%, 10rem);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}
.pricing-card__category-count {
    flex: 0 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    padding: 4px 10px;
    border: 1px solid rgba(76, 175, 80, 0.32);
    border-radius: var(--radius-full);
    background: rgba(76, 175, 80, 0.16);
    color: var(--color-success);
    font-size: var(--font-size-xs);
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
}
.pricing-card__category-list {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 8px;
    flex: 1 1 auto;
    max-height: 160px;
    overflow-y: auto;
    padding: 1px 2px 2px 1px;
    scrollbar-width: thin;
}
.pricing-card__category-chip {
    display: inline-flex;
    align-items: center;
    flex: 1 1 9rem;
    min-width: min(100%, 9rem);
    max-width: 100%;
    gap: 6px;
    padding: 7px 10px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: var(--color-text);
    font-size: var(--font-size-xs);
    font-weight: 700;
    line-height: 1.25;
    word-break: keep-all;
    overflow-wrap: break-word;
    hyphens: manual;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 22px rgba(0, 0, 0, 0.16);
}
.pricing-card__category-chip.category-label--pricing {
    border-left: 4px solid var(--category-label-bg);
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text);
}
.pricing-card__category-chip::before {
    content: "";
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    border-radius: var(--radius-full);
    background: var(--color-success);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.12);
}
.pricing-card__category-chip.category-label--pricing::before {
    background: var(--category-label-bg);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}
.pricing-card__category-empty {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    line-height: var(--line-height);
}

/* Payment Method Buttons: direct buttons per provider, no toggle dropdown.
   Requirement: logged-in users with multiple methods see all buttons directly.
   PayPal = blue tint, Crypto = green tint via checkout-method CSS custom properties. */
.pricing-card__actions {
    margin-top: var(--space-sm);
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.pricing-card .btn {
    min-height: 52px;
    white-space: normal;
    line-height: 1.25;
    text-align: center;
}
.pay-method {
    justify-content: center;
    gap: var(--space-xs);
    border-width: 1px;
}
/* PayPal button: blue-tinted border and background */
.pay-method--paypal {
    border-color: #1a7ccc;
    background: rgba(26, 124, 204, 0.14);
    color: #fff;
}
.pay-method--paypal:hover {
    border-color: #2991e3;
    background: rgba(26, 124, 204, 0.24);
    color: #fff;
}
/* Crypto/USDT button: green-tinted border and background */
.pay-method--crypto {
    border-color: #29a37b;
    background: rgba(41, 163, 123, 0.14);
    color: #fff;
}
.pay-method--crypto:hover {
    border-color: #36bf90;
    background: rgba(41, 163, 123, 0.24);
    color: #fff;
}
.btn--downgrade {
    background: transparent;
    border-color: var(--color-border);
    color: var(--color-text-muted);
    cursor: default;
    pointer-events: none;
}

/* === FAQ Section === */
.pricing-faq {
    max-width: 700px;
    margin: 0 auto;
}
.faq-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}
.faq-item {
    padding: var(--space-lg);
    background: var(--color-bg-elevated);
    border-radius: var(--card-radius);
    border: 1px solid var(--color-border);
}
.faq-item__q {
    font-size: var(--font-size-base);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--color-text);
}
.faq-item__a {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: var(--line-height);
}

@media (max-width: 480px) {
    .pricing-card__category-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .pricing-card__category-count {
        white-space: normal;
    }

    .pricing-card__category-chip {
        flex: 1 1 100%;
    }

    .pricing-card__category-chip.category-label--pricing {
        min-width: 100%;
    }
}

@media (max-width: 640px) {
    .pricing-unlock-context {
        grid-template-columns: 1fr;
        text-align: left;
        padding: var(--space-md);
    }

    .pricing-unlock-context__meta {
        grid-column: auto;
        grid-row: auto;
        text-align: left;
    }

    .pricing-cards {
        gap: var(--space-lg);
    }

    .pricing-card {
        --pricing-card-pad: var(--space-lg);
        padding: var(--space-lg);
    }

    .pricing-card__amount {
        font-size: 2.6rem;
    }

    .pricing-card__name {
        font-size: var(--font-size-lg);
    }
}

@media (min-width: 768px) {
    .pricing-highlight-card {
        flex-basis: 260px;
    }
}

/* Requirement: pricing card hover lift must be suppressed when user prefers reduced motion (WCAG 2.3.3).
   Approach: override the translateY transform to none so no physical movement occurs on hover. */
@media (prefers-reduced-motion: reduce) {
    .pricing-card:hover {
        transform: none;
    }
}
