/* ═══════════════════════════════════════
   BILLING PAGE
   ═══════════════════════════════════════ */

.billing-page {
    height: 100%;
    overflow-y: auto;
    padding: 20px;
}

.billing-header {
    font-size: 18px;
    color: var(--green);
    margin-bottom: 24px;
    text-align: center;
    position: relative;
    padding: 12px 0;
}

/* Balance hero */
/* ═══════════════════════════════════════════════════════════
 * BILLING PAGE — tier-themed hero, rich plan cards, topup grid
 * ═══════════════════════════════════════════════════════════ */

.billing-hero {
    position: relative;
    border-radius: 18px;
    padding: 0;
    margin-bottom: 20px;
    overflow: hidden;
    background: var(--panel);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--line);
}

.billing-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 20% 30%, rgba(var(--green-rgb), 0.18), transparent 50%),
                      radial-gradient(circle at 80% 70%, rgba(var(--amber-rgb), 0.12), transparent 50%);
    pointer-events: none;
}

.billing-hero-inner {
    position: relative;
    z-index: 1;
    padding: 32px 24px 28px;
    text-align: center;
}

.billing-hero-tier-line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(var(--green-rgb), 0.3);
    font-size: 12px;
    margin-bottom: 14px;
    backdrop-filter: blur(4px);
}

.billing-hero-tier-icon {
    font-size: 14px;
}

.billing-hero-tier-name {
    font-weight: 700;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.billing-hero-tier-label {
    color: var(--muted);
    font-size: 11px;
}

.billing-hero-balance {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 4px;
}

.billing-hero-balance-val {
    font-size: 56px;
    font-weight: 900;
    color: var(--amber);
    text-shadow: 0 0 40px rgba(var(--amber-rgb), 0.45), 0 0 80px rgba(var(--amber-rgb), 0.25);
    line-height: 1;
    font-family: "Share Tech Mono", "SF Mono", monospace;
}

.billing-hero-balance-unit {
    font-size: 34px;
    line-height: 1;
}

.billing-hero-balance-label {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.billing-hero-expires {
    margin-top: 10px;
    font-size: 11px;
    color: var(--muted);
    font-style: italic;
}

/* Tier-specific hero tints */
.billing-hero.hero-plus::before {
    background-image: radial-gradient(circle at 30% 40%, rgba(var(--amber-rgb), 0.22), transparent 55%),
                      radial-gradient(circle at 80% 60%, rgba(255, 213, 107, 0.12), transparent 55%);
}

.billing-hero.hero-plus .billing-hero-tier-name { color: var(--amber); }
.billing-hero.hero-plus .billing-hero-tier-line { border-color: rgba(var(--amber-rgb), 0.4); }

.billing-hero.hero-pro::before {
    background-image: radial-gradient(circle at 30% 40%, rgba(255, 80, 50, 0.2), transparent 55%),
                      radial-gradient(circle at 80% 60%, rgba(var(--amber-rgb), 0.1), transparent 55%);
}

.billing-hero.hero-pro .billing-hero-tier-name { color: #ff7060; }
.billing-hero.hero-pro .billing-hero-tier-line { border-color: rgba(255, 80, 50, 0.4); }

.billing-hero.hero-premium::before,
.billing-hero.hero-architect::before {
    background-image: radial-gradient(circle at 30% 40%, rgba(217, 164, 58, 0.3), transparent 55%),
                      radial-gradient(circle at 80% 60%, rgba(255, 213, 107, 0.18), transparent 55%);
}

.billing-hero.hero-premium .billing-hero-tier-name,
.billing-hero.hero-architect .billing-hero-tier-name {
    color: #f3cd6a;
    text-shadow: 0 0 12px rgba(255, 213, 107, 0.4);
}

.billing-hero.hero-premium .billing-hero-tier-line,
.billing-hero.hero-architect .billing-hero-tier-line {
    border-color: rgba(217, 164, 58, 0.55);
}

/* Billing sections */
.billing-section {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.billing-section-title {
    font-size: 12px;
    color: var(--green-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

/* Topup grid */
.billing-topup-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.billing-topup-btn {
    background: linear-gradient(180deg, rgba(var(--amber-rgb), 0.12), rgba(var(--amber-rgb), 0.04));
    border: 1px solid rgba(var(--amber-rgb), 0.25);
    border-radius: 12px;
    padding: 14px 8px;
    font-family: inherit;
    color: var(--amber);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    position: relative;
    overflow: hidden;
}

.billing-topup-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--amber-rgb), 0.6), transparent);
}

.billing-topup-btn:hover {
    background: linear-gradient(180deg, rgba(var(--amber-rgb), 0.22), rgba(var(--amber-rgb), 0.08));
    border-color: rgba(var(--amber-rgb), 0.5);
    box-shadow: 0 4px 18px rgba(var(--amber-rgb), 0.18);
    transform: translateY(-1px);
}

.billing-topup-amount {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.1;
}

.billing-topup-unit {
    font-size: 14px;
    opacity: 0.7;
}

.billing-topup-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ══════════ Plan cards — rich, tier-themed ══════════ */

.billing-plans-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 720px) {
    .billing-plans-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.billing-plan-card {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 0;
    transition: all 0.25s ease;
    background: linear-gradient(180deg, var(--panel), rgba(0, 0, 0, 0.45));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.billing-plan-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}

/* Plan hero image — top 16:9 strip with gradient fade */
.billing-plan-image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--panel-2);
}

