@php
    $brandTxt = $brand ?? config('app.name', 'Brand');
    $subTxt   = $subtitle ?? '업데이트/공지/소식';
    $subj     = $subject ?? '';
    $copy     = $copyright ?? ('© 2018 '.$brandTxt.'.');
    $bodyOut  = $body_html ?? nl2br(e($body_text ?? $body ?? ''));

    $snsList = [];
    if (!empty($sns) && is_array($sns)) {
        if (isset($sns[0]) && is_array($sns[0])) $snsList = $sns;
        else foreach ($sns as $k=>$u) if ($u) $snsList[] = ['label'=>ucfirst((string)$k), 'url'=>$u];
    }
@endphp

<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background:#070a12; padding:26px 0;">
    <tr>
        <td align="center">
            <table role="presentation" width="640" cellpadding="0" cellspacing="0"
                   style="width:640px; max-width:94%; background:#0b1220; border-radius:20px; overflow:hidden; border:1px solid rgba(255,255,255,.10);">

                <tr>
                    <td style="padding:18px 20px; background:linear-gradient(90deg,#22c55e,#16a34a,#0ea5e9); color:#052e16;">
                        <div style="font-weight:1000; font-size:16px; color:#fbfdfc;">
                            @if(!empty($logoUrl))
                                <img src="{{ $logoUrl }}" alt="{{ $brandTxt }}" style="height:20px; vertical-align:middle;">
                            @else
                                {{ $brandTxt }}
                            @endif
                        </div>
                    </td>
                </tr>

                @if(!empty($heroUrl))
                    <tr>
                        <td><img src="{{ $heroUrl }}" alt="" style="width:100%; display:block;"></td>
                    </tr>
                @endif

                <tr>
                    <td style="padding:18px 20px;">
                        <div style="color:#e5e7eb; font-weight:900; font-size:18px;">
                            {{ $subj }}
                        </div>
                        <div style="height:12px;"></div>

                        <div style="background:rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.12); border-radius:18px; padding:16px;">
                            <div style="color:rgba(255,255,255,.90); font-size:14px; line-height:1.85;  height:300px">
                                {!! $bodyOut !!}
                            </div>
                        </div>

                        {{-- Highlight tip --}}
                        <div style="border-left:4px solid #6b7280; padding:10px 12px; background:#19202d; border-radius:12px; margin-top:20px ">
                            <div style="font-size:12px; color:#ffffff; font-weight:800; margin-bottom:4px;">안내</div>
                            <div style="font-size:12px; color:#ffffff; line-height:1.6;">
                                이 메일은 발신 전용입니다. 문의가 필요하면 관리자 채널을 통해 연락해 주세요.
                            </div>
                        </div>

                        <div style="margin-top:18px; font-size:12px; color:rgba(255,255,255,.60); line-height:1.6;">
                            <div style="border-top:1px solid rgba(255,255,255,.08); padding-top:14px;">
                                <div style="margin-bottom:10px;">{{ $copy }}</div>

                                @if(!empty($snsList))
                                    <div>
                                        @foreach($snsList as $s)
                                            @php $u=$s['url']??''; $l=$s['label']??''; @endphp
                                            @if($u && $l)
                                                <a href="{{ $u }}" style="color:rgba(255,255,255,.75); text-decoration:none; margin-right:12px;">
                                                    {{ $l }}
                                                </a>
                                            @endif
                                        @endforeach
                                    </div>
                                @endif
                            </div>
                        </div>

                    </td>
                </tr>

            </table>
        </td>
    </tr>
</table>
