{% extends "base.html" %}
{% load static %}

{% block title %}系统初始化 - AgomTradePro{% endblock %}

{% block extra_css %}
<style>
.setup-page {
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.setup-card {
    width: 100%;
    max-width: 500px;
    background: var(--color-bg);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.setup-header {
    text-align: center;
    margin-bottom: 32px;
}

.setup-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 8px;
}

.setup-subtitle {
    color: var(--color-text-secondary);
    font-size: 14px;
}

.setup-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--color-text-primary);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    background: var(--color-surface);
    color: var(--color-text-primary);
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary:hover {
    background: var(--color-border);
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #d1fae5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.alert-warning {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #dbeafe;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.password-strength {
    margin-top: 8px;
    font-size: 12px;
}

.strength-bar {
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    transition: width 0.3s, background-color 0.3s;
}

.strength-weak { background: #ef4444; }
.strength-medium { background: #f59e0b; }
.strength-strong { background: #10b981; }

.skip-link {
    display: block;
    text-align: center;
    margin-top: 16px;
    color: var(--color-text-secondary);
    font-size: 14px;
    text-decoration: none;
}

.skip-link:hover {
    color: #667eea;
    text-decoration: underline;
}
</style>
{% endblock %}

{% block content %}
<div class="setup-page">
    <div class="setup-card">
        <div class="setup-header">
            <div class="setup-icon">🔐</div>
            <h1 class="setup-title">验证管理员身份</h1>
            <p class="setup-subtitle">系统已初始化，请输入管理员密码继续配置</p>
        </div>

        {% if messages %}
            {% for message in messages %}
                <div class="alert alert-{{ message.tags }}">{{ message }}</div>
            {% endfor %}
        {% endif %}

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

        <form method="post" action="{% url 'setup_wizard:auth' %}">
            {% csrf_token %}
            <div class="form-group">
                <label for="password">管理员密码</label>
                <input type="password" 
                       id="password" 
                       name="password" 
                       class="form-control" 
                       required 
                       autofocus
                       placeholder="请输入管理员密码">
            </div>
            <button type="submit" class="btn btn-primary">验证</button>
        </form>

        <a href="/" class="skip-link">返回首页</a>
    </div>
</div>
{% endblock %}
