/* ===== AI每日创作工坊 - 全局样式 ===== */
:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --bg: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --border: #e2e8f0;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.06);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --nav-height: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --border: #334155;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding-top: var(--nav-height);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 导航栏 ===== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  box-shadow: var(--shadow);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; }
.nav-logo-icon { font-size: 1.4rem; }
.nav-links { display: flex; gap: 0.25rem; list-style: none; }
.nav-links a {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
  text-decoration: none;
}
.nav-links a:hover { background: var(--bg-secondary); color: var(--text); text-decoration: none; }
.nav-links a.active { background: var(--primary); color: #fff; }
.nav-actions { display: flex; gap: 0.5rem; align-items: center; }

/* ===== 容器 ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }
.page-title { margin-bottom: 2rem; }
.page-title h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.25rem; }
.page-title p { color: var(--text-secondary); font-size: 0.95rem; }

/* ===== 卡片 ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-body { padding: 1.5rem; }
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { opacity: 0.9; text-decoration: none; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-secondary); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-secondary); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.w-full { width: 100%; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 1.25rem; }
.label { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 0.5rem; }
.input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 0.15s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1); }
textarea.input { min-height: 100px; resize: vertical; }
select.input { appearance: auto; }

/* ===== 标签/进度 ===== */
.tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-secondary);
  color: var(--text-secondary);
}
.tag.primary { background: #dbeafe; color: #1e40af; }
.tag.success { background: #dcfce7; color: #166534; }
@media (prefers-color-scheme: dark) {
  .tag.primary { background: rgb(37 99 235 / 0.25); color: #93c5fd; }
  .tag.success { background: rgb(16 185 129 / 0.25); color: #4ade80; }
}
.progress { height: 8px; background: var(--bg-secondary); border-radius: 999px; overflow: hidden; margin: 0.5rem 0; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.4s; }
.progress-bar.green { background: var(--success); }

/* ===== 网格 ===== */
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1024px) { .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .nav-links a { padding: 0.4rem 0.5rem; font-size: 0.8rem; }
  .container { padding: 1rem; }
  .page-title h1 { font-size: 1.4rem; }
}

/* ===== 首页专用 ===== */
.hero-section { text-align: center; padding: 3rem 0 2rem; }
.hero-section h1 { font-size: 2.25rem; font-weight: 800; margin-bottom: 0.75rem; line-height: 1.2; }
.hero-section p { font-size: 1.1rem; color: var(--text-secondary); max-width: 600px; margin: 0 auto; }
.quota-grid .quota-item { padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.quick-links { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
@media (max-width: 768px) { .quick-links { grid-template-columns: 1fr; } }
.quick-link-card {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: var(--text);
}
.quick-link-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transform: translateY(-2px);
}
.quick-link-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.quick-link-title { font-weight: 600; font-size: 1.1rem; margin-bottom: 0.25rem; }
.quick-link-desc { color: var(--text-secondary); font-size: 0.85rem; }

/* ===== 结果区域 ===== */
.result-content { white-space: pre-wrap; line-height: 1.8; padding: 1rem 0; }
.result-content h1, .result-content h2, .result-content h3 { margin: 1.25rem 0 0.5rem; font-weight: 600; }
.result-content p { margin-bottom: 0.75rem; }
.result-content ul, .result-content ol { margin-left: 1.5rem; margin-bottom: 0.75rem; }
.result-content hr { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.result-content blockquote { border-left: 3px solid var(--primary); padding-left: 1rem; margin: 0.75rem 0; color: var(--text-secondary); font-style: italic; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-tertiary); }
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }
.loading-state { text-align: center; padding: 3rem; }

/* ===== 按钮组 ===== */
.btn-group { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.btn-group .btn { flex: 1; min-width: 80px; text-align: center; }
.btn-group .btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 功能页面双栏 ===== */
@media (max-width: 768px) {
  .content-grid { grid-template-columns: 1fr; }
}

/* ===== 历史记录 ===== */
.history-item { padding: 1rem; border-bottom: 1px solid var(--border); display: flex; gap: 1rem; }
.history-item:last-child { border-bottom: none; }
.history-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius); flex-shrink: 0; }
.history-meta { font-size: 0.8rem; color: var(--text-tertiary); margin-bottom: 0.25rem; }
.history-text { font-size: 0.9rem; color: var(--text-secondary); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ===== 模态框 ===== */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 90%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}
.modal-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 1rem; }
.modal-desc { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 1.25rem; line-height: 1.5; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.5rem; }
.hidden { display: none !important; }

/* ===== 底部 ===== */
.footer { text-align: center; padding: 2rem; color: var(--text-tertiary); font-size: 0.8rem; border-top: 1px solid var(--border); margin-top: 3rem; }

/* ===== 响应式导航 ===== */
.nav-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text); padding: 0.25rem; }
@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .nav-links { display: none; position: absolute; top: var(--nav-height); left: 0; right: 0; background: var(--bg-card); flex-direction: column; padding: 0.5rem; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md); }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.75rem; font-size: 0.9rem; }
}

/* ===== 图片结果 ===== */
.image-result-box { text-align: center; }
.image-result-box img { max-width: 100%; max-height: 500px; border-radius: var(--radius); margin-bottom: 1rem; }
.image-result-box .btn { margin-top: 0.5rem; }

/* ===== 批量刷额条 ===== */
.batch-bar {
  background: #dbeafe;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 640px) { .batch-bar { flex-direction: column; text-align: center; } }
@media (prefers-color-scheme: dark) { .batch-bar { background: rgb(37 99 235 / 0.2); color: #93c5fd; } }