<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Pricing - SA STEM Tutor</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        .pricing-card {
            border: 1px solid #e0e0e0;
            border-radius: 10px;
            padding: 30px;
            margin: 20px 0;
            text-align: center;
            transition: transform 0.3s;
        }
        .pricing-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        }
        .premium-badge {
            background: #ffd700;
            color: #000;
            padding: 5px 10px;
            border-radius: 15px;
            font-weight: bold;
        }
        .btn-subscribe {
            background: #00c853;
            color: white;
            border: none;
            padding: 12px 30px;
            border-radius: 5px;
            font-size: 16px;
            text-decoration: none;
            display: inline-block;
            transition: background 0.3s;
        }
        .btn-subscribe:hover {
            background: #00b34a;
            color: white;
        }
    </style>
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container">
            <a class="navbar-brand" href="{{ url_for('index') }}">SA STEM Tutor</a>
            <div class="navbar-nav ms-auto">
                {% if user %}
                    <a class="nav-link" href="{{ url_for('dashboard') }}">Dashboard</a>
                    <a class="nav-link" href="{{ url_for('logout') }}">Logout</a>
                {% else %}
                    <a class="nav-link" href="{{ url_for('index') }}">Home</a>
                    <a class="nav-link" href="{{ url_for('login') }}">Login</a>
                {% endif %}
            </div>
        </div>
    </nav>

    <div class="container mt-4">
        <h2 class="text-center mb-4">Choose Your Plan</h2>

        <div class="row">
            <div class="col-md-6">
                <div class="pricing-card">
                    <h3>Free Tier</h3>
                    <div class="price">R0<span class="text-muted">/month</span></div>
                    <ul class="list-unstyled mt-3">
                        <li>✓ 3 questions per day</li>
                        <li>✓ All subjects supported</li>
                        <li>✓ Multiple languages</li>
                        <li>✓ CAPS curriculum aligned</li>
                        <li>✗ Unlimited questions</li>
                        <li>✗ Priority support</li>
                    </ul>
                    <p class="text-muted">Perfect for trying out the service</p>
                    {% if user %}
                        <a href="{{ url_for('dashboard') }}" class="btn btn-outline-primary">Go to Dashboard</a>
                    {% else %}
                        <a href="{{ url_for('login') }}" class="btn btn-outline-primary">Get Started</a>
                    {% endif %}
                </div>
            </div>
            <div class="col-md-6">
                <div class="pricing-card bg-light">
                    <span class="premium-badge">RECOMMENDED</span>
                    <h3>Premium Tier</h3>
                    <div class="price">R99<span class="text-muted">/month</span></div>
                    <ul class="list-unstyled mt-3">
                        <li>✓ Unlimited questions</li>
                        <li>✓ All subjects supported</li>
                        <li>✓ Multiple languages</li>
                        <li>✓ CAPS curriculum aligned</li>
                        <li>✓ Priority support</li>
                        <li>✓ Advanced explanations</li>
                    </ul>
                    <p class="text-muted">Best for serious learners</p>

                    {% if user %}
                        {% if user.is_premium %}
                            <button class="btn btn-success" disabled>Already Premium</button>
                            <p class="text-success mt-2">You're already a premium member!</p>
                        {% else %}
                            <a href="{{ url_for('subscribe') }}" class="btn-subscribe">Subscribe Now</a>
                            <p class="text-muted mt-2">Secure payment by Yoco</p>
                        {% endif %}
                    {% else %}
                        <a href="{{ url_for('login') }}" class="btn btn-primary btn-lg">Login to Subscribe</a>
                    {% endif %}
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>