@extends('layouts.app')

@section('title', '카카오톡 서비스 사용법')

@section('content')
<div class="max-w-4xl mx-auto">
    <!-- 페이지 헤더 -->
    <div class="mb-8">
        <div class="flex items-center gap-2 text-sm text-gray-500 mb-2">
            <a href="{{ route('barobill.kakaotalk.index') }}" class="hover:text-gray-700">카카오톡</a>
            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" /></svg>
            <span class="text-gray-700">사용법</span>
        </div>
        <h1 class="text-2xl font-bold text-gray-800">카카오톡 서비스 사용법</h1>
        <p class="text-sm text-gray-500 mt-1">알림톡/친구톡을 처음 사용하시는 분을 위한 안내서입니다.</p>
    </div>

    <!-- 목차 -->
    <div class="bg-yellow-50 border border-yellow-200 rounded-xl p-6 mb-8">
        <h2 class="font-semibold text-yellow-800 mb-3 flex items-center gap-2">
            <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 10h16M4 14h16M4 18h16" /></svg>
            목차
        </h2>
        <nav class="space-y-1 text-sm">
            <a href="#overview" class="block text-yellow-700 hover:text-yellow-900 py-1">1. 알림톡과 친구톡이란?</a>
            <a href="#prerequisites" class="block text-yellow-700 hover:text-yellow-900 py-1">2. 시작하기 전 준비사항</a>
            <a href="#channels" class="block text-yellow-700 hover:text-yellow-900 py-1">3. 채널 관리</a>
            <a href="#templates" class="block text-yellow-700 hover:text-yellow-900 py-1">4. 템플릿 관리</a>
            <a href="#send-alimtalk" class="block text-yellow-700 hover:text-yellow-900 py-1">5. 알림톡 발송하기</a>
            <a href="#send-friendtalk" class="block text-yellow-700 hover:text-yellow-900 py-1">6. 친구톡 발송하기</a>
            <a href="#history" class="block text-yellow-700 hover:text-yellow-900 py-1">7. 전송내역 확인하기</a>
            <a href="#faq" class="block text-yellow-700 hover:text-yellow-900 py-1">8. 자주 묻는 질문 (FAQ)</a>
        </nav>
    </div>

    <div class="space-y-10">

        <!-- 1. 개요 -->
        <section id="overview" class="scroll-mt-20">
            <div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
                <h2 class="text-xl font-bold text-gray-800 mb-4 flex items-center gap-3">
                    <span class="w-8 h-8 bg-yellow-500 text-white rounded-lg flex items-center justify-center text-sm font-bold">1</span>
                    알림톡과 친구톡이란?
                </h2>

                <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                    <!-- 알림톡 -->
                    <div class="bg-blue-50 rounded-lg p-5 border border-blue-100">
                        <div class="flex items-center gap-2 mb-3">
                            <span class="w-8 h-8 bg-blue-500 text-white rounded-full flex items-center justify-center">
                                <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" /></svg>
                            </span>
                            <h3 class="font-bold text-blue-800 text-lg">알림톡</h3>
                        </div>
                        <ul class="space-y-2 text-sm text-blue-900">
                            <li class="flex items-start gap-2">
                                <svg class="w-4 h-4 text-blue-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" /></svg>
                                <span><strong>정보성 메시지</strong>를 보내는 서비스</span>
                            </li>
                            <li class="flex items-start gap-2">
                                <svg class="w-4 h-4 text-blue-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" /></svg>
                                <span>카카오에서 <strong>승인받은 템플릿</strong>만 사용 가능</span>
                            </li>
                            <li class="flex items-start gap-2">
                                <svg class="w-4 h-4 text-blue-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" /></svg>
                                <span>친구 추가 <strong>없이도</strong> 전화번호만으로 발송</span>
                            </li>
                            <li class="flex items-start gap-2">
                                <svg class="w-4 h-4 text-blue-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" /></svg>
                                <span>예: 주문확인, 배송안내, 결제완료 등</span>
                            </li>
                        </ul>
                    </div>

                    <!-- 친구톡 -->
                    <div class="bg-green-50 rounded-lg p-5 border border-green-100">
                        <div class="flex items-center gap-2 mb-3">
                            <span class="w-8 h-8 bg-green-500 text-white rounded-full flex items-center justify-center">
                                <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 8h2a2 2 0 012 2v6a2 2 0 01-2 2h-2v4l-4-4H9a1.994 1.994 0 01-1.414-.586m0 0L11 14h4a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2v4l.586-.586z" /></svg>
                            </span>
                            <h3 class="font-bold text-green-800 text-lg">친구톡</h3>
                        </div>
                        <ul class="space-y-2 text-sm text-green-900">
                            <li class="flex items-start gap-2">
                                <svg class="w-4 h-4 text-green-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" /></svg>
                                <span><strong>광고/마케팅 메시지</strong>를 보내는 서비스</span>
                            </li>
                            <li class="flex items-start gap-2">
                                <svg class="w-4 h-4 text-green-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" /></svg>
                                <span>템플릿 없이 <strong>자유롭게 내용 작성</strong> 가능</span>
                            </li>
                            <li class="flex items-start gap-2">
                                <svg class="w-4 h-4 text-green-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" /></svg>
                                <span>채널을 <strong>친구 추가한 사용자</strong>에게만 발송</span>
                            </li>
                            <li class="flex items-start gap-2">
                                <svg class="w-4 h-4 text-green-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" /></svg>
                                <span><strong>이미지 첨부</strong> 가능 (일반/와이드)</span>
                            </li>
                        </ul>
                    </div>
                </div>

                <div class="mt-5 bg-gray-50 rounded-lg p-4">
                    <h4 class="font-medium text-gray-700 mb-2">한눈에 비교</h4>
                    <div class="overflow-x-auto">
                        <table class="w-full text-sm">
                            <thead>
                                <tr class="border-b border-gray-200">
                                    <th class="text-left py-2 px-3 font-medium text-gray-600">구분</th>
                                    <th class="text-center py-2 px-3 font-medium text-blue-600">알림톡</th>
                                    <th class="text-center py-2 px-3 font-medium text-green-600">친구톡</th>
                                </tr>
                            </thead>
                            <tbody class="text-gray-700">
                                <tr class="border-b border-gray-100">
                                    <td class="py-2 px-3">용도</td>
                                    <td class="py-2 px-3 text-center">정보성 알림</td>
                                    <td class="py-2 px-3 text-center">광고/마케팅</td>
                                </tr>
                                <tr class="border-b border-gray-100">
                                    <td class="py-2 px-3">템플릿</td>
                                    <td class="py-2 px-3 text-center">필수 (사전 승인)</td>
                                    <td class="py-2 px-3 text-center">불필요 (자유 작성)</td>
                                </tr>
                                <tr class="border-b border-gray-100">
                                    <td class="py-2 px-3">수신 대상</td>
                                    <td class="py-2 px-3 text-center">전화번호만 있으면 OK</td>
                                    <td class="py-2 px-3 text-center">채널 친구만</td>
                                </tr>
                                <tr class="border-b border-gray-100">
                                    <td class="py-2 px-3">이미지</td>
                                    <td class="py-2 px-3 text-center">불가</td>
                                    <td class="py-2 px-3 text-center">가능</td>
                                </tr>
                                <tr>
                                    <td class="py-2 px-3">SMS 대체발송</td>
                                    <td class="py-2 px-3 text-center">가능</td>
                                    <td class="py-2 px-3 text-center">가능</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </section>

        <!-- 2. 준비사항 -->
        <section id="prerequisites" class="scroll-mt-20">
            <div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
                <h2 class="text-xl font-bold text-gray-800 mb-4 flex items-center gap-3">
                    <span class="w-8 h-8 bg-yellow-500 text-white rounded-lg flex items-center justify-center text-sm font-bold">2</span>
                    시작하기 전 준비사항
                </h2>

                <div class="space-y-4">
                    <div class="flex items-start gap-4 p-4 bg-orange-50 rounded-lg border border-orange-100">
                        <div class="w-10 h-10 bg-orange-500 text-white rounded-full flex items-center justify-center flex-shrink-0 font-bold">!</div>
                        <div>
                            <h4 class="font-semibold text-orange-800 mb-1">카카오톡 서비스를 사용하려면 아래 3가지가 필요합니다</h4>
                            <p class="text-sm text-orange-700">하나라도 빠지면 발송이 불가하니 꼭 확인해주세요.</p>
                        </div>
                    </div>

                    <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                        <div class="bg-gray-50 rounded-lg p-5 border text-center">
                            <div class="w-12 h-12 bg-indigo-100 rounded-xl flex items-center justify-center mx-auto mb-3">
                                <svg class="w-6 h-6 text-indigo-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" /></svg>
                            </div>
                            <h4 class="font-semibold text-gray-800 mb-2">1. 바로빌 회원사 등록</h4>
                            <p class="text-xs text-gray-600">
                                <a href="{{ route('barobill.members.index') }}" class="text-indigo-600 hover:underline">회원사관리</a> 메뉴에서 사업자번호와 바로빌 계정이 등록되어 있어야 합니다.
                            </p>
                        </div>
                        <div class="bg-gray-50 rounded-lg p-5 border text-center">
                            <div class="w-12 h-12 bg-yellow-100 rounded-xl flex items-center justify-center mx-auto mb-3">
                                <svg class="w-6 h-6 text-yellow-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" /></svg>
                            </div>
                            <h4 class="font-semibold text-gray-800 mb-2">2. 카카오톡 채널 등록</h4>
                            <p class="text-xs text-gray-600">
                                <a href="{{ route('barobill.kakaotalk.channels') }}" class="text-indigo-600 hover:underline">채널관리</a>에서 바로빌에 카카오톡 채널을 등록해야 합니다. (바로빌 사이트에서 진행)
                            </p>
                        </div>
                        <div class="bg-gray-50 rounded-lg p-5 border text-center">
                            <div class="w-12 h-12 bg-blue-100 rounded-xl flex items-center justify-center mx-auto mb-3">
                                <svg class="w-6 h-6 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6z" /></svg>
                            </div>
                            <h4 class="font-semibold text-gray-800 mb-2">3. 알림톡 템플릿 등록</h4>
                            <p class="text-xs text-gray-600">
                                알림톡을 사용하려면 <a href="{{ route('barobill.kakaotalk.templates') }}" class="text-indigo-600 hover:underline">템플릿관리</a>에서 템플릿을 등록하고 카카오 승인을 받아야 합니다.
                            </p>
                        </div>
                    </div>

                    <div class="bg-blue-50 rounded-lg p-4 border border-blue-100">
                        <p class="text-sm text-blue-800">
                            <strong>참고:</strong> 친구톡은 템플릿이 필요 없습니다. 채널만 등록되어 있으면 바로 사용 가능합니다.
                        </p>
                    </div>
                </div>
            </div>
        </section>

        <!-- 3. 채널 관리 -->
        <section id="channels" class="scroll-mt-20">
            <div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
                <h2 class="text-xl font-bold text-gray-800 mb-4 flex items-center gap-3">
                    <span class="w-8 h-8 bg-yellow-500 text-white rounded-lg flex items-center justify-center text-sm font-bold">3</span>
                    채널 관리
                    <a href="{{ route('barobill.kakaotalk.channels') }}" class="text-sm font-normal text-indigo-600 hover:underline ml-auto">바로가기 &rarr;</a>
                </h2>

                <div class="space-y-4 text-sm text-gray-700">
                    <p>카카오톡 채널은 메시지를 발송하는 <strong>발신자 프로필</strong>입니다. 수신자에게 회사 이름으로 메시지가 표시됩니다.</p>

                    <div class="bg-gray-50 rounded-lg p-5 space-y-4">
                        <h4 class="font-semibold text-gray-800">채널 등록 방법</h4>
                        <ol class="space-y-3">
                            <li class="flex items-start gap-3">
                                <span class="w-6 h-6 bg-yellow-500 text-white rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0">1</span>
                                <span><a href="{{ route('barobill.kakaotalk.channels') }}" class="text-indigo-600 hover:underline font-medium">채널관리</a> 페이지에서 <strong>"채널 관리 (바로빌)"</strong> 버튼을 클릭합니다.</span>
                            </li>
                            <li class="flex items-start gap-3">
                                <span class="w-6 h-6 bg-yellow-500 text-white rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0">2</span>
                                <span>바로빌 사이트가 새 창으로 열립니다. 안내에 따라 <strong>카카오톡 채널을 등록</strong>합니다.</span>
                            </li>
                            <li class="flex items-start gap-3">
                                <span class="w-6 h-6 bg-yellow-500 text-white rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0">3</span>
                                <span>등록 완료 후, 채널관리 페이지에서 <strong>"새로고침"</strong> 버튼을 눌러 채널 목록을 확인합니다.</span>
                            </li>
                        </ol>
                    </div>

                    <div class="bg-amber-50 rounded-lg p-4 border border-amber-100">
                        <p class="text-amber-800">
                            <strong>Tip:</strong> 카카오톡 채널은 <a href="https://center-pf.kakao.com" target="_blank" class="underline">카카오 비즈니스</a>에서 먼저 개설한 뒤, 바로빌에 연동하는 방식입니다.
                        </p>
                    </div>
                </div>
            </div>
        </section>

        <!-- 4. 템플릿 관리 -->
        <section id="templates" class="scroll-mt-20">
            <div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
                <h2 class="text-xl font-bold text-gray-800 mb-4 flex items-center gap-3">
                    <span class="w-8 h-8 bg-yellow-500 text-white rounded-lg flex items-center justify-center text-sm font-bold">4</span>
                    템플릿 관리
                    <a href="{{ route('barobill.kakaotalk.templates') }}" class="text-sm font-normal text-indigo-600 hover:underline ml-auto">바로가기 &rarr;</a>
                </h2>

                <div class="space-y-4 text-sm text-gray-700">
                    <p>알림톡은 반드시 <strong>카카오에서 승인받은 템플릿</strong>으로만 발송할 수 있습니다. 승인까지 보통 1~2 영업일이 소요됩니다.</p>

                    <div class="bg-gray-50 rounded-lg p-5 space-y-4">
                        <h4 class="font-semibold text-gray-800">템플릿 등록 방법</h4>
                        <ol class="space-y-3">
                            <li class="flex items-start gap-3">
                                <span class="w-6 h-6 bg-yellow-500 text-white rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0">1</span>
                                <span><a href="{{ route('barobill.kakaotalk.templates') }}" class="text-indigo-600 hover:underline font-medium">템플릿관리</a> 페이지에서 <strong>"템플릿 관리 (바로빌)"</strong> 버튼을 클릭합니다.</span>
                            </li>
                            <li class="flex items-start gap-3">
                                <span class="w-6 h-6 bg-yellow-500 text-white rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0">2</span>
                                <span>바로빌 사이트에서 새 템플릿을 작성합니다. <strong>템플릿명, 내용, 버튼</strong> 등을 입력합니다.</span>
                            </li>
                            <li class="flex items-start gap-3">
                                <span class="w-6 h-6 bg-yellow-500 text-white rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0">3</span>
                                <span>작성 후 <strong>검수 요청</strong>을 합니다. 카카오에서 승인되면 상태가 <span class="px-1.5 py-0.5 bg-green-100 text-green-700 rounded text-xs font-medium">승인</span>으로 변경됩니다.</span>
                            </li>
                            <li class="flex items-start gap-3">
                                <span class="w-6 h-6 bg-yellow-500 text-white rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0">4</span>
                                <span>승인된 템플릿만 발송 페이지의 템플릿 목록에 나타납니다.</span>
                            </li>
                        </ol>
                    </div>

                    <div class="bg-gray-50 rounded-lg p-4">
                        <h4 class="font-medium text-gray-700 mb-2">템플릿 상태 안내</h4>
                        <div class="flex flex-wrap gap-3">
                            <span class="inline-flex items-center gap-1"><span class="px-2 py-0.5 bg-yellow-100 text-yellow-700 rounded-full text-xs font-medium">심사중</span> 카카오 검수 대기</span>
                            <span class="inline-flex items-center gap-1"><span class="px-2 py-0.5 bg-green-100 text-green-700 rounded-full text-xs font-medium">승인</span> 발송 가능</span>
                            <span class="inline-flex items-center gap-1"><span class="px-2 py-0.5 bg-red-100 text-red-700 rounded-full text-xs font-medium">반려</span> 수정 후 재신청 필요</span>
                        </div>
                    </div>

                    <div class="bg-amber-50 rounded-lg p-4 border border-amber-100">
                        <p class="text-amber-800">
                            <strong>Tip:</strong> 템플릿 내용에 <code class="bg-amber-100 px-1 rounded">#{변수명}</code>을 넣으면 발송 시 실제 값으로 치환됩니다.<br>
                            예: <code class="bg-amber-100 px-1 rounded">#{고객명}님, 주문하신 상품이 발송되었습니다.</code>
                        </p>
                    </div>
                </div>
            </div>
        </section>

        <!-- 5. 알림톡 발송 -->
        <section id="send-alimtalk" class="scroll-mt-20">
            <div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
                <h2 class="text-xl font-bold text-gray-800 mb-4 flex items-center gap-3">
                    <span class="w-8 h-8 bg-yellow-500 text-white rounded-lg flex items-center justify-center text-sm font-bold">5</span>
                    알림톡 발송하기
                    <a href="{{ route('barobill.kakaotalk.send') }}" class="text-sm font-normal text-indigo-600 hover:underline ml-auto">바로가기 &rarr;</a>
                </h2>

                <div class="space-y-4 text-sm text-gray-700">
                    <div class="bg-gray-50 rounded-lg p-5 space-y-4">
                        <h4 class="font-semibold text-gray-800">발송 순서</h4>
                        <ol class="space-y-3">
                            <li class="flex items-start gap-3">
                                <span class="w-6 h-6 bg-blue-500 text-white rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0">1</span>
                                <div>
                                    <strong>채널 선택</strong>
                                    <p class="text-gray-500 mt-0.5">메시지를 발송할 카카오톡 채널을 선택합니다.</p>
                                </div>
                            </li>
                            <li class="flex items-start gap-3">
                                <span class="w-6 h-6 bg-blue-500 text-white rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0">2</span>
                                <div>
                                    <strong>템플릿 선택</strong>
                                    <p class="text-gray-500 mt-0.5">승인된 템플릿을 선택하면 메시지 내용이 자동으로 채워집니다.</p>
                                </div>
                            </li>
                            <li class="flex items-start gap-3">
                                <span class="w-6 h-6 bg-blue-500 text-white rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0">3</span>
                                <div>
                                    <strong>수신자 정보 입력</strong>
                                    <p class="text-gray-500 mt-0.5">수신자 이름과 전화번호를 입력합니다. (하이픈 없이 숫자만)</p>
                                </div>
                            </li>
                            <li class="flex items-start gap-3">
                                <span class="w-6 h-6 bg-blue-500 text-white rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0">4</span>
                                <div>
                                    <strong>SMS 대체발송 설정 (선택)</strong>
                                    <p class="text-gray-500 mt-0.5">체크하면 카카오톡 발송 실패 시 자동으로 SMS가 발송됩니다.</p>
                                </div>
                            </li>
                            <li class="flex items-start gap-3">
                                <span class="w-6 h-6 bg-blue-500 text-white rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0">5</span>
                                <div>
                                    <strong>발송</strong>
                                    <p class="text-gray-500 mt-0.5">"알림톡 발송" 버튼을 클릭합니다. 성공하면 전송키가 표시됩니다.</p>
                                </div>
                            </li>
                        </ol>
                    </div>

                    <div class="bg-blue-50 rounded-lg p-4 border border-blue-100">
                        <p class="text-blue-800">
                            <strong>예약 발송:</strong> "예약 발송" 항목에 날짜/시간을 지정하면 해당 시간에 자동 발송됩니다. 비워두면 즉시 발송됩니다.
                        </p>
                    </div>
                </div>
            </div>
        </section>

        <!-- 6. 친구톡 발송 -->
        <section id="send-friendtalk" class="scroll-mt-20">
            <div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
                <h2 class="text-xl font-bold text-gray-800 mb-4 flex items-center gap-3">
                    <span class="w-8 h-8 bg-yellow-500 text-white rounded-lg flex items-center justify-center text-sm font-bold">6</span>
                    친구톡 발송하기
                    <a href="{{ route('barobill.kakaotalk.send') }}" class="text-sm font-normal text-indigo-600 hover:underline ml-auto">바로가기 &rarr;</a>
                </h2>

                <div class="space-y-4 text-sm text-gray-700">
                    <p>발송 페이지에서 상단의 <strong>"친구톡"</strong> 탭을 클릭하여 전환합니다.</p>

                    <div class="bg-gray-50 rounded-lg p-5 space-y-4">
                        <h4 class="font-semibold text-gray-800">발송 순서</h4>
                        <ol class="space-y-3">
                            <li class="flex items-start gap-3">
                                <span class="w-6 h-6 bg-green-500 text-white rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0">1</span>
                                <div>
                                    <strong>채널 선택</strong>
                                    <p class="text-gray-500 mt-0.5">발송할 카카오톡 채널을 선택합니다.</p>
                                </div>
                            </li>
                            <li class="flex items-start gap-3">
                                <span class="w-6 h-6 bg-green-500 text-white rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0">2</span>
                                <div>
                                    <strong>발송 유형 선택</strong>
                                    <p class="text-gray-500 mt-0.5"><strong>텍스트</strong> (글만), <strong>이미지</strong> (500x250px), <strong>와이드 이미지</strong> (800x400px) 중 선택합니다.</p>
                                </div>
                            </li>
                            <li class="flex items-start gap-3">
                                <span class="w-6 h-6 bg-green-500 text-white rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0">3</span>
                                <div>
                                    <strong>수신자 정보 + 메시지 입력</strong>
                                    <p class="text-gray-500 mt-0.5">친구톡은 자유롭게 메시지를 작성할 수 있습니다.</p>
                                </div>
                            </li>
                            <li class="flex items-start gap-3">
                                <span class="w-6 h-6 bg-green-500 text-white rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0">4</span>
                                <div>
                                    <strong>버튼 설정 (선택)</strong>
                                    <p class="text-gray-500 mt-0.5">"+ 버튼 추가"를 클릭하여 웹링크, 앱링크 등의 버튼을 추가할 수 있습니다.</p>
                                </div>
                            </li>
                            <li class="flex items-start gap-3">
                                <span class="w-6 h-6 bg-green-500 text-white rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0">5</span>
                                <div>
                                    <strong>광고 여부 체크</strong>
                                    <p class="text-gray-500 mt-0.5">광고성 메시지라면 반드시 체크해주세요. (법적 의무사항)</p>
                                </div>
                            </li>
                        </ol>
                    </div>

                    <div class="bg-red-50 rounded-lg p-4 border border-red-100">
                        <p class="text-red-800">
                            <strong>주의:</strong> 친구톡은 채널을 <strong>친구 추가한 사용자</strong>에게만 발송됩니다. 친구가 아닌 번호로 발송하면 실패합니다.
                        </p>
                    </div>
                </div>
            </div>
        </section>

        <!-- 7. 전송내역 -->
        <section id="history" class="scroll-mt-20">
            <div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
                <h2 class="text-xl font-bold text-gray-800 mb-4 flex items-center gap-3">
                    <span class="w-8 h-8 bg-yellow-500 text-white rounded-lg flex items-center justify-center text-sm font-bold">7</span>
                    전송내역 확인하기
                    <a href="{{ route('barobill.kakaotalk.history') }}" class="text-sm font-normal text-indigo-600 hover:underline ml-auto">바로가기 &rarr;</a>
                </h2>

                <div class="space-y-4 text-sm text-gray-700">
                    <p>메시지 발송 후 받게 되는 <strong>전송키</strong>를 사용하여 발송 결과를 확인할 수 있습니다.</p>

                    <div class="bg-gray-50 rounded-lg p-5 space-y-3">
                        <h4 class="font-semibold text-gray-800">사용 방법</h4>
                        <ul class="space-y-2">
                            <li class="flex items-start gap-2">
                                <svg class="w-4 h-4 text-yellow-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" /></svg>
                                <span>전송키 입력란에 <strong>전송키를 입력</strong>하고 "조회" 버튼을 클릭합니다.</span>
                            </li>
                            <li class="flex items-start gap-2">
                                <svg class="w-4 h-4 text-yellow-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" /></svg>
                                <span>여러 건을 한번에 조회하려면 <strong>쉼표(,)로 구분</strong>하여 입력합니다.</span>
                            </li>
                            <li class="flex items-start gap-2">
                                <svg class="w-4 h-4 text-yellow-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" /></svg>
                                <span><strong>예약 발송 취소:</strong> 아직 발송되지 않은 예약 건은 "예약취소" 버튼으로 취소할 수 있습니다.</span>
                            </li>
                        </ul>
                    </div>

                    <div class="bg-gray-50 rounded-lg p-4">
                        <h4 class="font-medium text-gray-700 mb-2">전송 상태 안내</h4>
                        <div class="flex flex-wrap gap-3">
                            <span class="inline-flex items-center gap-1"><span class="px-2 py-0.5 bg-yellow-100 text-yellow-700 rounded-full text-xs font-medium">대기</span> 발송 준비 중</span>
                            <span class="inline-flex items-center gap-1"><span class="px-2 py-0.5 bg-blue-100 text-blue-700 rounded-full text-xs font-medium">전송중</span> 발송 진행 중</span>
                            <span class="inline-flex items-center gap-1"><span class="px-2 py-0.5 bg-green-100 text-green-700 rounded-full text-xs font-medium">성공</span> 발송 완료</span>
                            <span class="inline-flex items-center gap-1"><span class="px-2 py-0.5 bg-red-100 text-red-700 rounded-full text-xs font-medium">실패</span> 발송 실패</span>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- 8. FAQ -->
        <section id="faq" class="scroll-mt-20">
            <div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
                <h2 class="text-xl font-bold text-gray-800 mb-4 flex items-center gap-3">
                    <span class="w-8 h-8 bg-yellow-500 text-white rounded-lg flex items-center justify-center text-sm font-bold">8</span>
                    자주 묻는 질문 (FAQ)
                </h2>

                <div class="space-y-4">
                    <details class="group bg-gray-50 rounded-lg border">
                        <summary class="flex items-center justify-between p-4 cursor-pointer">
                            <span class="font-medium text-gray-800 text-sm">Q. 알림톡 발송이 실패합니다.</span>
                            <svg class="w-5 h-5 text-gray-400 group-open:rotate-180 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" /></svg>
                        </summary>
                        <div class="px-4 pb-4 text-sm text-gray-600 space-y-2">
                            <p>아래 사항을 순서대로 확인해주세요:</p>
                            <ul class="list-disc pl-5 space-y-1">
                                <li>바로빌 회원사가 등록되어 있는지 확인</li>
                                <li>카카오톡 채널이 정상 상태인지 확인</li>
                                <li>사용한 템플릿이 <strong>"승인"</strong> 상태인지 확인</li>
                                <li>수신자 전화번호가 올바른지 확인 (하이픈 없이 숫자만)</li>
                                <li>바로빌 충전 잔액이 충분한지 확인</li>
                            </ul>
                        </div>
                    </details>

                    <details class="group bg-gray-50 rounded-lg border">
                        <summary class="flex items-center justify-between p-4 cursor-pointer">
                            <span class="font-medium text-gray-800 text-sm">Q. 친구톡을 보냈는데 상대방이 못 받았습니다.</span>
                            <svg class="w-5 h-5 text-gray-400 group-open:rotate-180 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" /></svg>
                        </summary>
                        <div class="px-4 pb-4 text-sm text-gray-600">
                            <p>친구톡은 <strong>카카오톡 채널을 친구 추가한 사용자</strong>에게만 발송됩니다. 상대방이 채널을 친구 추가했는지 확인해주세요. 친구가 아닌 경우 SMS 대체발송을 활성화하면 문자로 전송됩니다.</p>
                        </div>
                    </details>

                    <details class="group bg-gray-50 rounded-lg border">
                        <summary class="flex items-center justify-between p-4 cursor-pointer">
                            <span class="font-medium text-gray-800 text-sm">Q. SMS 대체발송이란 무엇인가요?</span>
                            <svg class="w-5 h-5 text-gray-400 group-open:rotate-180 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" /></svg>
                        </summary>
                        <div class="px-4 pb-4 text-sm text-gray-600">
                            <p>카카오톡 발송에 실패했을 때 (수신자가 카카오톡 미사용, 수신거부 등) <strong>자동으로 SMS/LMS로 대신 발송</strong>하는 기능입니다. 발송 폼에서 "SMS 대체발송"을 체크하고 SMS 메시지를 입력하면 됩니다. 90바이트를 초과하면 자동으로 LMS로 발송됩니다.</p>
                        </div>
                    </details>

                    <details class="group bg-gray-50 rounded-lg border">
                        <summary class="flex items-center justify-between p-4 cursor-pointer">
                            <span class="font-medium text-gray-800 text-sm">Q. 예약 발송을 취소할 수 있나요?</span>
                            <svg class="w-5 h-5 text-gray-400 group-open:rotate-180 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" /></svg>
                        </summary>
                        <div class="px-4 pb-4 text-sm text-gray-600">
                            <p>네, <a href="{{ route('barobill.kakaotalk.history') }}" class="text-indigo-600 hover:underline">전송내역</a> 페이지에서 전송키로 조회한 후, 상태가 "대기"인 건은 <strong>"예약취소"</strong> 버튼으로 취소할 수 있습니다. 이미 발송된 건은 취소할 수 없습니다.</p>
                        </div>
                    </details>

                    <details class="group bg-gray-50 rounded-lg border">
                        <summary class="flex items-center justify-between p-4 cursor-pointer">
                            <span class="font-medium text-gray-800 text-sm">Q. 대량 발송은 어떻게 하나요?</span>
                            <svg class="w-5 h-5 text-gray-400 group-open:rotate-180 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" /></svg>
                        </summary>
                        <div class="px-4 pb-4 text-sm text-gray-600">
                            <p>현재 화면에서는 단건 발송만 지원합니다. 대량 발송이 필요한 경우 시스템 관리자에게 문의해주세요. API를 통해 한 번에 여러 건을 발송할 수 있는 기능이 준비되어 있습니다.</p>
                        </div>
                    </details>

                    <details class="group bg-gray-50 rounded-lg border">
                        <summary class="flex items-center justify-between p-4 cursor-pointer">
                            <span class="font-medium text-gray-800 text-sm">Q. 발송 비용은 얼마인가요?</span>
                            <svg class="w-5 h-5 text-gray-400 group-open:rotate-180 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" /></svg>
                        </summary>
                        <div class="px-4 pb-4 text-sm text-gray-600">
                            <p>바로빌 충전 잔액에서 차감됩니다. 요금은 바로빌 요금 정책에 따르며, 알림톡과 친구톡의 단가가 다릅니다. SMS 대체발송 시 추가 비용이 발생합니다. 잔액은 <a href="{{ route('barobill.members.index') }}" class="text-indigo-600 hover:underline">회원사관리</a>에서 확인할 수 있습니다.</p>
                        </div>
                    </details>
                </div>
            </div>
        </section>

        <!-- 하단 바로가기 -->
        <div class="bg-yellow-50 border border-yellow-200 rounded-xl p-6 text-center">
            <h3 class="font-semibold text-yellow-800 mb-3">바로 시작하기</h3>
            <div class="flex flex-wrap justify-center gap-3">
                <a href="{{ route('barobill.kakaotalk.channels') }}" class="px-4 py-2 bg-white border border-yellow-300 text-yellow-700 rounded-lg hover:bg-yellow-100 transition text-sm">채널 관리</a>
                <a href="{{ route('barobill.kakaotalk.templates') }}" class="px-4 py-2 bg-white border border-yellow-300 text-yellow-700 rounded-lg hover:bg-yellow-100 transition text-sm">템플릿 관리</a>
                <a href="{{ route('barobill.kakaotalk.send') }}" class="px-4 py-2 bg-yellow-500 text-white rounded-lg hover:bg-yellow-600 transition text-sm font-medium">메시지 발송</a>
                <a href="{{ route('barobill.kakaotalk.history') }}" class="px-4 py-2 bg-white border border-yellow-300 text-yellow-700 rounded-lg hover:bg-yellow-100 transition text-sm">전송내역</a>
            </div>
        </div>

    </div>
</div>
@endsection