.billing-plan-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    filter: saturate(1.08) contrast(1.05) brightness(0.88);
    transition: transform 0.5s ease, filter 0.3s ease;
}

.billing-plan-card:hover .billing-plan-image {
    transform: scale(1.05);
    filter: saturate(1.2) contrast(1.08) brightness(1);
}

.billing-plan-image-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 30%, rgba(10, 20, 16, 0.65) 78%, var(--panel) 100%);
    pointer-events: none;
}

.billing-plan-title-overlay {
    position: absolute;
    bottom: 10px;
    left: 14px;
    right: 14px;
    display: flex;
    align-items: baseline;
    gap: 6px;
    z-index: 2;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
}

.billing-plan-title-icon {
    font-size: 22px;
}

.billing-plan-title-name {
    font-size: 22px;
    font-weight: 900;
    color: #fff;
    letter-spacing: 0.02em;
}

.billing-plan-title-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Flag — "Current" / "Recommended" ribbon in top-right of image */
.billing-plan-flag {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    backdrop-filter: blur(6px);
}

.billing-plan-flag-current {
    background: rgba(var(--green-rgb), 0.85);
    color: #000;
    box-shadow: 0 0 16px rgba(var(--green-rgb), 0.4);
}

.billing-plan-flag-recommended {
    background: linear-gradient(135deg, #ffb000, #ffd36b);
    color: #1a0f00;
    box-shadow: 0 0 18px rgba(var(--amber-rgb), 0.45);
    animation: recommendedPulse 2.4s ease-in-out infinite;
}

@keyframes recommendedPulse {
    0%, 100% { box-shadow: 0 0 18px rgba(var(--amber-rgb), 0.45); }
    50%      { box-shadow: 0 0 28px rgba(var(--amber-rgb), 0.75); }
}

/* Plan body (below image) */
.billing-plan-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.billing-plan-tagline {
    font-size: 12px;
    color: var(--muted);
    font-style: italic;
    line-height: 1.4;
}

.billing-plan-price-block {
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--panel-2);
    border: 1px solid var(--line);
}

.billing-plan-price-main {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
}

.billing-plan-price-bonus {
    font-size: 11px;
    color: var(--green);
    margin-top: 3px;
    font-weight: 600;
}

