@extends('layouts.admin')

@section('title', 'Create Operator')
@section('page-title', 'Create Operator')

@section('content')
<div class="row justify-content-center">
    <div class="col-lg-10 col-xl-8">
        <div class="d-flex align-items-center gap-3 mb-4">
            <a href="{{ route('admin.operators.index') }}" class="btn btn-sm px-3 py-2" style="background:#f0f2f5; border-radius:10px;">
                <i class="bi bi-arrow-left"></i>
            </a>
            <div>
                <h5 class="fw-bold mb-0">Create Operator</h5>
                <p class="text-muted small mb-0">Add a new operator account</p>
            </div>
        </div>

        <div class="premium-card p-4 p-lg-5">
            @if($errors->any())
                <div class="alert border-0 mb-4" style="background:rgba(239,68,68,.08); color:#dc2626; border-radius:12px;">
                    <ul class="mb-0 small">
                        @foreach($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                </div>
            @endif

            <form method="POST" action="{{ route('admin.operators.store') }}">
                @csrf
                <div class="mb-3">
                    <label for="name" class="form-label small fw-semibold text-muted text-uppercase" style="letter-spacing:.5px;">Full Name <span class="text-danger">*</span></label>
                    <input type="text" class="form-control py-2 @error('name') is-invalid @enderror" style="border-radius:10px;"
                           id="name" name="name" value="{{ old('name') }}" required placeholder="Enter full name">
                </div>
                <div class="mb-3">
                    <label for="email" class="form-label small fw-semibold text-muted text-uppercase" style="letter-spacing:.5px;">Email Address <span class="text-danger">*</span></label>
                    <input type="email" class="form-control py-2 @error('email') is-invalid @enderror" style="border-radius:10px;"
                           id="email" name="email" value="{{ old('email') }}" required placeholder="Enter email address">
                </div>
                <div class="mb-4">
                    <label for="phone" class="form-label small fw-semibold text-muted text-uppercase" style="letter-spacing:.5px;">Phone Number</label>
                    <input type="text" class="form-control py-2 @error('phone') is-invalid @enderror" style="border-radius:10px;"
                           id="phone" name="phone" value="{{ old('phone') }}" placeholder="Enter phone number">
                </div>

                <hr class="my-4" style="border-color:#e5e7eb;">

                <div class="mb-3">
                    <label for="password" class="form-label small fw-semibold text-muted text-uppercase" style="letter-spacing:.5px;">Password <span class="text-danger">*</span></label>
                    <input type="password" class="form-control py-2 @error('password') is-invalid @enderror" style="border-radius:10px;"
                           id="password" name="password" required placeholder="Minimum 8 characters">
                </div>
                <div class="mb-4">
                    <label for="password_confirmation" class="form-label small fw-semibold text-muted text-uppercase" style="letter-spacing:.5px;">Confirm Password <span class="text-danger">*</span></label>
                    <input type="password" class="form-control py-2" style="border-radius:10px;"
                           id="password_confirmation" name="password_confirmation" required placeholder="Re-enter password">
                </div>

                <div class="d-flex gap-3">
                    <button type="submit" class="btn px-4 py-2" style="background:linear-gradient(135deg, #780045, #F54927); color:#fff; font-weight:600; border-radius:12px;">
                        <i class="bi bi-check-lg me-1"></i>Create Operator
                    </button>
                    <a href="{{ route('admin.operators.index') }}" class="btn px-4 py-2" style="background:#f0f2f5; color:#6b7280; font-weight:600; border-radius:12px;">
                        Cancel
                    </a>
                </div>
            </form>
        </div>
    </div>
</div>
@endsection
