{% extends 'expat_life/base.html' %}
{% load static %}
{% block title %}Guest Sign In{% endblock %}

{% block content %}

<style>
    .guest-login-hero {
        position: relative;
        min-height: 100vh;
        padding: 6rem 0;
        background:
            radial-gradient(circle at top left, rgba(255, 193, 7, 0.13), transparent 32%),
            radial-gradient(circle at bottom right, rgba(32, 201, 151, 0.16), transparent 34%),
            linear-gradient(
                90deg,
                rgba(7, 19, 28, 0.96) 0%,
                rgba(7, 19, 28, 0.90) 34%,
                rgba(11, 61, 145, 0.78) 62%,
                rgba(15, 118, 110, 0.68) 100%
            ),
            url("{% static 'expat_life/images/guest_signup_hero.webp' %}") center/cover no-repeat;
        color: #fff;
        overflow: hidden;
    }

    .guest-login-hero::before {
        content: "";
        position: absolute;
        inset: 0;
        background:
            linear-gradient(120deg, rgba(255, 255, 255, 0.06), transparent 35%),
            radial-gradient(circle at 82% 12%, rgba(255, 193, 7, 0.09), transparent 28%);
        pointer-events: none;
    }

    .guest-login-hero::after {
        content: "";
        position: absolute;
        right: -160px;
        bottom: -180px;
        width: 480px;
        height: 480px;
        border-radius: 50%;
        background: rgba(255, 193, 7, 0.08);
        pointer-events: none;
    }

    .guest-login-hero .container {
        position: relative;
        z-index: 2;
    }

    .guest-login-hero h1 {
        color: #fff;
        font-size: clamp(2.35rem, 4.2vw, 4.1rem);
        font-weight: 900;
        letter-spacing: -0.045em;
        line-height: 1.06;
    }

    .guest-login-hero .lead {
        color: rgba(255, 255, 255, 0.86) !important;
        font-size: 1.12rem;
        line-height: 1.8;
    }

    .guest-login-hero .section-mini-title {
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
        background: rgba(255, 193, 7, 0.16);
        color: #ffd36b;
        border: 1px solid rgba(255, 193, 7, 0.32);
        font-weight: 900;
        font-size: 0.78rem;
        text-transform: uppercase;
        letter-spacing: 0.075em;
        padding: 7px 15px;
        border-radius: 999px;
        margin-bottom: 16px;
        backdrop-filter: blur(10px);
    }

    .guest-login-hero .section-mini-title::before {
        content: "";
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #ffc107;
        box-shadow: 0 0 0 5px rgba(255, 193, 7, 0.14);
    }

    .guest-login-hero .login-info-list {
        margin: 24px 0 20px;
    }

    .guest-login-hero .login-info-item {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 14px;
        font-size: 1rem;
        color: rgba(255, 255, 255, 0.92);
        font-weight: 600;
    }

    .guest-login-hero .login-info-item i {
        color: #ffd36b;
        font-size: 1.2rem;
    }

    .guest-login-hero .login-note-box {
        background: rgba(255, 251, 235, 0.13);
        border-left: 4px solid #ffc107;
        color: rgba(255, 255, 255, 0.92);
        padding: 16px 20px;
        border-radius: 16px;
        display: flex;
        gap: 12px;
        align-items: flex-start;
        line-height: 1.65;
    }

    .guest-login-hero .login-note-box i {
        color: #ffc107;
        font-size: 1.3rem;
        margin-top: 2px;
    }

    .login-form-card {
        background: rgba(255, 255, 255, 0.98);
        border-radius: 32px;
        box-shadow: 0 28px 70px rgba(0, 0, 0, 0.24);
        overflow: hidden;
        border: 1px solid rgba(255, 255, 255, 0.35);
    }

    .login-form-header {
        background:
            radial-gradient(circle at top right, rgba(255, 193, 7, 0.12), transparent 34%),
            linear-gradient(135deg, #ffffff 0%, #f5f9ff 100%);
        padding: 28px 32px;
        color: #102033;
        text-align: center;
        border-bottom: 1px solid rgba(13, 110, 253, 0.10);
    }

    .login-form-header h3 {
        margin: 0;
        font-weight: 900;
        color: #102033;
        letter-spacing: -0.025em;
    }

    .login-form-header p {
        color: #64748b !important;
        font-size: 0.9rem;
        margin-top: 8px;
    }

    .login-form-body {
        padding: 32px;
    }

    .login-form-body .form-label {
        color: #102033;
        font-weight: 700;
    }

    .login-form-body .form-control {
        border-radius: 15px;
        border: 1px solid #cbd5e1;
        padding: 0.78rem 0.95rem;
        box-shadow: none;
        color: #102033;
    }

    .login-form-body .form-control:focus {
        border-color: #0d6efd;
        box-shadow: 0 0 0 0.22rem rgba(13, 110, 253, 0.12);
    }

    .forgot-password-link {
        color: #0d6efd;
        text-decoration: none;
        font-weight: 700;
        font-size: 0.85rem;
    }

    .forgot-password-link:hover {
        color: #0b3d91;
        text-decoration: underline;
    }

    .login-form-body .btn-dark {
        background: linear-gradient(135deg, #07131c, #0d6efd);
        border: none;
        border-radius: 48px;
        padding: 0.85rem 1rem;
        font-weight: 800;
        box-shadow: 0 16px 32px rgba(13, 110, 253, 0.22);
    }

    .login-form-body .btn-dark:hover {
        background: linear-gradient(135deg, #07131c, #0f766e);
    }

    @media (max-width: 768px) {
        .guest-login-hero {
            padding: 4rem 0;
        }

        .login-form-body {
            padding: 24px;
        }

        .login-form-header {
            padding: 22px 20px;
        }

        .login-form-card {
            border-radius: 26px;
        }
    }
</style>

<section class="guest-login-hero">
    <div class="container">
        <div class="row align-items-center g-5 justify-content-center">
            <div class="col-lg-5">
                <span class="section-mini-title">Account Access</span>
                <h1 class="fw-bold mb-3">Guest Sign In</h1>
                <p class="lead text-muted mb-4">
                    Sign in to access your guest dashboard, view your profile, and manage your approved access areas.
                </p>

                <div class="login-info-list">
                    <div class="login-info-item">
                        <i class="bi bi-check-circle-fill"></i>
                        <span>Access your dashboard</span>
                    </div>
                    <div class="login-info-item">
                        <i class="bi bi-check-circle-fill"></i>
                        <span>View consultation progress</span>
                    </div>
                    <div class="login-info-item">
                        <i class="bi bi-check-circle-fill"></i>
                        <span>Access private approved areas</span>
                    </div>
                </div>

                <div class="login-note-box mt-4">
                    <i class="bi bi-info-circle-fill"></i>
                    <div>
                        This login area is only for users who already have an approved guest account in the system.
                    </div>
                </div>
            </div>

            <div class="col-lg-5">
                <div class="login-form-card shadow-lg">
                    <div class="login-form-header">
                        <h3 class="fw-bold mb-2">Sign In</h3>
                        <p class="text-muted mb-0">
                            Enter your username and password to continue.
                        </p>
                    </div>

                    <form method="post" class="login-form-body">
                        {% csrf_token %}

                        {% if form.errors %}
                        <div class="alert alert-danger rounded-4">
                            Invalid username or password. Please try again.
                        </div>
                        {% endif %}

                        <div class="mb-3">
                            <label for="id_username" class="form-label">Username</label>
                            <input type="text" name="username" autofocus required id="id_username" class="form-control">
                        </div>

                        <div class="mb-2">
                            <label for="id_password" class="form-label">Password</label>
                            <input type="password" name="password" required id="id_password" class="form-control">
                        </div>

                        <div class="d-flex justify-content-end mb-4">
                            <a href="{% url 'expat_life:foreigner_password_reset' %}"
                            class="forgot-password-link">
                                <i class="bi bi-key-fill me-1"></i>
                                Forgot your password?
                            </a>
                        </div>

                        {% if next %}
                        <input type="hidden" name="next" value="{{ next }}">
                        {% endif %}

                        <button type="submit" class="btn btn-dark btn-lg w-100">
                            <i class="bi bi-box-arrow-in-right me-1"></i>
                            Sign In
                        </button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</section>

{% endblock %}