@props([
    'variant' => 'primary',
    'size' => 'md',
    'href' => null,
    'disabled' => false,
    'type' => 'button',
])

@php
$base = 'inline-flex items-center justify-center gap-2 font-medium rounded-lg transition duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed';

$variants = [
    'primary' => 'bg-brand text-white hover:bg-brand-700 focus:ring-brand',
    'accent' => 'bg-accent text-brand-900 hover:bg-accent-500 focus:ring-accent',
    'danger' => 'bg-danger text-white hover:bg-danger-700 focus:ring-danger',
    'ghost' => 'bg-transparent text-brand-600 hover:bg-brand-50 focus:ring-brand',
    'outline' => 'border-2 border-brand text-brand hover:bg-brand-50 focus:ring-brand',
];

$sizes = [
    'sm' => 'px-3 py-1.5 text-sm',
    'md' => 'px-5 py-2.5 text-sm',
    'lg' => 'px-7 py-3 text-base',
];

$classes = $base . ' ' . ($variants[$variant] ?? $variants['primary']) . ' ' . ($sizes[$size] ?? $sizes['md']);
@endphp

@if ($href)
    <a href="{{ $disabled ? '#' : $href }}" {{ $attributes->merge(['class' => $classes, 'aria-disabled' => $disabled ? 'true' : null]) }}>
        {{ $slot }}
    </a>
@else
    <button type="{{ $type }}" {{ $attributes->merge(['class' => $classes, 'disabled' => $disabled]) }}>
        {{ $slot }}
    </button>
@endif
