/* ============================================================
   팻지 챗봇 위젯 스타일
   배치 위치: 04_web/assets/css/chatbot_widget.css
   → 수정 후 public/assets/css/ 복사 → 카페24 /www/assets/css/ 업로드
   (기존 CSS 워크플로 원칙 그대로 적용)
   ============================================================ */

#patji-widget-root {
  --patji-navy: #1a2340;
  --patji-accent: #2563eb;
  --patji-accent-light: #eff4ff;
  --patji-border: #e2e6ef;
  --patji-text-mid: #3d4966;
  --patji-text-muted: #6b7797;
  --patji-radius: 16px;
  font-family: 'Apple SD Gothic Neo', 'Noto Sans KR', -apple-system, sans-serif;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9500;
}

/* ── 플로팅 버튼 ── */
#patji-toggle-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--patji-accent);
  box-shadow: 0 6px 20px rgba(37,99,235,0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.2s ease;
}
#patji-toggle-btn:hover { transform: scale(1.05); }
#patji-toggle-btn img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* ── "생각 중" 발광 펄스 (이미지 자체 대신 CSS로 신호를 명확히) ── */
@keyframes patji-pulse-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(94, 220, 200, 0.5), 0 6px 20px rgba(37,99,235,0.35);
  }
  50% {
    box-shadow: 0 0 16px 6px rgba(94, 220, 200, 0.55), 0 6px 20px rgba(37,99,235,0.35);
  }
}
#patji-toggle-btn.patji-thinking {
  animation: patji-pulse-glow 1.4s ease-in-out infinite;
}
#patji-header-icon.patji-thinking {
  border-radius: 50%;
  animation: patji-pulse-glow 1.4s ease-in-out infinite;
}

/* ── 패널 ── */
#patji-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 360px;
  max-width: calc(100vw - 40px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: var(--patji-radius);
  box-shadow: 0 12px 40px rgba(26,35,64,0.22);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--patji-border);
}
#patji-panel.open { display: flex; }

/* ── 헤더 ── */
#patji-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--patji-navy);
  color: #fff;
  flex-shrink: 0;
}
#patji-header img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
#patji-header .patji-title {
  flex: 1;
  font-size: 14.5px;
  font-weight: 700;
}
#patji-header .patji-subtitle {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  font-weight: 400;
}
#patji-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
#patji-close-btn:hover { color: #fff; }

/* ── 메시지 영역 ── */
#patji-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8f9fc;
}

.patji-msg {
  max-width: 84%;
  font-size: 13.5px;
  line-height: 1.6;
  padding: 10px 13px;
  border-radius: 14px;
  word-break: break-word;
  white-space: pre-line;
}
.patji-msg.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--patji-border);
  color: var(--patji-text-mid);
  border-bottom-left-radius: 4px;
}
.patji-msg.user {
  align-self: flex-end;
  background: var(--patji-accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.patji-msg a.patji-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--patji-accent);
  font-weight: 700;
  text-decoration: none;
}
.patji-msg a.patji-link:hover { text-decoration: underline; }

/* ── 버튼(퀵리플라이) 그룹 ── */
.patji-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-self: flex-start;
  max-width: 100%;
}
.patji-quick-btn {
  border: 1px solid var(--patji-accent);
  background: var(--patji-accent-light);
  color: var(--patji-accent);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.patji-quick-btn:hover { background: var(--patji-accent); color: #fff; }
.patji-quick-btn.patji-escalate {
  border-color: #dc2626;
  background: #fef2f2;
  color: #b91c1c;
}
.patji-quick-btn.patji-escalate:hover { background: #dc2626; color: #fff; }

/* ── 타이핑 인디케이터 ── */
.patji-typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid var(--patji-border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
}
.patji-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b7c0d6;
  animation: patji-bounce 1.2s infinite ease-in-out;
}
.patji-typing span:nth-child(2) { animation-delay: 0.15s; }
.patji-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes patji-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ── 입력 영역 ── */
#patji-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--patji-border);
  background: #fff;
  flex-shrink: 0;
}
#patji-text-input {
  flex: 1;
  border: 1px solid var(--patji-border);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 13.5px;
  outline: none;
}
#patji-text-input:focus { border-color: var(--patji-accent); }
#patji-send-btn {
  background: var(--patji-accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
#patji-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 480px) {
  #patji-panel { width: calc(100vw - 24px); right: -8px; }
}
