/* ===== 부성TK AI 챗봇 위젯 ===== */

/* 플로팅 버튼 */
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  height: 48px;
  padding: 0 20px 0 14px;
  border-radius: 24px;
  background: #ea580c;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.4);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.chat-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(234, 88, 12, 0.5);
}
.chat-fab svg {
  width: 22px;
  height: 22px;
  fill: #fff;
  flex-shrink: 0;
}
.chat-fab__label {
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.chat-fab--hidden {
  display: none;
}

/* 채팅 패널 */
.chat-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.chat-panel--open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* 헤더 */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #ea580c;
  color: #fff;
  flex-shrink: 0;
}
.chat-header__title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-header__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}
.chat-header__close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  font-size: 20px;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.chat-header__close:hover {
  opacity: 1;
}

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

/* 말풍선 공통 */
.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

/* AI (좌측) */
.chat-bubble--ai {
  align-self: flex-start;
  background: #f3f4f6;
  color: #1f2937;
  border-bottom-left-radius: 4px;
}

/* 사용자 (우측) */
.chat-bubble--user {
  align-self: flex-end;
  background: #ea580c;
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* 타이핑 인디케이터 */
.chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: #f3f4f6;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}
.chat-typing__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  animation: chatTyping 1.2s infinite;
}
.chat-typing__dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing__dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatTyping {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* 입력 영역 */
.chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  flex-shrink: 0;
}
.chat-input-area input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.chat-input-area input:focus {
  border-color: #ea580c;
}
.chat-input-area input::placeholder {
  color: #9ca3af;
}
.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ea580c;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.chat-send-btn:hover {
  background: #c2410c;
}
.chat-send-btn:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}
.chat-send-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* 빠른 질문 칩 */
.chat-quick-questions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-self: flex-start;
  max-width: 80%;
}
.chat-quick-chip {
  background: #fff;
  border: 1px solid #ea580c;
  color: #ea580c;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.chat-quick-chip:hover {
  background: #ea580c;
  color: #fff;
}

/* 모바일: 전체 너비 */
@media (max-width: 480px) {
  .chat-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .chat-fab {
    bottom: 16px;
    right: 16px;
    height: 44px;
    padding: 0 16px 0 12px;
  }
}
