/* ============================================================
   AI Writer Pro - 全站样式
   ============================================================ */

:root {
  --primary:    #6366f1;   /* indigo-500 */
  --primary-d:  #4f46e5;
  --secondary:  #06b6d4;   /* cyan-500 */
  --success:    #22c55e;
  --danger:     #ef4444;
  --warning:    #f59e0b;
  --bg:         #0f172a;   /* slate-900 */
  --bg2:        #1e293b;   /* slate-800 */
  --bg3:        #334155;   /* slate-700 */
  --text:       #f1f5f9;
  --text2:      #94a3b8;
  --border:     #334155;
  --radius:     12px;
  --shadow:     0 4px 24px rgba(0,0,0,.4);
  --font:       'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-d); }

/* ---- 导航栏 ---- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15,23,42,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.navbar-brand {
  font-size: 1.3rem; font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.navbar-links { display: flex; gap: 1.5rem; align-items: center; }
.navbar-links a { color: var(--text2); font-size: .92rem; transition: color .2s; }
.navbar-links a:hover { color: var(--text); }
.navbar-links .btn { margin-left: .5rem; }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1.3rem; border-radius: 8px;
  font-size: .92rem; font-weight: 600; cursor: pointer;
  border: none; transition: all .2s; text-decoration: none;
}
.btn-primary {
  background: var(--primary); color: #fff;
}
.btn-primary:hover { background: var(--primary-d); color: #fff; }
.btn-outline {
  background: transparent; color: var(--text2);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-lg { padding: .8rem 2rem; font-size: 1rem; border-radius: 10px; }
.btn-sm { padding: .35rem .9rem; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- 卡片 ---- */
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  box-shadow: var(--shadow);
}

/* ---- 表单 ---- */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block; font-size: .86rem; font-weight: 600;
  color: var(--text2); margin-bottom: .4rem;
}
.form-control {
  width: 100%; padding: .6rem .9rem;
  background: var(--bg3); border: 1.5px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: .93rem;
  transition: border-color .2s; outline: none;
}
.form-control:focus { border-color: var(--primary); }
.form-control::placeholder { color: var(--text2); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

/* ---- Hero ---- */
.hero {
  padding: 5rem 1.5rem 4rem;
  text-align: center;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(99,102,241,.18), transparent);
}
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 800; line-height: 1.15;
  background: linear-gradient(135deg, #e2e8f0, var(--primary), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 1.2rem;
}
.hero p { font-size: 1.1rem; color: var(--text2); max-width: 600px; margin: 0 auto 2rem; }
.hero-btns { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ---- 工具卡片网格 ---- */
.tools-grid {
  display: grid; gap: 1.2rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.tool-card {
  background: var(--bg2); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 1.3rem;
  cursor: pointer; transition: all .2s;
  display: flex; flex-direction: column; gap: .6rem;
}
.tool-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.tool-card.active { border-color: var(--primary); background: rgba(99,102,241,.08); }
.tool-icon { font-size: 2rem; }
.tool-name { font-weight: 700; font-size: 1rem; }
.tool-desc { font-size: .84rem; color: var(--text2); }

/* ---- 编辑器区域 ---- */
.editor-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;
}
@media (max-width: 900px) {
  .editor-layout { grid-template-columns: 1fr; }
}
.result-area {
  background: var(--bg3); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem;
  min-height: 300px; white-space: pre-wrap; line-height: 1.8;
  font-size: .95rem; overflow-y: auto; max-height: 600px;
  position: relative;
}
.result-placeholder {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: var(--text2); font-size: .9rem;
  flex-direction: column; gap: .5rem;
}

/* ---- 定价卡片 ---- */
.pricing-grid {
  display: grid; gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  max-width: 900px; margin: 0 auto;
}
.pricing-card {
  background: var(--bg2); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 2rem; position: relative;
  display: flex; flex-direction: column; gap: 1rem;
}
.pricing-card.popular { border-color: var(--primary); }
.popular-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; padding: .2rem .8rem;
  border-radius: 99px; font-size: .78rem; font-weight: 700;
}
.pricing-name { font-size: 1.2rem; font-weight: 700; }
.pricing-price { font-size: 2.6rem; font-weight: 800; }
.pricing-price span { font-size: 1rem; font-weight: 400; color: var(--text2); }
.pricing-features { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.pricing-features li { font-size: .9rem; color: var(--text2); display: flex; gap: .5rem; }
.pricing-features li::before { content: '✓'; color: var(--success); font-weight: 700; }

/* ---- 使用量进度 ---- */
.usage-bar {
  background: var(--bg3); border-radius: 99px; height: 8px; overflow: hidden;
}
.usage-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width .5s;
}

