/* ============================================================================
   Generation paywall — the plan sheet (public/js/generation-paywall.js)

   Opens when an image or video request needs a plan. Bottom sheet on phones,
   centred card from 720px. Tokens only (npm run theme:check); the brand skins
   in theme.css re-value them. On the chat page the chat modal
   (chat-image-paywall.css) is used instead.
   ========================================================================== */

.gpw-overlay {
    position: fixed;
    inset: 0;
    z-index: 13600;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: var(--scrim);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

.gpw-overlay.is-open { opacity: 1; }

.gpw-modal {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 92vh;
    max-height: 92dvh;
    overflow-y: auto;
    padding: 28px 20px 20px;
    border-radius: 22px 22px 0 0;
    border: 1px solid var(--glass-line);
    border-bottom: none;
    background-color: var(--surface-overlay);
    background-image: linear-gradient(var(--glass), var(--glass));
    color: var(--ink);
    box-shadow: var(--shadow-lg);
    transform: translateY(24px);
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.4, 1);
}

.gpw-overlay.is-open .gpw-modal { transform: translateY(0); }

.gpw-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface-raised);
    color: var(--ink-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.gpw-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--brand-ink);
}

.gpw-title {
    margin: 8px 40px 6px 0;
    font-size: 22px;
    line-height: 1.25;
    font-weight: 700;
    color: var(--ink);
}

.gpw-body {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink-soft);
}

.gpw-plans {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.gpw-loading {
    padding: 24px;
    text-align: center;
    color: var(--ink-muted);
}

.gpw-plan {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface-raised);
    color: var(--ink);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.gpw-plan:hover { border-color: var(--line-strong); transform: translateY(-1px); color: var(--ink); }
.gpw-plan:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.gpw-plan:disabled { opacity: 0.7; cursor: wait; }

.gpw-plan.is-popular {
    border-color: transparent;
    background-image: linear-gradient(var(--surface-raised), var(--surface-raised)), var(--brand-gradient);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    border: 2px solid transparent;
}

.gpw-plan--link { align-items: center; font-weight: 600; }

.gpw-plan-flag {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: var(--brand-fill-soft);
    color: var(--brand-ink);
}

.gpw-plan-name { font-size: 15px; font-weight: 700; }

.gpw-plan-price { font-size: 20px; font-weight: 700; }
.gpw-plan-price small { margin-left: 4px; font-size: 12px; font-weight: 500; color: var(--ink-muted); }

.gpw-plan-allow { font-size: 12px; color: var(--ink-soft); }

.gpw-fine {
    margin: 14px 0 6px;
    font-size: 12px;
    text-align: center;
    color: var(--ink-muted);
}

.gpw-links {
    display: flex;
    justify-content: center;
    gap: 18px;
}

.gpw-link {
    padding: 6px 0;
    border: none;
    background: none;
    font-size: 13px;
    color: var(--ink-soft);
    text-decoration: underline;
    cursor: pointer;
}

@media (min-width: 720px) {
    .gpw-overlay { align-items: center; padding: 24px; }
    .gpw-modal { border-radius: 22px; border-bottom: 1px solid var(--glass-line); padding: 32px 28px 22px; }
    .gpw-plans { grid-template-columns: repeat(3, 1fr); }
    .gpw-plan-flag { position: static; margin-bottom: 4px; }
}
