{% extends "base.html" %}

{% block title %}Wyslij ponownie email weryfikacyjny - Norda Biznes Hub{% endblock %}

{% block container_class %}container-narrow{% endblock %}

{% block extra_css %}
<style>
    .auth-container {
        max-width: 480px;
        margin: 0 auto;
        padding: var(--spacing-2xl) 0;
    }

    .auth-card {
        background-color: var(--surface);
        padding: var(--spacing-2xl);
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-lg);
    }

    .auth-header {
        text-align: center;
        margin-bottom: var(--spacing-xl);
    }

    .auth-header h1 {
        font-size: var(--font-size-3xl);
        color: var(--text-primary);
        margin-bottom: var(--spacing-sm);
    }

    .auth-header p {
        color: var(--text-secondary);
    }

    .auth-icon {
        width: 64px;
        height: 64px;
        background: linear-gradient(135deg, var(--primary), #1d4ed8);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 auto var(--spacing-lg);
    }

    .auth-icon svg {
        width: 32px;
        height: 32px;
        color: white;
    }

    .form-group {
        margin-bottom: var(--spacing-lg);
    }

    .form-label {
        display: block;
        font-weight: 500;
        margin-bottom: var(--spacing-sm);
        color: var(--text-primary);
    }

    .form-label .required {
        color: var(--error);
    }

    .form-input {
        width: 100%;
        padding: var(--spacing-md);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        font-size: var(--font-size-base);
        font-family: var(--font-family);
        transition: var(--transition);
    }

    .form-input:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    }

    .form-input.error {
        border-color: var(--error);
    }

    .form-actions {
        margin-top: var(--spacing-xl);
    }

    .btn-full {
        width: 100%;
    }

    .auth-footer {
        text-align: center;
        margin-top: var(--spacing-lg);
        padding-top: var(--spacing-lg);
        border-top: 1px solid var(--border);
        color: var(--text-secondary);
    }

    .auth-footer a {
        color: var(--primary);
        text-decoration: none;
        font-weight: 500;
    }

    .auth-footer a:hover {
        text-decoration: underline;
    }

    .info-box {
        background-color: #dbeafe;
        border: 1px solid #3b82f6;
        border-radius: var(--radius);
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-lg);
        font-size: var(--font-size-sm);
        color: #1e40af;
    }
</style>
{% endblock %}

{% block content %}
<div class="auth-container">
    <div class="auth-card">
        <div class="auth-header">
            <div class="auth-icon">
                <svg fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/>
                </svg>
            </div>
            <h1>Wyslij ponownie email</h1>
            <p>Podaj adres email aby otrzymac nowy link weryfikacyjny</p>
        </div>

        <div class="info-box">
            Jesli nie otrzymales emaila weryfikacyjnego lub link wygasl, mozesz tutaj poprosic o nowy. Link bedzie wazny przez 24 godziny.
        </div>

        <form method="POST" action="{{ url_for('resend_verification') }}" novalidate>
            <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">

            <div class="form-group">
                <label for="email" class="form-label">
                    Adres email <span class="required">*</span>
                </label>
                <input
                    type="email"
                    id="email"
                    name="email"
                    class="form-input"
                    placeholder="twoj@email.com"
                    required
                    autocomplete="email"
                    autofocus
                >
            </div>

            <div class="form-actions">
                <button type="submit" class="btn btn-primary btn-lg btn-full">
                    Wyslij email weryfikacyjny
                </button>
            </div>
        </form>

        <div class="auth-footer">
            <p><a href="{{ url_for('login') }}">Powrot do logowania</a></p>
            <p style="margin-top: var(--spacing-sm);">Nie masz konta? <a href="{{ url_for('register') }}">Zarejestruj sie</a></p>
        </div>
    </div>
</div>
{% endblock %}

{% block extra_js %}
    document.querySelector('form').addEventListener('submit', function(e) {
        const email = document.getElementById('email');

        if (!email.value || !email.value.includes('@')) {
            email.classList.add('error');
            e.preventDefault();
        } else {
            email.classList.remove('error');
        }
    });
{% endblock %}
