/*
 * idea-notebook-mvp · Step 6 demo v2 · style.css
 *
 * 相对 v1 的变更：
 *   1. textarea min-height 80→200（Jacob 反馈"笔记本让你一眼看更多字"）
 *   2. draft-indicator 极小灰字（Q2 选项 b）
 *   3. all-ideas-overlay 正式视图（替代 v1 的 pre 毛坯）
 *   4. visual_tolerance 扩大（配合更大输入区域）
 */

:root {
  --bg: #f9f7f2;
  --fg: #2a2a2a;
  --fg-muted: #8a8a8a;
  --fg-faint: #c0c0c0;
  --accent: #3b82f6;
  --surface: #ffffff;
  --border: rgba(0,0,0,0.08);
  --shadow-soft: 0 2px 8px rgba(0,0,0,0.05);
  --shadow-float: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-overlay: 0 8px 32px rgba(0,0,0,0.15);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

main#note-capture-unit {
  max-width: 900px;
  margin: 0 auto;
  padding: 60px 24px 160px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* ---- capture-input (v2: 更大) ---- */

section#capture-area {
  width: 100%;
}

#capture-input {
  width: 100%;
  min-height: 200px;           /* v2: 80→200，让你一眼看更多字 */
  max-height: 60vh;
  padding: 24px 28px;
  font-size: 18px;
  font-family: inherit;
  line-height: 1.7;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  resize: none;
  outline: none;
  transition: box-shadow 180ms ease, transform 120ms ease;
}

#capture-input:focus {
  box-shadow: var(--shadow-float);
  border-color: var(--accent);
}

#capture-input.committing {
  /* commit 瞬间的视觉反馈 —— 非常轻的亮一下 */
  animation: commit-flash 350ms ease;
}

@keyframes commit-flash {
  0% { transform: scale(1); box-shadow: var(--shadow-float); }
  50% { transform: scale(1.002); box-shadow: 0 4px 20px rgba(59, 130, 246, 0.15); }
  100% { transform: scale(1); box-shadow: var(--shadow-soft); }
}

#capture-input::placeholder {
  color: var(--fg-muted);
}

#capture-hint {
  margin-top: 10px;
  padding: 0 4px;
  font-size: 11px;
  color: var(--fg-faint);
  display: flex;
  justify-content: space-between;
  align-items: center;
  opacity: 0.8;
}

#hint-text {
  /* 桌面显示，移动端不显示（移动端用户学习成本低，少噪音）*/
}

#draft-indicator {
  font-size: 11px;
  color: var(--fg-muted);
  opacity: 0;
  transition: opacity 400ms ease;
}

#draft-indicator.show {
  opacity: 0.7;
}

#draft-indicator.fading {
  opacity: 0;
}

/* ---- recall-bubble ---- */

section#recall-area {
  margin-top: 32px;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recall-bubble {
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: translateY(4px);
  cursor: default;
  max-width: 100%;
  overflow: hidden;
  will-change: opacity, transform;
}

.recall-bubble.fade-in {
  /* v2: 改用 class 触发而非 animation auto-play，避免 race */
  animation: bubble-fade-in 320ms ease-out forwards;
}

.recall-bubble.dismissing {
  animation: bubble-fade-out 500ms ease-out forwards;
}

.recall-bubble-label {
  font-size: 11px;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.recall-bubble-text {
  font-size: 14px;
  color: var(--fg);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recall-bubble-time {
  font-size: 10px;
  color: var(--fg-muted);
  margin-top: 4px;
  opacity: 0.6;
}

@keyframes bubble-fade-in {
  to {
    opacity: 0.7;
    transform: translateY(0);
  }
}

@keyframes bubble-fade-out {
  to {
    opacity: 0;
    transform: translateY(-4px);
  }
}

/* ---- all-ideas overlay（v2 新增）---- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(249, 247, 242, 0.98);
  z-index: 100;
  display: flex;
  flex-direction: column;
  animation: overlay-fade-in 250ms ease;
}

.overlay[hidden] {
  display: none;
}

@keyframes overlay-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.overlay-header {
  padding: 20px 24px 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.overlay-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--fg);
}

.overlay-meta {
  font-size: 12px;
  color: var(--fg-muted);
  flex: 1;
}

#overlay-close {
  background: transparent;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
}

#overlay-close:hover {
  background: rgba(0,0,0,0.04);
  color: var(--fg);
}

.overlay-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 80px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.idea-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-soft);
  transition: box-shadow 150ms ease;
}

.idea-card:hover {
  box-shadow: var(--shadow-float);
}

.idea-card-time {
  font-size: 11px;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.idea-card-text {
  font-size: 15px;
  color: var(--fg);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.idea-card-empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--fg-muted);
  font-size: 14px;
}

/* ---- dev-panel（生产要删）---- */

aside#dev-panel {
  position: fixed;
  bottom: 16px;
  right: 16px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.9);
  border: 1px dashed var(--border);
  border-radius: 6px;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: var(--fg-muted);
  z-index: 50;
  backdrop-filter: blur(6px);
}

#dev-panel button {
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg-muted);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}

#dev-panel button:hover {
  background: rgba(0,0,0,0.03);
}

/* ---- 响应式 ---- */

@media (max-width: 600px) {
  main#note-capture-unit {
    padding: 24px 16px 120px;
  }
  #capture-input {
    font-size: 16px;           /* iOS 防缩放 */
    padding: 18px 20px;
    min-height: 180px;
  }
  #hint-text {
    display: none;             /* 手机上隐藏学习成本文案 */
  }
  #capture-hint {
    justify-content: flex-end; /* 只留 draft-indicator */
  }
  aside#dev-panel {
    font-size: 11px;
    padding: 8px 12px;
  }
  .overlay-header {
    padding: 16px 18px 12px;
  }
  .overlay-body {
    padding: 12px 16px 80px;
  }
}
