/*!
 * 푸헐크샵 실시간 상담 위젯 스타일
 * 사이트 현대화 톤(인디고~바이올렛)과 통일.
 */
.puhk-chat, .puhk-chat * { box-sizing: border-box; }
.puhk-chat {
    --kc-primary: #10b981;
    --kc-primary-2: #1FD192;
    --kc-grad: linear-gradient(135deg, #10b981 0%, #1FD192 100%);
    --kc-bg: #ffffff;
    --kc-panel-bg: #f4f5fb;
    --kc-text: #1e293b;
    --kc-muted: #64748b;
    --kc-line: rgba(15,23,42,.10);
    --kc-user: linear-gradient(135deg, #10b981 0%, #14b884 100%);
    --kc-agent: #ffffff;
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 100000;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* 런처 버튼 */
.puhk-chat-launcher {
    position: relative;
    width: 60px; height: 60px;
    border: 0; border-radius: 50%;
    background: var(--kc-grad);
    color: #fff; cursor: pointer;
    box-shadow: 0 10px 25px -6px rgba(16,185,129,.55), 0 4px 10px rgba(0,0,0,.12);
    display: flex; align-items: center; justify-content: center;
    transition: transform .18s ease, box-shadow .18s ease;
}
.puhk-chat-launcher:hover { transform: translateY(-2px) scale(1.04); }
.puhk-chat-launcher .ico-close { display: none; }
.puhk-chat.is-open .puhk-chat-launcher .ico-chat { display: none; }
.puhk-chat.is-open .puhk-chat-launcher .ico-close { display: block; }
.puhk-chat-badge {
    position: absolute; top: -3px; right: -3px;
    min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 999px; background: #ef4444; color: #fff;
    border: 2px solid #fff;
    font-size: 11px; font-weight: 800; line-height: 16px; text-align: center;
}

/* 패널 */
.puhk-chat-panel {
    position: absolute; right: 0; bottom: 74px;
    width: 370px; max-width: calc(100vw - 32px);
    height: 560px; max-height: calc(100vh - 120px);
    background: var(--kc-panel-bg);
    border: 1px solid var(--kc-line);
    border-radius: 18px;
    box-shadow: 0 24px 60px -12px rgba(16,24,40,.35);
    display: flex; flex-direction: column; overflow: hidden;
    transform-origin: bottom right;
    animation: puhkChatIn .18s ease;
}
@keyframes puhkChatIn {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 헤더 */
.puhk-chat-head {
    background: var(--kc-grad);
    color: #fff; padding: 16px 16px;
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.puhk-chat-title { font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.puhk-chat-status { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 12px; opacity: .92; }
.puhk-chat-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; box-shadow: 0 0 0 0 rgba(255,255,255,.5); }
.puhk-chat-status .dot.online { background: #4ade80; animation: puhkPulse 2s infinite; }
@keyframes puhkPulse { 0%{box-shadow:0 0 0 0 rgba(74,222,128,.6)} 70%{box-shadow:0 0 0 7px rgba(74,222,128,0)} 100%{box-shadow:0 0 0 0 rgba(74,222,128,0)} }
.puhk-chat-headbtn { border: 0; background: rgba(255,255,255,.16); color: #fff; width: 32px; height: 32px; border-radius: 9px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s ease; }
.puhk-chat-headbtn:hover { background: rgba(255,255,255,.28); }

/* 사전 입력 폼 */
.puhk-chat-intro { padding: 26px 20px; flex: 1; overflow-y: auto; }
.puhk-chat-intro-lead { margin: 4px 0 20px; font-size: 14px; line-height: 1.6; color: var(--kc-text); text-align: center; }
.puhk-chat-field { margin-bottom: 10px; }
.puhk-chat-field input {
    width: 100%; height: 46px; padding: 0 14px;
    border: 1px solid var(--kc-line); border-radius: 11px;
    background: #fff; font-size: 14px; color: var(--kc-text);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.puhk-chat-field input:focus { outline: 0; border-color: var(--kc-primary); box-shadow: 0 0 0 3px rgba(16,185,129,.14); }
.puhk-chat-startbtn {
    width: 100%; height: 48px; margin-top: 6px;
    border: 0; border-radius: 12px; cursor: pointer;
    background: var(--kc-grad); color: #fff; font-size: 15px; font-weight: 700;
    box-shadow: 0 8px 18px -6px rgba(16,185,129,.5);
    transition: filter .15s ease, transform .12s ease;
}
.puhk-chat-startbtn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.puhk-chat-intro-note { margin: 14px 0 0; font-size: 11px; color: var(--kc-muted); text-align: center; }

/* 메시지 영역 */
.puhk-chat-body { position: relative; flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.puhk-chat-body::-webkit-scrollbar { width: 8px; }
.puhk-chat-body::-webkit-scrollbar-thumb { background: rgba(100,116,139,.35); border-radius: 8px; }
.kc-row { display: flex; flex-direction: column; max-width: 82%; }
.kc-row.user { align-self: flex-end; align-items: flex-end; }
.kc-row.agent { align-self: flex-start; align-items: flex-start; }
.kc-row.system { align-self: center; align-items: center; max-width: 92%; }
.kc-name { font-size: 11px; color: var(--kc-muted); margin: 0 4px 3px; font-weight: 600; }
.kc-bubble {
    padding: 10px 13px; font-size: 14px; line-height: 1.5; word-break: break-word;
    border-radius: 15px; box-shadow: 0 1px 2px rgba(16,24,40,.06);
}
.kc-row.user .kc-bubble { background: var(--kc-user); color: #fff; border-bottom-right-radius: 5px; }
.kc-row.agent .kc-bubble { background: var(--kc-agent); color: var(--kc-text); border: 1px solid var(--kc-line); border-bottom-left-radius: 5px; }
.kc-row.system .kc-bubble { background: rgba(100,116,139,.12); color: var(--kc-muted); font-size: 12.5px; text-align: center; border-radius: 999px; padding: 7px 15px; box-shadow: none; }
.kc-time { font-size: 10px; color: var(--kc-muted); margin: 3px 5px 0; }

/* ---------- 사진 메시지 ---------- */
.kc-row.photo .kc-bubble { padding: 0; overflow: hidden; background: transparent; border: 0; box-shadow: none; position: relative; line-height: 0; }
.kc-photo { display: block; }
.kc-photo img {
    display: block; max-width: 220px; max-height: 260px;
    width: auto; height: auto; border-radius: 14px;
    border: 1px solid var(--kc-line); background: #fff;
    cursor: zoom-in;
    box-shadow: 0 1px 3px rgba(16,24,40,.10);
    transition: filter .15s ease;
}
.kc-photo:hover img { filter: brightness(.94); }
.kc-row.user.photo .kc-photo img { border-bottom-right-radius: 5px; }
.kc-row.agent.photo .kc-photo img { border-bottom-left-radius: 5px; }

/* 전송 중 */
.kc-row.pending .kc-photo img { opacity: .55; cursor: default; }
.kc-uploading {
    position: absolute; left: 0; right: 0; bottom: 0;
    display: flex; align-items: center; justify-content: center; gap: 7px;
    padding: 7px 0; font-size: 11.5px; line-height: 1; font-weight: 600; color: #fff;
    background: rgba(15,23,42,.62); border-radius: 0 0 14px 14px;
}
.kc-spin {
    width: 12px; height: 12px; border-radius: 50%; display: inline-block;
    border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
    animation: puhkSpin .7s linear infinite;
}
@keyframes puhkSpin { to { transform: rotate(360deg); } }
.kc-progress { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: rgba(15,23,42,.18); border-radius: 14px 14px 0 0; overflow: hidden; }
.kc-progress i { display: block; width: 0; height: 100%; background: var(--kc-primary-2); transition: width .15s ease; }

/* 드래그 앤 드롭 안내 */
.puhk-chat-drop {
    position: absolute; top: 8px; right: 8px; bottom: 8px; left: 8px; inset: 8px; z-index: 3;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    border: 2px dashed var(--kc-primary); border-radius: 14px;
    background: rgba(16,185,129,.09); color: var(--kc-primary);
    font-size: 13px; font-weight: 700; pointer-events: none;
}
.puhk-chat-drop[hidden] { display: none; }

/* 사진 크게보기 */
.puhk-chat-lightbox {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0; inset: 0; z-index: 100010;
    display: flex; align-items: center; justify-content: center;
    padding: 40px 20px; background: rgba(9,13,26,.88);
    animation: puhkChatIn .15s ease; cursor: zoom-out;
}
.puhk-chat-lightbox[hidden] { display: none; }
.puhk-chat-lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.5); cursor: default; }
.puhk-lb-close {
    position: absolute; top: 16px; right: 16px; width: 42px; height: 42px;
    border: 0; border-radius: 50%; cursor: pointer;
    background: rgba(255,255,255,.14); color: #fff;
    display: flex; align-items: center; justify-content: center; transition: background .15s ease;
}
.puhk-lb-close:hover { background: rgba(255,255,255,.28); }

/* 입력 영역 */
.puhk-chat-input {
    flex-shrink: 0; display: flex; align-items: flex-end; gap: 8px;
    padding: 10px 12px; background: #fff; border-top: 1px solid var(--kc-line);
}
.puhk-chat-attachbtn {
    flex-shrink: 0; width: 42px; height: 42px; border: 1px solid var(--kc-line);
    border-radius: 12px; cursor: pointer; background: #fff; color: var(--kc-muted);
    display: flex; align-items: center; justify-content: center;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.puhk-chat-attachbtn:hover { color: var(--kc-primary); border-color: var(--kc-primary); background: rgba(16,185,129,.07); }
.puhk-chat-attachbtn:disabled { opacity: .45; cursor: default; }
.puhk-chat-input textarea {
    flex: 1; resize: none; max-height: 110px; min-height: 42px;
    padding: 11px 14px; border: 1px solid var(--kc-line); border-radius: 12px;
    font-size: 14px; line-height: 1.4; font-family: inherit; color: var(--kc-text);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.puhk-chat-input textarea:focus { outline: 0; border-color: var(--kc-primary); box-shadow: 0 0 0 3px rgba(16,185,129,.14); }
.puhk-chat-sendbtn {
    flex-shrink: 0; width: 42px; height: 42px; border: 0; border-radius: 12px; cursor: pointer;
    background: var(--kc-grad); color: #fff; display: flex; align-items: center; justify-content: center;
    transition: filter .15s ease, transform .12s ease;
}
.puhk-chat-sendbtn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.puhk-chat-sendbtn:disabled { opacity: .5; cursor: default; transform: none; filter: none; }

/* 하단 종료 */
.puhk-chat-foot { flex-shrink: 0; padding: 0 12px 10px; background: #fff; text-align: center; }
.puhk-chat-closebtn { border: 0; background: none; color: var(--kc-muted); font-size: 12px; cursor: pointer; text-decoration: underline; padding: 4px; }
.puhk-chat-closebtn:hover { color: #ef4444; }

@media (max-width: 480px) {
    .puhk-chat { right: 14px; bottom: 14px; }
    .puhk-chat-panel { bottom: 70px; height: calc(100vh - 100px); }
}
