/* 채팅 위젯 스타일 — 고객사 인트라넷 임베드용 */

/* 플로팅 버튼 */
.chat-widget-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: var(--cw-primary, #1a56db);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 99998;
  transition: transform 0.2s, box-shadow 0.2s;
  user-select: none;
}
.chat-widget-button:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.chat-widget-button.bottom-left {
  right: auto;
  left: 24px;
}

/* 채팅창 컨테이너 */
.chat-widget-container {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 380px;
  height: 520px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Malgun Gothic', sans-serif;
  font-size: 14px;
}
.chat-widget-container.bottom-left {
  right: auto;
  left: 24px;
}

/* 헤더 */
.chat-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background-color: var(--cw-primary, #1a56db);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
}
.chat-widget-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.8;
}
.chat-widget-close:hover {
  opacity: 1;
}

/* 메시지 영역 */
.chat-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 메시지 버블 */
.chat-widget-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.5;
  word-break: break-word;
}
.chat-widget-msg.user {
  align-self: flex-end;
  background: var(--cw-primary, #1a56db);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-widget-msg.assistant {
  align-self: flex-start;
  background: #f1f3f5;
  color: #333;
  border-bottom-left-radius: 4px;
}

/* 로딩 애니메이션 */
.chat-widget-msg.loading {
  display: flex;
  gap: 4px;
  padding: 12px 18px;
}
.chat-widget-msg.loading .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  animation: cw-bounce 1.2s infinite;
}
.chat-widget-msg.loading .dot:nth-child(2) { animation-delay: 0.2s; }
.chat-widget-msg.loading .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes cw-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* 출처 pill */
.citation-pill {
  display: inline-block;
  background: #e8f0fe;
  color: #1a56db;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  cursor: pointer;
  margin: 0 2px;
  white-space: nowrap;
}
.citation-pill:hover {
  background: #d0e0fd;
}

/* 신뢰도 태그 */
.confidence-tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 6px;
}
.confidence-tag.high { background: #d4edda; color: #155724; }
.confidence-tag.medium { background: #fff3cd; color: #856404; }
.confidence-tag.low { background: #f8d7da; color: #721c24; }

/* 입력 영역 */
.chat-widget-input {
  display: flex;
  padding: 10px 12px;
  border-top: 1px solid #e9ecef;
  background: #fafafa;
  flex-shrink: 0;
}
.chat-widget-input input {
  flex: 1;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.chat-widget-input input:focus {
  border-color: var(--cw-primary, #1a56db);
}
.chat-widget-input button {
  margin-left: 8px;
  padding: 8px 16px;
  background: var(--cw-primary, #1a56db);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}
.chat-widget-input button:hover {
  opacity: 0.9;
}
.chat-widget-input button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 피드백 버튼 (답변 하단) */
.chat-widget-feedback {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  padding-top: 4px;
}
.feedback-btn {
  background: none;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 13px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s, border-color 0.2s;
}
.feedback-btn:hover {
  opacity: 1;
  border-color: #adb5bd;
}
.feedback-done {
  font-size: 11px;
  color: #868e96;
  padding-top: 2px;
}
