/* AI챗봇관리 (2026-08-30, 실험적) — A-4 액센트형 (차콜 #3e6187 축)
   페이지(DB관리 > AI챗봇관리) + API 키 모달 + 캐시/챗봇 모달 공용. .aicb-* */

/* ── 페이지 탭 — 광고캠페인관리 목록 그룹 세그먼트와 같은 시각 언어 (2026-08-30 개편) ── */
.aicb-tabs {
  display: inline-flex; align-items: center; gap: 2px;
  background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 9px; padding: 3px;
}
.aicb-tab {
  padding: 4px 12px; border: none; border-radius: 6px;
  background: transparent; color: #64748b; font-size: 11.5px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.aicb-tab strong { font-size: 11px; color: #94a3b8; font-weight: 700; }
.aicb-tab.on {
  background: #fff; color: #1e293b; font-weight: 700;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
}
.aicb-tab.on strong { color: #2563eb; }
.aicb-panel { display: none; }
.aicb-panel.on { display: block; }

/* ── 섹션 밴드 카드 (A-4) ────────────────────────────────────────── */
.aicb-card { border: 1px solid #dbe6f0; border-radius: 10px; background: #fff; overflow: hidden; }
.aicb-card + .aicb-card { margin-top: 12px; }
.aicb-card-band {
  padding: 8px 14px; background: #f3f7fb; border-bottom: 1px solid #dbe6f0;
  font-size: 12px; font-weight: 700; color: #3e6187;
  display: flex; align-items: center; gap: 8px;
}
.aicb-card-body { padding: 14px; }

/* ── 폼 필드 ─────────────────────────────────────────────────────── */
.aicb-fld { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.aicb-fld label { font-size: 12px; font-weight: 600; color: #374151; }
.aicb-fld input[type="text"], .aicb-fld input[type="password"], .aicb-fld input[type="number"],
.aicb-fld select, .aicb-fld textarea {
  padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 7px;
  font-size: 13px; background: #fff; color: #111827; box-sizing: border-box; width: 100%;
}
.aicb-fld input:focus, .aicb-fld select:focus, .aicb-fld textarea:focus {
  outline: none; border-color: #3e6187; box-shadow: 0 0 0 3px #3e618722;
}
.aicb-hint { font-size: 11px; color: #94a3b8; line-height: 1.5; }

/* ── API 키 프로바이더 행 ────────────────────────────────────────── */
.aicb-key-row { display: flex; align-items: center; gap: 8px; }
.aicb-key-row input { flex: 1; font-family: monospace; }
.aicb-key-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
}
.aicb-key-status.is-on  { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.aicb-key-status.is-off { background: #fffbeb; color: #b45309; border: 1px solid #fcd34d; }

/* ── 버튼 (A-4 pill) ─────────────────────────────────────────────── */
.aicb-btn {
  display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px;
  border: 1px solid #d1d5db; border-radius: 999px; background: #fff; color: #374151;
  font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.aicb-btn:hover { background: #f3f7fb; }
.aicb-btn.primary { background: #3e6187; border-color: #3e6187; color: #fff; }
.aicb-btn.primary:hover { background: #34526f; }
.aicb-btn.danger { border-color: #fca5a5; color: #dc2626; }
.aicb-btn.danger:hover { background: #fef2f2; }
.aicb-btn:disabled { opacity: .55; cursor: default; }

/* ── 클릭 가능한 목록 행 ─────────────────────────────────────────── */
.aicb-row-click { cursor: pointer; }
.aicb-row-click:hover { background: #f3f7fb; }

/* ── 안내 배너 ───────────────────────────────────────────────────── */
.aicb-note {
  padding: 10px 12px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px;
  font-size: 11.5px; color: #1e40af; line-height: 1.55;
}
.aicb-note.warn { background: #fffbeb; border-color: #fcd34d; color: #78350f; }

/* ── 대화 콘솔 말풍선 ────────────────────────────────────────────── */
.aicb-console-msg {
  max-width: 82%; padding: 9px 13px; border-radius: 14px;
  font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.aicb-console-msg.user {
  align-self: flex-end; background: #3e6187; color: #fff; border-bottom-right-radius: 4px;
}
.aicb-console-msg.assistant {
  align-self: flex-start; background: #fff; color: #1e293b;
  border: 1px solid #e2e8f0; border-bottom-left-radius: 4px;
}
.aicb-console-msg.failed {
  align-self: flex-start; background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca;
  font-size: 12px;
}
.aicb-console-msg.typing { color: #94a3b8; font-style: italic; }

/* ── 콘솔 마크다운 (assistant 말풍선 내부) ───────────────────────── */
.aicb-md { white-space: normal; }
.aicb-md .aicb-md-gap { height: 7px; }
.aicb-md .aicb-md-h { font-weight: 700; color: #3e6187; margin: 4px 0 2px; }
.aicb-md ul { margin: 3px 0; padding-left: 18px; }
.aicb-md li { margin: 2px 0; }
.aicb-md table {
  border-collapse: collapse; margin: 6px 0; font-size: 12.5px; width: 100%;
  display: block; overflow-x: auto;
}
.aicb-md th, .aicb-md td { border: 1px solid #dbe6f0; padding: 5px 9px; text-align: left; white-space: nowrap; }
.aicb-md th { background: #f3f7fb; color: #3e6187; font-weight: 700; }
.aicb-md img { max-width: 240px; max-height: 240px; border-radius: 10px; display: block; margin: 6px 0; border: 1px solid #e2e8f0; background: #fff; }
.aicb-md a { color: #2563eb; text-decoration: underline; word-break: break-all; }

/* ── 선택지 칩 (답변 하단 빠른 응답) ─────────────────────────────── */
.aicb-chips { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; max-width: 82%; }
.aicb-chip {
  padding: 7px 14px; border: 1px solid #9db8d2; border-radius: 999px;
  background: #fff; color: #3e6187; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background .12s;
}
.aicb-chip:hover { background: #eaf1f8; }

/* ── 추천 하이라이트 (==...== ) ──────────────────────────────────── */
.aicb-md mark.aicb-rec {
  background: linear-gradient(transparent 55%, #ffe9a8 55%);
  color: inherit; font-weight: 700; padding: 0 2px;
  border-bottom: 2px solid #f0b429;
}

/* ── 대기 인디케이터 — 점 3개 바운스 ─────────────────────────────── */
.aicb-dots-anim { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: middle; }
.aicb-dots-anim i {
  width: 6px; height: 6px; border-radius: 50%; background: #94a3b8;
  animation: aicb-bounce 1.2s infinite ease-in-out;
}
.aicb-dots-anim i:nth-child(2) { animation-delay: .18s; }
.aicb-dots-anim i:nth-child(3) { animation-delay: .36s; }
@keyframes aicb-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ── 스트리밍 캐럿 ───────────────────────────────────────────────── */
.aicb-caret {
  display: inline-block; width: 2px; height: 1em; margin-left: 2px;
  background: #3e6187; vertical-align: -2px;
  animation: aicb-caret-blink 0.9s steps(1) infinite;
}
@keyframes aicb-caret-blink { 50% { opacity: 0; } }

/* ── 캐시 본문 편집기 검색/치환 바 ───────────────────────────────── */
.aicb-editor-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 10px; margin-bottom: 8px;
  background: #f3f7fb; border: 1px solid #dbe6f0; border-radius: 8px;
}
.aicb-editor-bar input[type="text"] {
  padding: 6px 9px; border: 1px solid #d1d5db; border-radius: 6px;
  font-size: 12px; width: 170px; background: #fff;
}
.aicb-editor-bar input[type="text"]:focus { outline: none; border-color: #3e6187; box-shadow: 0 0 0 3px #3e618722; }
.aicb-editor-bar .aicb-btn { padding: 5px 10px; font-size: 11.5px; }
