@extends('installer.layout')

@section('content')
    <div>
        <p class="text-sm font-bold uppercase tracking-wide text-blue-600 dark:text-blue-300">Folder Permissions</p>
        <h2 class="mt-2 text-2xl font-black text-slate-950 dark:text-white">Check writable folders.</h2>
        <p class="mt-3 text-sm text-slate-600 dark:text-slate-300">On cPanel, storage and bootstrap/cache must be writable so Laravel can save logs, cache, sessions, uploads, and installer files.</p>
    </div>

    <div class="mt-6 overflow-hidden rounded-lg border border-blue-100 dark:border-blue-900/50">
        @foreach ($permissions as $permission)
            <div class="flex items-center justify-between gap-4 border-b border-blue-50 px-4 py-3 last:border-b-0 dark:border-blue-900/40">
                <div>
                    <p class="font-bold text-slate-900 dark:text-white">{{ $permission['name'] }}</p>
                    <p class="break-all text-sm text-slate-500 dark:text-slate-400">{{ $permission['path'] }}</p>
                </div>
                <span class="rounded-full px-3 py-1 text-xs font-black uppercase {{ $permission['passed'] ? 'bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-200' : 'bg-red-100 text-red-700 dark:bg-red-950 dark:text-red-200' }}">
                    {{ $permission['passed'] ? 'Writable' : 'Not Writable' }}
                </span>
            </div>
        @endforeach
    </div>

    <div class="mt-6 flex justify-between">
        <a href="{{ route('install.requirements') }}" class="rounded-lg border border-blue-100 px-5 py-2.5 text-sm font-bold text-blue-700 dark:border-blue-900 dark:text-blue-300">Back</a>
        @if ($canContinue)
            <a href="{{ route('install.database') }}" class="rounded-lg bg-blue-600 px-5 py-2.5 text-sm font-bold text-white hover:bg-blue-700">Continue</a>
        @else
            <button disabled class="rounded-lg bg-slate-300 px-5 py-2.5 text-sm font-bold text-white dark:bg-slate-700">Fix Permissions First</button>
        @endif
    </div>
@endsection
