/* ============================================
   QUICK_floating/cs_talk - CS톡 채팅 상담
   버튼 + 카톡형 채팅 패널
   테마 컬러: --cst-theme / 버튼 크기: --cst-btn-size
   ============================================ */

.cs_talk .cstalk-wrap {
    position: relative;
    pointer-events: auto;
    font-size: 14px;
}

/* --- 관리자 안내 (미설정/중단 시) --- */
.cs_talk .cstalk-admin-warn {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    font-size: 12px;
    line-height: 1.5;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    text-align: center;
}

/* --- 플로팅 버튼 --- */
.cs_talk .cstalk-btn {
    position: relative;
    width: var(--cst-btn-size, 60px);
    height: var(--cst-btn-size, 60px);
    border: none;
    border-radius: 24px;
    background: var(--cst-theme, #4075bd);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
    transition: transform 0.2s, box-shadow 0.2s;
    float: right;
}
.cs_talk .cstalk-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}
.cs_talk .cstalk-btn-icon,
.cs_talk .cstalk-btn-close {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--cst-btn-size, 60px) * 0.46);
    transition: opacity 0.2s, transform 0.2s;
}
.cs_talk .cstalk-btn-icon img,
.cs_talk .cstalk-btn-icon svg,
.cs_talk .cstalk-btn-icon lottie-player {
    width: calc(var(--cst-btn-size, 60px) * 0.5);
    height: calc(var(--cst-btn-size, 60px) * 0.5);
}
.cs_talk .cstalk-btn-close { opacity: 0; transform: rotate(-90deg); }
.cs_talk .cstalk-btn.open .cstalk-btn-icon { opacity: 0; transform: rotate(90deg); }
.cs_talk .cstalk-btn.open .cstalk-btn-close { opacity: 1; transform: rotate(0deg); }

/* 부재중 표시 점 */
.cs_talk .cstalk-away-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #f59e0b;
    border: 2px solid #fff;
}

/* --- 채팅 패널 --- */
.cs_talk .cstalk-panel {
    position: absolute;
    right: 0;
    bottom: calc(var(--cst-btn-size, 60px) + 14px);
    width: 360px;
    max-width: calc(100vw - 24px);
    height: 540px;
    max-height: min(72vh, 600px);
    background: #f7f8fa;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.98);
    transition: opacity 0.22s, transform 0.22s, visibility 0.22s;
}
.cs_talk .cstalk-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* --- 헤더 --- */
.cs_talk .cstalk-head {
    background: var(--cst-theme, #4075bd);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.cs_talk .cstalk-head-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.cs_talk .cstalk-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
.cs_talk .cstalk-status-dot.on { background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.3); }
.cs_talk .cstalk-status-dot.away { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.3); }
.cs_talk .cstalk-head-title {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cs_talk .cstalk-head-state {
    font-size: 11px;
    opacity: 0.85;
    white-space: nowrap;
}
.cs_talk .cstalk-head-btns {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.cs_talk .cstalk-head-admin,
.cs_talk .cstalk-head-close {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.cs_talk .cstalk-head-admin:hover,
.cs_talk .cstalk-head-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* --- 헤더 뒤로가기 (관리자) --- */
.cs_talk .cstalk-head-back {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    margin-right: 2px;
}
.cs_talk .cstalk-head-back:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* --- 관리자 대화방 목록 --- */
.cs_talk .cstalk-rooms {
    display: block;
}
.cs_talk .cstalk-room-item {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.cs_talk .cstalk-room-item:hover {
    border-color: var(--cst-theme, #4075bd);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.cs_talk .cstalk-room-item.waiting {
    border-left: 3px solid #ef4444;
}
.cs_talk .cstalk-room-top {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.cs_talk .cstalk-room-nm {
    font-size: 13px;
    font-weight: 700;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cs_talk .cstalk-room-badge {
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    flex-shrink: 0;
    line-height: 1.4;
}
.cs_talk .cstalk-room-time {
    margin-left: auto;
    font-size: 10px;
    color: #9ca3af;
    flex-shrink: 0;
}
.cs_talk .cstalk-room-preview {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- 부재중 배너 --- */
.cs_talk .cstalk-banner {
    padding: 10px 16px;
    font-size: 12px;
    line-height: 1.6;
    flex-shrink: 0;
}
.cs_talk .cstalk-banner-away {
    background: #fef3c7;
    color: #92400e;
    border-bottom: 1px solid #fde68a;
}

/* --- 본문 (메시지 영역) --- */
.cs_talk .cstalk-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    -webkit-overflow-scrolling: touch;
}
.cs_talk .cstalk-msg-welcome {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.6;
    color: #374151;
    margin-bottom: 14px;
}
.cs_talk .cstalk-loading {
    text-align: center;
    color: #9ca3af;
    font-size: 12px;
    padding: 10px 0;
}

/* --- 메시지 말풍선 --- */
.cs_talk .cstalk-msg {
    margin-bottom: 10px;
}
.cs_talk .cstalk-msg-name {
    font-size: 11px;
    color: #6b7280;
    margin: 0 4px 3px;
}
.cs_talk .cstalk-bubble-row {
    display: flex;
    align-items: flex-end;
    gap: 5px;
}
.cs_talk .cstalk-msg.me .cstalk-bubble-row {
    justify-content: flex-end;
}
.cs_talk .cstalk-bubble {
    max-width: 76%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.55;
    word-break: break-word;
    white-space: normal;
}
.cs_talk .cstalk-msg.me .cstalk-bubble {
    background: var(--cst-theme, #4075bd);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.cs_talk .cstalk-msg.staff .cstalk-bubble {
    background: #fff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}
.cs_talk .cstalk-msg-time {
    font-size: 10px;
    color: #9ca3af;
    flex-shrink: 0;
    padding-bottom: 2px;
}

/* --- 로그인 유도 --- */
.cs_talk .cstalk-login-guide {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    padding: 20px;
}
.cs_talk .cstalk-login-icon {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #eef2f7;
    color: var(--cst-theme, #4075bd);
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cs_talk .cstalk-login-guide p {
    font-size: 13px;
    line-height: 1.7;
    color: #4b5563;
    margin: 0;
}
.cs_talk .cstalk-login-btn {
    display: inline-block;
    padding: 11px 30px;
    background: var(--cst-theme, #4075bd);
    color: #fff;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}
.cs_talk .cstalk-login-btn:hover { opacity: 0.9; color: #fff; }

/* --- 입력 영역 --- */
.cs_talk .cstalk-foot {
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
}
.cs_talk .cstalk-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    max-height: 120px;
    box-sizing: border-box;
}
.cs_talk .cstalk-input:focus {
    outline: none;
    border-color: var(--cst-theme, #4075bd);
}
.cs_talk .cstalk-send {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 10px;
    background: var(--cst-theme, #4075bd);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}
.cs_talk .cstalk-send:hover { opacity: 0.9; }
.cs_talk .cstalk-send:disabled { opacity: 0.5; cursor: default; }
.cs_talk .cstalk-blocked {
    flex: 1;
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
    padding: 10px 0;
}

/* --- 모바일 --- */
@media screen and (max-width: 480px) {
    .cs_talk .cstalk-panel {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(var(--cst-btn-size, 60px) + 80px);
        width: auto;
        height: 66vh;
        max-height: none;
    }
}
