/**
 * Billing Page Styles - Multi-Row Pricing Layout
 * Modern SaaS theme with soft gradients and glassmorphism
 */

/* =================== CSS Variables =================== */
:root {
    --billing-bg: #0f172a;
    --billing-surface: rgba(15, 23, 42, 0.9);
    --billing-border: rgba(255, 255, 255, 0.08);
    --billing-primary: #6366f1;
    --billing-primary-glow: rgba(99, 102, 241, 0.15);
    --billing-success: #10b981;
    --billing-warning: #f59e0b;
    --billing-danger: #ef4444;
    --billing-text: #f1f5f9;
    --billing-text-muted: #64748b;
    --billing-card-hover: rgba(99, 102, 241, 0.08);
    --billing-accent: #14b8a6;
}

/* =================== Page Layout =================== */
.billing-page {
    min-height: 100vh;
    width: 100%;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 25%, #134e4a 50%, #1e1b4b 75%, #0f172a 100%);
    background-attachment: fixed;
    padding: 40px 0 60px;
}

/* =================== Login Prompt Banner =================== */
.login-prompt-banner {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(99, 102, 241, 0.15));
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    padding: 16px 24px;
    margin: 0 auto 24px;
    max-width: 1400px;
}

.login-prompt-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #a5b4fc;
    font-size: 1rem;
}

.login-prompt-content i {
    color: #6366f1;
    font-size: 1.25rem;
}

.login-prompt-content .login-link {
    color: #818cf8;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.login-prompt-content .login-link:hover {
    color: #a5b4fc;
}

.billing-container {
    max-width: 100%;
    width: 100%;
    padding: 0 40px;
    margin: 0 auto;
}

@media (min-width: 1920px) {
    .billing-container {
        max-width: 1800px;
        padding: 0 60px;
    }
}

/* =================== Header =================== */
.billing-header {
    text-align: center;
    margin-bottom: 60px;
    position: relative;
}

.back-link {
    position: absolute;
    top: 0;
    left: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--billing-text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--billing-primary);
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 50px;
    font-size: 0.875rem;
    color: var(--billing-primary);
    margin-bottom: 24px;
}

.billing-header h1 {
    font-size: 3rem;
    font-weight: 700;
    color: var(--billing-text);
    margin-bottom: 16px;
    line-height: 1.2;
}

.gradient-text {
    background: linear-gradient(135deg, #6366f1 0%, #14b8a6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.billing-header p {
    font-size: 1.125rem;
    color: var(--billing-text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* =================== Current Plan Banner =================== */
.current-plan-banner {
    background: var(--billing-surface);
    border: 1px solid var(--billing-border);
    border-radius: 16px;
    padding: 24px 32px;
    margin-bottom: 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    backdrop-filter: blur(10px);
}

.current-plan-info h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--billing-text-muted);
    margin-bottom: 8px;
}

.current-plan-info .plan-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--billing-text);
}

.current-plan-status {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: capitalize;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--billing-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.trialing {
    background: rgba(245, 158, 11, 0.15);
    color: var(--billing-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.canceled,
.status-badge.inactive {
    background: rgba(239, 68, 68, 0.15);
    color: var(--billing-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

#nextBillingDate {
    color: var(--billing-text-muted);
    font-size: 0.875rem;
}

/* =================== Pricing Sections =================== */
.pricing-section {
    margin-bottom: 60px;
}

.section-title {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 3px;
    color: var(--billing-text-muted);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-transform: uppercase;
}

.section-title i {
    color: var(--billing-primary);
    font-size: 1rem;
}

/* =================== Pricing Grid =================== */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    width: 100%;
}

@media (min-width: 1400px) {
    .pricing-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1200px) {
    .pricing-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .pricing-grid {
        grid-template-columns: 1fr;
    }

    .billing-header h1 {
        font-size: 2rem;
    }

    .back-link {
        position: static;
        display: block;
        margin-bottom: 20px;
        text-align: left;
    }
}

/* =================== Pricing Cards =================== */
.pricing-card {
    background: var(--billing-surface);
    border: 1px solid var(--billing-border);
    border-radius: 16px;
    padding: 32px 24px;
    position: relative;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
}

.pricing-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 212, 255, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3),
                0 0 40px var(--billing-primary-glow);
}

.pricing-card.popular {
    border-color: var(--billing-primary);
    background: linear-gradient(180deg, rgba(0, 212, 255, 0.08) 0%, var(--billing-surface) 100%);
}

.pricing-card.current {
    border-color: var(--billing-success);
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, var(--billing-surface) 100%);
}

