/* 트래비티 AI 상담 챗봇 위젯.
   광고주 사이트(자체 CSS)와 크리에이터 사이트 양쪽에 얹히므로
   모든 선택자를 .tvc- 로 시작하고, 상속을 끊어(all:initial 대신 명시 지정) 페이지 스타일과 섞이지 않게 한다. */

.tvc-root {
  --tvc-color: #FA6781;
  --tvc-ink: #1f1f1f;
  --tvc-sub: #6b7280;
  --tvc-line: #ececf0;
  position: fixed;
  bottom: 20px;
  z-index: 2147483000;
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--tvc-ink);
}
.tvc-root.tvc-right { right: 20px; }
.tvc-root.tvc-left  { left: 20px; }

/* ─── 런처 버튼 ─── */
.tvc-launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 60px;
  padding: 0 20px 0 8px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .16);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  color: var(--tvc-ink);
  transition: transform .15s, box-shadow .15s;
}
.tvc-launcher:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }
.tvc-launcher img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; display: block; background: #fff3f6; }
.tvc-launcher .tvc-l-txt { white-space: nowrap; font-size: 14.5px; }
.tvc-launcher .tvc-dot {
  position: absolute; top: 6px; left: 44px;
  width: 10px; height: 10px; border-radius: 50%;
  background: #22c55e; border: 2px solid #fff;
}
.tvc-root.tvc-open .tvc-launcher { display: none; }

/* ─── 패널 ─── */
.tvc-panel {
  display: none;
  flex-direction: column;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 620px;
  max-height: calc(100vh - 100px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .22);
  overflow: hidden;
}
.tvc-root.tvc-open .tvc-panel { display: flex; }

.tvc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--tvc-color);
  color: #fff;
}
.tvc-head img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: rgba(255, 255, 255, .25); display: block; }
.tvc-head b { font-size: 15px; font-weight: 800; display: block; letter-spacing: .3px; }
.tvc-head small { font-size: 12px; opacity: .9; }
.tvc-close {
  margin-left: auto; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .18); color: #fff; font-size: 18px; cursor: pointer; line-height: 1;
}
.tvc-close:hover { background: rgba(255, 255, 255, .3); }

.tvc-body { flex: 1; overflow-y: auto; padding: 18px; background: #fafafa; }
.tvc-intro { padding: 4px 2px 16px; }
.tvc-intro h3 { margin: 0 0 4px; font-size: 20px; font-weight: 800; line-height: 1.4; white-space: pre-line; color: var(--tvc-ink); }

.tvc-msg { display: flex; gap: 8px; margin-bottom: 12px; align-items: flex-end; }
.tvc-msg img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: #fff3f6; }
.tvc-bubble {
  max-width: 78%;
  padding: 11px 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--tvc-line);
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: break-word;
}
.tvc-msg.tvc-me { justify-content: flex-end; }
.tvc-msg.tvc-me .tvc-bubble { background: var(--tvc-color); color: #fff; border-color: transparent; }

.tvc-chips { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 14px 38px; }
.tvc-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border: 1px solid #ffd4dc;
  border-radius: 12px;
  background: #fff;
  color: var(--tvc-color);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
  text-align: left;
  word-break: keep-all;
}
.tvc-chip:hover { background: #fff5f7; }
.tvc-chip i { margin-left: auto; font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--tvc-sub); flex-shrink: 0; }
.tvc-chip-primary { background: var(--tvc-color); color: #fff; border-color: transparent; }
.tvc-chip-primary:hover { background: var(--tvc-color); filter: brightness(.95); }
.tvc-chip-ghost { border-color: var(--tvc-line); color: var(--tvc-sub); font-weight: 500; }
.tvc-chip-ghost:hover { background: #f6f6f8; }

.tvc-foot { border-top: 1px solid var(--tvc-line); background: #fff; padding: 10px 12px 12px; }
.tvc-form { display: flex; gap: 8px; align-items: flex-end; }
.tvc-input {
  flex: 1;
  min-height: 42px;
  max-height: 96px;
  padding: 10px 14px;
  border: 1px solid var(--tvc-line);
  border-radius: 999px;
  font: inherit;
  font-size: 13.5px;
  resize: none;
  outline: 0;
  background: #fafafa;
  color: var(--tvc-ink);
}
.tvc-input:focus { border-color: var(--tvc-color); background: #fff; }
.tvc-send {
  width: 42px; height: 42px; flex-shrink: 0;
  border: 0; border-radius: 50%;
  background: var(--tvc-color); color: #fff;
  font-size: 17px; cursor: pointer;
}
.tvc-send:disabled { opacity: .45; cursor: default; }
.tvc-direct {
  width: 100%;
  margin-top: 8px;
  padding: 9px;
  border: 1px solid #ffd4dc;
  border-radius: 10px;
  background: #fff;
  color: var(--tvc-color);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.tvc-direct:hover { background: #fff5f7; }

/* 상담 폼 */
.tvc-lead { background: #fff; border: 1px solid #ffd4dc; border-radius: 14px; padding: 14px; margin: 0 0 14px 38px; }
.tvc-lead b { display: block; font-size: 13.5px; margin-bottom: 4px; }
.tvc-lead p { margin: 0 0 10px; font-size: 12.5px; color: var(--tvc-sub); }
.tvc-lead input, .tvc-lead textarea {
  width: 100%; margin-bottom: 8px; padding: 9px 12px;
  border: 1px solid var(--tvc-line); border-radius: 8px; font: inherit; font-size: 13px; outline: 0;
  color: var(--tvc-ink); background: #fff; resize: vertical;
}
.tvc-lead input:focus, .tvc-lead textarea:focus { border-color: var(--tvc-color); }
.tvc-lead button {
  width: 100%; padding: 10px; border: 0; border-radius: 8px;
  background: var(--tvc-color); color: #fff; font: inherit; font-weight: 700; cursor: pointer;
}
.tvc-lead .tvc-err { color: #dc2626; font-size: 12px; margin: 0 0 8px; }

/* 로딩 점 */
.tvc-typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.tvc-typing i { width: 6px; height: 6px; border-radius: 50%; background: #c9ccd2; animation: tvc-blink 1.2s infinite; }
.tvc-typing i:nth-child(2) { animation-delay: .2s; }
.tvc-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes tvc-blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

@media (max-width: 480px) {
  .tvc-root { bottom: 14px; }
  .tvc-root.tvc-right { right: 14px; }
  .tvc-root.tvc-left { left: 14px; }
  .tvc-panel { width: calc(100vw - 28px); height: calc(100vh - 90px); }
  .tvc-launcher { height: 54px; padding: 0 16px 0 7px; }
  .tvc-launcher img { width: 40px; height: 40px; }
}
