/* =============================================
   대경대학교 AI 챗봇 Widget
   ============================================= */

/* Floating Toggle Button */
.chatbot-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary, hsl(280, 50%, 30%));
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, box-shadow .2s;
}
.chatbot-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0,0,0,.35);
}
.chatbot-toggle svg { width: 28px; height: 28px; }
.chatbot-toggle .icon-close { display: none; }
.chatbot-toggle.active .icon-chat { display: none; }
.chatbot-toggle.active .icon-close { display: block; }

/* Chat Window */
.chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9998;
  width: 380px;
  max-height: 540px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(.95);
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.chatbot-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.chatbot-header {
  background: var(--primary, hsl(280, 50%, 30%));
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.chatbot-header__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.chatbot-header__info h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.chatbot-header__info p {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: .8;
}

/* Messages Area */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 300px;
  max-height: 360px;
  background: #f8f7fa;
}
.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* Message Bubbles */
.chatbot-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-break: keep-all;
  animation: chatFadeIn .3s ease;
}
@keyframes chatFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chatbot-msg--bot {
  align-self: flex-start;
  background: #fff;
  color: #333;
  border: 1px solid #e8e5f0;
  border-bottom-left-radius: 4px;
}
.chatbot-msg--user {
  align-self: flex-end;
  background: var(--primary, hsl(280, 50%, 30%));
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.chatbot-typing {
  display: none;
  align-self: flex-start;
  padding: 10px 18px;
  background: #fff;
  border: 1px solid #e8e5f0;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.chatbot-typing.show { display: flex; gap: 4px; }
.chatbot-typing span {
  width: 7px;
  height: 7px;
  background: #aaa;
  border-radius: 50%;
  animation: typingBounce .6s infinite alternate;
}
.chatbot-typing span:nth-child(2) { animation-delay: .15s; }
.chatbot-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce {
  to { opacity: .3; transform: translateY(-4px); }
}

/* Quick Replies */
.chatbot-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 8px;
  background: #f8f7fa;
}
.chatbot-quick button {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--primary, hsl(280, 50%, 30%));
  background: #fff;
  color: var(--primary, hsl(280, 50%, 30%));
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.chatbot-quick button:hover {
  background: var(--primary, hsl(280, 50%, 30%));
  color: #fff;
}

/* Input Area */
.chatbot-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #eee;
  background: #fff;
}
.chatbot-input input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
  font-family: inherit;
}
.chatbot-input input:focus {
  border-color: var(--primary, hsl(280, 50%, 30%));
}
.chatbot-input button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--primary, hsl(280, 50%, 30%));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s;
  flex-shrink: 0;
}
.chatbot-input button:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.chatbot-input button svg { width: 18px; height: 18px; }

/* Mobile */
@media (max-width: 480px) {
  .chatbot-window {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 80px;
    max-height: 70vh;
  }
  .chatbot-toggle {
    bottom: 16px;
    right: 16px;
  }
}
