@using Microsoft.AspNetCore.Components
@inject NavigationManager Navigation

<div class="toast-body text-white p-3 rounded shadow-sm"
     style="background-color:@GetBackgroundColor(); border:2px solid white;">
    <div class="d-flex justify-content-between align-items-center">
        <i class="fas fa-link fa-sm me-2"></i>
        <span class="fw-bold small me-3">Documento</span>
        <button class="btn btn-outline-light btn-sm" @onclick="LinkClicked">
            @Comprobante
        </button>
    </div>
</div>
@code {
    [Parameter] public string Url { get; set; } = "/";
    [Parameter] public string Comprobante { get; set; } = "Ver";
    [Parameter] public string Style { get; set; } = "success";

    void LinkClicked(MouseEventArgs e)
    {
        Navigation.NavigateTo(Url);
    }

    string GetBackgroundColor() => Style.ToLower() switch
    {
        "success" => "#28a745",
        "danger" => "#dc3545",
        "primary" => "#007bff",
        "dark" => "#343a40",
        "info" => "#17a2b8",
        "warning" => "#ffc107",
        "secondary" => "#6c757d",
        "light" => "#f8f9fa",
        "muted" => "#6c757d",
        "orange" => "#fd7e14",
        "cyan" => "#0dcaf0",
        "purple" => "#6f42c1",
        "pink" => "#d63384",
        "lime" => "#84cc16",
        "indigo" => "#6610f2",
        "rose" => "#e11d48",
        "emerald" => "#10b981",
        "amber" => "#d97706",
        "violet" => "#7c3aed",
        "slate" => "#64748b",
        _ => "#6c757d"  // fallback secondary
    };
}
