/* ============================================
   设计规范
   - 主色调: #3b82f6 (蓝色)
   - 辅助色: #10b981 (绿色), #f59e0b (橙色), #ef4444 (红色)
   - 文字色: #1f2937 (深灰), #6b7280 (中灰), #9ca3af (浅灰)
   - 背景色: #f8fafc (浅灰), #ffffff (白色)
   - 圆角: 6px (小), 10px (中), 14px (大)
   - 阴影: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.08)
   - 字体: system-ui, -apple-system, sans-serif
   ============================================ */

/* 基础样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f8fafc;
  color: #1f2937;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
}

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

.login-container {
  width: 100%;
  max-width: 400px;
}

.login-box {
  background: white;
  padding: 40px;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.login-box h1 {
  text-align: center;
  margin-bottom: 6px;
  color: #1f2937;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-box .subtitle {
  text-align: center;
  color: #6b7280;
  font-size: 0.8125rem;
  margin-bottom: 28px;
}

/* 表单样式 */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #374151;
  font-size: 0.8125rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  background: white;
  color: #1f2937;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #9ca3af;
  font-size: 0.8125rem;
}

.form-group small {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: #6b7280;
}

/* 表单行 - 多列布局 */
.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

/* 表单区块 */
.form-section {
  margin-bottom: 20px;
}

.form-section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

/* 分割线 */
.section-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 20px 0;
}

/* 按钮样式 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}

.btn-primary {
  background: #3b82f6;
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
}

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

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

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

.btn-sm {
  padding: 5px 10px;
  font-size: 0.75rem;
}

/* 错误消息 */
.error-message {
  color: #dc2626;
  margin-top: 12px;
  text-align: center;
  font-size: 0.8125rem;
  padding: 10px;
  background: #fef2f2;
  border-radius: 8px;
  border: 1px solid #fecaca;
}

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

/* 侧边栏 */
.sidebar {
  width: 240px;
  background: #1f2937;
  color: white;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header h2 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 2px;
  letter-spacing: -0.02em;
}

.sidebar-header p {
  font-size: 0.75rem;
  color: #9ca3af;
  font-weight: 400;
}

.sidebar-nav {
  padding: 10px 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: #9ca3af;
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 0.8125rem;
  font-weight: 500;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  color: #e5e7eb;
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  color: white;
  background: rgba(255, 255, 255, 0.06);
  border-left-color: #3b82f6;
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer .btn {
  width: 100%;
  justify-content: center;
}

/* 主内容区 */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 28px;
  min-height: 100vh;
}

/* 区块样式 */
.section {
  display: none;
}

.section.active {
  display: block;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e5e7eb;
}

.section-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  letter-spacing: -0.02em;
}

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

.stat-card {
  background: white;
  padding: 20px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
}

.stat-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.stat-card h3 {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.stat-card p {
  font-size: 1.75rem;
  font-weight: 700;
  color: #3b82f6;
  letter-spacing: -0.02em;
}

/* 列表容器 */
.list-container {
  background: white;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.2s ease;
}

.list-item:hover {
  background: #f9fafb;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item-info h4 {
  margin-bottom: 3px;
  color: #1f2937;
  font-size: 0.875rem;
  font-weight: 600;
}

.list-item-info p {
  font-size: 0.75rem;
  color: #6b7280;
}

.list-item-actions {
  display: flex;
  gap: 6px;
}

/* 模态框 */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.modal.active {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-content {
  background: white;
  padding: 28px;
  border-radius: 14px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-content h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1f2937;
}

.close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  color: #9ca3af;
  font-size: 1.125rem;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  flex-shrink: 0;
}

.close:hover {
  color: #374151;
  background: #f3f4f6;
}

/* 设置表单 */
.settings-form {
  background: white;
  padding: 28px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}

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

.settings-form .form-group:last-child {
  margin-bottom: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    position: relative;
    height: auto;
  }

  .main-content {
    margin-left: 0;
  }

  .admin-layout {
    flex-direction: column;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .login-box {
    padding: 32px 24px;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 24px;
  color: #6b7280;
}

.empty-state p {
  font-size: 0.875rem;
}

/* 标签 */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 0.6875rem;
  font-weight: 500;
  background: #eff6ff;
  color: #3b82f6;
}

/* 状态标签 */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 0.6875rem;
  font-weight: 500;
}

.status-badge.published {
  background: #dcfce7;
  color: #16a34a;
}

.status-badge.draft {
  background: #fef3c7;
  color: #d97706;
}
