/* WB Report Hub - 样式文件 */

/* ==================== 全局样式 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #4F46E5;
  --primary-hover: #4338CA;
  --secondary-color: #6B7280;
  --success-color: #10B981;
  --danger-color: #EF4444;
  --warning-color: #F59E0B;
  --bg-color: #F3F4F6;
  --sidebar-bg: #1F2937;
  --sidebar-text: #F9FAFB;
  --card-bg: #FFFFFF;
  --text-primary: #111827;
  --text-secondary: #6B7280;
  --border-color: #E5E7EB;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
}

/* ==================== 顶部导航栏 ==================== */
.header {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 0 2rem;
  height: 60px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  font-size: 1.8rem;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* ==================== 按钮样式 ==================== */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--sidebar-text);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

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

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

/* ==================== 主容器 ==================== */
.main-container {
  display: flex;
  margin-top: 60px;
  min-height: calc(100vh - 60px);
}

/* ==================== 侧边栏 ==================== */
.sidebar {
  width: 280px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.category-list {
  padding: 1rem 0;
}

.category-item {
  padding: 0.875rem 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 3px solid transparent;
}

.category-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.category-item.active {
  background: rgba(79, 70, 229, 0.3);
  border-left-color: var(--primary-color);
}

.category-item-name {
  font-size: 0.9375rem;
  font-weight: 500;
}

.category-item-count {
  background: rgba(255, 255, 255, 0.15);
  padding: 0.25rem 0.625rem;
  border-radius: 12px;
  font-size: 0.8125rem;
}

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: auto;
}

.hint {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.5;
}

/* ==================== 主内容区 ==================== */
.content {
  flex: 1;
  margin-left: 280px;
  padding: 2rem;
  max-width: 1200px;
}

.category-info {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-color);
}

.category-info h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.category-info p {
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.report-count {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.report-count span {
  font-weight: 700;
  color: var(--primary-color);
  font-size: 1.25rem;
}

/* ==================== 报告列表 ==================== */
.report-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.report-card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: all 0.2s;
  cursor: pointer;
  border: 1px solid var(--border-color);
}

.report-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--primary-color);
}

.report-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.report-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.report-meta {
  display: flex;
  gap: 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.report-meta-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.report-source {
  background: #EEF2FF;
  color: var(--primary-color);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8125rem;
  font-weight: 500;
}

/* ==================== 空状态 ==================== */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 4rem;
  display: block;
  margin-bottom: 1rem;
  opacity: 0.5;
}

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

/* ==================== 分页 ==================== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.page-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
}

.page-btn:hover:not(:disabled) {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-info {
  padding: 0 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ==================== 弹窗 ==================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 12px;
  max-width: 1400px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
}

.modal-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  flex: 1;
  padding-right: 1rem;
  line-height: 1.4;
}

.btn-close {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}

.btn-close:hover {
  color: var(--text-primary);
}

.modal-meta {
  padding: 1rem 2rem;
  background: var(--bg-color);
  display: flex;
  gap: 1.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.modal-body {
  padding: 2rem;
  line-height: 1.8;
}

/* ==================== Markdown 样式 ==================== */
.markdown-body {
  line-height: 1.8;
}

.markdown-body h1 { font-size: 2rem; margin: 1.5rem 0 1rem; }
.markdown-body h2 { font-size: 1.5rem; margin: 1.5rem 0 0.75rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
.markdown-body h3 { font-size: 1.25rem; margin: 1.25rem 0 0.75rem; }
.markdown-body p { margin: 0.75rem 0; }
.markdown-body ul, .markdown-body ol { margin: 0.75rem 0; padding-left: 2rem; }
.markdown-body li { margin: 0.375rem 0; }
.markdown-body code {
  background: #F3F4F6;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-size: 0.875em;
}
.markdown-body pre {
  background: #1F2937;
  color: #F9FAFB;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1rem 0;
}
.markdown-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}
.markdown-body blockquote {
  border-left: 4px solid var(--primary-color);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--text-secondary);
  font-style: italic;
}
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}
.markdown-body th, .markdown-body td {
  border: 1px solid var(--border-color);
  padding: 0.75rem;
  text-align: left;
}
.markdown-body th {
  background: var(--bg-color);
  font-weight: 600;
}
.markdown-body a {
  color: var(--primary-color);
  text-decoration: none;
}
.markdown-body a:hover {
  text-decoration: underline;
}

/* ==================== 加载动画 ==================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}

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

  .content {
    margin-left: 0;
  }

  .main-container {
    flex-direction: column;
  }

  .header {
    padding: 0 1rem;
  }

  .logo h1 {
    font-size: 1.25rem;
  }

  .header-actions {
    gap: 0.5rem;
  }

  .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
  }

  .modal {
    padding: 0.5rem;
  }

  .modal-content {
    max-height: 98vh;
    border-radius: 8px;
  }

  .modal-header {
    padding: 1rem 1.25rem;
  }

  .modal-header h2 {
    font-size: 1.125rem;
  }

  .modal-meta {
    padding: 0.75rem 1.25rem;
    gap: 0.75rem;
    font-size: 0.8125rem;
  }

  .modal-body {
    padding: 1rem 1.25rem;
  }

  .login-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 60px);
  }

  .login-box {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 100%;
  }

  .login-box h2 {
    margin-bottom: 0.5rem;
  }

  .login-box p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
  }

  .form-group {
    margin-bottom: 1rem;
  }

  .form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9375rem;
    transition: border-color 0.2s;
  }

  .form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  }

  .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
  }

  .stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
  }

  .stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }

  .stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
  }

  .stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
  }

  .admin-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
  }

  .admin-report-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .admin-report-item {
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
  }

  .admin-report-info {
    flex: 1;
  }

  .admin-report-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
  }

  .admin-report-meta {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    display: flex;
    gap: 1rem;
  }

  .admin-report-actions {
    display: flex;
    gap: 0.5rem;
  }
}
