/**
 * AI 챗봇 위젯 스타일
 * 
 * 독립적으로 사용 가능한 챗봇 위젯 스타일시트
 */

/* CSS 변수 */
:root {
  --chatbot-primary: #4361ee;
  --chatbot-secondary: #7209b7;
  --chatbot-bg: #ffffff;
  --chatbot-text: #1e293b;
  --chatbot-border: #e2e8f0;
  --chatbot-shadow: rgba(0, 0, 0, 0.1);
}

/* 챗봇 위젯 컨테이너 */
.chatbot-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* 챗봇 버튼 */
.chatbot-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 15px rgba(67, 97, 238, 0.4);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.chatbot-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.chatbot-button:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 25px rgba(67, 97, 238, 0.6);
}

.chatbot-button:hover::before {
  opacity: 0.2;
}

.chatbot-button:active {
  transform: translateY(0) scale(1);
}

.chatbot-button i {
  z-index: 1;
  position: relative;
}

/* 챗봇 배지 */
.chatbot-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #dc3545;
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  border: 2px solid white;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.9;
  }
}

/* 챗봇 팝업 */
.chatbot-popup {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 350px;
  height: 500px;
  background: var(--chatbot-bg);
  border-radius: 16px;
  box-shadow: 0 10px 40px var(--chatbot-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.chatbot-popup.show {
  display: flex;
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* 챗봇 헤더 */
.chatbot-header {
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
  color: white;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.chatbot-info {
  flex: 1;
}

.chatbot-info h5 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.chatbot-status {
  font-size: 0.8rem;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.chatbot-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #28a745;
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.chatbot-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 챗봇 메시지 영역 */
.chatbot-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

/* 위젯 메시지 */
.widget-message {
  display: flex;
  gap: 0.5rem;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.widget-message.ai-message {
  align-items: flex-start;
}

.widget-message.user-message {
  justify-content: flex-end;
}

.widget-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.widget-message-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 75%;
}

.widget-message-bubble {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.ai-message .widget-message-bubble {
  background: white;
  color: var(--chatbot-text);
  border: 1px solid var(--chatbot-border);
  border-top-left-radius: 4px;
}

.user-message .widget-message-bubble {
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
  color: white;
  border-top-right-radius: 4px;
  margin-left: auto;
}

.widget-message-time {
  font-size: 0.7rem;
  color: #94a3b8;
  padding: 0 0.5rem;
}

.user-message .widget-message-time {
  text-align: right;
}

/* 생각 중 인디케이터 */
.widget-message.thinking .widget-message-bubble {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.widget-message.thinking .widget-message-bubble::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 6px;
  background: linear-gradient(90deg, 
    var(--chatbot-primary) 0%, 
    var(--chatbot-primary) 33%, 
    transparent 33%, 
    transparent 66%, 
    var(--chatbot-primary) 66%
  );
  background-size: 300% 100%;
  animation: thinking 1.5s infinite;
}

@keyframes thinking {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 0%; }
}

/* 챗봇 입력 영역 */
.chatbot-input {
  padding: 1rem;
  border-top: 1px solid var(--chatbot-border);
  background: white;
  flex-shrink: 0;
}

.chatbot-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chatbot-input-field {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  outline: none;
  transition: all 0.2s ease;
  background: #f9fafb;
}

.chatbot-input-field:focus {
  border-color: var(--chatbot-primary);
  background: white;
}

.chatbot-input-field::placeholder {
  color: #9ca3af;
}

.chatbot-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--chatbot-primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chatbot-send-btn:hover {
  background: var(--chatbot-secondary);
  transform: scale(1.05);
}

.chatbot-send-btn:active {
  transform: scale(0.95);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
  .chatbot-widget {
    bottom: 15px;
    right: 15px;
  }

  .chatbot-button {
    width: 55px;
    height: 55px;
    font-size: 1.3rem;
  }

  .chatbot-popup {
    width: calc(100vw - 30px);
    max-width: 320px;
    height: 450px;
    bottom: 75px;
    right: -5px;
  }

  .chatbot-header {
    padding: 0.875rem;
  }

  .chatbot-avatar {
    width: 35px;
    height: 35px;
    font-size: 1.1rem;
  }

  .chatbot-info h5 {
    font-size: 0.9rem;
  }

  .chatbot-messages {
    padding: 0.75rem;
  }

  .widget-message-bubble {
    font-size: 0.8rem;
    padding: 0.65rem 0.875rem;
  }

  .chatbot-input {
    padding: 0.875rem;
  }

  .chatbot-input-field {
    font-size: 16px; /* iOS 자동 확대 방지 */
    padding: 0.65rem 0.875rem;
  }

  .chatbot-send-btn {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .chatbot-popup {
    width: calc(100vw - 20px);
    right: -10px;
    bottom: 70px;
  }

  .chatbot-button {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }

  .chatbot-badge {
    width: 18px;
    height: 18px;
    font-size: 0.65rem;
  }
}

/* 다크 모드 지원 (선택사항) - 비활성화됨 */
/* 항상 밝은 테마를 유지합니다 */
/*
@media (prefers-color-scheme: dark) {
  :root {
    --chatbot-bg: #1e293b;
    --chatbot-text: #f1f5f9;
    --chatbot-border: #334155;
    --chatbot-shadow: rgba(0, 0, 0, 0.3);
  }

  .chatbot-messages {
    background: #0f172a;
  }

  .ai-message .widget-message-bubble {
    background: #1e293b;
    border-color: #334155;
  }

  .chatbot-input {
    background: #1e293b;
    border-color: #334155;
  }

  .chatbot-input-field {
    background: #0f172a;
    color: #f1f5f9;
    border-color: #334155;
  }

  .chatbot-input-field:focus {
    background: #1e293b;
  }
}
*/