.billing-plan-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.billing-plan-features li {
    font-size: 12.5px;
    color: var(--text);
    opacity: 0.85;
    line-height: 1.4;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.billing-plan-check {
    color: var(--green);
    font-weight: 700;
    flex-shrink: 0;
    text-shadow: 0 0 6px rgba(var(--green-rgb), 0.35);
}

/* Subscribe button */
.billing-subscribe-btn {
    display: block;
    width: 100%;
    padding: 13px 18px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    border: none;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-top: auto;
}

.billing-subscribe-note {
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    padding: 13px;
    font-style: italic;
    margin-top: auto;
}

.billing-subscribe-btn.current-btn {
    background: rgba(var(--green-rgb), 0.15);
    border: 1px solid rgba(var(--green-rgb), 0.4);
    color: var(--green);
    cursor: default;
}

/* Tier-specific tints on card border/bg + subscribe button */
.billing-plan-card.plan-free {
    border-color: rgba(90, 122, 86, 0.25);
}

.billing-plan-card.plan-plus {
    border-color: rgba(var(--amber-rgb), 0.35);
    background: linear-gradient(180deg, var(--panel), rgba(var(--amber-rgb), 0.03));
}
.billing-plan-card.plan-plus.recommended {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), 0 0 32px rgba(var(--amber-rgb), 0.12);
}
.billing-plan-card.plan-plus:hover {
    border-color: rgba(var(--amber-rgb), 0.55);
}
.plan-plus .billing-subscribe-btn {
    background: linear-gradient(135deg, #ffb000, #ffd36b);
    color: #1a0f00;
    box-shadow: 0 4px 14px rgba(var(--amber-rgb), 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.plan-plus .billing-subscribe-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(var(--amber-rgb), 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.billing-plan-card.plan-pro {
    border-color: rgba(255, 80, 50, 0.35);
    background: linear-gradient(180deg, var(--panel), rgba(255, 80, 50, 0.03));
}
.billing-plan-card.plan-pro:hover {
    border-color: rgba(255, 80, 50, 0.55);
}
.plan-pro .billing-subscribe-btn {
    background: linear-gradient(135deg, #ff5032, #ff7060);
    color: #fff;
    box-shadow: 0 4px 14px rgba(255, 80, 50, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.plan-pro .billing-subscribe-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(255, 80, 50, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.billing-plan-card.plan-premium {
    border-color: rgba(217, 164, 58, 0.5);
    background: linear-gradient(180deg, var(--panel), rgba(217, 164, 58, 0.05));
}
.billing-plan-card.plan-premium::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #d9a43a, #ffd36b, #d9a43a);
    z-index: 4;
}
.billing-plan-card.plan-premium:hover {
    border-color: rgba(217, 164, 58, 0.75);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 48px rgba(217, 164, 58, 0.18);
}
.plan-premium .billing-subscribe-btn {
    background: linear-gradient(135deg, #d9a43a 0%, #ffd36b 50%, #d9a43a 100%);
    color: #1b1200;
    box-shadow: 0 4px 16px rgba(217, 164, 58, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}
.plan-premium .billing-subscribe-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(217, 164, 58, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.billing-plan-card.plan-free .billing-subscribe-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
    border: 1px solid var(--line);
}

.billing-plan-card.current {
    border-width: 2px;
}

.billing-subscribe-btn:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

/* Usage progress bars */
.billing-usage-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
}

.billing-usage-icon {
    font-size: 16px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.billing-usage-label {
    min-width: 45px;
    color: var(--muted);
    flex-shrink: 0;
}

.billing-usage-bar {
    flex: 1;
    height: 10px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.billing-usage-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green), rgba(var(--green-rgb), 0.7));
    border-radius: 4px;
    transition: width 0.5s ease;
    box-shadow: 0 0 6px rgba(var(--green-rgb), 0.2);
}

.billing-usage-count {
    font-size: 11px;
    color: var(--muted);
    min-width: 40px;
    text-align: right;
    flex-shrink: 0;
}

/* Light theme billing overrides */
[data-theme="light"] .billing-page {
    background: var(--bg);
}

[data-theme="light"] .billing-hero,
[data-theme="light"] .billing-section {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .billing-topup-btn {
    background: rgba(194, 120, 0, 0.06);
    border-color: rgba(194, 120, 0, 0.2);
}

[data-theme="light"] .billing-plan-card.plan-free {
    background: rgba(136, 136, 136, 0.06);
}

[data-theme="light"] .billing-plan-card.plan-plus {
    background: rgba(194, 120, 0, 0.04);
}

[data-theme="light"] .billing-plan-card.plan-pro {
    background: rgba(212, 70, 56, 0.04);
}

/* Mobile billing — see consolidated mobile block below */

/* ═══ Date separator between message groups ═══ */
.msg-date-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    font-size: 11px;
    color: var(--muted);
    opacity: 0.6;
    align-self: center;
    width: 100%;
}

.msg-date-separator::before,
.msg-date-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--line);
}

/* ═══ Conversation "..." menu button ═══ */
.sidebar-item {
    position: relative;
}

.sidebar-item-menu-btn {
    position: absolute;
    right: 8px;
    top: 8px;
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 14px;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    z-index: 2;
}

.sidebar-item:hover .sidebar-item-menu-btn,
.sidebar-item-menu-btn.open {
    display: flex;
}

/* sidebar-item-menu-btn mobile — see consolidated mobile block below */

.sidebar-item-menu-btn:hover {
    color: var(--green);
    border-color: var(--green-dim);
    background: rgba(var(--green-rgb), 0.08);
}

.sidebar-item-dropdown {
    position: absolute;
    right: 8px;
    top: 34px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 4px 0;
    z-index: 10;
    min-width: 140px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    animation: pickerSlideIn 0.15s ease-out;
}

.sidebar-item-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    font-family: inherit;
    text-align: left;
}

.sidebar-item-dropdown-item:hover {
    background: rgba(var(--green-rgb), 0.06);
    color: var(--green);
}

.sidebar-item-dropdown-item.danger {
    color: var(--red);
}

.sidebar-item-dropdown-item.danger:hover {
    background: rgba(var(--red-rgb), 0.08);
    color: var(--red);
}

/* ═══ Page loading skeleton ═══ */
.page-loading {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
}

.page-skeleton-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
}

.page-skeleton-title {
    height: 14px;
    width: 40%;
    background: linear-gradient(90deg, var(--panel-2) 25%, rgba(var(--green-rgb), 0.06) 50%, var(--panel-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 12px;
}

.page-skeleton-row {
    height: 12px;
    width: 80%;
    background: linear-gradient(90deg, var(--panel-2) 25%, rgba(var(--green-rgb), 0.06) 50%, var(--panel-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}

.page-skeleton-row:nth-child(odd) {
    width: 65%;
}

/* ═══ Billing plan current state (improved) ═══ */
.billing-plan-card.current {
    border-width: 2px;
    position: relative;
}

.billing-plan-current-badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 6px;
    background: rgba(var(--green-rgb), 0.15);
    color: var(--green);
    border: 1px solid rgba(var(--green-rgb), 0.3);
    font-weight: bold;
    white-space: nowrap;
}

/* ═══ Sidebar conversation count ═══ */
.sidebar-conv-count {
    font-size: 11px;
    color: var(--muted);
    margin-left: 4px;
    opacity: 0.7;
}

/* ───────── Payment success celebration modal ───────── */

.payment-success-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease-out;
    overflow: hidden;
}
.payment-success-overlay.open { opacity: 1; }

.payment-success-modal {
    background: var(--panel);
    border: 1px solid var(--green);
    border-radius: 18px;
    box-shadow:
        0 0 120px rgba(var(--green-rgb), 0.25),
        0 30px 80px rgba(0, 0, 0, 0.8),
        inset 0 0 40px rgba(var(--amber-rgb), 0.05);
    width: 100%;
    max-width: 520px;
    max-height: 92vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.92) translateY(20px);
    transition: transform 0.32s cubic-bezier(0.22, 1.3, 0.36, 1);
}
.payment-success-overlay.open .payment-success-modal {
    transform: scale(1) translateY(0);
}

.payment-success-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6); /* intentional dark scrim over hero image, theme-agnostic */
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.payment-success-close:hover {
    background: rgba(var(--red-rgb), 0.2);
    border-color: var(--red);
    transform: rotate(90deg);
}

.payment-success-hero {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 18px 18px 0 0;
    background: var(--panel-2);
}

.payment-success-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    animation: paymentSuccessKenBurns 8s ease-out;
}

@keyframes paymentSuccessKenBurns {
    0%   { transform: scale(1.1); }
    100% { transform: scale(1.0); }
}

.payment-success-hero-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0) 40%,
        rgba(8, 19, 26, 0.6) 75%,
        var(--panel) 100%
    );
    pointer-events: none;
}