/* Popular Badge */
.popular-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--billing-primary) 0%, #667eea 100%);
    color: #0a0c10;
    padding: 6px 20px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

/* Card Header */
.card-header {
    margin-bottom: 24px;
}

.pricing-card .plan-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--billing-text);
    margin-bottom: 12px;
}

.plan-price {
    font-size: 2.75rem;
    font-weight: 700;
    color: var(--billing-text);
    line-height: 1;
}

.plan-price .currency {
    font-size: 1.5rem;
    vertical-align: super;
    margin-right: 2px;
}

.plan-price .period {
    font-size: 1rem;
    font-weight: 400;
    color: var(--billing-text-muted);
}

/* Features List */
.features-list {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
    flex: 1;
}

.features-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    color: var(--billing-text);
    font-size: 0.9375rem;
    border-bottom: 1px solid var(--billing-border);
}

.features-list li:last-child {
    border-bottom: none;
}

.features-list li i {
    color: var(--billing-primary);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.features-list.compact li {
    padding: 8px 0;
    font-size: 0.875rem;
}

/* Subscribe Button */
.subscribe-btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: auto;
}

.subscribe-btn.primary {
    background: var(--billing-primary);
    color: #0a0c10;
}

.subscribe-btn.primary:hover {
    background: #00e5ff;
    box-shadow: 0 8px 24px var(--billing-primary-glow);
}

.subscribe-btn.secondary {
    background: transparent;
    color: var(--billing-text);
    border: 1px solid var(--billing-border);
}

.subscribe-btn.secondary:hover {
    border-color: var(--billing-primary);
    color: var(--billing-primary);
}

.subscribe-btn:disabled,
.subscribe-btn.current {
    opacity: 0.5;
    cursor: not-allowed;
}

.subscribe-btn.current {
    background: transparent;
    border: 2px solid var(--billing-success);
    color: var(--billing-success);
}

/* =================== Custom Card Controls =================== */
.custom-card .card-header {
    margin-bottom: 16px;
}

.custom-selector {
    margin-bottom: 20px;
}

.custom-selector label {
    display: block;
    font-size: 0.875rem;
    color: var(--billing-text-muted);
    margin-bottom: 12px;
}

/* Stepper Control */
.stepper-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
}

.stepper-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--billing-border);
    background: transparent;
    color: var(--billing-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.stepper-btn:hover {
    border-color: var(--billing-primary);
    color: var(--billing-primary);
    background: rgba(0, 212, 255, 0.1);
}

.stepper-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--billing-text);
    min-width: 120px;
    text-align: center;
}

.unit-price {
    display: block;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--billing-text-muted);
}

/* Slider Control */
.slider-control {
    margin-bottom: 8px;
}

.custom-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 12px;
}

.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--billing-primary);
    cursor: pointer;
    box-shadow: 0 0 10px var(--billing-primary-glow);
    transition: transform 0.2s;
}

.custom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.custom-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--billing-primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px var(--billing-primary-glow);
}

.slider-value {
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--billing-text);
    margin-bottom: 12px;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--billing-text-muted);
    flex-wrap: wrap;
    gap: 4px;
}

.slider-labels span {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.slider-labels span:hover {
    color: var(--billing-text);
}

.slider-labels span.active {
    color: var(--billing-primary);
    font-weight: 600;
    background: rgba(0, 212, 255, 0.1);
}

/* =================== Addon Section =================== */
.addon-section .section-title {
    color: var(--billing-primary);
}

.addon-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    max-width: 700px;
}

