/* ========================================
   森谷AI · 大脑思考前端样式
   展示思考过程，而非答案
   ======================================== */

:root {
  --bg: #ffffff;
  --text: #202124;
  --text-secondary: #5f6368;
  --border: #dadce0;
  --hover-bg: #f8f9fa;
  --accent: #1a73e8;
  --accent-light: #e8f0fe;
  --green: #34a853;
  --max-w: 640px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: -apple-system, "PingFang SC", "Noto Sans SC", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ==================== 状态栏 ==================== */

#statusBar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  user-select: none;
}

#modelStatus {
  color: var(--green);
  font-size: 8px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ==================== 主区域 ==================== */

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 28px;
  overflow-y: auto;
}

/* ==================== 空状态 ==================== */

#emptyState {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: var(--max-w);
  padding: 0 24px;
}

#emptyState.active { display: flex; }

#logo {
  text-align: center;
  margin-bottom: 30px;
}

#logoIcon {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 8px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

#logo h1 {
  font-size: 36px;
  font-weight: 300;
  color: var(--text);
  letter-spacing: 2px;
  margin-bottom: 4px;
}

#tagline {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 400;
  letter-spacing: 1px;
}

/* ==================== 搜索框 ==================== */

#searchWrap {
  width: 100%;
  max-width: 560px;
}

#searchBox {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 8px 8px 8px 20px;
  transition: box-shadow 0.2s, border-color 0.2s;
  background: var(--bg);
}

#searchBox:focus-within {
  box-shadow: 0 1px 6px rgba(32,33,36,0.12);
  border-color: rgba(223,225,229,0);
}

#searchInput {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  line-height: 24px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
}

#searchInput::placeholder { color: var(--text-secondary); }

#sendBtn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

#sendBtn:hover { background: #1557b0; }

/* ==================== 提示词 ==================== */

#hints {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.hint {
  font-size: 13px;
  color: var(--accent);
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.hint:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

/* ==================== 对话模式 ==================== */

#chatArea {
  display: none;
  flex: 1;
  width: 100%;
  max-width: var(--max-w);
  padding: 20px 24px;
  margin: 0 auto;
}

#chatArea.active { display: block; }

#messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100%;
}

/* ==================== 消息通用 ==================== */

.msg {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.6;
  animation: fadeIn 0.3s ease;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}

.msg.error {
  align-self: flex-start;
  background: #fce8e6;
  color: #c5221f;
  border-bottom-left-radius: 4px;
}

.msg.loading {
  align-self: flex-start;
  background: var(--hover-bg);
  color: var(--text-secondary);
  border-bottom-left-radius: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.msg.loading::after {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==================== 🧠 大脑思考消息 ==================== */

.msg.brain {
  align-self: flex-start;
  background: #fafafa;
  color: var(--text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
  max-width: 92%;
}

.brain-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.brain-indicator {
  font-size: 16px;
  animation: thinkingPulse 2s ease-in-out infinite;
}

@keyframes thinkingPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

.brain-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.brain-badge {
  margin-left: auto;
  font-size: 10px;
  color: #e37400;
  background: #fef7e0;
  padding: 2px 8px;
  border-radius: 10px;
}

.brain-thought {
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  color: #1a1a1a;
}

.brain-meta {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==================== 底部输入栏 ==================== */

#bottomBar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 12px 24px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
  position: relative;
}

#bottomBar.active { display: flex; }

#inputWrap {
  flex: 1;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 4px 4px 4px 16px;
  transition: box-shadow 0.2s;
}

#inputWrap:focus-within {
  box-shadow: 0 1px 6px rgba(32,33,36,0.12);
}

#chatInput {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  line-height: 24px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
}

#chatInput::placeholder { color: var(--text-secondary); }
#chatInput:disabled { opacity: 0.5; }

#chatSendBtn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

#chatSendBtn:disabled { opacity: 0.4; cursor: default; }
#chatSendBtn:hover:not(:disabled) { background: #1557b0; }

#thinkBadge {
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
  display: none;
}

#thinkBadge.show { display: block; }

/* ==================== 响应式 ==================== */

@media (max-width: 480px) {
  #logoIcon { font-size: 48px; }
  #logo h1 { font-size: 28px; }
  #searchBox { padding: 6px 6px 6px 16px; }
  #searchInput { font-size: 15px; }
  .msg { font-size: 14px; }
  .msg.brain { max-width: 96%; }
  #bottomBar { padding: 8px 16px 16px; }
}
