@php
    // Type-aware wording — a sport/match or regular video is NOT a song.
    $isSong  = $video->isAudioOnly() || $video->type === 'music';
    $noun    = $isSong ? 'song' : ($video->type === 'match' ? 'match' : 'video');
    $cta     = $isSong ? 'Listen now' : 'Watch now';
    $icon    = $isSong ? '&#x1F3B5;' : '&#9654;';            // 🎵 vs ▶
    $byLabel = $isSong ? 'Artist' : ($video->type === 'match' ? 'Posted by' : 'Channel');
@endphp
<x-emails.layout subject="{{ $sender->name }} shared a {{ $noun }} with you">

    {{-- Icon --}}
    <div style="width:64px;height:64px;border-radius:50%;background:rgba(230,30,30,.12);border:1px solid rgba(230,30,30,.25);margin:0 auto 24px;text-align:center;line-height:64px;font-size:28px;">{!! $icon !!}</div>

    <h1 class="email-title">{{ $sender->name }} shared a {{ $noun }} with you</h1>
    <p class="email-subtitle">They thought you'd enjoy this on {{ config('app.name') }}.</p>

    @if($personalMessage)
    {{-- Personal note --}}
    <div class="email-infobox" style="border-left:3px solid #e61e1e;">
        <div class="email-infobox-label">Message from {{ $sender->name }}</div>
        <div style="color:#ddd;font-size:14px;line-height:1.6;white-space:pre-wrap;">{{ $personalMessage }}</div>
    </div>
    @endif

    {{-- Cover --}}
    @php($thumbEmbed = \App\Support\EmailThumbnail::localPath($video))
    <div class="email-thumb-wrap">
        @if($video->thumbnail)
            <a href="{{ $shareUrl }}">
                <img src="{{ $thumbEmbed ? $message->embed($thumbEmbed) : route('media.thumbnail', $video->thumbnail) }}" alt="{{ $shareTitle }}">
            </a>
        @else
            <div class="email-thumb-placeholder">
                <span style="font-size:32px;">{!! $icon !!}</span>
                <span>{{ Str::limit($shareTitle, 40) }}</span>
            </div>
        @endif
    </div>

    {{-- Details --}}
    <div class="email-infobox">
        <div class="email-infobox-label">Details</div>
        <div class="email-inforow">
            <span class="email-inforow-key">Title</span>
            <span class="email-inforow-val">{{ $shareTitle }}</span>
        </div>
        @if($video->formatted_duration)
        <div class="email-inforow">
            <span class="email-inforow-key">Duration</span>
            <span class="email-inforow-val">{{ $video->formatted_duration }}</span>
        </div>
        @endif
        <div class="email-inforow">
            <span class="email-inforow-key">{{ $byLabel }}</span>
            <span class="email-inforow-val">{{ $video->user->name ?? config('app.name') }}</span>
        </div>
    </div>

    {{-- CTA --}}
    <div class="email-btn-wrap">
        <a href="{{ $shareUrl }}" class="email-btn">{!! $isSong ? '&#9654;&nbsp; ' : '&#9654;&nbsp; ' !!}{{ $cta }}</a>
    </div>

    <hr class="email-divider">

    <p class="email-note">
        {{ $sender->name }} sent you this link from {{ config('app.name') }}. If you weren't expecting it, you can safely ignore this email.
    </p>

</x-emails.layout>
