/* ============================================================
   erp-chat.css — 17번 고객응대_상담이 챗봇 뷰어 전용 스타일
   ⚠️ 주의: 이 파일은 erp.html의 기존 스타일과 완전 독립
   모든 클래스명은 .cs- 접두사로 네임스페이스 격리
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

/* ── FAB (Floating Action Button) ───────────────────────── */
.cs-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-size: 24px;
}
.cs-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(99, 102, 241, 0.7);
}
.cs-fab.cs-fab--active {
    background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
}

/* 알림 배지 */
.cs-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: #ef4444;
    border-radius: 50%;
    font-size: 10px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 2px solid #fff;
}

/* ── 챗봇 패널 컨테이너 ────────────────────────────────── */
.cs-panel {
    position: fixed;
    bottom: 96px;
    right: 28px;
    width: 380px;
    height: 600px;
    background: rgba(15, 17, 26, 0.97);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(139, 92, 246, 0.1);
    z-index: 8999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}
.cs-panel.cs-panel--open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* ── 패널 헤더 ──────────────────────────────────────────── */
.cs-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
    flex-shrink: 0;
}
.cs-panel-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.cs-panel-title {
    flex: 1;
    font-family: 'Noto Sans KR', sans-serif;
}
.cs-panel-title strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #e2e8f0;
}
.cs-panel-title span {
    font-size: 11px;
    color: #10b981;
    display: flex;
    align-items: center;
    gap: 4px;
}
.cs-panel-title span::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    animation: cs-pulse 2s infinite;
}
.cs-panel-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}
.cs-panel-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* ── 메시지 목록 ────────────────────────────────────────── */
.cs-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
}
.cs-messages::-webkit-scrollbar { width: 4px; }
.cs-messages::-webkit-scrollbar-track { background: transparent; }
.cs-messages::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.3); border-radius: 2px; }

/* 말풍선 공통 */
.cs-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 13px;
    line-height: 1.6;
    word-break: break-word;
}
.cs-bubble--bot {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: #e2e8f0;
    border-radius: 4px 16px 16px 16px;
    align-self: flex-start;
}
.cs-bubble--user {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border-radius: 16px 4px 16px 16px;
    align-self: flex-end;
}

/* ── 인터랙티브 카드 ─────────────────────────────────────── */
.cs-card {
    background: rgba(30, 34, 54, 0.9);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 14px;
    padding: 14px;
    font-family: 'Noto Sans KR', sans-serif;
    align-self: flex-start;
    width: 100%;
    max-width: 95%;
}
.cs-card-title {
    font-size: 12px;
    font-weight: 700;
    color: #818cf8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.cs-card-body {
    font-size: 13px;
    color: #cbd5e1;
    line-height: 1.6;
    margin-bottom: 12px;
}
.cs-card-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    color: #94a3b8;
}
.cs-card-row strong { color: #e2e8f0; }

/* 업로드 드롭존 카드 */
.cs-upload-zone {
    border: 2px dashed rgba(99, 102, 241, 0.4);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    color: #94a3b8;
    font-size: 13px;
    font-family: 'Noto Sans KR', sans-serif;
}
.cs-upload-zone:hover,
.cs-upload-zone.cs-dragover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.08);
    color: #a5b4fc;
}
.cs-upload-zone .cs-upload-icon { font-size: 28px; margin-bottom: 6px; }
.cs-upload-zone input[type="file"] { display: none; }

/* 조판 진행 모달 오버레이 */
.cs-progress-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 12, 20, 0.92);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    border-radius: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.cs-progress-overlay.cs-visible {
    opacity: 1;
    pointer-events: all;
}
.cs-progress-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: cs-spin 0.8s linear infinite;
}
.cs-progress-label {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 14px;
    color: #e2e8f0;
    text-align: center;
}
.cs-progress-sub {
    font-size: 12px;
    color: #6366f1;
}
.cs-progress-bar-wrap {
    width: 200px;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
}
.cs-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 2px;
    width: 0%;
    transition: width 0.4s ease;
}

/* 결과물 다운로드 카드 */
.cs-result-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(6, 78, 59, 0.15) 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 14px;
    padding: 14px;
    align-self: flex-start;
    width: 100%;
    max-width: 95%;
    font-family: 'Noto Sans KR', sans-serif;
}
.cs-result-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
}
.cs-result-preview {
    width: 100%;
    height: 90px;
    background: linear-gradient(135deg, #1e1e2e, #2a2a3e);
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.cs-book-cover-mini {
    display: flex;
    align-items: stretch;
    height: 70px;
    gap: 2px;
    font-size: 10px;
    color: #fff;
}
.cs-book-back { width: 52px; background: linear-gradient(180deg, #4c1d95, #312e81); border-radius: 3px 0 0 3px; display: flex; align-items: center; justify-content: center; font-size: 9px; color: #a5b4fc; }
.cs-book-spine { width: 14px; background: linear-gradient(180deg, #7c3aed, #6d28d9); display: flex; align-items: center; justify-content: center; writing-mode: vertical-rl; font-size: 8px; font-weight: 700; color: #ede9fe; }
.cs-book-front { width: 52px; background: linear-gradient(180deg, #1d4ed8, #1e3a8a); border-radius: 0 3px 3px 0; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: #bfdbfe; text-align: center; padding: 4px; }

/* 버튼 공통 */
.cs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 10px;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    width: 100%;
    margin-top: 6px;
}
.cs-btn:hover { transform: translateY(-1px); }
.cs-btn--primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}
.cs-btn--success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 4px 12px rgba(16,185,129,0.35);
}
.cs-btn--download {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 4px 12px rgba(245,158,11,0.35);
}
.cs-btn--ghost {
    background: rgba(255,255,255,0.06);
    color: #94a3b8;
    border: 1px solid rgba(255,255,255,0.1);
}

/* 빠른 답변 칩 */
.cs-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 14px 10px;
}
.cs-chip {
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    font-size: 12px;
    font-family: 'Noto Sans KR', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.cs-chip:hover {
    background: rgba(99, 102, 241, 0.25);
    color: #c7d2fe;
}

/* ── 입력창 ─────────────────────────────────────────────── */
.cs-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid rgba(99, 102, 241, 0.15);
    background: rgba(10, 12, 20, 0.5);
    flex-shrink: 0;
}
.cs-input {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(99,102,241,0.25);
    border-radius: 10px;
    padding: 8px 12px;
    color: #e2e8f0;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.cs-input::placeholder { color: #475569; }
.cs-input:focus { border-color: #6366f1; }
.cs-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}
.cs-send-btn:hover { transform: scale(1.1); }

/* ── 타이핑 인디케이터 ──────────────────────────────────── */
.cs-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    align-self: flex-start;
}
.cs-typing span {
    width: 7px; height: 7px;
    background: #6366f1;
    border-radius: 50%;
    animation: cs-bounce 1.2s infinite;
}
.cs-typing span:nth-child(2) { animation-delay: 0.2s; }
.cs-typing span:nth-child(3) { animation-delay: 0.4s; }

/* ── 애니메이션 ─────────────────────────────────────────── */
@keyframes cs-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}
@keyframes cs-spin {
    to { transform: rotate(360deg); }
}
@keyframes cs-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* ── 모바일 반응형 ──────────────────────────────────────── */
@media (max-width: 480px) {
    .cs-panel {
        width: 100%;
        height: 75vh;
        right: 0;
        bottom: 0;
        border-radius: 20px 20px 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
    }
    .cs-fab {
        bottom: 20px;
        right: 20px;
    }
}
