/* =========================================================
   챗봇 CSS — 기존 components.css 챗봇 부분 발췌 (디자인 동일)
   원본 위치: ../css/components.css 라인 1106-1396, 8473-8820
   ========================================================= */

/* CSS 변수 (기존 사이트 색상 그대로) */
:root {
  --blue: #4527a0;
  --bg-subtle: #f8f9fa;
}

/* ===== 토글 버튼 ===== */
.chatbot-toggle {
  position: fixed;
  bottom: 110px;
  right: 20px;
  width: 52px;
  height: 52px;
  background: #3617ce;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(54, 23, 206, 0.3);
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}
@media (min-width: 769px) {
  .chatbot-toggle { bottom: 30px; right: 30px; }
}
.chatbot-toggle:hover { background: #2c11a6; transform: scale(1.1); }
.chatbot-toggle img {
  width: 52px; height: 52px;
  animation: chatbot-alive 4s infinite;
}
.chatbot-toggle__emoji { font-size: 28px; line-height: 1; }

@keyframes chatbot-alive {
  0%, 85%, 100% { transform: scaleY(1) rotate(0deg); }
  90% { transform: scaleY(0.1) rotate(0deg); }
  25% { transform: scaleY(1) rotate(-2deg); }
  75% { transform: scaleY(1) rotate(2deg); }
}

/* ===== 말풍선 ===== */
.chatbot-speech-bubble {
  position: fixed;
  bottom: 160px;
  right: 20px;
  background: #FFFEF5;
  color: #333;
  padding: 8px 14px;
  border-radius: 14px 14px 4px 14px;
  border: 2px solid #f0f0f0;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
  font-size: 12px;
  font-weight: 600;
  font-family: "Noto Sans KR", sans-serif;
  z-index: 1002;
  opacity: 0;
  transform: translateY(10px) scale(0.8);
  transition: all 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}
.chatbot-speech-bubble.show {
  opacity: 1; transform: translateY(0) scale(1);
}
.chatbot-speech-bubble::after {
  content: "";
  position: absolute;
  bottom: -8px; right: 20px;
  width: 0; height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #FFFEF5;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}
.chatbot-speech-bubble.hidden {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ===== 컨테이너 ===== */
.chatbot-container {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 350px;
  height: 500px;
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
}
@media (min-width: 769px) {
  .chatbot-container { bottom: 20px; }
}
@media (max-width: 480px) {
  .chatbot-container {
    width: calc(100% - 24px);
    right: 12px;
    bottom: 80px;
    height: 70vh;
    max-height: 560px;
  }
}

/* ===== 헤더 ===== */
.chatbot-header {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue) 100%);
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}
.chatbot-title { font-size: 1rem; font-weight: 700; }
.close-btn {
  background: none; border: none; color: white;
  font-size: 1.5rem; cursor: pointer;
  padding: 5px; border-radius: 50%;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.3s ease;
}
.close-btn:hover { background: rgba(255, 255, 255, 0.2); }

/* ===== 메시지 영역 ===== */
.chat-messages {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  background: var(--bg-subtle);
}
.message {
  display: flex;
  flex-direction: column !important;
  margin-bottom: 15px;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.bot-message {
  background: #f1f3f5;
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 85%;
  text-align: left;
  color: #212529;
  font-size: 13px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  white-space: pre-line !important;
  word-break: keep-all !important;
  line-height: 1.45 !important;
  letter-spacing: -0.3px;
}
.user-message {
  background: var(--blue);
  color: white;
  padding: 12px 16px;
  border-radius: 18px;
  max-width: 80%;
  text-align: left;
  line-height: 1.6;
  margin-left: auto;
  font-size: 14px;
  word-wrap: break-word;
  box-shadow: 0 2px 4px rgba(69, 39, 160, 0.2);
}
.bot-message p { margin: 0 0 14px 0 !important; line-height: 1.8 !important; }
.bot-message p:last-child { margin-bottom: 0 !important; }
.bot-message strong { font-weight: 700 !important; color: var(--blue) !important; }
.bot-message ul, .bot-message ol { margin: 14px 0 !important; padding-left: 24px !important; }
.bot-message li { margin-bottom: 10px !important; line-height: 1.7 !important; }

/* ===== 타이핑 인디케이터 ===== */
.typing-indicator { display: flex; gap: 4px; padding: 8px; }
.typing-indicator span {
  width: 8px; height: 8px; background: #868e96;
  border-radius: 50%; animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.7; }
  30% { transform: translateY(-10px); opacity: 1; }
}

/* ===== 빠른 버튼 ===== */
.quick-buttons {
  display: flex; flex-direction: column;
  gap: 8px; margin-top: 12px;
}
.quick-buttons button {
  padding: 10px 16px;
  font-size: 13px;
  border: 1px solid #dee2e6;
  border-radius: 20px;
  background: white;
  color: #495057;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-family: inherit;
}
.quick-buttons button:hover {
  background: var(--bg-subtle);
  border-color: var(--blue);
  color: var(--blue);
  transform: translateY(-2px);
}
.quick-buttons button.consultation-btn {
  background: var(--blue); color: white; border: none; font-weight: 500;
}
.quick-buttons button.consultation-btn:hover {
  background: #5e35b1; color: white;
}

/* ===== 빠른 질문 ===== */
.quick-questions {
  display: flex; flex-wrap: wrap;
  gap: 6px; margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}
.quick-questions button {
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid #e0e0ee;
  border-radius: 16px;
  background: #f8f8fc;
  color: #555577;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  white-space: nowrap;
}
.quick-questions button:hover {
  background: #3617ce; color: #fff; border-color: #3617ce;
}

/* ===== 입력창 ===== */
.chat-input-container {
  display: flex; gap: 8px;
  padding: 15px;
  background: var(--bg-subtle);
  border-top: 1px solid #dee2e6;
}
.chat-input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #ced4da;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.chat-input:focus { border-color: var(--blue); }
.chat-send-btn {
  width: 45px; height: 45px;
  background: linear-gradient(135deg, var(--blue) 0%, #5e35b1 100%);
  color: white; border: none;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.chat-send-btn:hover {
  background: linear-gradient(135deg, #5e35b1 0%, #7e57c2 100%);
  transform: scale(1.05);
}
.chat-send-btn:active { transform: scale(0.95); }

/* ===== 고정 버튼 영역 ===== */
.chatbot-fixed-buttons {
  background: var(--bg-subtle);
  border-top: 1px solid #dee2e6;
  padding: 10px 15px;
}
.ai-warning {
  font-size: 0.7rem;
  color: #6c757d;
  text-align: center;
  margin-bottom: 8px;
  font-weight: 500;
}
.action-buttons { display: flex; gap: 6px; }
.action-btn {
  flex: 1;
  padding: 9px 6px;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-family: inherit;
}
.action-btn:hover { transform: translateY(-2px); }
.kakao-btn { background: #fee500; color: #000; }
.kakao-btn:hover { background: #fada0a; }
.consult-btn { background: #007bff; color: #fff; }
.consult-btn:hover { background: #0056b3; }

@media (max-width: 480px) {
  .bot-message, .user-message { max-width: 85%; font-size: 13px; }
  .quick-buttons button { padding: 9px 14px; font-size: 12px; }
  .chat-input { font-size: 13px; padding: 10px 13px; }
  .chat-send-btn { width: 40px; height: 40px; font-size: 18px; }
  .chatbot-fixed-buttons { padding: 8px 10px; }
  .action-btn { padding: 8px 5px; font-size: 0.75rem; }
}

/* lp의 모바일 고정 버튼과 겹치지 않게 위치 조정 */
@media (max-width: 768px) {
  .chatbot-toggle { bottom: 80px; }
  .chatbot-speech-bubble { bottom: 140px; }
}
