@php
    $appKey = $app ?? null;
    $variant = $variant ?? 'horizontal';
    $class = $class ?? '';
    $style = $style ?? '';

    $appConfig = $appKey ? config("mexco.apps.{$appKey}") : null;
    $title = $appConfig['name'] ?? config('mexco.platform');
    $tagline = $appConfig['tagline'] ?? null;

    $logoPath = match ($variant) {
        'main', 'pass' => config('mexco.logos.main', config('mexco.logos.pass_main')),
        'icon' => config('mexco.logos.app_icon'),
        default => config('mexco.logos.horizontal', config('mexco.logos.main')),
    };
@endphp

@if($variant === 'text')
    <div class="mexco-brand-text {{ $class }}" @if($style) style="{{ $style }}" @endif>
        <div class="mexco-brand-name">{{ $title }}</div>
        @if($tagline)
            <div class="mexco-brand-tagline">{{ $tagline }}</div>
        @endif
    </div>
@else
    <img
        src="{{ asset($logoPath) }}"
        alt="{{ $title }}{{ $tagline ? ' · '.$tagline : '' }}"
        class="{{ $class }}"
        @if($style) style="{{ $style }}" @endif
    >
@endif
