/* ============================================
   Chatbot Widget - Standalone CSS
   Cool Blue Chat Theme

   독립적으로 사용 가능한 챗봇 위젯 스타일
   다른 프로젝트에서 이 파일만 import하여 사용 가능
   ============================================ */

/* ============================================
   CSS Variables (독립 사용을 위한 변수)
   ============================================ */

:root {
  /* Cool Blue Palette (Chat) */
  --chatbot-primary: #4a90d9;
  --chatbot-primary-light: #6bb3f0;
  --chatbot-secondary: #3d7fc7;
  --chatbot-bg: #f8fafd;
  --chatbot-bg-alt: #eef4fb;
  --chatbot-accent: #7eb8e8;
  --chatbot-text: #2c3e50;
  --chatbot-border: #d4e3f3;
}

/* ============================================
   Chat Window - Cool Blue Style
   ============================================ */

.chatbot {
  position: fixed;
  bottom: 100px;
  right: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
  border: none;
  box-shadow: 0 8px 32px rgba(74, 144, 217, 0.25);
  background-color: var(--chatbot-bg);
  z-index: 999;
}

.chatbot:hover {
  box-shadow: 0 8px 32px rgba(74, 144, 217, 0.25);
}

/* Blue Chat Header */
.chatbot .chatbot-header {
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-light) 100%);
  border: none;
  border-radius: 20px 20px 0 0;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chatbot .chatbot-header h5,
