/* ──────────────────────────────────────────
   나라봇 챗봇 UI 스타일
   ────────────────────────────────────────── */

/* ── 플로팅 버튼 ── */
#chatbot-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1000;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--color-primary);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(37,99,235,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, box-shadow .2s;
}
#chatbot-fab:hover { transform: scale(1.08); box-shadow: 0 6px 22px rgba(37,99,235,.55); }
#chatbot-fab.open  { background: #1d4ed8; }

/* 펄스 링 (초기 어텐션) */
#chatbot-fab::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(37,99,235,.4);
  animation: pulse-ring 2.5s ease-out infinite;
}
#chatbot-fab.open::before { display: none; }

@keyframes pulse-ring {
  0%   { transform: scale(1);    opacity: 1; }
  70%  { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}

/* 알림 뱃지 */
#chatbot-badge {
  position: absolute;
  top: -3px; right: -3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  display: none;
}
#chatbot-badge.visible { display: flex; }

/* ── 챗봇 창 ── */
#chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 1000;
  width: 400px;
  height: 580px;
  background: var(--color-surface);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.18), 0 4px 12px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s ease;
}
#chatbot-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* 헤더 */
.chatbot-header {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 60%, #3b82f6 100%);
  padding: 14px 16px 0;
  flex-shrink: 0;
  color: #fff;
}

.chatbot-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.chatbot-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.9375rem;
}

.chatbot-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  opacity: .85;
  margin-top: 2px;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: .4; } }

.chatbot-close-btn {
  width: 28px; height: 28px;
  border: none; background: rgba(255,255,255,.15);
  border-radius: 50%;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.chatbot-close-btn:hover { background: rgba(255,255,255,.3); }

/* 모드 탭 */
.chatbot-tabs {
  display: flex;
  gap: 4px;
}
.chatbot-tab {
  flex: 1;
  padding: 8px 4px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.65);
  font-size: 0.78125rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.chatbot-tab.active {
  color: #fff;
  border-bottom-color: #fff;
}
.chatbot-tab:hover:not(.active) { color: rgba(255,255,255,.85); }

/* ── 메시지 영역 ── */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

/* 시작 배너 */
.chatbot-welcome {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: #0369a1;
}
.chatbot-welcome strong { display: block; margin-bottom: 4px; font-size: 0.875rem; }

/* 메시지 버블 */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.msg-row.user  { flex-direction: row-reverse; }
.msg-row.bot   { flex-direction: row; }

.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
  align-self: flex-end;
}

.msg-bubble {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.55;
  word-break: keep-all;
  white-space: pre-wrap;
}
.msg-row.user .msg-bubble {
  background: var(--color-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-row.bot .msg-bubble {
  background: #f1f5f9;
  color: var(--color-text);
  border-bottom-left-radius: 4px;
}

/* 타이핑 인디케이터 */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #f1f5f9;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}
.typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: typing-bounce .9s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-5px); }
}

/* ── 빠른 질문 ── */
.quick-questions {
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  background: var(--color-surface);
}
.quick-btn {
  padding: 5px 11px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--color-text);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.quick-btn:hover { background: var(--color-primary-light); border-color: var(--color-primary); color: var(--color-primary); }

/* ── 문의 폼 ── */
.inquiry-form {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 14px;
  font-size: 0.8125rem;
}
.inquiry-form p { margin-bottom: 10px; color: #1d4ed8; font-weight: 600; }
.inquiry-form .form-group { margin-bottom: 8px; }
.inquiry-form input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  font-size: 0.8125rem;
  background: #fff;
}
.inquiry-form input:focus { outline: none; border-color: var(--color-primary); }
.inquiry-form .submit-btn {
  width: 100%;
  padding: 8px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: background .15s;
}
.inquiry-form .submit-btn:hover { background: var(--color-primary-dark); }

/* ── 입력 영역 ── */
.chatbot-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  background: var(--color-surface);
}
.chatbot-input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: 0.875rem;
  background: var(--color-bg);
  resize: none;
  max-height: 100px;
  line-height: 1.4;
  transition: border-color .15s;
  font-family: inherit;
}
.chatbot-input:focus { outline: none; border-color: var(--color-primary); }
.chatbot-send-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
}
.chatbot-send-btn:hover { background: var(--color-primary-dark); }
.chatbot-send-btn:active { transform: scale(.92); }
.chatbot-send-btn:disabled { background: var(--color-border); cursor: not-allowed; }

/* ── 반응형 (모바일) ── */
@media (max-width: 480px) {
  #chatbot-window {
    width: calc(100vw - 16px);
    height: calc(100vh - 80px);
    right: 8px;
    bottom: 72px;
    border-radius: 14px;
  }
  #chatbot-fab { bottom: 16px; right: 16px; }
  .quick-questions { display: none; }  /* 모바일에서 공간 절약 */
}
