{{!
    This file is part of Moodle - http://moodle.org/
    Subscription Management Template - Modern, Beautiful, Responsive Interface
    Note: Do NOT load Bootstrap from CDN - Moodle includes Bootstrap and loading another version breaks navigation
}}
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.all.min.js"></script>

{{#js}}
require(['jquery', 'core/ajax', 'core/notification', 'report_adeptus_insights/subscription'], function($, Ajax, Notification, Subscription) {
    try {
        // Initialize subscription module
        Subscription.init({});
    } catch (error) {
        console.error('Error initializing subscription:', error);
    }
});
{{/js}}

<div class="adeptus-subscription-container" id="subscription-container" 
     {{#current_subscription}}data-subscription='{"status":"{{status}}","is_active":{{is_active}},"is_cancelled":{{is_cancelled}},"has_payment_issues":{{has_payment_issues}},"should_disable_api_access":{{should_disable_api_access}},"status_message":"{{status_message}}","status_details":{}}{{/current_subscription}}'>
    <!-- Header Section -->
    <div class="subscription-header">
        <div class="subscription-header-content">
            <h1 class="subscription-title">
                <i class="fa fa-credit-card subscription-icon"></i>
                {{#str}}subscription_management, report_adeptus_insights{{/str}}
            </h1>
            <p class="subscription-subtitle">Manage your subscription and billing</p>
        </div>
        <div class="subscription-header-actions">
            <a style="margin-bottom: 17px;" href="{{config.wwwroot}}/report/adeptus_insights/index.php" class="btn btn-primary">
                <i class="fa fa-arrow-left"></i> Back to Dashboard
            </a>
            <div class="subscription-user-info">
                <span class="user-welcome">Welcome, {{user_fullname}}</span>
            </div>
        </div>
    </div>

    <!-- Current Usage Analytics Cards -->
    <div class="usage-analytics-section">
        <div class="analytics-grid">
            <div class="analytics-card">
                <div class="analytics-header">
                    <div class="analytics-icon">
                        <i class="fa fa-code"></i>
                    </div>
                    <div class="analytics-title">
                        <h3>AI Tokens</h3>
                        <p>Monthly Usage &amp; Limit</p>
                    </div>
                </div>
                <div class="analytics-details">
                    <div class="detail-row">
                        <span class="detail-label">Monthly Limit:</span>
                        <span class="detail-value total numeric">{{#current_subscription}}{{tokens_limit_formatted}}{{/current_subscription}}{{^current_subscription}}50K{{/current_subscription}}</span>
                    </div>
                    <div class="detail-row">
                        <span class="detail-label">Used:</span>
                        <span class="detail-value used numeric">{{#current_subscription}}{{tokens_used_formatted}}{{/current_subscription}}{{^current_subscription}}0{{/current_subscription}}</span>
                    </div>
                    <div class="detail-row">
                        <span class="detail-label">Remaining:</span>
                        <span class="detail-value remaining numeric">{{#current_subscription}}{{tokens_remaining_formatted}}{{/current_subscription}}{{^current_subscription}}50K{{/current_subscription}}</span>
                    </div>
                    {{#current_subscription}}
                    <div class="analytics-progress">
                        <div class="progress-bar">
                            <div class="progress-fill" style="width: {{tokens_usage_percent}}%"></div>
                        </div>
                    </div>
                    {{/current_subscription}}
                </div>
            </div>
            
            <div class="analytics-card">
                <div class="analytics-header">
                    <div class="analytics-icon">
                        <i class="fa fa-file-text-o"></i>
                    </div>
                    <div class="analytics-title">
                        <h3>Reports &amp; Exports</h3>
                        <p>Monthly Generation &amp; Remaining</p>
                    </div>
                </div>
                <div class="analytics-details">
                    <div class="detail-row">
                        <span class="detail-label">Monthly Exports:</span>
                        <span class="detail-value total numeric">{{#current_subscription}}{{exports_remaining}}{{/current_subscription}}{{^current_subscription}}0{{/current_subscription}}</span>
                    </div>
                    <div class="detail-row">
                        <span class="detail-label">Generated:</span>
                        <span class="detail-value used numeric">{{#current_subscription}}{{reports_total}}{{/current_subscription}}{{^current_subscription}}0{{/current_subscription}}</span>
                    </div>
                    <div class="detail-row">
                        <span class="detail-label">Exports Left:</span>
                        <span class="detail-value remaining numeric">{{#current_subscription}}{{exports_remaining}}{{/current_subscription}}{{^current_subscription}}0{{/current_subscription}}</span>
                    </div>
                    {{#current_subscription}}
                    <div class="analytics-progress">
                        <div class="progress-bar">
                            <div class="progress-fill" style="width: {{#usage}}{{reports_generated_this_month}}{{/usage}}{{^usage}}0{{/usage}}%"></div>
                        </div>
                    </div>
                    {{/current_subscription}}
                </div>
            </div>
            
            <div class="analytics-card">
                <div class="analytics-header">
                    <div class="analytics-icon">
                        <i class="fa fa-calendar"></i>
                    </div>
                    <div class="analytics-title">
                        <h3>Billing Period</h3>
                        <p>Current &amp; Next Billing</p>
                    </div>
                </div>
                <div class="analytics-details">
                    <div class="detail-row">
                        <span class="detail-label">Period Start:</span>
                        <span class="detail-value total">{{#current_subscription}}{{current_period_start}}{{/current_subscription}}{{^current_subscription}}N/A{{/current_subscription}}</span>
                    </div>
                    <div class="detail-row">
                        <span class="detail-label">Period End:</span>
                        <span class="detail-value used">{{#current_subscription}}{{current_period_end}}{{/current_subscription}}{{^current_subscription}}N/A{{/current_subscription}}</span>
                    </div>
                    <div class="detail-row">
                        <span class="detail-label">Next Billing:</span>
                        <span class="detail-value remaining">{{#current_subscription}}{{#next_billing}}{{next_billing}}{{/next_billing}}{{^next_billing}}N/A{{/next_billing}}{{/current_subscription}}{{^current_subscription}}N/A{{/current_subscription}}</span>
                    </div>
                    {{#current_subscription}}
                    <div class="analytics-info">
                        <span class="info-text">{{#is_trial}}Trial active until {{trial_ends_at}}{{/is_trial}}{{^is_trial}}Billing cycle active{{/is_trial}}</span>
                    </div>
                    {{/current_subscription}}
                </div>
            </div>
            
            <div class="analytics-card">
                <div class="analytics-header">
                    <div class="analytics-icon">
                        <i class="fa fa-credit-card"></i>
                    </div>
                    <div class="analytics-title">
                        <h3>Subscription</h3>
                        <p>Current Plan &amp; Status</p>
                    </div>
                </div>
                <div class="analytics-details">
                    <div class="detail-row">
                        <span class="detail-label">Plan Name:</span>
                        <span class="detail-value total">{{#current_subscription}}{{plan_name}}{{/current_subscription}}{{^current_subscription}}No Plan{{/current_subscription}}</span>
                    </div>
                    <div class="detail-row">
                        <span class="detail-label">Status:</span>
                        <span class="detail-value used status-{{#current_subscription}}{{status}}{{/current_subscription}}{{^current_subscription}}inactive{{/current_subscription}}">{{#current_subscription}}{{status}}{{/current_subscription}}{{^current_subscription}}Inactive{{/current_subscription}}</span>
                    </div>
                    <div class="detail-row">
                        <span class="detail-label">Price:</span>
                        <span class="detail-value remaining currency">{{#current_subscription}}{{price}} {{billing_cycle}}{{/current_subscription}}{{^current_subscription}}Free{{/current_subscription}}</span>
                    </div>
                    {{#current_subscription}}
                    <div class="analytics-status">
                        <span class="status-badge status-{{status}}">{{status}}</span>
                        {{#is_trial}}
                        <span class="trial-badge">Trial until {{trial_ends_at}}</span>
                        {{/is_trial}}
                    </div>
                    {{/current_subscription}}
                </div>
            </div>
        </div>
    </div>

    <!-- Current Subscription Status -->
    {{#current_subscription}}
    <div class="subscription-status-section">
        <div class="status-card current-plan status-{{status}}{{#is_free_plan}} status-free{{/is_free_plan}}">
            <div class="status-header">
                <h3>
                    {{#is_active}}
                        <i class="fa fa-check-circle status-icon-active"></i> Current Plan Details
                    {{/is_active}}
                    {{^is_active}}
                        {{#is_cancelled}}
                            <i class="fa fa-times-circle status-icon-cancelled"></i> Cancelled Plan Details
                        {{/is_cancelled}}
                        {{^is_cancelled}}
                            {{#has_payment_issues}}
                                <i class="fa fa-exclamation-triangle status-icon-payment-issue"></i> Payment Issue
                            {{/has_payment_issues}}
                            {{^has_payment_issues}}
                                <i class="fa fa-info-circle status-icon-inactive"></i> Inactive Plan Details
                            {{/has_payment_issues}}
                        {{/is_cancelled}}
                    {{/is_active}}
                </h3>
            </div>
            <div class="status-content">
                <div class="plan-details">
                    <h4>{{plan_name}}</h4>
                    <p class="plan-price">{{price}} <span class="billing-cycle">{{billing_cycle}}</span></p>
                    <div class="plan-status">
                        <span class="status-badge status-{{status}}">{{status_message}}</span>
                    </div>
                </div>
                
                <!-- Status-specific information -->
                {{#is_cancelled}}
                <div class="cancellation-info">
                    <div class="info-item">
                        <i class="fa fa-calendar-times-o"></i>
                        <span>Cancelled: {{cancellation_info.cancelled_at_formatted}}</span>
                    </div>
                    {{#cancel_at_period_end}}
                    <div class="info-item">
                        <i class="fa fa-clock-o"></i>
                        <span>Access ends: {{cancellation_info.access_ends_at_formatted}}</span>
                    </div>
                    {{/cancel_at_period_end}}
                    {{#status_details.can_renew}}
                    <div class="renewal-prompt">
                        <i class="fa fa-refresh"></i>
                        <span>You can renew your subscription to restore access</span>
                    </div>
                    {{/status_details.can_renew}}
                </div>
                {{/is_cancelled}}
                
                {{#has_payment_issues}}
                <div class="payment-issue-info">
                    <div class="info-item">
                        <i class="fa fa-exclamation-triangle"></i>
                        <span>Payment failed: {{payment_info.last_payment_failed_at_formatted}}</span>
                    </div>
                    <div class="info-item">
                        <i class="fa fa-credit-card"></i>
                        <span>Please update your payment method</span>
                    </div>
                </div>
                {{/has_payment_issues}}
                
                {{#is_trial}}
                <div class="trial-notice">
                    <i class="fa fa-clock-o"></i>
                    <span>Trial active until {{trial_ends_at}}</span>
                </div>
                {{/is_trial}}
                
                <div class="usage-details">
                    <div class="usage-item">
                        <i class="fa fa-bar-chart"></i>
                        <span>{{reports_total}} / {{reports_limit}} Reports Generated</span>
                    </div>
                    <div class="usage-item">
                        <i class="fa fa-code"></i>
                        <span>{{tokens_remaining_formatted}} AI Tokens Remaining</span>
                    </div>
                    <div class="usage-item">
                        <i class="fa fa-file-text-o"></i>
                        <span>{{exports_remaining}} Exports Remaining</span>
                    </div>
                    {{#next_billing}}
                    <div class="usage-item">
                        <i class="fa fa-calendar"></i>
                        <span>Next billing: {{next_billing}}</span>
                    </div>
                    {{/next_billing}}
                </div>

                <!-- Report limit policy notice -->
                <div class="report-policy-notice">
                    <i class="fa fa-info-circle"></i>
                    <span><strong>Report Policy:</strong> If you downgrade or cancel your subscription, any reports exceeding your new plan's limit will be automatically deleted (oldest first) when the change takes effect.</span>
                </div>

                <!-- Access restrictions notice -->
                {{#should_disable_api_access}}
                <div class="access-restriction-notice">
                    <i class="fa fa-lock"></i>
                    <span>API access is currently restricted due to subscription status</span>
                </div>
                {{/should_disable_api_access}}
            </div>
            
            <div class="status-actions">
                {{#is_active}}
                    {{#is_free_plan}}
                    <button class="btn btn-success btn-upgrade-plan" id="upgrade-plan">
                        <i class="fa fa-arrow-up"></i> Upgrade Plan
                    </button>
                    {{/is_free_plan}}
                    {{^is_free_plan}}
                    <button class="btn btn-primary btn-modify-subscription" id="modify-subscription">
                        <i class="fa fa-cog"></i> Manage Subscription
                    </button>
                    <button class="btn btn-outline-danger btn-cancel-subscription" id="cancel-subscription">
                        <i class="fa fa-times"></i> Cancel Subscription
                    </button>
                    {{/is_free_plan}}
                {{/is_active}}
                {{^is_active}}
                    {{#is_cancelled}}
                        {{#status_details.can_renew}}
                        <button class="btn btn-success" id="renew-subscription">
                            <i class="fa fa-refresh"></i> Renew Subscription
                        </button>
                        {{/status_details.can_renew}}
                        <button class="btn btn-outline-primary btn-view-plans" id="view-plans">
                            <i class="fa fa-eye"></i> View Plans
                        </button>
                    {{/is_cancelled}}
                    {{^is_cancelled}}
                        {{#has_payment_issues}}
                        <button class="btn btn-warning" id="update-payment">
                            <i class="fa fa-credit-card"></i> Update Payment Method
                        </button>
                        <button class="btn btn-outline-primary btn-view-plans" id="view-plans">
                            <i class="fa fa-eye"></i> View Plans
                        </button>
                        {{/has_payment_issues}}
                        {{^has_payment_issues}}
                        <button class="btn btn-outline-primary btn-view-plans" id="view-plans">
                            <i class="fa fa-eye"></i> View Plans
                        </button>
                        {{/has_payment_issues}}
                    {{/is_cancelled}}
                {{/is_active}}
            </div>
        </div>
    </div>
    {{/current_subscription}}

</div>

<style>

.subscription-user-info {
    text-align: right;
}

.adeptus-subscription-container {
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* Header Styles */
.subscription-header {
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    color: white;
    padding: 40px 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.subscription-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.subscription-icon {
    font-size: 2rem;
}

.subscription-subtitle {
    font-size: 1.2rem;
    margin: 10px 0 0 0;
    opacity: 0.9;
}

.user-welcome {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Status Section */
.subscription-status-section {
    margin-bottom: 40px;
}

.status-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 2px solid #e9ecef;
}

.status-header h3 {
    color: #2c3e50;
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 20px;
}

.plan-details h4 {
    color: #2c3e50;
    margin: 0 0 10px 0;
    font-size: 1.5rem;
}

.plan-price {
    font-size: 1.8rem;
    font-weight: 700;
    color: #27ae60;
    margin-bottom: 10px;
}

.billing-cycle {
    font-size: 1rem;
    color: #7f8c8d;
    font-weight: 400;
}

.status-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.usage-details {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.usage-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2c3e50;
}

.usage-item i {
    color: #3498db;
    width: 20px;
}

.trial-notice {
    background: #fff3cd;
    color: #856404;
    padding: 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.status-actions {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

/* Enhanced Status Styles */
.status-card.status-active {
    border-left: 5px solid #27ae60;
}

.status-card.status-cancelled {
    border-left: 5px solid #e74c3c;
    background: #fdf2f2;
}

.status-card.status-past_due,
.status-card.status-unpaid {
    border-left: 5px solid #f39c12;
    background: #fef9e7;
}

.status-card.status-incomplete,
.status-card.status-incomplete_expired {
    border-left: 5px solid #9b59b6;
    background: #f4f0f7;
}

.status-card.status-paused {
    border-left: 5px solid #95a5a6;
    background: #f8f9fa;
}

.status-card.status-free {
    border-left: 5px solid #2ecc71;
    background: #f0f9f4;
}

.status-card.status-free .status-badge {
    background: #2ecc71;
    color: white;
}

/* Status Icons */
.status-icon-active {
    color: #27ae60;
}

.status-icon-cancelled {
    color: #e74c3c;
}

.status-icon-payment-issue {
    color: #f39c12;
}

.status-icon-inactive {
    color: #95a5a6;
}

/* Status-specific information sections */
.cancellation-info,
.payment-issue-info,
.access-restriction-notice,
.report-policy-notice,
.renewal-prompt {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    border-left: 4px solid #6c757d;
}

.cancellation-info {
    border-left-color: #e74c3c;
    background: #fdf2f2;
}

.payment-issue-info {
    border-left-color: #f39c12;
    background: #fef9e7;
}

.access-restriction-notice {
    border-left-color: #dc3545;
    background: #f8d7da;
}

.report-policy-notice {
    border-left-color: #17a2b8;
    background: #e8f4f8;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9em;
    color: #0c5460;
}

.report-policy-notice i {
    color: #17a2b8;
    margin-top: 2px;
}

.renewal-prompt {
    border-left-color: #28a745;
    background: #d4edda;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: #495057;
}

.info-item:last-child {
    margin-bottom: 0;
}

.info-item i {
    width: 16px;
    text-align: center;
}

/* Status badges */
.status-badge.status-active {
    background: #d4edda;
    color: #155724;
}

.status-badge.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.status-past_due {
    background: #fff3cd;
    color: #856404;
}

.status-badge.status-unpaid {
    background: #fff3cd;
    color: #856404;
}

.status-badge.status-incomplete {
    background: #e2e3f1;
    color: #383d41;
}

.status-badge.status-incomplete_expired {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.status-paused {
    background: #e2e3e5;
    color: #383d41;
}

.status-badge.status-trialing {
    background: #d1ecf1;
    color: #0c5460;
}

/* Action buttons for different statuses */
.btn-success {
    background: #28a745;
    border-color: #28a745;
}

.btn-warning {
    background: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

.btn-outline-primary {
    color: #007bff;
    border-color: #007bff;
}

.btn-outline-primary:hover {
    background: #007bff;
    color: white;
}

/* Usage Analytics Section */
.usage-analytics-section {
    margin-bottom: 40px;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.analytics-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 280px;
}

.analytics-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.analytics-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.analytics-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.analytics-title {
    flex: 1;
}

.analytics-title h3 {
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 5px 0;
    line-height: 1.2;
}

.analytics-title p {
    color: #7f8c8d;
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.3;
}

.analytics-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f8f9fa;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: #7f8c8d;
    font-size: 0.85rem;
    font-weight: 500;
}

.detail-value {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    min-width: 60px;
    text-align: center;
}

.detail-value.total {
    background: #e3f2fd;
    color: #1976d2;
}

.detail-value.used {
    background: #fff3e0;
    color: #f57c00;
}

.detail-value.remaining {
    background: #e8f5e8;
    color: #388e3c;
}

/* Additional styling for better data display */
.analytics-info {
    margin-top: 15px;
    flex-shrink: 0;
}

.info-text {
    font-size: 0.8rem;
    color: #7f8c8d;
    font-weight: 500;
    text-align: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.analytics-status {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    margin-top: 15px;
    flex-shrink: 0;
}

.trial-badge {
    background: #fff3cd;
    color: #856404;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    border: 1px solid #ffeaa7;
}

/* Data formatting utilities */
.detail-value.numeric {
    font-family: 'Courier New', monospace;
    font-weight: 700;
}

.detail-value.currency {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: #27ae60;
}

.detail-value.status-active {
    background: #d4edda;
    color: #155724;
}

.detail-value.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

.detail-value.status-trial {
    background: #fff3cd;
    color: #856404;
}

/* Ensure consistent spacing in analytics cards */
.analytics-card > *:last-child {
    margin-bottom: 0;
}

.analytics-card > *:first-child {
    margin-top: 0;
}

.analytics-card:nth-child(1) .analytics-icon {
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
}

.analytics-card:nth-child(2) .analytics-icon {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
}

.analytics-card:nth-child(3) .analytics-icon {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.analytics-card:nth-child(4) .analytics-icon {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.analytics-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 10px 0;
}

.analytics-label {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin: 0 0 15px 0;
    font-weight: 500;
}

.analytics-progress {
    margin-top: 15px;
    flex-shrink: 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
    position: relative;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, #f8f9fa 25%, transparent 25%, transparent 50%, #f8f9fa 50%, #f8f9fa 75%, transparent 75%);
    background-size: 20px 20px;
    animation: progress-stripes 2s linear infinite;
}

@keyframes progress-stripes {
    0% { background-position: 0 0; }
    100% { background-position: 20px 0; }
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    font-size: 0.8rem;
    color: #7f8c8d;
    font-weight: 500;
}

.analytics-info {
    margin-top: 15px;
}

.info-text {
    font-size: 0.8rem;
    color: #7f8c8d;
    font-weight: 500;
}

.analytics-status {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.trial-badge {
    background: #fff3cd;
    color: #856404;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.btn {
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    background: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-primary {
    background: white;
    color: #2563eb;
}

.btn-success {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
}

/* Registration Section */
.registration-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    max-width: 500px;
    margin: 0 auto;
}

.registration-form .form-group {
    margin-bottom: 20px;
}

.registration-form label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
}

.registration-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.registration-form input:focus {
    outline: none;
    border-color: #667eea;
}

.form-actions {
    text-align: center;
    margin-top: 30px;
}

/* Modal Styles */
.modal-content {
    border-radius: 15px;
    border: none;
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px 15px 0 0;
}

.modal-title {
    color: white;
    margin: 0;
}

.btn-close {
    filter: invert(1);
}

.selected-plan-summary {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.stripe-card-element {
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    background: white;
}

.stripe-error {
    color: #e74c3c;
    font-size: 0.9rem;
    margin-top: 8px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .analytics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .subscription-header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .subscription-title {
        font-size: 2rem;
    }
    
    .status-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .step-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .analytics-card {
        padding: 20px;
        min-height: 250px;
    }
    
    .analytics-header {
        gap: 12px;
    }
    
    .analytics-icon {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .analytics-title h3 {
        font-size: 1.1rem;
    }
    
    .analytics-title p {
        font-size: 0.8rem;
    }
    
    .detail-row {
        padding: 6px 0;
        gap: 8px;
    }
    
    .detail-label {
        font-size: 0.8rem;
    }
    
    .detail-value {
        font-size: 0.85rem;
        padding: 3px 6px;
        min-width: 50px;
    }
}
@media (min-width: 768px) {
    .pagelayout-standard #page.drawers .main-inner, body.limitedwidth #page.drawers .main-inner {
        max-width: 100% !important;
    }
}
</style> 