/* styles.css —— 日昇史鉴 前端样式
 * 设计基调：移动优先、六中蓝主题（#1565C0）、宣纸底、墨色文字，
 * 克制地点缀历史韵味（印章红、细竹线），无外部资源依赖。
 */

:root {
  --school-blue: #1565C0;
  --school-blue-dark: #0D47A1;
  --school-blue-light: #E3F2FD;
  --ink: #1F2933;
  --ink-soft: #51606F;
  --paper: #F7F3EA;
  --paper-card: #FFFDF8;
  --seal-red: #C0392B;
  --bamboo: #8AA37B;
  --border: #E2DCCB;
  --shadow: 0 2px 10px rgba(21, 101, 192, 0.10);
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  background: var(--paper);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶部 ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--school-blue) 0%, var(--school-blue-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow);
  border-bottom: 3px solid var(--seal-red);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--seal-red);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 2px;
  font-weight: 700;
}

.brand-text p {
  margin: 0;
  font-size: 12px;
  opacity: 0.85;
  letter-spacing: 1px;
}

.model-select {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.model-select label {
  white-space: nowrap;
  opacity: 0.9;
}

.model-select select {
  max-width: 150px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  font-size: 13px;
  outline: none;
}

/* ---------- Tab ---------- */
.tabs {
  display: flex;
  background: var(--paper-card);
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 12px 8px;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color 0.15s ease;
}

.tab.active {
  color: var(--school-blue);
}

.tab.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  border-radius: 3px;
  background: var(--school-blue);
}

/* ---------- 内容区 ---------- */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 12px;
  overflow: hidden;
}

.panel {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.panel.active {
  display: flex;
}

.hint {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--ink-soft);
  background: var(--school-blue-light);
  border-left: 3px solid var(--bamboo);
  padding: 8px 12px;
  border-radius: 8px;
}

.hint strong { color: var(--school-blue-dark); }

/* ---------- 聊天区 ---------- */
.chat-box {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 2px;
  min-height: 0;
}

.bubble {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: var(--radius);
  white-space: normal;
  word-break: break-word;
  box-shadow: var(--shadow);
  font-size: 15px;
}

.bubble.user {
  align-self: flex-end;
  background: var(--school-blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bubble.assistant {
  align-self: flex-start;
  background: var(--paper-card);
  color: var(--ink);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

/* 打字加载态 */
.bubble.typing,
.typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-soft);
  opacity: 0.5;
  animation: blink 1.2s infinite ease-in-out;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* ---------- 解析区 ---------- */
.analysis-box {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.analysis-card {
  background: var(--paper-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  font-size: 15px;
  white-space: normal;
  word-break: break-word;
}

.analysis-box .typing {
  padding: 16px;
}

/* ---------- 输入区 ---------- */
.composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--paper-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow);
}

.composer textarea {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  max-height: 140px;
}

.composer textarea::placeholder {
  color: #A9A293;
}

.btn-send {
  flex-shrink: 0;
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  background: var(--school-blue);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn-send:hover { background: var(--school-blue-dark); }

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

/* ---------- 页脚 ---------- */
.app-footer {
  text-align: center;
  padding: 10px;
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--paper-card);
  border-top: 1px solid var(--border);
}

/* ---------- 响应式：更大屏 ---------- */
@media (min-width: 720px) {
  .content {
    max-width: 760px;
    margin: 0 auto;
    width: 100%;
  }
  .chat-box, .analysis-box { padding: 12px 4px; }
}
