<?php
/**
 * License Page Template
 * 
 * Shows license information and activation form
 * 
 * @package EasyInvoice
 * @since 1.0.0
 */

// Get current page
$current_page = $_GET['page'] ?? '';

// Check if Pro plugin wants to override the content
$pro_content = apply_filters('easy_invoice_license_page_content', '');
?>

<div class="wrap easy-invoice-admin">
    <div class="easy-invoice-content">
        <?php if (!empty($pro_content)): ?>
            <!-- Pro plugin has provided content -->
            <?php echo $pro_content; ?>
        <?php else: ?>
            <!-- Free Version Message -->
            <div class="free-version-card">
                <div class="card-header">
                    <h2><?php _e('You\'re Using the Free Version', 'easy-invoice'); ?></h2>
                    <p><?php _e('No license activation required. You can continue using all free features.', 'easy-invoice'); ?></p>
                </div>
                
                <div class="card-content">
                    <!-- Premium Features List -->
                    <div class="premium-features">
                        <h3><?php _e('Upgrade to Pro and Unlock These Premium Features:', 'easy-invoice'); ?></h3>
                        <div class="features-grid">
                            <div class="feature-item">
                                <div class="feature-icon">
                                    <svg class="w-6 h-6" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                        <path d="M12 1V23" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                                        <path d="M17 5H9.5C8.57174 5 7.6815 5.36875 7.02513 6.02513C6.36875 6.6815 6 7.57174 6 8.5C6 9.42826 6.36875 10.3185 7.02513 10.9749C7.6815 11.6313 8.57174 12 9.5 12H14.5C15.4283 12 16.3185 12.3687 16.9749 13.0251C17.6313 13.6815 18 14.5717 18 15.5C18 16.4283 17.6313 17.3185 16.9749 17.9749C16.3185 18.6313 15.4283 19 14.5 19H6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                                    </svg>
                                </div>
                                <div class="feature-content">
                                    <h4><?php _e('Recurring Invoices', 'easy-invoice'); ?></h4>
                                    <p><?php _e('Automatically generate and send recurring invoices on schedule.', 'easy-invoice'); ?></p>
                                </div>
                            </div>
                            
                            <div class="feature-item">
                                <div class="feature-icon">
                                    <svg class="w-6 h-6" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                        <path d="M14 2H6C4.9 2 4 2.9 4 4V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V8L14 2Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                                        <path d="M14 2V8H20" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                                    </svg>
                                </div>
                                <div class="feature-content">
                                    <h4><?php _e('Advanced PDF Customization', 'easy-invoice'); ?></h4>
                                    <p><?php _e('Customize PDF templates with your branding, colors, and layout preferences.', 'easy-invoice'); ?></p>
                                </div>
                            </div>
                            
                            <div class="feature-item">
                                <div class="feature-icon">
                                    <svg class="w-6 h-6" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                        <path d="M17 21V19C17 17.9391 16.5786 16.9217 15.8284 16.1716C15.0783 15.4214 14.0609 15 13 15H5C3.93913 15 2.92172 15.4214 2.17157 16.1716C1.42143 16.9217 1 17.9391 1 19V21" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                                        <circle cx="9" cy="7" r="4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                                    </svg>
                                </div>
                                <div class="feature-content">
                                    <h4><?php _e('Multiple Payment Gateways', 'easy-invoice'); ?></h4>
                                    <p><?php _e('Accept payments via PayPal, Stripe, Square, Authorize.Net, and more.', 'easy-invoice'); ?></p>
                                </div>
                            </div>
                            
                            <div class="feature-item">
                                <div class="feature-icon">
                                    <svg class="w-6 h-6" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                        <rect x="3" y="4" width="18" height="18" rx="2" ry="2" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                                        <line x1="16" y1="2" x2="16" y2="6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                                        <line x1="8" y1="2" x2="8" y2="6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                                        <line x1="3" y1="10" x2="21" y2="10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                                    </svg>
                                </div>
                                <div class="feature-content">
                                    <h4><?php _e('Partial Payments', 'easy-invoice'); ?></h4>
                                    <p><?php _e('Allow customers to pay invoices in installments with flexible payment options.', 'easy-invoice'); ?></p>
                                </div>
                            </div>
                            
                            <div class="feature-item">
                                <div class="feature-icon">
                                    <svg class="w-6 h-6" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                        <path d="M17 21V19C17 17.9391 16.5786 16.9217 15.8284 16.1716C15.0783 15.4214 14.0609 15 13 15H5C3.93913 15 2.92172 15.4214 2.17157 16.1716C1.42143 16.9217 1 17.9391 1 19V21" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                                        <circle cx="9" cy="7" r="4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                                        <path d="M23 21V19C23 18.1137 22.6485 17.2628 22.0237 16.6425C21.3989 16.0221 20.5471 15.6722 19.66 15.6722C18.7729 15.6722 17.9211 16.0221 17.2963 16.6425C16.6715 17.2628 16.32 18.1137 16.32 19V21" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                                    </svg>
                                </div>
                                <div class="feature-content">
                                    <h4><?php _e('Client Portal', 'easy-invoice'); ?></h4>
                                    <p><?php _e('Give clients access to view invoices, make payments, and manage their account.', 'easy-invoice'); ?></p>
                                </div>
                            </div>
                            
                            <div class="feature-item">
                                <div class="feature-icon">
                                    <svg class="w-6 h-6" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                        <path d="M18 20V10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                                        <path d="M12 20V4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                                        <path d="M6 20V14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                                    </svg>
                                </div>
                                <div class="feature-content">
                                    <h4><?php _e('Advanced Reports', 'easy-invoice'); ?></h4>
                                    <p><?php _e('Detailed analytics, revenue reports, and business insights.', 'easy-invoice'); ?></p>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="upgrade-actions">
                        <a href="https://matrixaddons.com/plugins/easy-invoice/#free-vs-pro" target="_blank" class="upgrade-button">
                            <?php _e('Upgrade to Pro', 'easy-invoice'); ?>
                        </a>
                    </div>
                </div>
            </div>
        <?php endif; ?>
    </div>
