@php
    $consent = app(\App\Services\Consent\ConsentService::class);
    $position = setting('consent_banner_position', 'bottom');
    $text = setting('consent_banner_text_' . app()->getLocale()) ?: __('store.consent_banner_text');
    $policyUrl = resolve_content_link(setting('consent_policy_url'), app()->getLocale());
@endphp

@if($consent->shouldShowBanner())
<div class="procp-consent-banner procp-consent-banner--{{ $position }}"
     data-api-accept="{{ route('store.consent.accept') }}"
     data-api-reject="{{ route('store.consent.reject') }}"
     role="dialog"
     aria-live="polite"
     aria-label="{{ __('store.consent_banner_text') }}">
    <div class="procp-consent-banner__text">
        {{ $text }}
        @if($policyUrl)
            <a href="{{ $policyUrl }}" target="_blank" rel="noopener">{{ __('store.consent_policy_link') }}</a>
        @endif
    </div>
    <div class="procp-consent-banner__actions">
        <button type="button" class="btn btn-sm btn-outline-secondary" data-action="reject">
            {{ __('store.consent_reject') }}
        </button>
        <button type="button" class="btn btn-sm btn-primary" data-action="accept">
            {{ __('store.consent_accept') }}
        </button>
    </div>
</div>
@endif
