{% extends "base.html" %}

{% block title %}Change Email - AISBF{% endblock %}

{% block content %}
<div class="container">
    <h1 data-i18n="email_page.title">Change Email Address</h1>
    <p data-i18n="email_page.subtitle">Update your email address. You will need to verify the new email before it takes effect.</p>

    {% if success %}
    <div class="alert alert-success">{{ success }}</div>
    {% endif %}

    {% if error %}
    <div class="alert alert-error">{{ error }}</div>
    {% endif %}

    <div class="card">
        <h2 data-i18n="email_page.current">Current Email</h2>
        <p style="color: #a0a0a0; margin-bottom: 2rem;">{{ session.email }}</p>
        
        <form method="POST" action="{{ url_for(request, '/dashboard/change-email') }}">
            <div class="form-group">
                <label for="new_email" data-i18n="email_page.new">New Email Address</label>
                <input type="email" id="new_email" name="new_email" required>
            </div>

            <div class="form-group">
                <label for="password" data-i18n="email_page.password">Current Password</label>
                <input type="password" id="password" name="password" required>
                <small style="color: #a0a0a0; display: block; margin-top: 0.5rem;">Confirm your password to proceed</small>
            </div>

            <div style="margin-top: 1.5rem; display: flex; gap: 1rem;">
                <button type="submit" class="btn btn-primary" data-i18n="email_page.submit">Send Verification Email</button>
                <a href="{{ url_for(request, '/dashboard/profile') }}" class="btn btn-secondary">Cancel</a>
            </div>
        </form>
    </div>
</div>

<style>
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
}

.card {
    background: #16213e;
    padding: 2rem;
    border-radius: 8px;
    margin-top: 1.5rem;
}

.card h2 {
    margin-bottom: 1.5rem;
    color: #e0e0e0;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #e0e0e0;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #0f3460;
    border-radius: 4px;
    background: #1a1a2e;
    color: #e0e0e0;
    font-size: 1rem;
}

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

.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #1b5e20;
    color: #a5d6a7;
    border: 1px solid #2e7d32;
}

.alert-error {
    background: #b71c1c;
    color: #ef9a9a;
    border: 1px solid #c62828;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #0f3460;
    color: #e0e0e0;
}

.btn-secondary:hover {
    background: #16213e;
}
</style>
{% endblock %}
