/* ============================================
   NRF-TCC AI 챗봇 위젯 스타일
   NRF-TCC 브랜드 컬러 (블루 #003F93) 적용
   ============================================ */

/* 챗봇 버튼 컨테이너 (버튼 + 말풍선) */
.chatbot-button-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2147483647; /* 최상위 z-index */
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: floatUpDown 2s ease-in-out infinite;
}

/* 위아래 둥실둥실 애니메이션 */
@keyframes floatUpDown {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* 호버 시 더 활발한 움직임 */
.chatbot-button-container:hover {
  animation: floatUpDownHover 0.8s ease-in-out infinite;
}

@keyframes floatUpDownHover {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}

/* AI 상담봇 말풍선 */
.chatbot-tooltip {
  background: linear-gradient(135deg, #003F93 0%, #0056b3 100%);
  color: #fff;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(0, 63, 147, 0.3);
  white-space: nowrap;
  position: relative;
  font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif;
}

/* 말풍선 꼬리 (아래 방향) */
.chatbot-tooltip::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #0056b3;
}

/* 챗봇 버튼 (우하단 고정) - 마스코트 스타일 (큰 사이즈) */
.chatbot-button {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #4CAF50;
  border: 4px solid #fff;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.chatbot-button:hover {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  transform: scale(1.08);
}

.chatbot-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chatbot-button svg {
  width: 24px;
  height: 24px;
  fill: white;
  display: none;
}

.chatbot-button .ai-label {
  display: none;
}

/* 챗봇 창이 열리면 컨테이너 숨김 */
.chatbot-button-container.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
  animation: none;
}

/* 챗봇 창 */
.chatbot-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  height: 580px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  border: 1px solid #e0e0e0;
  z-index: 2147483647; /* 최상위 z-index */
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: "Noto Sans KR", "Malgun Gothic", sans-serif;
}

.chatbot-window.active {
  display: flex;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 헤더 - NRF-TCC AI 브랜드 */
.chatbot-header {
  background: linear-gradient(135deg, #003F93 0%, #0056b3 100%);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: none;
}

.chatbot-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 헤더 마스코트 아바타 */
.header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #4CAF50;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.3);
  flex-shrink: 0;
}

.header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chatbot-logo {
  height: 32px;
  width: auto;
  filter: brightness(0) invert(1);
}

/* 온라인 상태 */
.online-status {
  color: #90EE90 !important;
  font-size: 11px;
}

.chatbot-header-text h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chatbot-header-text h3 .ai-badge {
  background: rgba(255,255,255,0.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.chatbot-header-text .subtitle {
  font-size: 11px;
  color: rgba(255,255,255,0.8);
  margin-top: 2px;
  font-weight: 400;
}

.chatbot-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 6px;
  transition: all 0.2s;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.2);
}

/* 메시지 영역 - SNS 채팅방 스타일 */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: linear-gradient(180deg, #e8f5e9 0%, #f5f7fa 100%);
}

.chatbot-messages::-webkit-scrollbar {
  width: 5px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: #f0f0f0;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border-radius: 3px;
}

/* 메시지 버블 - SNS 스타일 */
.message {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
}

.message.bot {
  align-items: flex-start;
  flex-direction: row;
  gap: 8px;
}

.message.user {
  align-items: flex-end;
}

/* 봇 아바타 */
.bot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #4CAF50;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.bot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 봇 메시지 컨텐츠 영역 */
.message-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: calc(100% - 50px);
}

/* 봇 이름 */
.bot-name {
  font-size: 11px;
  color: #666;
  font-weight: 600;
  margin-bottom: 4px;
}

.message-bubble {
  max-width: 100%;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
  word-break: keep-all;
}

