/* 홈페이지 챗봇 — 런처(우하단 원형) + 패널(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;
  flex-shrink: 0;
}

.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;
  flex-shrink: 0;
}

.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;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  white-space: normal;
}

.chatbot-cta a {
  color: #fff;
  background: var(--chatbot-ink);
  border-radius: 8px;
  margin: 0;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.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;
  flex-shrink: 0;
}

.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;
  min-height: 42px;
  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;
  }
}

/* All additions stay inside the chatbot, except its temporary page scroll lock. */
html.chatbot-scroll-locked,
html.chatbot-scroll-locked body { overflow: hidden; }
.chatbot [hidden] { display: none !important; }
.chatbot button { font-family: inherit; }
.chatbot button:focus-visible,
.chatbot a:focus-visible,
.chatbot textarea:focus-visible,
.chatbot-messages:focus-visible {
  outline: 2px solid var(--chatbot-accent);
  outline-offset: 2px;
}
.chatbot button:disabled { cursor: default; opacity: .5; }
.chatbot-header-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.chatbot-header-actions button:not(.chatbot-close) {
  color: #fff;
  background: transparent;
  border: 1px solid #ffffff66;
  border-radius: 6px;
  min-height: 36px;
  padding: 4px 6px;
  font-size: 11px;
  line-height: 1.3;
  cursor: pointer;
}
.chatbot-header-actions button:hover { background: #ffffff1f; }
.chatbot-msg { overflow-wrap: anywhere; flex-shrink: 0; }
.chatbot-msg a:not(.chatbot-option) { color: var(--chatbot-accent); text-underline-offset: 3px; }
.chatbot-links { white-space: normal; gap: 8px; }
.chatbot-links li::before { content: none; }
.chatbot-links a {
  display: block;
  padding: 10px;
  border: 1px solid #e3e3e3;
  border-radius: 8px;
  line-height: 1.5;
}
.chatbot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  background: #fff;
  padding: 10px 12px;
}
.chatbot-actions:empty { display: none; }
.chatbot-option,
.chatbot-stop,
.chatbot-cancel {
  box-sizing: border-box;
  color: var(--chatbot-ink);
  background: #fff;
  border: 1px solid #c9c9c9;
  border-radius: 8px;
  min-height: 40px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}
.chatbot-option:hover,
.chatbot-stop:hover { background: var(--chatbot-bg); border-color: var(--chatbot-ink); }
.chatbot-cancel { border: 0; color: var(--chatbot-accent); align-self: flex-end; margin-right: 12px; }
.chatbot-notice { color: #666; background: #fff; margin: 0; padding: 0 12px 12px; font-size: 12px; line-height: 1.5; }
.chatbot-progress { display: flex; align-items: center; gap: 8px; white-space: normal; }
.chatbot-progress .chatbot-typing { padding: 0; }
.chatbot-msg.is-streaming .chatbot-msg-text::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 3px;
  vertical-align: -.1em;
  background: currentColor;
  animation: chatbotCursor 1s steps(2, end) infinite;
}
@keyframes chatbotCursor { 50% { opacity: 0; } }
.chatbot-consent { white-space: normal; }
.chatbot-consent ul { padding-left: 20px; }
.chatbot-consent li + li { margin-top: 8px; }
.chatbot-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.chatbot-backdrop { position: fixed; inset: 0; z-index: 900; background: #1a1a1acc; }
.chatbot.is-expanded .chatbot-panel {
  z-index: 901;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  border-radius: 0;
  animation: none;
}
.chatbot.is-expanded .chatbot-header,
.chatbot.is-expanded .chatbot-messages,
.chatbot.is-expanded .chatbot-actions {
  padding-inline: max(20px, calc((100vw - 760px) / 2));
}
.chatbot.is-expanded .chatbot-form { width: min(100%, 760px); box-sizing: border-box; margin-inline: auto; }
.chatbot.is-expanded .chatbot-notice { padding-inline: max(12px, calc((100vw - 736px) / 2)); }
.chatbot.is-expanded .chatbot-cancel { margin-right: max(12px, calc((100vw - 736px) / 2)); }
.chatbot ::selection { color: #fff; background: var(--chatbot-accent); }
.chatbot textarea { caret-color: var(--chatbot-accent); }
.chatbot-messages { scrollbar-color: #aaa transparent; scrollbar-width: thin; min-height: 0; }
/* The local debug toolbar must not cover chatbot controls while it is open. */
body:has(.chatbot.open) #djDebugRoot { display: none; }
@media (max-width: 480px) {
  .chatbot #chatbotExpand { display: none; }
  .chatbot-panel { height: 100dvh; }
  .chatbot-header-actions button { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .chatbot-msg.is-streaming .chatbot-msg-text::after { animation: none; }
  .chatbot button { transition: none; }
}
