@php
    $brandTxt = $brand ?? config('app.name', 'Brand');
    $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:#f3f4f6; padding:26px 0;">
    <tr>
        <td align="center">
            <table role="presentation" width="660" cellpadding="0" cellspacing="0"
                   style="width:660px; max-width:94%; background:#ffffff; border-radius:18px; overflow:hidden; border:1px solid #e5e7eb;">
                <tr>
                    <td style="padding:18px 20px; background:linear-gradient(90deg,#0ea5e9,#6366f1); color:#fff;">
                        <div style="font-weight:900; font-size:15px;">
                            @if(!empty($logoUrl))
                                <img src="{{ $logoUrl }}" alt="{{ $brandTxt }}" style="height:20px; vertical-align:middle;">
                            @else
                                {{ $brandTxt }}
                            @endif
                        </div>
                        <div style="font-size:12px; opacity:.9; margin-top:6px;">안내 메일</div>
                    </td>
                </tr>

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

                <tr>
                    <td style="padding:22px 20px;">
                        <div style="font-weight:900; font-size:18px; color:#0f172a; margin-bottom:12px;">
                            {{ $subj }}
                        </div>

                        <div style="background:#f8fafc; border:1px solid #e5e7eb; border-radius:14px; padding:14px;">
                            <div style="font-size:14px; line-height:1.85; color:#111;  height:300px">
                                {!! $bodyOut !!}
                            </div>
                        </div>

                        <div style="height:16px;"></div>

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

                        <div style="margin-top:18px; font-size:12px; color:#6b7280;">
                            <div style="border-top:1px solid #eef2f7; 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:#2563eb; text-decoration:none; margin-right:12px;">
                                                    {{ $l }}
                                                </a>
                                            @endif
                                        @endforeach
                                    </div>
                                @endif
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
