/* =============================================================================
   Billing Page — Subscription plans, feature comparison, payment status
   ============================================================================= */

/* Current Plan Card */
.billing-current-plan {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(129, 140, 248, 0.08));
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.billing-plan-info .billing-plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #6366f1;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.billing-plan-info .billing-plan-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary, #f0f0f0);
    margin-bottom: 4px;
}

.billing-plan-info .billing-plan-price {
    font-size: 0.9rem;
    color: var(--text-secondary, #aaa);
}

.billing-plan-info .billing-plan-price .amount {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary, #f0f0f0);
}

.billing-plan-info .billing-plan-period {
    font-size: 0.8rem;
    color: var(--text-muted, #666);
    margin-top: 6px;
}

.billing-plan-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.billing-plan-actions .btn {
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.billing-plan-actions .btn-manage {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary, #aaa);
    border: 1px solid var(--border-color, #2a2a3e);
}

/* Section Headers */
.billing-section-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #f0f0f0);
    margin: 32px 0 16px;
}

.billing-section-sub {
    font-size: 0.85rem;
    color: var(--text-muted, #888);
    margin: -8px 0 16px;
}

/* Billing Period Toggle */
.billing-period-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary, #12121a);
    border-radius: 10px;
    padding: 4px;
    width: fit-content;
    margin: 0 0 24px;
}

.billing-toggle-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted, #888);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.billing-toggle-btn.active {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.billing-save-badge {
    font-size: 0.65rem;
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

/* Plan Cards Grid */
.billing-plans-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

@media (max-width: 900px) {
    .billing-plans-grid { grid-template-columns: 1fr; }
}

.billing-plan-card {
    background: var(--bg-card, #1a1a2e);
    border: 1px solid var(--border-color, #2a2a3e);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: border-color 0.2s;
}

.billing-plan-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

.billing-plan-card.current {
    border-color: #6366f1;
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.3);
}

.billing-plan-card.recommended {
    border-color: #818cf8;
}

.billing-plan-card .recommended-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.billing-plan-card .plan-card-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary, #f0f0f0);
    margin-bottom: 4px;
}

.billing-plan-card .plan-card-tagline {
    font-size: 0.8rem;
    color: var(--text-muted, #888);
    margin-bottom: 16px;
    font-style: italic;
}

.billing-plan-card .plan-card-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #f0f0f0);
    margin-bottom: 2px;
}

.billing-plan-card .plan-card-period {
    font-size: 0.8rem;
    color: var(--text-muted, #888);
    margin-bottom: 16px;
}

.billing-plan-card .plan-card-features {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    flex-grow: 1;
}

.billing-plan-card .plan-card-features li {
    font-size: 0.82rem;
    color: var(--text-secondary, #bbb);
    padding: 4px 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.billing-plan-card .plan-card-features li .check {
    color: #34d399;
    font-weight: 700;
    flex-shrink: 0;
}

.billing-plan-card .plan-card-btn {
    display: block;
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: center;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.billing-plan-card .plan-card-btn.btn-current {
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    cursor: default;
}

.billing-plan-card .plan-card-btn.btn-upgrade {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: white;
}

.billing-plan-card .plan-card-btn.btn-upgrade:hover {
    opacity: 0.9;
}

.billing-plan-card .plan-card-btn.btn-contact {
    background: rgba(236, 72, 153, 0.1);
    color: #ec4899;
    border: 1px solid rgba(236, 72, 153, 0.25);
}

/* Feature Comparison Table */
.billing-feature-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 32px;
}

.billing-feature-table th,
.billing-feature-table td {
    padding: 10px 14px;
    text-align: left;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--border-color, #2a2a3e);
}

.billing-feature-table th {
    color: var(--text-muted, #888);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    background: var(--bg-secondary, #12121a);
    position: sticky;
    top: 0;
    z-index: 1;
}

.billing-feature-table .category-row td {
    font-weight: 700;
    color: var(--text-primary, #f0f0f0);
    background: rgba(99, 102, 241, 0.05);
    font-size: 0.8rem;
    padding-top: 14px;
}

.billing-feature-table .check-yes {
    color: #34d399;
    font-weight: 700;
}

.billing-feature-table .check-no {
    color: var(--text-muted, #555);
}

/* Payment Placeholder */
.billing-payment-placeholder {
    background: var(--bg-card, #1a1a2e);
    border: 1px dashed var(--border-color, #2a2a3e);
    border-radius: 14px;
    padding: 32px;
    text-align: center;
    margin-bottom: 32px;
}

.billing-payment-placeholder .placeholder-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.billing-payment-placeholder .placeholder-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #f0f0f0);
    margin-bottom: 8px;
}

.billing-payment-placeholder .placeholder-text {
    font-size: 0.85rem;
    color: var(--text-muted, #888);
    margin-bottom: 16px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.billing-payment-placeholder .btn-waitlist {
    display: inline-block;
    padding: 10px 24px;
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.billing-payment-placeholder .btn-waitlist:hover {
    background: rgba(99, 102, 241, 0.2);
}

/* Downgrade Button */
.billing-plan-card .plan-card-btn.btn-downgrade {
    background: transparent;
    color: var(--text-muted, #666);
    border: 1px solid var(--border-color, #2a2a3e);
    font-size: 0.8rem;
}

.billing-plan-card .plan-card-btn.btn-downgrade:hover {
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--text-secondary, #aaa);
}

/* Narrative Section */
.billing-narrative {
    background: var(--bg-card, #1a1a2e);
    border: 1px solid var(--border-color, #2a2a3e);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 32px;
}

.billing-narrative p {
    font-size: 0.85rem;
    color: var(--text-secondary, #bbb);
    line-height: 1.6;
    margin-bottom: 8px;
}

.billing-narrative p:last-child {
    margin-bottom: 0;
}

.billing-narrative strong {
    color: var(--text-primary, #f0f0f0);
}

/* Collapsible Feature Table */
#feature-table-wrapper.collapsed {
    display: none;
}

.billing-toggle-link {
    background: none;
    border: none;
    color: #818cf8;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    margin-left: 12px;
    vertical-align: middle;
}

.billing-toggle-link:hover {
    text-decoration: underline;
}

/* Downgrade Confirmation Modal */
.downgrade-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.downgrade-modal-content {
    background: var(--bg-card, #1a1a2e);
    border: 1px solid var(--border-color, #2a2a3e);
    border-radius: 16px;
    padding: 28px;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.downgrade-modal-content h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary, #f0f0f0);
    margin-bottom: 12px;
}

.downgrade-modal-content p {
    font-size: 0.85rem;
    color: var(--text-secondary, #bbb);
    margin-bottom: 12px;
    line-height: 1.5;
}

.downgrade-feature-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}

.downgrade-feature-list li {
    font-size: 0.82rem;
    color: #ef4444;
    padding: 4px 0;
}

.downgrade-feature-list li::before {
    content: '\2717 ';
    margin-right: 6px;
}

.downgrade-reassure {
    font-size: 0.8rem;
    color: var(--text-muted, #888);
    font-style: italic;
}

.downgrade-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-modal-cancel {
    padding: 8px 16px;
    border: 1px solid var(--border-color, #2a2a3e);
    background: transparent;
    color: var(--text-secondary, #bbb);
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-modal-confirm {
    padding: 8px 16px;
    border: none;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-modal-confirm:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* Loading state */
.billing-loading {
    text-align: center;
    padding: 48px;
    color: var(--text-muted, #888);
}
