/* ==========================================
   line-chat.css — LINE 聊天介面樣式
   ========================================== */

/* LINE 頂部 Header */
.line-header {
  background: var(--line-header-bg);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.back-btn {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  opacity: 0.9;
}

.line-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.chat-name {
  color: white;
  font-size: 15px;
  font-weight: 600;
}

.chat-status {
  color: rgba(255,255,255,0.75);
  font-size: 11px;
}

.menu-btn {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
}

/* ── 聊天訊息區 ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--line-chat-bg);
}

/* 訊息群組 */
.msg-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-group.bot { align-items: flex-start; }
.msg-group.user { align-items: flex-end; }

/* Bot 帶頭像的Row */
.bot-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.bot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--line-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  align-self: flex-end;
}

/* 訊息泡泡 */
.msg-bubble {
  max-width: 240px;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.msg-group.bot .msg-bubble {
  background: var(--line-bubble-bot);
  border-radius: 4px 18px 18px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  color: var(--line-text);
}

.msg-group.user .msg-bubble {
  background: var(--line-bubble-user);
  border-radius: 18px 18px 4px 18px;
  color: var(--line-text);
}

/* 時間戳 */
.msg-time {
  font-size: 10px;
  color: rgba(0,0,0,0.4);
  padding: 0 4px;
}

/* Flex Message 容器區 */
.flex-container {
  max-width: 290px;
  overflow: visible;
}

/* 打字動畫 */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.typing-dots {
  background: white;
  border-radius: 14px;
  padding: 10px 16px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #aaa;
  animation: typing-bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1.2); opacity: 1; }
}

/* 日期分隔線 */
.date-divider {
  text-align: center;
  font-size: 11px;
  color: rgba(0,0,0,0.4);
  padding: 4px 0;
}

/* ── 輸入列 ── */
.chat-inputbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #F5F5F5;
  border-top: 1px solid #E0E0E0;
  flex-shrink: 0;
}

.input-icon-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #666;
  padding: 4px;
}

.chat-input {
  flex: 1;
  border: 1px solid #DDD;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  font-family: 'Noto Sans TC', sans-serif;
  outline: none;
  background: white;
  transition: border-color 0.2s;
}
.chat-input:focus { border-color: var(--line-green); }

.send-btn {
  background: var(--line-green);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.send-btn:hover { background: var(--line-green-dark); }
