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

{% block title %}个人中心 - 茄子在线检测系统{% endblock %}

{% block content %}
<div class="container py-5">
    <div class="row justify-content-center">
        <div class="col-lg-6 col-md-8 fade-in-up">
            <div class="card border-0 shadow-lg overflow-hidden profile-card">
                <div class="profile-header bg-gradient-primary">
                    <div class="header-overlay"></div>
                </div>

                <div class="avatar-wrapper text-center">
                    <div class="avatar-circle bg-white shadow">
                        <i class="bi bi-person-circle text-primary" style="font-size: 4rem;"></i>
                    </div>
                </div>

                <div class="card-body text-center pt-5 pb-4 px-4">
                    <h3 class="fw-bold text-dark mb-1">{{ user.username }}</h3>
                    <p class="text-muted mb-4">
                        <i class="bi bi-patch-check-fill text-success me-1"></i>
                        {{ user_info.nickname|default:"普通用户" }}
                    </p>

                    <hr class="my-4 opacity-10">

                    <div class="info-list text-start mx-auto" style="max-width: 400px;">
                        <div class="info-item d-flex align-items-center mb-3 p-3 rounded bg-light hover-effect">
                            <div class="icon-box bg-white text-primary shadow-sm me-3">
                                <i class="bi bi-telephone"></i>
                            </div>
                            <div>
                                <small class="text-muted d-block">电话号码</small>
                                <span class="fw-medium text-dark">{{ user_info.phone_number|default:"未绑定" }}</span>
                            </div>
                        </div>

                        <div class="info-item d-flex align-items-center mb-3 p-3 rounded bg-light hover-effect">
                            <div class="icon-box bg-white text-danger shadow-sm me-3">
                                <i class="bi bi-envelope"></i>
                            </div>
                            <div>
                                <small class="text-muted d-block">电子邮箱</small>
                                <span class="fw-medium text-dark">{{ user.email|default:"未绑定" }}</span>
                            </div>
                        </div>

                        <div class="info-item d-flex align-items-center p-3 rounded bg-light hover-effect">
                            <div class="icon-box bg-white text-info shadow-sm me-3">
                                <i class="bi bi-calendar-check"></i>
                            </div>
                            <div>
                                <small class="text-muted d-block">注册时间</small>
                                <span class="fw-medium text-dark">{{ user_info.created_at|date:"Y-m-d H:i:s" }}</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="row justify-content-center mt-4">
        <div class="col-lg-6 col-md-8">
            <div class="card border-0 shadow-sm">
                <div class="card-body p-4">
                    <h5 class="fw-bold text-center mb-4 text-secondary">
                        <i class="bi bi-clock-history me-2"></i>检测历史归档
                    </h5>
                    <div class="row g-3">
{#                        <div class="col-sm-6">#}
{#                            <a href="{% url 'shape_detection_results' %}" class="btn btn-outline-primary w-100 py-3 rounded-pill d-flex align-items-center justify-content-center shadow-hover">#}
{#                                <i class="bi bi-stars me-2 fs-5"></i>#}
{#                                <span>品相检测结果</span>#}
{#                            </a>#}
{#                        </div>#}
                        <div class="col-sm-6 mx-auto">
                            <a href="{% url 'PAD_detection_results' %}" class="btn btn-outline-success w-100 py-3 rounded-pill d-flex align-items-center justify-content-center shadow-hover">
                                <i class="bi bi-bug me-2 fs-5"></i>
                                <span>病虫害检测结果</span>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<style>
    /* 动画 */
    .fade-in-up {
        animation: fadeInUp 0.6s ease-out forwards;
        opacity: 0;
        transform: translateY(20px);
    }
    @keyframes fadeInUp {
        to { opacity: 1; transform: translateY(0); }
    }

    /* 个人资料卡片样式 */
    .profile-card {
        border-radius: 16px;
    }

    .profile-header {
        height: 120px;
        background: linear-gradient(135deg, #6f42c1, #a66efa); /* 茄子紫渐变 */
        position: relative;
    }

    .header-overlay {
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 0;
        background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 20.5V18H0v-2h20v-2H0v-2h20v-2H0V8h20V6H0V4h20V2H0V0h22v20h2V0h2v20h2V0h2v20h2V0h2v20h2v2H20v-1.5zM0 20h2v20H0V20zm4 0h2v20H4V20zm4 0h2v20H8V20zm4 0h2v20h-2V20zm4 0h2v20h-2V20zm4 0h2v20h-2V20zm4 0h2v20h-2V20zm4 0h2v20h-2V20zm4 0h2v20h-2V20zm4 0h2v20h-2V20z' fill='%23ffffff' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
    }

    .avatar-wrapper {
        margin-top: -60px;
        position: relative;
        z-index: 2;
    }

    .avatar-circle {
        width: 120px;
        height: 120px;
        border-radius: 50%;
        margin: 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 4px solid #fff;
    }

    /* 信息列表样式 */
    .icon-box {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
    }

    .hover-effect {
        transition: transform 0.2s, background-color 0.2s;
    }
    .hover-effect:hover {
        transform: translateX(5px);
        background-color: #e9ecef !important;
    }

    /* 按钮悬浮效果 */
    .shadow-hover {
        transition: all 0.3s ease;
    }
    .shadow-hover:hover {
        transform: translateY(-3px);
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }
</style>
{% endblock %}