.chatbot .chatbot-header .chatbot-title {
  color: white;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

/* Close Button */
.chatbot .chatbot-close {
  background-color: rgba(255, 255, 255, 0.25);
  border: none;
  color: white;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

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

/* Blue Tab Navigation */
.chatbot .chatbot-tabs {
  border-bottom: 1px solid var(--chatbot-border);
  background-color: var(--chatbot-bg);
  display: flex;
}

.chatbot .chatbot-tab {
  flex: 1;
  color: var(--chatbot-text);
  border: none;
  background: none;
  border-radius: 0;
  padding: 12px 8px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0.7;
  transition: all 0.2s ease;
  cursor: pointer;
}

.chatbot .chatbot-tab:hover {
  color: var(--chatbot-primary);
  background-color: var(--chatbot-bg-alt);
  opacity: 1;
}

.chatbot .chatbot-tab.active {
  color: var(--chatbot-primary);
  background-color: transparent;
  border-bottom: 2px solid var(--chatbot-primary);
  opacity: 1;
}

/* Blue Tab Content */
.chatbot-content {
  flex: 0 0 auto;
  min-height: 100px;
  max-height: 130px;
  overflow-y: auto;
  background-color: var(--chatbot-bg-alt);
  border-bottom: 1px solid var(--chatbot-border);
  padding: 12px 16px;
}

.chatbot-content h6 {
  color: var(--chatbot-primary);
  margin: 0 0 8px 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.chatbot-content .text-muted {
  color: var(--chatbot-text);
  opacity: 0.8;
}

.chatbot .tab-content {
  display: none;
}

.chatbot .tab-content.active {
  display: block;
}

/* Blue Chat Messages */
.chatbot-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 150px;
  background-color: var(--chatbot-bg);
  padding: 16px;
}

.message {
  display: flex;
  max-width: 85%;
}

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

.message--assistant {
  align-self: flex-start;
}

.message--system {
  align-self: center;
  max-width: 100%;
}

.message-content {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
}

/* User Message - Blue Gradient */
.message--user .message-content {
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-light) 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

/* Assistant Message - Soft Blue */
.message--assistant .message-content {
  background: white;
  color: var(--chatbot-text);
  border: 1px solid var(--chatbot-border);
  border-bottom-left-radius: 4px;
}

/* System Message */
.message--system .message-content {
  background: var(--chatbot-bg-alt);
  color: var(--chatbot-text);
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 12px;
  opacity: 0.9;
}

/* Typing Indicator */
.message--typing .message-content {
  display: flex;
  gap: 4px;
  padding: 14px 20px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--chatbot-accent);
  border-radius: 50%;
  animation: chatbot-typing 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

/* Blue Chat Input */
.chatbot-footer {
  background-color: var(--chatbot-bg);
  border-top: 1px solid var(--chatbot-border);
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.chatbot-footer .chatbot-input {
  flex: 1;
  border: 1px solid var(--chatbot-border);
  background-color: white;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.chatbot-footer .chatbot-input:focus {
  border-color: var(--chatbot-primary);
}

/* Blue Send Button */
.chatbot-footer .chatbot-send {
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-light) 100%);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chatbot-footer .chatbot-send:hover {
  background: linear-gradient(135deg, var(--chatbot-secondary) 0%, var(--chatbot-primary) 100%);
  transform: scale(1.05);
}

.chatbot-footer .chatbot-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Custom Scrollbar - Blue */
.chatbot-messages::-webkit-scrollbar,
.chatbot-content::-webkit-scrollbar {
  width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track,
.chatbot-content::-webkit-scrollbar-track {
  background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb,
.chatbot-content::-webkit-scrollbar-thumb {
  background: var(--chatbot-border);
  border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover,
.chatbot-content::-webkit-scrollbar-thumb:hover {
  background: var(--chatbot-accent);
}

/* ============================================
   Floating Action Button (FAB)
   ============================================ */

.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-light) 100%);
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(74, 144, 217, 0.4);
  transition: all 0.3s ease;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(74, 144, 217, 0.5);
}

.chat-fab:active {
  transform: scale(0.95);
}

.chat-fab-icon,
.chat-fab-close {
  position: absolute;
  transition: all 0.3s ease;
}

.chat-fab-icon {
  opacity: 1;
  transform: rotate(0deg);
}

.chat-fab-close {
  opacity: 0;
  transform: rotate(-90deg);
}

.chat-fab.active .chat-fab-icon {
  opacity: 0;
  transform: rotate(90deg);
}

.chat-fab.active .chat-fab-close {
  opacity: 1;
  transform: rotate(0deg);
}

.chat-fab.active {
  background: linear-gradient(135deg, #64748b 0%, #94a3b8 100%);
}

/* Pulse Animation */
.chat-fab::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
  animation: chatbot-pulse 2s ease-out infinite;
  z-index: -1;
}

.chat-fab.active::before {
  animation: none;
}

@keyframes chatbot-pulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* ============================================
   Utilities
   ============================================ */

.chatbot [hidden] {
  display: none !important;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 991.98px) {
  .chatbot {
    width: 100%;
    max-width: 450px;
  }
}

@media (max-width: 575.98px) {
  .chatbot {
    right: 12px;
    bottom: 80px;
    left: 12px;
    width: auto;
    max-width: none;
  }

  .chat-fab {
    right: 16px;
    bottom: 16px;
    width: 52px;
    height: 52px;
    font-size: 20px;
  }
}

/* ============================================
   Bootstrap 호환 스타일 (기존 마크업 지원)
   ============================================ */

/* Bootstrap card 구조 호환 */
.chatbot.card {
  border-radius: 20px !important;
  border: none !important;
  box-shadow: 0 8px 32px rgba(74, 144, 217, 0.25) !important;
}

.chatbot .card-header {
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-light) 100%) !important;
  border: none !important;
  border-radius: 20px 20px 0 0 !important;
  padding: 16px 20px !important;
}

.chatbot .card-header h5 {
  color: white !important;
}

.chatbot .btn-light {
  background-color: rgba(255, 255, 255, 0.25) !important;
  border: none !important;
  color: white !important;
  border-radius: 8px !important;
}

.chatbot .btn-light:hover {
  background-color: rgba(255, 255, 255, 0.35) !important;
}

/* Bootstrap nav-tabs 호환 */
.chatbot .nav-tabs {
  border-bottom: 1px solid var(--chatbot-border) !important;
  background-color: var(--chatbot-bg);
}

.chatbot .nav-link {
  color: var(--chatbot-text);
  border: none;
  border-radius: 0;
  padding: 12px 8px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.chatbot .nav-link:hover {
  color: var(--chatbot-primary);
  background-color: var(--chatbot-bg-alt);
  opacity: 1;
}

.chatbot .nav-link.active {
  color: var(--chatbot-primary);
  background-color: transparent;
  border-bottom: 2px solid var(--chatbot-primary);
  opacity: 1;
}

/* Bootstrap card-footer 호환 */
.chatbot .card-footer {
  background-color: var(--chatbot-bg) !important;
  border-top: 1px solid var(--chatbot-border) !important;
  padding: 16px !important;
}

.chatbot .card-footer .form-control {
  border: 1px solid var(--chatbot-border) !important;
  background-color: white !important;
  border-radius: 20px !important;
  padding: 10px 16px !important;
}

.chatbot .card-footer .form-control:focus {
  border-color: var(--chatbot-primary) !important;
  box-shadow: none !important;
}

.chatbot .card-footer .btn-primary {
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-light) 100%) !important;
  border: none !important;
  border-radius: 50% !important;
  width: 44px !important;
  height: 44px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.chatbot .card-footer .btn-primary:hover {
  background: linear-gradient(135deg, var(--chatbot-secondary) 0%, var(--chatbot-primary) 100%) !important;
  transform: scale(1.05);
}