</div>

<style>
/* License Page Styles */
.easy-invoice-admin {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.easy-invoice-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Free Version Styles */
.free-version-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.free-version-card .card-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    padding: 40px 30px;
    text-align: center;
}

.free-version-card .card-header .header-icon {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.9;
}

.free-version-card .card-header h2 {
    margin: 0 0 15px 0;
    font-size: 28px;
    font-weight: 600;
}

.free-version-card .card-header p {
    margin: 0;
    font-size: 16px;
    opacity: 0.9;
}

.free-version-card .card-content {
    padding: 40px 30px;
}

/* Premium Features */
.premium-features {
    margin-bottom: 40px;
}

.premium-features h3 {
    margin: 0 0 30px 0;
    color: #1d2327;
    font-size: 22px;
    font-weight: 600;
    text-align: center;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #8b5cf6;
    transition: all 0.2s ease;
}

.feature-item:hover {
    background: #f0f0ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.1);
}

.feature-icon {
    color: #8b5cf6;
    margin-top: 2px;
}

.feature-content h4 {
    margin: 0 0 8px 0;
    color: #1d2327;
    font-size: 16px;
    font-weight: 600;
}

.feature-content p {
    margin: 0;
    color: #646970;
    font-size: 14px;
    line-height: 1.5;
}

.upgrade-actions {
    text-align: center;
    padding: 30px 0;
    border-top: 1px solid #e5e7eb;
}

.upgrade-button {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.upgrade-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    color: #fff;
}

/* Responsive Design */
@media (max-width: 768px) {
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .upgrade-card .card-header,
    .free-version-card .card-header {
        padding: 30px 20px;
    }
    
    .upgrade-card .card-content,
    .free-version-card .card-content {
        padding: 30px 20px;
    }
    
    .upgrade-button {
        padding: 10px 20px;
        font-size: 14px;
    }
}
</style> 