.payment-success-badge {
    position: absolute;
    top: 18px;
    left: 18px;
    padding: 8px 18px;
    background: linear-gradient(135deg, #ffb000, #ff9500);
    border: 2px solid #fff;
    border-radius: 40px;
    color: #1a0f00;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 0.5px;
    box-shadow:
        0 4px 16px rgba(var(--amber-rgb), 0.5),
        0 0 0 4px rgba(var(--amber-rgb), 0.15);
    animation: paymentSuccessBadgePop 0.5s cubic-bezier(0.22, 1.4, 0.36, 1) 0.2s both;
}

@keyframes paymentSuccessBadgePop {
    0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
    70%  { transform: scale(1.15) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.payment-success-body {
    padding: 18px 28px 28px;
    text-align: center;
}

.payment-success-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
    text-shadow: 0 0 20px rgba(var(--green-rgb), 0.4);
}

.payment-success-subtitle {
    font-size: 14px;
    color: var(--text);
    line-height: 1.55;
    margin-bottom: 22px;
}
.payment-success-subtitle b {
    color: var(--amber);
    font-weight: 700;
}

.payment-success-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.payment-success-btn-primary {
    background: linear-gradient(135deg, var(--green), var(--green-dim));
    border: 1px solid var(--green);
    border-radius: 8px;
    padding: 12px 24px;
    color: var(--bg);
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 140px;
}
.payment-success-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(var(--green-rgb), 0.3);
}

.payment-success-btn-secondary {
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 24px;
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 140px;
}
.payment-success-btn-secondary:hover {
    border-color: var(--muted);
    color: var(--text);
}

/* ─── Falling caps celebration particles ─── */

.payment-success-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 5001;
    overflow: hidden;
}

