{% load static %}
<c-layouts.auth title="Registro de Alumnos | Lo Justo LMS">
    <div class="py-10 px-4 w-full flex justify-center">
        <div class="max-w-xl w-full bg-white rounded-3xl border border-zinc-200/80 shadow-2xl p-8 sm:p-10 relative overflow-hidden">
            <!-- Acento superior -->
            <div class="absolute top-0 left-0 right-0 h-2 bg-gradient-to-r from-emerald-600 via-emerald-500 to-amber-400"></div>

            <div class="text-center mb-8 mt-2">
                <a href="{% url 'core:landing' %}" class="inline-flex items-center justify-center decoration-0 group mb-2">
                    <img src="{% static 'img/logo.png' %}" alt="Lo Justo Learning" class="h-14 sm:h-16 w-auto object-contain transition-transform group-hover:scale-105" />
                </a>
                <h1 class="text-2xl font-black text-zinc-900 mt-4 tracking-tight">Registro de Alumnos</h1>
                <p class="text-sm text-zinc-500 mt-1 font-medium">Completa tus datos profesionales para la emisión de diplomas ISO 17025</p>
            </div>

            {% if messages %}
                <div class="mb-6 space-y-2">
                    {% for message in messages %}
                        <div class="p-4 rounded-xl text-xs font-bold {% if message.tags == 'error' %}bg-red-50 text-red-700 border border-red-200{% else %}bg-emerald-50 text-emerald-800 border border-emerald-200{% endif %}">
                            {{ message }}
                        </div>
                    {% endfor %}
                </div>
            {% endif %}

            <form method="post" action="{% url 'users:register' %}" class="space-y-4">
                {% csrf_token %}

                <div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
                    <div>
                        <label class="block text-xs font-bold text-zinc-700 uppercase tracking-wider mb-1">Nombre</label>
                        <input type="text" name="first_name" required
                               class="w-full px-4 py-2.5 bg-zinc-50 border border-zinc-300 rounded-xl text-sm font-medium focus:bg-white focus:outline-none focus:ring-2 focus:ring-emerald-500"
                               placeholder="Carlos">
                    </div>
                    <div>
                        <label class="block text-xs font-bold text-zinc-700 uppercase tracking-wider mb-1">Apellidos</label>
                        <input type="text" name="last_name" required
                               class="w-full px-4 py-2.5 bg-zinc-50 border border-zinc-300 rounded-xl text-sm font-medium focus:bg-white focus:outline-none focus:ring-2 focus:ring-emerald-500"
                               placeholder="Mendoza Soto">
                    </div>
                </div>

                <div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
                    <div>
                        <label class="block text-xs font-bold text-zinc-700 uppercase tracking-wider mb-1">RUT / DNI</label>
                        <input type="text" name="rut" required
                               class="w-full px-4 py-2.5 bg-zinc-50 border border-zinc-300 rounded-xl text-sm font-medium focus:bg-white focus:outline-none focus:ring-2 focus:ring-emerald-500"
                               placeholder="18.555.444-K">
                    </div>
                    <div>
                        <label class="block text-xs font-bold text-zinc-700 uppercase tracking-wider mb-1">Correo Electrónico</label>
                        <input type="email" name="email" required
                               class="w-full px-4 py-2.5 bg-zinc-50 border border-zinc-300 rounded-xl text-sm font-medium focus:bg-white focus:outline-none focus:ring-2 focus:ring-emerald-500"
                               placeholder="carlos@empresa.cl">
                    </div>
                </div>

                <div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
                    <div>
                        <label class="block text-xs font-bold text-zinc-700 uppercase tracking-wider mb-1">Empresa / Laboratorio</label>
                        <input type="text" name="company"
                               class="w-full px-4 py-2.5 bg-zinc-50 border border-zinc-300 rounded-xl text-sm font-medium focus:bg-white focus:outline-none focus:ring-2 focus:ring-emerald-500"
                               placeholder="Lo Justo Metrología">
                    </div>
                    <div>
                        <label class="block text-xs font-bold text-zinc-700 uppercase tracking-wider mb-1">Cargo en Empresa</label>
                        <input type="text" name="position_title"
                               class="w-full px-4 py-2.5 bg-zinc-50 border border-zinc-300 rounded-xl text-sm font-medium focus:bg-white focus:outline-none focus:ring-2 focus:ring-emerald-500"
                               placeholder="Especialista en Balanzas">
                    </div>
                </div>

                <div class="grid grid-cols-1 sm:grid-cols-2 gap-4 pt-2">
                    <div>
                        <label class="block text-xs font-bold text-zinc-700 uppercase tracking-wider mb-1">Contraseña</label>
                        <input type="password" name="password" required
                               class="w-full px-4 py-2.5 bg-zinc-50 border border-zinc-300 rounded-xl text-sm font-medium focus:bg-white focus:outline-none focus:ring-2 focus:ring-emerald-500"
                               placeholder="••••••••">
                    </div>
                    <div>
                        <label class="block text-xs font-bold text-zinc-700 uppercase tracking-wider mb-1">Confirmar Contraseña</label>
                        <input type="password" name="password_confirm" required
                               class="w-full px-4 py-2.5 bg-zinc-50 border border-zinc-300 rounded-xl text-sm font-medium focus:bg-white focus:outline-none focus:ring-2 focus:ring-emerald-500"
                               placeholder="••••••••">
                    </div>
                </div>

                <div class="pt-4">
                    <button type="submit"
                            class="w-full py-3.5 px-6 bg-gradient-to-r from-emerald-600 to-emerald-700 hover:from-emerald-700 hover:to-emerald-800 text-white font-black rounded-xl shadow-lg shadow-emerald-600/20 uppercase tracking-wider text-xs transition-all transform hover:-translate-y-0.5 active:translate-y-0">
                        Crear Cuenta de Alumno →
                    </button>
                </div>
            </form>

            <div class="mt-8 pt-6 border-t border-zinc-100 text-center text-xs text-zinc-500 font-medium">
                ¿Ya tienes cuenta o eres Docente / Coordinador?
                <a href="{% url 'users:login' %}" class="font-bold text-emerald-600 hover:text-emerald-700 hover:underline ml-1">
                    Iniciar Sesión aquí
                </a>
            </div>
        </div>
    </div>
</c-layouts.auth>
