/* =========================================================
   나무자전거 챗봇 – Modern Forest Style (Refined)
========================================================= */

/* 공통 컬러 변수 */
:root {
  --forest-green: #1e4d2b;
  --forest-green-soft: rgba(30,77,43,0.08);
  --user-bg: #f3ede4;
  --user-text: #5d4037;
  --bot-border: #eee;
}

/* 챗봇 컨테이너 */
.namu-chatbot {
  position: fixed;
  right: 25px;
  bottom: 95px;
  width: 100%;
  max-width: 360px;
  height: 550px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.2);
  font-family: 'Noto Sans KR', sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99999;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  border: 1px solid rgba(0,0,0,0.05);
}

/* 숨김 */
.namu-chatbot.hidden {
  display: none !important;
  opacity: 0;
  transform: translateY(20px);
}

/* ================= Header ================= */
.namu-chatbot .chat-header {
  background: var(--forest-green);
  color: #fff;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.namu-chatbot .chat-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.namu-chatbot .chat-header .close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.namu-chatbot .chat-header .close-btn:hover { color: #fff; }

/* ================= Chat Log ================= */
.namu-chatbot .chat-log {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #fdfdfd;
  display: flex;
  flex-direction: column;
}

.namu-chatbot .chat-log > div {
  margin-bottom: 15px;
  max-width: 100%;
  line-height: 1.6;
  font-size: 14px;
  padding: 12px 16px;
  border-radius: 15px;
  word-break: break-word;
}

/* User */
.namu-chatbot .chat-log .user {
  margin-left: auto;
  background: var(--user-bg);
  color: var(--user-text);
  border-bottom-right-radius: 2px;
  font-weight: 500;
}

/* Bot */
.namu-chatbot .chat-log .bot {
  margin-right: auto;
  background: #fff;
  color: #333;
  border-bottom-left-radius: 2px;
  border: 1px solid var(--bot-border);
  box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.namu-chatbot .chat-log .bot.loading {
  background: #f9f9f9;
  color: #999;
  border: none;
}

/* 로딩 점 애니메이션 */
.dot-ani::after {
  content: '.';
  animation: dots 1.5s steps(5,end) infinite;
}
@keyframes dots {
  0%,20% { content: '.'; }
  40% { content: '..'; }
  60% { content: '...'; }
  80%,100% { content: ''; }
}

/* ================= Input ================= */
.namu-chatbot .chat-input-wrap {
  display: flex;
  padding: 15px;
  gap: 10px;
  background: #fff;
  border-top: 1px solid #f0f0f0;
}

.namu-chatbot input[type="text"] {
  flex: 1;
  height: 45px;
  padding: 0 15px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  font-size: 14px;
  background: #fafafa;
}

.namu-chatbot input[type="text"]:focus {
  outline: none;
  border-color: var(--forest-green);
  background: #fff;
}

.namu-chatbot button.send-btn {
  width: 65px;
  background: var(--forest-green);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

/* ================= Toggle Button ================= */
.chatbot-toggle-btn {
  position: fixed !important;
  right: 25px !important;
  bottom: 25px !important;
  width: 60px !important;
  height: 60px !important;
  border-radius: 50% !important;
  background: var(--forest-green) !important;
  color: #fff !important;
  border: none !important;
  font-size: 28px !important;
  cursor: pointer !important;
  box-shadow: 0 6px 15px rgba(0,0,0,0.3) !important;
  z-index: 99999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: transform 0.2s ease;
}

.chatbot-toggle-btn:hover { transform: scale(1.1); }

/* ================= Notice ================= */
.namu-chatbot .chat-notice {
  padding: 8px 12px;
  background: #fffbe6;
  color: #856404;
  font-size: 11px;
  text-align: center;
  border-top: 1px solid #ffe58f;
}

/* ================= Product Link ================= */
.namu-chatbot .chat-link {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 15px;
  background: #fff;
  color: var(--forest-green) !important;
  border: 1px solid var(--forest-green);
  border-radius: 8px;
  text-decoration: none !important;
  font-size: 12px;
  font-weight: bold;
}

.namu-chatbot .chat-link:hover {
  background: var(--forest-green);
  color: #fff !important;
}

/* ================= Responsive ================= */
@media (min-width: 769px) {
  .namu-chatbot .chat-header {
    cursor: grab;
    user-select: none;
  }
  .namu-chatbot .chat-header:active {
    cursor: grabbing;
  }
}

@media (max-width: 768px) {
  .namu-chatbot {
    right: 10px;
    bottom: 80px;
    left: auto !important;
    top: auto !important;
  }
}