/* 봇 메시지 버블 - 말풍선 스타일 */
.message.bot .message-bubble {
  background: white;
  color: #333;
  border: none;
  border-radius: 0 16px 16px 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* 사용자 메시지 버블 - 말풍선 스타일 */
.message.user .message-bubble {
  background: linear-gradient(135deg, #003F93 0%, #0056b3 100%);
  color: white;
  border-radius: 16px 16px 0 16px;
  box-shadow: 0 1px 2px rgba(0,63,147,0.2);
}

/* AI 응답 라벨 */
.ai-response-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #003F93;
  font-weight: 600;
  margin-bottom: 6px;
  padding: 2px 6px;
  background: #e8f0fe;
  border-radius: 4px;
}

.ai-response-label svg {
  width: 12px;
  height: 12px;
  fill: #003F93;
}

.message-time {
  font-size: 10px;
  color: #888;
  margin-top: 4px;
  padding: 0 2px;
}

/* 빠른 답변 버튼 */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.quick-reply-btn {
  background: #e8f0fe;
  border: 1px solid #003F93;
  color: #003F93;
  padding: 7px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}

.quick-reply-btn:hover {
  background: linear-gradient(135deg, #003F93 0%, #0056b3 100%);
  color: white;
}

/* FAQ 후보 목록 */
.faq-suggestions {
  margin-top: 12px;
}

.faq-suggestions > p {
  font-size: 11px;
  color: #666;
  margin-bottom: 8px;
  font-weight: 500;
}

.faq-suggestion-item {
  background: white;
  border: 1px solid #ddd;
  border-left: 3px solid #003F93;
  border-radius: 4px;
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 12px;
  color: #333;
}

.faq-suggestion-item:hover {
  border-color: #003F93;
  background: #e8f0fe;
}

/* 고객센터 안내 */
.contact-info {
  background: #e8f0fe;
  border: 1px solid #b8d4fe;
  border-left: 3px solid #003F93;
  border-radius: 4px;
  padding: 12px;
  margin-top: 12px;
  font-size: 12px;
}

.contact-info h4 {
  margin: 0 0 8px 0;
  font-size: 12px;
  color: #003F93;
  font-weight: 600;
}

.contact-info p {
  margin: 3px 0;
  color: #555;
  line-height: 1.5;
}

.contact-info a {
  color: #003F93;
  text-decoration: none;
  font-weight: 500;
}

.contact-info a:hover {
  text-decoration: underline;
}

/* 만족도 피드백 */
.feedback-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.feedback-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid #ddd;
  background: white;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
  font-weight: 500;
}

.feedback-btn.satisfied {
  color: #003F93;
}

.feedback-btn.satisfied:hover {
  background: #e8f0fe;
  border-color: #003F93;
}

.feedback-btn.unsatisfied {
  color: #c62828;
}

.feedback-btn.unsatisfied:hover {
  background: #ffebee;
  border-color: #c62828;
}

/* 입력 영역 */
.chatbot-input-area {
  padding: 12px 16px;
  background: white;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 8px;
}

.chatbot-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.chatbot-input:focus {
  border-color: #003F93;
}

.chatbot-input::placeholder {
  color: #999;
}

.chatbot-send {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: linear-gradient(135deg, #003F93 0%, #0056b3 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.chatbot-send:hover {
  background: linear-gradient(135deg, #0056b3 0%, #006fd6 100%);
}

.chatbot-send:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.chatbot-send svg {
  width: 18px;
  height: 18px;
  fill: white;
}

/* 타이핑 인디케이터 (AI 생각 중) - SNS 스타일 */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: white;
  border-radius: 0 16px 16px 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  width: fit-content;
}

.typing-indicator .typing-text {
  font-size: 12px;
  color: #003F93;
  font-weight: 500;
}

.typing-indicator .typing-dots {
  display: flex;
  gap: 4px;
}

.typing-indicator .typing-dots span {
  width: 6px;
  height: 6px;
  background: #003F93;
  border-radius: 50%;
  animation: typing 1.2s infinite;
}

.typing-indicator .typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-indicator .typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

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

/* 검색 안내 링크 */
.search-redirect {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 4px;
  font-size: 12px;
}

.search-redirect a {
  color: #003F93;
  text-decoration: none;
  font-weight: 600;
}

.search-redirect a:hover {
  text-decoration: underline;
}

/* 반응형 - 모바일 전체화면 */
@media (max-width: 480px) {
  .chatbot-window {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    z-index: 99999;
  }

  /* 모바일 헤더 - 더 크게 */
  .chatbot-header {
    padding: 16px;
    padding-top: max(16px, env(safe-area-inset-top));
  }

  .header-avatar {
    width: 44px;
    height: 44px;
  }

  .chatbot-header-text h3 {
    font-size: 16px;
  }

  .chatbot-header-text .subtitle {
    font-size: 12px;
  }

  /* 닫기 버튼 더 크게 */
  .chatbot-close {
    width: 36px;
    height: 36px;
    padding: 8px;
  }

  .chatbot-close svg {
    width: 24px;
    height: 24px;
  }

  /* 메시지 영역 */
  .chatbot-messages {
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  /* 입력 영역 - 하단 safe area 고려 */
  .chatbot-input-area {
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .chatbot-input {
    font-size: 16px; /* iOS 확대 방지 */
    padding: 12px 14px;
  }

  .chatbot-send {
    width: 44px;
    height: 44px;
  }

  /* 챗봇 버튼 컨테이너 - 모바일 */
  .chatbot-button-container {
    right: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
  }

  /* 말풍선 - 모바일에서 조금 작게 */
  .chatbot-tooltip {
    font-size: 12px;
    padding: 6px 12px;
  }

  /* 챗봇 버튼 - 모바일에서도 크게 */
  .chatbot-button {
    width: 90px;
    height: 90px;
    border-width: 3px;
  }

  /* 봇 아바타 */
  .bot-avatar {
    width: 32px;
    height: 32px;
  }

  .bot-name {
    font-size: 10px;
  }

  .message-bubble {
    font-size: 14px;
    padding: 10px 12px;
  }

  /* 빠른 답변 버튼 */
  .quick-reply-btn {
    padding: 10px 14px;
    font-size: 13px;
  }
}
