/* 后台管理样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f1f5f9;
}

/* 登录页 */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  width: 100%;
  max-width: 400px;
}

.login-box h1 {
  text-align: center;
  margin-bottom: 10px;
  color: #1e293b;
}

.subtitle {
  text-align: center;
  color: #64748b;
  margin-bottom: 30px;
}

.login-form .form-group { margin-bottom: 20px; }

.login-form label {
  display: block;
  margin-bottom: 8px;
  color: #475569;
  font-weight: 500;
}

.login-form .form-control {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1em;
}

.login-form .form-control:focus {
  outline: none;
  border-color: #2563eb;
}

.btn-block { width: 100%; }

.login-tip {
  text-align: center;
  margin-top: 20px;
  color: #64748b;
}

.alert {
  padding: 12px 15px;
  border-radius: 6px;
  margin-bottom: 20px;
}

.alert-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

/* 后台布局 */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 250px;
  background: #1e293b;
  color: white;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  padding: 25px 20px;
  border-bottom: 1px solid #334155;
}

.sidebar-header h2 {
  font-size: 1.3em;
  color: #f1f5f9;
}

.sidebar-nav { padding: 20px 0; }

.sidebar-nav a {
  display: block;
  padding: 12px 20px;
  color: #94a3b8;
  transition: all 0.2s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: #334155;
  color: white;
  text-decoration: none;
}

.admin-content {
  flex: 1;
  margin-left: 250px;
  padding: 30px;
}

.admin-content h1 {
  font-size: 1.8em;
  color: #1e293b;
  margin-bottom: 25px;
}

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-card h3 {
  color: #64748b;
  font-size: 0.9em;
  margin-bottom: 10px;
}

.stat-number {
  font-size: 2.5em;
  color: #1e293b;
  font-weight: bold;
}

.stat-card.warning .stat-number { color: #f59e0b; }

/* 数据表格 */
.data-table {
  width: 100%;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 15px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.data-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
}

.data-table tr:hover { background: #f8fafc; }

.data-table tr:last-child td { border-bottom: none; }

/* 状态标签 */
.status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 500;
}

.status.published {
  background: #dcfce7;
  color: #166534;
}

.status.draft {
  background: #f1f5f9;
  color: #475569;
}

.status.pending {
  background: #fef3c7;
  color: #92400e;
}

/* 按钮 */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95em;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-sm { padding: 5px 10px; font-size: 0.85em; }
.btn-lg { padding: 12px 24px; font-size: 1.05em; }

.btn-primary {
  background: #2563eb;
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
  text-decoration: none;
}

.btn-secondary {
  background: #64748b;
  color: white;
}

.btn-secondary:hover { background: #475569; }

.btn-danger {
  background: #dc2626;
  color: white;
}

.btn-danger:hover { background: #b91c1c; }

.btn-success {
  background: #16a34a;
  color: white;
}

.btn-success:hover { background: #15803d; }

.btn-block { width: 100%; }

/* 表单 */
.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #475569;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1em;
}

.form-control:focus {
  outline: none;
  border-color: #2563eb;
}

textarea.form-control {
  resize: vertical;
  font-family: 'Monaco', 'Consolas', monospace;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.inline-form {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.inline-form .form-control { width: auto; }

/* 页面头部操作栏 */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

/* 文章编辑器 */
.post-editor {
  background: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.form-actions {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
}

.form-actions .btn { margin-right: 10px; }

/* Markdown 预览 */
.markdown-preview {
  background: #f8fafc;
  padding: 20px;
  border-radius: 8px;
  margin-top: 20px;
}

/* 响应式 */
@media (max-width: 768px) {
  .admin-sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
  
  .admin-content {
    margin-left: 0;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
}
