/* ============================================
   龙猫森林风设计系统
   色彩：oklch 基底
   ============================================ */

:root {
  --forest-deep:  oklch(0.25 0.06 145);
  --forest:       oklch(0.40 0.10 145);
  --bark:         oklch(0.45 0.10 50);
  --cream:        oklch(0.95 0.02 90);
  --warm-white:   oklch(0.97 0.015 85);
  --leaf:         oklch(0.55 0.10 140);
  --sun:          oklch(0.82 0.12 85);

  --bg:           var(--warm-white);
  --surface:      var(--cream);
  --text:         var(--forest-deep);
  --text-muted:   oklch(0.50 0.05 145);
  --border:       oklch(0.88 0.02 90);
  --shadow:       0 8px 32px rgba(60,80,60,0.10);
  --radius:       16px;
  --sidebar-w:    260px;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Noto Serif SC', serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--forest-deep);
}

.logo-img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
}

.new-chat-btn {
  margin: 12px 16px;
  padding: 10px 16px;
  background: var(--forest);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s ease;
}
.new-chat-btn:hover { background: var(--forest-deep); }

.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.chat-history::-webkit-scrollbar { width: 4px; }
.chat-history::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.history-item {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
  transition: background 0.15s;
}
.history-item:hover { background: var(--border); color: var(--text); }
.history-item.active { background: var(--forest); color: white; }

/* ---- Main ---- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Hero header */
.hero-header {
  position: relative;
  height: 180px;
  flex-shrink: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.hero-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.85) saturate(1.1);
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, var(--bg) 100%);
}
.hero-content {
  position: absolute;
  bottom: 16px;
  left: 28px;
}
.hero-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 26px;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.hero-subtitle {
  font-family: 'Caveat', cursive;
  font-size: 15px;
  color: rgba(255,255,255,0.9);
  margin-top: 4px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.3);
}

/* Chat container */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.chat-container::-webkit-scrollbar { width: 6px; }
.chat-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Message bubbles */
.message {
  display: flex;
  gap: 14px;
  animation: fadeInUp 0.3s ease-out;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.message.user { flex-direction: row-reverse; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--forest);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  font-family: 'Noto Serif SC', serif;
}
.message.user .avatar { background: var(--sun); }
.avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
}

.bubble {
  max-width: 72%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
}
.message.user .bubble {
  background: var(--forest);
  color: white;
  border-color: var(--forest);
}

/* Summary sections */
.summary-section {
  margin-bottom: 16px;
}
.summary-section:last-child { margin-bottom: 0; }
.summary-label {
  font-family: 'Noto Serif SC', serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--forest);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.summary-label::before {
  content: '';
  width: 12px;
  height: 2px;
  background: var(--forest);
  border-radius: 1px;
}
.message.user .summary-label { color: var(--sun); }
.message.user .summary-label::before { background: var(--sun); }

.summary-content {
  font-size: 14px;
  line-height: 1.7;
}

/* Citation cards */
.citation-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(60,80,60,0.06);
}
.citation-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.citation-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--forest);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.citation-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.citation-domain {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.citation-snippet {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 8px;
  padding-left: 32px;
}
.citation-rating {
  padding-left: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.stars {
  color: var(--sun);
  letter-spacing: 1px;
}
.rating-reason {
  color: var(--text-muted);
  font-style: italic;
}
.citation-link {
  display: inline-block;
  padding-left: 32px;
  font-size: 12px;
  color: var(--forest);
  text-decoration: none;
  font-weight: 500;
}
.citation-link:hover { text-decoration: underline; }

/* Loading */
.loading-dots {
  display: flex;
  gap: 5px;
  padding: 8px 0;
}
.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--forest);
  animation: bounce 1.2s infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.loading-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input area */
.input-area {
  padding: 16px 28px 20px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s;
}
.input-wrapper:focus-within {
  border-color: var(--forest);
}
.input-wrapper textarea {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  color: var(--text);
  resize: none;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
}
.input-wrapper textarea::placeholder { color: var(--text-muted); }
.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--forest);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s;
}
.send-btn:hover { background: var(--forest-deep); }
.send-btn:active { transform: scale(0.94); }
.send-btn:disabled { background: var(--border); cursor: not-allowed; }

.input-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  font-family: 'Caveat', cursive;
}
