<x-app-layout>
    <x-slot name="header">
        <h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
            {{ __('Editar entrada clínica') }}
        </h2>
    </x-slot>

    <div class="py-8">
        <div class="max-w-3xl mx-auto sm:px-6 lg:px-8">
            <div class="bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg p-6">
                <form method="post" action="{{ route('clients.patients.medical-records.update', [$client, $patient, $medicalRecord]) }}" enctype="multipart/form-data">
                    @method('put')
                    @if ($medicalRecord->attachments->isNotEmpty())
                        <div class="mb-6 rounded-lg border border-gray-200 dark:border-gray-700 p-4">
                            <p class="text-sm font-medium text-gray-900 dark:text-gray-100 mb-3">{{ __('Adjuntos actuales') }}</p>
                            <ul class="space-y-2">
                                @foreach ($medicalRecord->attachments as $att)
                                    <li class="flex items-center gap-2 text-sm">
                                        <input type="checkbox" name="remove_attachment_ids[]" value="{{ $att->id }}" class="rounded border-gray-300 dark:border-gray-700" />
                                        <span class="text-gray-700 dark:text-gray-300">{{ $att->original_name }}</span>
                                    </li>
                                @endforeach
                            </ul>
                            <p class="text-xs text-gray-500 mt-2">{{ __('Marca para eliminar al guardar.') }}</p>
                        </div>
                    @endif
                    @include('medical_records._form', ['submitLabel' => __('Guardar cambios')])
                </form>
            </div>
        </div>
    </div>
</x-app-layout>
