/* ═══════════════════════════════════════════════════════════════
   AI量化助手 — components.css
   §3 header 已入 layout / bubble / loading / quick-btn / input /
      send-btn / toast / empty-state
   ═══════════════════════════════════════════════════════════════ */

/* ── 空状态(§3.8)────────────────────────────────────── */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  padding: 40px 20px;
}

.empty-icon {
  font-size: 48px;
  opacity: 0.5;
}

.empty-text {
  font-size: 14px;
  text-align: center;
  line-height: 1.6;
}

.empty-text strong {
  color: var(--gold);
}

/* ── 消息气泡(§3.2)──────────────────────────────────── */
.message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: fadeInUp 0.3s ease-out;
}

/* 用户气泡稍快,体现"我的消息秒出"(§5.2.3) */
.message.user {
  animation-duration: 0.2s;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.user {
  align-self: flex-end;
  align-items: flex-end;
}

.message.user .bubble {
  background: var(--bubble-user);
  color: var(--bubble-user-text);
  border-radius: 16px 16px 4px 16px;
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
  box-shadow: 0 2px 8px var(--gold-alpha-15);
  /* §3.2 新增 — 玻璃拟态 */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.message.ai {
  align-self: flex-start;
  align-items: flex-start;
}

.message.ai .bubble {
  background: var(--bubble-ai);
  color: var(--bubble-ai-text);
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.6;
  word-break: break-word;
  border: 1px solid var(--border-color);
  /* §3.2 新增 — 左侧 2px 金色竖条 */
  box-shadow: inset 2px 0 0 var(--gold);
}

/* 消息时间戳 */
.message-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

/* ── Loading 动画(§3.4)──────────────────────────────── */
.loading-message {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bubble-ai);
  border-radius: 16px 16px 16px 4px;
  border: 1px solid var(--border-color);
  animation: fadeInUp 0.3s ease-out;
  /* §3.4 新增 — 整体脉动光环 */
  box-shadow: 0 0 0 4px var(--gold-alpha-15);
}

.loading-message.fade-out {
  animation: fadeOut 0.2s ease-out forwards;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.loading-dots {
  display: flex;
  gap: 3px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

.loading-text {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── 快捷指令栏(§3.5)────────────────────────────────── */
.quick-actions {
  display: flex;
  gap: 8px;
  padding: 8px 14px;
  justify-content: space-between;
  flex-shrink: 0;
  border-top: 1px solid rgba(58, 42, 26, 0.5);
}

.quick-btn {
  flex: 1;
  min-width: 0;
  justify-content: center;
  text-align: center;
  padding: 7px 6px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  font-family: inherit;
}

@media (hover: hover) {
  .quick-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--gold-alpha-08);
  }
}

.quick-btn:active {
  transform: scale(0.96);
  background: var(--gold-alpha-15);
}

@media (max-width: 380px) {
  .quick-btn {
    padding: 5px 4px;
    font-size: 10px;
  }
}

/* ── 输入区(§3.6)────────────────────────────────────── */
.input-area {
  padding: 8px 14px calc(8px + var(--safe-area-bottom));
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.input-wrapper {
  flex: 1;
  position: relative;
}

#messageInput {
  width: 100%;
  padding: 10px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  resize: none;
}

#messageInput:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-alpha-15);
}

#messageInput::placeholder {
  color: var(--text-muted);
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

@media (hover: hover) {
  .send-btn:hover {
    background: var(--gold);
    color: var(--bg-primary);
  }
}

.send-btn:active {
  transform: scale(0.92);
}

.send-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

@media (hover: hover) {
  .send-btn:disabled:hover {
    background: transparent;
    color: var(--gold);
  }
}

/* ── Toast(§3.7)─────────────────────────────────────── */
.toast {
  position: fixed;
  top: max(20px, env(safe-area-inset-top, 20px));
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 20px;
  background: var(--bubble-ai);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 13px;
  z-index: 100;
  animation: toastIn 0.3s ease-out, toastOut 0.3s 2.5s ease-out forwards;
  max-width: 90%;
  text-align: center;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
