/* ===== EchoBlog 全局样式 ===== */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #e0e7ff;
  --secondary: #f43f5e;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-code: #1e293b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.12);
  --radius: 12px;
  --radius-sm: 6px;
  --transition: .2s ease;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  line-height: 1.7;
  font-size: 16px;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== Layout ===== */
.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.page-wrap { min-height: calc(100vh - 140px); padding: 40px 0 80px; }

/* ===== Navbar ===== */
.navbar {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
}
.navbar .inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}
.navbar .logo {
  font-size: 1.35rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}
.navbar .nav-links {
  display: flex;
  gap: 8px;
  flex: 1;
}
.navbar .nav-links a {
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all var(--transition);
}
.navbar .nav-links a:hover,
.navbar .nav-links a.active { color: var(--primary); background: var(--primary-light); }
.navbar .nav-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.navbar .avatar-btn {
  width: 36px; height: 36px; border-radius: 50%;
  object-fit: cover; cursor: pointer;
  border: 2px solid var(--border);
  transition: border-color var(--transition);
}
.navbar .avatar-btn:hover { border-color: var(--primary); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,.4); }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--bg-main); color: var(--text-main); }
.btn-danger {
  background: #fee2e2;
  color: #dc2626;
  border: 1.5px solid #fca5a5;
}
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-body { padding: 20px 24px; }

/* ===== Post Card ===== */
.post-card { display: flex; flex-direction: column; height: 100%; }
.post-card .cover {
  width: 100%; height: 190px;
  object-fit: cover;
  background: linear-gradient(135deg, #e0e7ff 0%, #fce7f3 100%);
}
.post-card .cover-placeholder {
  width: 100%; height: 190px;
  background: linear-gradient(135deg, #667eea22 0%, #764ba222 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
}
.post-card .card-body { flex: 1; display: flex; flex-direction: column; }
.post-card .category-tag {
  display: inline-flex; align-items: center;
  background: var(--primary-light);
  color: var(--primary);
  font-size: .75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
}
.post-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card h3 a:hover { color: var(--primary); }
.post-card .excerpt {
  color: var(--text-muted);
  font-size: .875rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  margin-bottom: 14px;
}
.post-card .meta {
  display: flex; align-items: center; gap: 14px;
  color: var(--text-light);
  font-size: .8rem;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  flex-wrap: wrap;
}
.post-card .meta .author { display: flex; align-items: center; gap: 5px; }
.post-card .meta .author img {
  width: 22px; height: 22px; border-radius: 50%; object-fit: cover;
  background: var(--border);
}
.meta-icon { width: 14px; height: 14px; opacity: .6; }

/* ===== Tags ===== */
.tag {
  display: inline-flex; align-items: center;
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 20px;
  transition: all var(--transition);
}
.tag:hover { background: var(--primary-light); color: var(--primary); }

/* ===== Forms ===== */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--text-main);
  background: var(--bg-card);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.form-textarea { resize: vertical; min-height: 120px; }
.form-hint { font-size: .8rem; color: var(--text-light); margin-top: 4px; }
.form-error { font-size: .8rem; color: #dc2626; margin-top: 4px; }

/* ===== Pagination ===== */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-top: 48px;
}
.pagination .page-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--bg-card);
  color: var(--text-muted);
  transition: all var(--transition);
}
.pagination .page-btn:hover { border-color: var(--primary); color: var(--primary); }
.pagination .page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ===== Toast ===== */
#toast-container {
  position: fixed; top: 80px; right: 24px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  min-width: 260px; max-width: 380px;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: slideIn .3s ease;
  transition: opacity .3s ease, transform .3s ease;
}
.toast.success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.toast.error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.toast.info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 480px;
  padding: 32px;
  position: relative;
  animation: modalIn .25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; cursor: pointer;
  color: var(--text-light); font-size: 1.3rem;
  line-height: 1; padding: 4px;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text-main); }

/* ===== Loading Skeleton ===== */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center; padding: 80px 24px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 4rem; margin-bottom: 16px; opacity: .5; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.empty-state p { font-size: .9rem; }

/* ===== Sidebar ===== */
.sidebar-widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.sidebar-widget h4 {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary-light);
}