@media (max-width: 768px) {
    .addon-grid {
        grid-template-columns: 1fr;
        max-width: 100%;
    }
}

.addon-card {
    background: var(--billing-surface);
    border: 1px solid var(--billing-border);
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.addon-card:hover:not(.coming-soon) {
    border-color: rgba(0, 212, 255, 0.3);
    transform: translateY(-4px);
}

.addon-card.coming-soon {
    opacity: 0.6;
}

.coming-soon-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(107, 114, 128, 0.3);
    color: var(--billing-text-muted);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.addon-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--billing-primary);
    background: rgba(0, 212, 255, 0.1);
    border-radius: 16px;
}

.addon-card h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--billing-text);
    margin-bottom: 8px;
}

.addon-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--billing-text);
    margin-bottom: 16px;
}

.addon-price span {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--billing-text-muted);
}

.addon-features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
    text-align: left;
}

.addon-features li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 0.875rem;
    color: var(--billing-text-muted);
}

.addon-features .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--billing-primary);
    flex-shrink: 0;
}

.addon-btn {
    width: 100%;
    padding: 12px 20px;
    border: 1px solid var(--billing-border);
    border-radius: 8px;
    background: transparent;
    color: var(--billing-text);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.addon-btn:hover:not(.disabled) {
    border-color: var(--billing-primary);
    color: var(--billing-primary);
}

.addon-btn.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* =================== Cancel Section =================== */
.cancel-section {
    text-align: center;
    padding: 40px;
    border-top: 1px solid var(--billing-border);
    margin-top: 60px;
}

.cancel-section p {
    color: var(--billing-text-muted);
    margin-bottom: 16px;
}

.cancel-btn {
    padding: 12px 24px;
    border: 1px solid var(--billing-danger);
    border-radius: 8px;
    background: transparent;
    color: var(--billing-danger);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.cancel-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* =================== Loading Overlay =================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 12, 16, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--billing-border);
    border-top-color: var(--billing-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    margin-top: 16px;
    color: var(--billing-text);
    font-size: 0.9375rem;
}

/* =================== Toast Notification =================== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    border-radius: 10px;
    background: var(--billing-surface);
    border: 1px solid var(--billing-border);
    color: var(--billing-text);
    font-size: 0.9375rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    backdrop-filter: blur(10px);
    animation: slideIn 0.3s ease;
}

.toast.hidden {
    display: none;
}

.toast.success {
    border-color: var(--billing-success);
}

.toast.error {
    border-color: var(--billing-danger);
}

.toast.warning {
    border-color: var(--billing-warning);
}

.toast.info {
    border-color: var(--billing-primary);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* =================== Utility Classes =================== */
.hidden {
    display: none !important;
}

/* =================== Highlighted Plan Animation =================== */
.pricing-card.highlighted {
    animation: highlightPulse 2s ease-in-out;
    border-color: var(--billing-primary) !important;
}

@keyframes highlightPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.4); }
    50% { box-shadow: 0 0 0 20px rgba(0, 212, 255, 0); }
}

/* =================== Responsive Adjustments =================== */
@media (max-width: 1200px) {
    .billing-header h1 {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .billing-page {
        padding: 20px 0 40px;
    }

    .billing-container {
        padding: 0 16px;
    }

    .billing-header {
        margin-bottom: 40px;
    }

    .billing-header h1 {
        font-size: 1.75rem;
    }

    .billing-header p {
        font-size: 1rem;
    }

    .current-plan-banner {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .current-plan-status {
        flex-direction: column;
        gap: 8px;
    }

    .pricing-section {
        margin-bottom: 40px;
    }

    .pricing-card {
        padding: 24px 20px;
    }

    .plan-price {
        font-size: 2.25rem;
    }

    .toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }
}

/* =================== Dark Theme Overrides =================== */
[data-theme="dark"] .billing-page {
    background: var(--billing-bg);
}

