@extends('theme::layouts.auth')

@section('title', 'Nustatyti naują slaptažodį')

@section('content')
<h1>Naujas slaptažodis</h1>
<p class="subtitle">Pasirinkite naują slaptažodį savo paskyrai</p>

<form method="POST" action="{{ route(cms_route_name_for_current_locale(cms_current_environment() . '.auth.password.update')) }}" id="resetForm" novalidate>
    @csrf

    {{-- Token from URL — ResetPasswordController injects it via $request->route('token') --}}
    <input type="hidden" name="token" value="{{ $token ?? $request->route('token') }}">

    <div class="mb-3">
        <label for="email" class="form-label">El. paštas</label>
        <input type="email" id="email" name="email"
               value="{{ old('email', $email ?? '') }}"
               class="form-control @error('email') is-invalid @enderror"
               required autocomplete="email" readonly>
        @error('email')
            <div class="invalid-feedback d-block">{{ $message }}</div>
        @enderror
    </div>

    <div class="mb-3">
        <label for="password" class="form-label">Naujas slaptažodis</label>
        <input type="password" id="password" name="password"
               class="form-control @error('password') is-invalid @enderror"
               required autocomplete="new-password" minlength="8" autofocus>
        <div class="form-text" style="font-size:12px; color:var(--muted); margin-top:4px;">
            Mažiausiai 8 simboliai
        </div>
        @error('password')
            <div class="invalid-feedback d-block">{{ $message }}</div>
        @enderror
    </div>

    <div class="mb-3">
        <label for="password_confirmation" class="form-label">Pakartokite slaptažodį</label>
        <input type="password" id="password_confirmation" name="password_confirmation"
               class="form-control"
               required autocomplete="new-password">
    </div>

    <button type="submit" class="btn-brand">Išsaugoti slaptažodį</button>
</form>

<div class="divider"></div>

<div class="meta-link">
    <a href="{{ route(cms_route_name_for_current_locale(cms_current_environment() . '.auth.login')) }}">
        <i class="bi bi-arrow-left me-1"></i> Grįžti į prisijungimą
    </a>
</div>
@endsection
