@extends('layouts.app')

@section('title', 'Manual de Administrador')
@section('full_width', true)

@section('content')
    @php
        $manualHtmlUrl = asset('docs/manual-de-usuario.html');
        $hasPdf = is_file(storage_path('app/private/manual/manual-de-usuario.pdf'))
            || is_file(public_path('docs/manual-de-usuario.pdf'));
    @endphp
    <div class="container py-4">
        <div class="d-flex flex-column flex-lg-row justify-content-between align-items-lg-center gap-3 mb-4">
            <div>
                <h1 class="h3 mb-1">Manual de Administrador</h1>
                <p class="text-muted-brand mb-0">Consulta la guia operativa del sistema desde este modulo.</p>
            </div>
            <div class="d-flex flex-wrap gap-2">
                <a class="btn btn-outline-secondary" href="{{ route('manual.administrador.markdown') }}">Descargar Markdown</a>
                <a class="btn btn-outline-primary" href="{{ $manualHtmlUrl }}" target="_blank" rel="noopener noreferrer">Abrir HTML</a>
                @if ($hasPdf)
                    <a class="btn btn-brand" href="{{ route('manual.administrador.pdf') }}" target="_blank" rel="noopener noreferrer">Abrir PDF</a>
                    <a class="btn btn-outline-secondary" href="{{ route('manual.administrador.pdf.download') }}">Descargar PDF</a>
                @endif
            </div>
        </div>

        <div class="card shadow-sm border-0 overflow-hidden">
            <div class="card-body p-0">
                <iframe
                    src="{{ $manualHtmlUrl }}"
                    title="Manual de Administrador"
                    style="width:100%;min-height:78vh;border:0;background:#fff;"
                ></iframe>
            </div>
        </div>
    </div>
@endsection