@props(['modulo'])

@php
    $ativo = $modulo['ativo'] ?? false;
    $href = $ativo ? route($modulo['rota']) : route('modulos.placeholder', $modulo['slug']);
@endphp

<a href="{{ $href }}" class="portal-card group block p-5">
    <div class="flex items-start justify-between gap-4">
        <span class="flex h-12 w-12 items-center justify-center rounded-lg bg-accent-50 text-accent-700 transition group-hover:bg-accent-500 group-hover:text-slate-950 dark:bg-slate-800 dark:text-accent-300">
            <x-heroicon :name="$modulo['icone']" class="h-6 w-6" />
        </span>

        <span @class([
            'rounded-full px-2.5 py-1 text-xs font-semibold',
            'bg-accent-100 text-accent-700 dark:bg-accent-900/40 dark:text-accent-300' => $ativo,
            'bg-slate-100 text-slate-500 dark:bg-slate-800 dark:text-slate-400' => ! $ativo,
        ])>
            {{ $ativo ? 'Ativo' : 'Em breve' }}
        </span>
    </div>

    <div class="mt-5">
        <h3 class="text-base font-bold text-slate-950 dark:text-white">{{ $modulo['nome'] }}</h3>
        <p class="mt-2 min-h-[48px] text-sm leading-6 text-slate-600 dark:text-slate-400">{{ $modulo['descricao'] }}</p>
    </div>
</a>
