/* ============================================================
   style.css - AI 内容助手样式
   蓝白配色，简洁现代风格
   ============================================================ */

/* ---------- 全局 Reset & 基础变量 ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-light: #eff6ff;
  --teal:          #0d9488;
  --teal-dark:     #0f766e;
  --violet:        #7c3aed;
  --violet-dark:   #6d28d9;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --bg:            #f8fafc;
  --white:         #ffffff;
  --radius:        12px;
  --shadow:        0 4px 24px rgba(37, 99, 235, 0.08);
  --shadow-hover:  0 8px 32px rgba(37, 99, 235, 0.16);
  --transition:    0.2s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 40px 16px 80px;
}

/* ---------- 主容器 ---------- */
.container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ---------- 顶部标题 ---------- */
.header {
  text-align: center;
  padding: 16px 0 8px;
}

.logo {
  font-size: 36px;
  color: var(--primary);
  margin-bottom: 10px;
  animation: float 3s ease-in-out infinite;
}

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

.header h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.subtitle {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}

/* ---------- 输入区 ---------- */
.input-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}

.input-section:focus-within {
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}

.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

textarea {
  width: 100%;
  resize: vertical;
  border: none;
  outline: none;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text);
  font-family: inherit;
  background: transparent;
  min-height: 180px;
}

textarea::placeholder {
  color: #c0ccd8;
}

.char-count {
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ---------- 操作按钮组 ---------- */
.actions {
  display: flex;
  gap: 12px;
}

.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.975rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition),
              background var(--transition), opacity var(--transition);
  user-select: none;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

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

/* 蓝色 - 总结 */
.btn-summarize {
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}
.btn-summarize:hover:not(:disabled) {
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

/* 青绿色 - 改写 */
.btn-rewrite {
  background: linear-gradient(135deg, var(--teal), #14b8a6);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.3);
}
.btn-rewrite:hover:not(:disabled) {
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.4);
}

/* 紫色 - 大纲 */
.btn-outline-btn {
  background: linear-gradient(135deg, var(--violet), #8b5cf6);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
}
.btn-outline-btn:hover:not(:disabled) {
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.4);
}

.btn-icon {
  font-size: 1.1rem;
}

/* ---------- 结果区域 ---------- */
.result-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--primary-light);
  border-bottom: 1px solid var(--border);
}

.result-label {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.copy-btn {
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 6px;
  padding: 5px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.copy-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.copy-btn:active { transform: translateY(0); }

.result-box {
  padding: 24px;
  min-height: 160px;
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.placeholder-text {
  color: #c0ccd8;
}

/* 加载动画 */
.loading-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  font-weight: 500;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #bfdbfe;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* 错误状态 */
.error-text {
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 12px 16px;
}

/* 流式输出文字 */
.stream-output {
  white-space: pre-wrap;
  word-break: break-word;
}

/* 打字机光标 */
.cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--primary);
  margin-left: 2px;
  vertical-align: text-bottom;
  border-radius: 1px;
  animation: blink 0.8s step-end infinite;
}

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

/* ---------- 响应式 ---------- */
@media (max-width: 560px) {
  .header h1 { font-size: 1.5rem; }
  .actions { flex-direction: column; }
  .btn { padding: 12px; }
}
