/* 홈페이지 챗봇 — 런처(우하단 원형) + 패널(channel talk 레이아웃).
   문의 모달(z-index 1000) 아래에 둔다 — 답변 카드의 [문의하기]가 모달을 위에 띄운다. */

.chatbot {
  --chatbot-z: 900;
  --chatbot-ink: var(--corsair-black, #1a1a1a);
  --chatbot-accent: var(--corsair-red, #a30e2d);
  --chatbot-bg: var(--background, #f5f1f2);
  --chatbot-gap: 24px;
  font-family: Suit, "Noto Sans KR", Arial, sans-serif;
  letter-spacing: -.02em;
}

.chatbot-launcher {
  z-index: var(--chatbot-z);
  cursor: pointer;
  background: var(--chatbot-ink);
  border: 0;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  padding: 0;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  position: fixed;
  right: var(--chatbot-gap);
  bottom: var(--chatbot-gap);
  box-shadow: 0 8px 24px #0003;
}

.chatbot-launcher img {
  aspect-ratio: 1;
  object-fit: cover;
  width: 100%;
  height: 100%;
  display: block;
}

.chatbot-launcher:hover,
.chatbot-launcher:focus-visible {
  transform: scale(1.06);
  box-shadow: 0 12px 28px #0004;
}

.chatbot-launcher:focus-visible,
.chatbot-close:focus-visible,
.chatbot-send:focus-visible {
  outline: 2px solid var(--chatbot-accent);
  outline-offset: 2px;
}

.chatbot-panel {
  z-index: var(--chatbot-z);
  background: #fff;
  border-radius: 16px;
  flex-direction: column;
  width: 380px;
  max-width: calc(100vw - var(--chatbot-gap) * 2);
  height: 600px;
  max-height: calc(100vh - 120px);
  display: flex;
  position: fixed;
  right: var(--chatbot-gap);
  bottom: calc(var(--chatbot-gap) + 72px);
  overflow: hidden;
  box-shadow: 0 12px 40px #0000002e;
  animation: chatbotIn .2s ease-out;
}

.chatbot-panel[hidden] {
  display: none;
}

@keyframes chatbotIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.chatbot-header {
  color: #fff;
  background: var(--chatbot-ink);
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  display: flex;
}

.chatbot-avatar {
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--chatbot-ink);
  border: 1px solid #ffffff33;
  border-radius: 50%;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}

.chatbot-header-text {
  flex: 1;
  flex-direction: column;
  min-width: 0;
  display: flex;
}

.chatbot-header-text strong {
  /* style_new.css의 전역 strong(빨강 배경 하이라이트) 무효화 */
  color: inherit;
  background: none;
  border-radius: 0;
  padding: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.chatbot-header-text span {
  opacity: .7;
  font-size: 12px;
  line-height: 1.3;
}

.chatbot-close {
  color: #fff;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  transition: background-color .2s;
}

.chatbot-close:hover {
  background: #ffffff1f;
}

.chatbot-messages {
  background: var(--chatbot-bg);
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  display: flex;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chatbot-msg {
  word-break: keep-all;
  white-space: pre-wrap;
  border-radius: 16px;
  max-width: 84%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.55;
  text-wrap: pretty;
}

.chatbot-msg.bot {
  color: var(--chatbot-ink);
  background: #fff;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 2px #0000000f;
}

.chatbot-msg.user {
  color: #fff;
  background: var(--chatbot-accent);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.chatbot-msg.error {
  color: #b91c1c;
  background: #fef2f2;
}

.chatbot-links {
  border-top: 1px solid #eee;
  flex-direction: column;
  gap: 4px;
  margin: 10px 0 0;
  padding: 10px 0 0;
  list-style: none;
  display: flex;
}

.chatbot-links li::before {
  content: "↗ ";
  color: var(--subtxt-gray, #757575);
}

.chatbot-links a {
  color: var(--purple, #815cf0);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chatbot-cta {
  color: var(--subtxt-gray, #757575);
  border-top: 1px solid #eee;
  margin-top: 10px;
  padding-top: 10px;
  font-size: 13px;
}

.chatbot-cta a {
  color: #fff;
  background: var(--chatbot-ink);
  border-radius: 999px;
  margin-top: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .2s;
  display: inline-block;
}

.chatbot-cta a:hover {
  background: var(--chatbot-accent);
}

.chatbot-typing {
  gap: 4px;
  padding: 14px;
  display: flex;
}

.chatbot-typing i {
  background: #bbb;
  border-radius: 50%;
  width: 6px;
  height: 6px;
  animation: chatbotDot 1s infinite;
}

.chatbot-typing i:nth-child(2) { animation-delay: .15s; }
.chatbot-typing i:nth-child(3) { animation-delay: .3s; }

@keyframes chatbotDot {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.chatbot-form {
  background: #fff;
  border-top: 1px solid #eee;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  display: flex;
}

.chatbot-form textarea {
  box-sizing: border-box;
  overflow-y: auto;
  font-family: inherit;
  letter-spacing: inherit;
  color: var(--chatbot-ink);
  resize: none;
  background: #f7f7f7;
  border: 1px solid #e3e3e3;
  border-radius: 12px;
  flex: 1;
  min-width: 0;
  max-height: 96px;
  margin: 0;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.45;
}

.chatbot-form textarea:focus {
  background: #fff;
  border-color: var(--chatbot-ink);
  outline: none;
}

.chatbot-send {
  color: #fff;
  cursor: pointer;
  background: var(--chatbot-ink);
  border: 0;
  border-radius: 50%;
  flex-shrink: 0;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  transition: background-color .2s, opacity .2s;
  display: flex;
}

.chatbot-send:hover {
  background: var(--chatbot-accent);
}

.chatbot-form.busy .chatbot-send,
.chatbot-form.busy textarea {
  opacity: .5;
  pointer-events: none;
}

@media (max-width: 480px) {
  .chatbot-panel {
    border-radius: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    inset: 0;
    animation: none;
  }

  .chatbot.open .chatbot-launcher {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot-panel,
  .chatbot-typing i,
  .chatbot-launcher {
    animation: none;
    transition: none;
  }
}
