@extends('layouts.admin')

@section('title', 'Manage Users | Smart Dermatology')
@section('page_title', 'User Management')
@section('page_subtitle', 'View registered members and their assigned panel access.')

@section('content')
    <div class="card panel-card overflow-hidden">
        <div class="table-responsive">
            <table class="table table-hover align-middle mb-0">
                <thead class="table-light">
                    <tr>
                        <th class="ps-4">User Details</th>
                        <th>Status</th>
                        <th>Role</th>
                        <th>Registered</th>
                        <th class="text-end pe-4">Actions</th>
                    </tr>
                </thead>
                <tbody>
                    @forelse ($users as $user)
                        <tr>
                            <td class="ps-4">
                                <div class="d-flex align-items-center">
                                    <div class="rounded-circle me-3 p-2 text-center" style="width: 45px; background: #fff0f3; color: var(--brand-pink);">{{ strtoupper(substr($user->name, 0, 2)) }}</div>
                                    <div>
                                        <div class="fw-bold">{{ $user->name }}</div>
                                        <div class="small text-muted">{{ $user->email }}</div>
                                    </div>
                                </div>
                            </td>
                            <td><span class="badge bg-success-subtle text-success rounded-pill px-3">Active</span></td>
                            <td class="text-capitalize">{{ $user->user_type }}</td>
                            <td>{{ $user->created_at?->format('d M Y') }}</td>
                            <td class="text-end pe-4">
                                <button class="btn btn-light btn-sm text-primary me-2" type="button" disabled><i class="fas fa-pen"></i></button>
                                <button class="btn btn-light btn-sm text-danger" type="button" disabled><i class="fas fa-trash"></i></button>
                            </td>
                        </tr>
                    @empty
                        <tr>
                            <td colspan="5" class="text-center text-muted py-4">No users available.</td>
                        </tr>
                    @endforelse
                </tbody>
            </table>
        </div>
    </div>
@endsection
