@props(['type' => 'primary', 'href' => null])

@php
    $classes = match($type) {
        'primary' => 'bg-[#4A538F] text-white hover:bg-[#424B84] focus:ring-[#4A538F]',
        'secondary' => 'bg-[#E9EBF5] text-[#4A538F] hover:bg-[#d8dce8] focus:ring-[#4A538F]',
        'danger' => 'bg-[#C0392B] text-white hover:bg-[#a93226] focus:ring-[#C0392B]',
        'success' => 'bg-[#1F9254] text-white hover:bg-[#177a45] focus:ring-[#1F9254]',
        'warning' => 'bg-[#B78103] text-white hover:bg-[#9a6d03] focus:ring-[#B78103]',
        default => 'bg-[#4A538F] text-white hover:bg-[#424B84] focus:ring-[#4A538F]',
    };
    
    $baseClasses = 'inline-flex items-center gap-2 px-5 py-2.5 rounded-lg font-medium transition-colors focus:ring-2 focus:ring-offset-2 text-sm';
@endphp

@if($href)
    <a href="{{ $href }}" {{ $attributes->merge(['class' => $baseClasses . ' ' . $classes]) }}>
        {{ $slot }}
    </a>
@else
    <button {{ $attributes->merge(['class' => $baseClasses . ' ' . $classes]) }}>
        {{ $slot }}
    </button>
@endif
