@extends('layouts.admin')

@section('title', 'Admin Profile | Smart Dermatology')
@section('page_title', 'Profile Settings')
@section('page_subtitle', 'Update your admin account information and password securely.')

@push('styles')
    <style>
        .profile-card { border: 0; border-radius: 24px; box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08); }
        .profile-badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: #fff0f3; color: var(--brand-pink); font-weight: 600; }
    </style>
@endpush

@section('content')
    <div class="row g-4">
        <div class="col-lg-4">
            <div class="card profile-card p-4 h-100">
                <span class="profile-badge mb-3"><i class="fas fa-user-shield"></i> Admin Account</span>
                <h3 class="fw-bold">{{ auth()->user()->name }}</h3>
                <p class="text-muted mb-2">{{ auth()->user()->email }}</p>
                <p class="text-muted mb-0">Keep your administrator profile up to date and secure access to the control panel.</p>
            </div>
        </div>

        <div class="col-lg-8">
            <div class="card profile-card p-4 mb-4">
                <h4 class="fw-bold mb-1">Basic Information</h4>
                <p class="text-muted mb-4">Edit your display name and email address.</p>

                <form method="POST" action="{{ route('admin.profile.information') }}">
                    @csrf
                    @method('PATCH')
                    <div class="row g-3">
                        <div class="col-md-6">
                            <label class="form-label fw-semibold">Full Name</label>
                            <input type="text" name="name" class="form-control @error('name') is-invalid @enderror" value="{{ old('name', auth()->user()->name) }}" required>
                            @error('name') <div class="invalid-feedback d-block">{{ $message }}</div> @enderror
                        </div>
                        <div class="col-md-6">
                            <label class="form-label fw-semibold">Email Address</label>
                            <input type="email" name="email" class="form-control @error('email') is-invalid @enderror" value="{{ old('email', auth()->user()->email) }}" required>
                            @error('email') <div class="invalid-feedback d-block">{{ $message }}</div> @enderror
                        </div>
                    </div>
                    <div class="mt-4">
                        <button type="submit" class="btn text-white rounded-pill px-4" style="background: var(--brand-pink); border:none;">Save Changes</button>
                    </div>
                </form>
            </div>

            <div class="card profile-card p-4">
                <h4 class="fw-bold mb-1">Change Password</h4>
                <p class="text-muted mb-4">Confirm your current password before setting a new one.</p>

                <form method="POST" action="{{ route('admin.profile.password') }}">
                    @csrf
                    @method('PATCH')
                    <div class="row g-3">
                        <div class="col-12">
                            <label class="form-label fw-semibold">Current Password</label>
                            <input type="password" name="current_password" class="form-control @error('current_password') is-invalid @enderror" required>
                            @error('current_password') <div class="invalid-feedback d-block">{{ $message }}</div> @enderror
                        </div>
                        <div class="col-md-6">
                            <label class="form-label fw-semibold">New Password</label>
                            <input type="password" name="password" class="form-control @error('password') is-invalid @enderror" required>
                            @error('password') <div class="invalid-feedback d-block">{{ $message }}</div> @enderror
                        </div>
                        <div class="col-md-6">
                            <label class="form-label fw-semibold">Confirm Password</label>
                            <input type="password" name="password_confirmation" class="form-control" required>
                        </div>
                    </div>
                    <div class="mt-4">
                        <button type="submit" class="btn text-white rounded-pill px-4" style="background: var(--brand-pink); border:none;">Update Password</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
@endsection