/* ===== Article Content ===== */
.article-content {
  color: var(--text-main);
  line-height: 1.9;
  font-size: 1rem;
}
.article-content h1, .article-content h2, .article-content h3 {
  font-weight: 700; margin: 2rem 0 1rem; line-height: 1.4;
}
.article-content h1 { font-size: 1.8rem; }
.article-content h2 { font-size: 1.4rem; }
.article-content h3 { font-size: 1.15rem; }
.article-content p { margin-bottom: 1.2rem; }
.article-content ul, .article-content ol { padding-left: 1.5rem; margin-bottom: 1.2rem; }
.article-content li { margin-bottom: .5rem; }
.article-content blockquote {
  border-left: 4px solid var(--primary);
  padding: 12px 20px;
  background: var(--primary-light);
  border-radius: 0 8px 8px 0;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-style: italic;
}
.article-content code {
  background: var(--bg-code);
  color: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .85em;
  font-family: 'Fira Code', monospace;
}
.article-content pre {
  background: var(--bg-code);
  border-radius: 10px;
  padding: 20px 24px;
  overflow-x: auto;
  margin: 1.5rem 0;
}
.article-content pre code { background: none; padding: 0; color: #e2e8f0; }
.article-content img { border-radius: 8px; margin: 1.5rem 0; }
.article-content a { color: var(--primary); border-bottom: 1px solid var(--primary-light); }

/* ===== Hero Section ===== */
.hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  padding: 72px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero h1 { font-size: 2.8rem; font-weight: 800; margin-bottom: 16px; position: relative; }
.hero p { font-size: 1.15rem; opacity: .85; max-width: 560px; margin: 0 auto 32px; position: relative; }
.hero .hero-actions { display: flex; gap: 12px; justify-content: center; position: relative; }
.hero .btn-hero-primary {
  background: #fff; color: var(--primary);
  font-size: 1rem; padding: 13px 28px;
  border-radius: 10px; border: none; font-weight: 700;
  cursor: pointer; transition: all var(--transition);
}
.hero .btn-hero-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.2); }
.hero .btn-hero-outline {
  background: transparent; color: #fff;
  font-size: 1rem; padding: 12px 28px;
  border-radius: 10px; border: 2px solid rgba(255,255,255,.6); font-weight: 700;
  cursor: pointer; transition: all var(--transition);
}
.hero .btn-hero-outline:hover { background: rgba(255,255,255,.15); border-color: #fff; }

/* ===== Grid ===== */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.layout-main { display: grid; grid-template-columns: 1fr 300px; gap: 32px; align-items: start; }

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 28px 24px;
  text-align: center;
  color: var(--text-light);
  font-size: .85rem;
}
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--primary); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .layout-main { grid-template-columns: 1fr; }
  .sidebar { order: -1; }
}
@media (max-width: 600px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  .hero p { font-size: 1rem; }
  .container { padding: 0 16px; }
}

/* ===== Auth Pages ===== */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #667eea22 0%, #764ba222 100%);
  padding: 40px 24px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
}
.auth-card .logo { text-align: center; margin-bottom: 28px; }
.auth-card .logo h1 {
  font-size: 1.6rem; font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-card .logo p { color: var(--text-muted); font-size: .9rem; margin-top: 4px; }
.auth-tabs { display: flex; background: var(--bg-main); border-radius: 8px; padding: 4px; margin-bottom: 24px; }
.auth-tabs button {
  flex: 1; padding: 8px; border: none; background: none;
  border-radius: 6px; font-weight: 600; font-size: .875rem;
  cursor: pointer; color: var(--text-muted); transition: all var(--transition);
}
.auth-tabs button.active { background: var(--bg-card); color: var(--primary); box-shadow: var(--shadow-sm); }

/* ===== Write Page ===== */
.write-layout { display: grid; grid-template-columns: 1fr 280px; gap: 24px; align-items: start; }
.editor-toolbar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--bg-main);
  border: 1.5px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.editor-toolbar button {
  padding: 5px 10px; border: none; background: none;
  cursor: pointer; font-size: .8rem; font-weight: 600;
  color: var(--text-muted); border-radius: 4px;
  transition: all var(--transition);
}
.editor-toolbar button:hover { background: var(--bg-card); color: var(--text-main); }
.editor-toolbar .sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.write-editor {
  width: 100%; min-height: 480px; padding: 16px;
  border: 1.5px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-size: .95rem; line-height: 1.8;
  resize: vertical; font-family: 'Fira Code', monospace;
  background: var(--bg-card);
  color: var(--text-main);
  transition: border-color var(--transition);
}
.write-editor:focus { outline: none; border-color: var(--primary); }

/* ===== Profile Page ===== */
.profile-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  display: flex; align-items: flex-start; gap: 28px;
  margin-bottom: 28px;
}
.profile-avatar {
  width: 90px; height: 90px; border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  flex-shrink: 0;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 2rem; font-weight: 700;
}
.profile-info { flex: 1; }
.profile-info h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.profile-info .username { color: var(--text-muted); font-size: .9rem; margin-bottom: 10px; }
.profile-info .bio { color: var(--text-muted); font-size: .9rem; line-height: 1.6; }

/* ===== Detail Page ===== */
.detail-header { margin-bottom: 32px; }
.detail-header .category-tag { margin-bottom: 14px; }
.detail-header h1 { font-size: 2.2rem; font-weight: 800; line-height: 1.3; margin-bottom: 16px; }
.detail-header .meta {
  display: flex; align-items: center; gap: 20px;
  color: var(--text-light); font-size: .875rem; flex-wrap: wrap;
}
.detail-header .meta img {
  width: 28px; height: 28px; border-radius: 50%;
  object-fit: cover; background: var(--border);
}
.detail-cover {
  width: 100%; max-height: 400px; object-fit: cover;
  border-radius: var(--radius); margin-bottom: 32px;
}
.tags-wrap { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; }