/* ---- Toast 通知 ---- */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
  display: flex; flex-direction: column; gap: .5rem;
}
.toast {
  padding: .8rem 1.2rem; border-radius: 10px;
  font-size: .9rem; font-weight: 500; max-width: 320px;
  animation: slideIn .3s ease;
  display: flex; align-items: center; gap: .5rem;
}
.toast-success { background: #166534; border: 1px solid #22c55e; color: #bbf7d0; }
.toast-error   { background: #7f1d1d; border: 1px solid #ef4444; color: #fecaca; }
.toast-info    { background: #1e3a5f; border: 1px solid #3b82f6; color: #bfdbfe; }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ---- 加载动画 ---- */
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff; animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- 语言切换 ---- */
.lang-toggle {
  display: flex; gap: .3rem; background: var(--bg3);
  border-radius: 8px; padding: .3rem;
}
.lang-btn {
  padding: .3rem .8rem; border-radius: 6px; font-size: .84rem;
  cursor: pointer; transition: all .2s; border: none;
  background: transparent; color: var(--text2);
}
.lang-btn.active { background: var(--primary); color: #fff; }

/* ---- 布局工具 ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.section    { padding: 4rem 1.5rem; }
.flex       { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1  { gap: .5rem; } .gap-2 { gap: 1rem; } .gap-3 { gap: 1.5rem; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.text-muted  { color: var(--text2); font-size: .9rem; }
.badge {
  display: inline-block; padding: .2rem .6rem;
  border-radius: 99px; font-size: .76rem; font-weight: 700;
}
.badge-primary { background: rgba(99,102,241,.2); color: var(--primary); }
.badge-success { background: rgba(34,197,94,.2);  color: var(--success); }
.badge-warning { background: rgba(245,158,11,.2); color: var(--warning); }

/* ---- 登录/注册卡片 ---- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(99,102,241,.15), transparent);
}
.auth-card { width: 100%; max-width: 420px; }
.auth-logo  { text-align: center; font-size: 1.6rem; font-weight: 800; margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* ---- 仪表盘侧边栏 ---- */
.dash-layout { display: flex; min-height: calc(100vh - 64px); }
.dash-sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--bg2); border-right: 1px solid var(--border);
  padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: .3rem;
}
.dash-sidebar a {
  display: flex; align-items: center; gap: .6rem;
  padding: .65rem .9rem; border-radius: 8px;
  color: var(--text2); font-size: .92rem; font-weight: 500;
  transition: all .2s;
}
.dash-sidebar a:hover { background: var(--bg3); color: var(--text); }
.dash-sidebar a.active { background: rgba(99,102,241,.15); color: var(--primary); }
.dash-main { flex: 1; padding: 2rem; overflow-y: auto; }

@media (max-width: 768px) {
  .dash-sidebar { display: none; }
  .navbar-links .nav-hide { display: none; }
}

/* ---- 复制按钮 ---- */
.copy-btn {
  position: absolute; top: .8rem; right: .8rem;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 6px; padding: .3rem .7rem; font-size: .8rem;
  cursor: pointer; color: var(--text2); transition: all .2s;
}
.copy-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ---- 字数统计 ---- */
.word-count { font-size: .8rem; color: var(--text2); text-align: right; margin-top: .3rem; }