.payment-success-cap {
    position: absolute;
    top: -40px;
    animation: paymentSuccessFall linear forwards;
    opacity: 0.9;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

@keyframes paymentSuccessFall {
    0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

@media (max-width: 560px) {
    .payment-success-modal { max-width: 100%; }
    .payment-success-body { padding: 16px 20px 24px; }
    .payment-success-title { font-size: 18px; }
    .payment-success-badge { font-size: 15px; padding: 6px 14px; top: 12px; left: 12px; }
    .payment-success-btn-primary,
    .payment-success-btn-secondary { flex: 1; min-width: 0; }
}

/* ───────── Saved card chip + save-card toggle ───────── */

.billing-saved-card {
    margin: 10px 0 14px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(var(--green-rgb), 0.06), rgba(var(--amber-rgb), 0.04));
    border: 1px solid var(--green-dim);
    border-radius: 10px;
}

.billing-saved-card-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.billing-saved-card-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.billing-saved-card-text {
    flex: 1;
    min-width: 0;
}

.billing-saved-card-title {
    font-size: 13px;
    color: var(--green);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.billing-saved-card-desc {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

.billing-saved-card-forget {
    background: transparent;
    border: 1px solid var(--red);
    border-radius: 6px;
    padding: 6px 12px;
    color: var(--red);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.12s;
    flex-shrink: 0;
}
.billing-saved-card-forget:hover {
    background: rgba(var(--red-rgb), 0.12);
}

.billing-save-card-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 10px;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.12s;
}
.billing-save-card-toggle:hover {
    background: rgba(var(--green-rgb), 0.04);
    color: var(--text);
}
.billing-save-card-toggle input {
    accent-color: var(--green);
    flex-shrink: 0;
}



/* ── Payment History ── */
.billing-hist-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(var(--green-rgb),0.08);
}
.billing-hist-icon { font-size: 18px; flex-shrink: 0; }
.billing-hist-info { flex: 1; min-width: 0; }
.billing-hist-label { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.billing-hist-date { font-size: 11px; color: var(--muted); }
.billing-hist-amount { font-size: 14px; font-weight: 700; flex-shrink: 0; }
.billing-hist-income { color: var(--green); }
