/**
 * 任务中心 - 企业级UI/UX设计
 * 设计理念：现代、专业、高效
 * 优化版本：使用CSS变量减少重复代码
 */

/* ==================== CSS变量定义 ==================== */
:root {
  /* 颜色系统 */
  --tc-primary: #667eea;
  --tc-primary-dark: #764ba2;
  --tc-success: #10b981;
  --tc-warning: #f59e0b;
  --tc-danger: #ef4444;
  --tc-info: #3b82f6;

  /* 中性色 */
  --tc-gray-50: #f9fafb;
  --tc-gray-100: #f3f4f6;
  --tc-gray-200: #e5e7eb;
  --tc-gray-300: #d1d5db;
  --tc-gray-400: #9ca3af;
  --tc-gray-500: #6b7280;
  --tc-gray-600: #4b5563;
  --tc-gray-700: #374151;
  --tc-gray-800: #1f2937;
  --tc-gray-900: #111827;

  /* 背景色 */
  --tc-bg-page: #f5f7fa;
  --tc-bg-card: #ffffff;
  --tc-bg-hover: #f9fafb;

  /* 间距 */
  --tc-spacing-xs: 4px;
  --tc-spacing-sm: 8px;
  --tc-spacing-md: 12px;
  --tc-spacing-lg: 16px;
  --tc-spacing-xl: 24px;
  --tc-spacing-2xl: 32px;

  /* 圆角 */
  --tc-radius-sm: 4px;
  --tc-radius-md: 8px;
  --tc-radius-lg: 12px;
  --tc-radius-xl: 16px;

  /* 阴影 */
  --tc-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --tc-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --tc-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --tc-shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

  /* 过渡 */
  --tc-transition: all 0.3s ease;
}

/* ==================== 全局样式 ==================== */
.task-center-page {
  background: var(--tc-bg-page);
  min-height: 100vh;
  padding: var(--tc-spacing-xl);
}

/* ==================== 仪表盘头部 ==================== */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--tc-spacing-2xl);
  padding: var(--tc-spacing-xl);
  background: linear-gradient(135deg, var(--tc-primary) 0%, var(--tc-primary-dark) 100%);
  border-radius: var(--tc-radius-xl);
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.header-left {
  color: white;
}

.dashboard-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-subtitle {
  font-size: 14px;
  opacity: 0.9;
  margin: 0;
}

.header-right {
  display: flex;
  gap: 12px;
}

.btn-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-action.btn-primary {
  background: white;
  color: #667eea;
}

.btn-action.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn-action.btn-secondary {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  backdrop-filter: blur(10px);
}

.btn-action.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* ==================== 统计卡片 ==================== */
.stats-container {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: white;
  border-radius: 10px;
  padding: 20px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  border-left: 4px solid transparent;
  min-width: 0;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.stat-card.stat-pending {
  border-left-color: #f59e0b;
}

.stat-card.stat-progress {
  border-left-color: #3b82f6;
}

.stat-card.stat-submitted {
  border-left-color: #8b5cf6;
}

.stat-card.stat-completed {
  border-left-color: #10b981;
}

.stat-card.stat-rejected {
  border-left-color: #ef4444;
}

.stat-card.stat-overdue {
  border-left-color: #f97316;
}

.stat-card.stat-rate {
  border-left-color: #06b6d4;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card.stat-rate .stat-label {
  color: rgba(255, 255, 255, 0.9);
}

.stat-icon {
  font-size: 20px;
  opacity: 0.6;
  flex-shrink: 0;
}

.stat-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
}

.stat-card.stat-rate .stat-value {
  color: white;
}

.stat-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #6b7280;
  white-space: nowrap;
}

.stat-trend.success {
  color: #10b981;
}

.stat-trend.danger {
  color: #ef4444;
}

.stat-trend.warning {
  color: #f59e0b;
}

.stat-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  background: white;
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* ==================== 最近任务区域 ==================== */
.recent-tasks-container {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title h2 {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.section-title i {
  font-size: 24px;
  color: #667eea;
}

.section-filters {
  display: flex;
  gap: 8px;
}

.filter-chip {
  padding: 8px 16px;
  border: 2px solid #e5e7eb;
  background: white;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-chip:hover {
  border-color: #667eea;
  color: #667eea;
}

.filter-chip.active {
  background: #667eea;
  border-color: #667eea;
  color: white;
}

/* ==================== 任务网格 ==================== */
.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.task-item {
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.task-item:hover {
  border-color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.task-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.task-item-title {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin: 0;
  flex: 1;
}

.task-status-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

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

.task-status-badge.status-in_progress {
  background: #dbeafe;
  color: #1e40af;
}

.task-status-badge.status-submitted {
  background: #ede9fe;
  color: #5b21b6;
}

.task-status-badge.status-completed {
  background: #d1fae5;
  color: #065f46;
}

.task-status-badge.status-rejected {
  background: #fee2e2;
  color: #991b1b;
}

/* ==================== 加载状态 ==================== */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #6b7280;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #f3f4f6;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

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

.loading-state p {
  font-size: 14px;
  margin: 0;
}

/* ==================== 空状态 ==================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #9ca3af;
  font-size: 14px;
  text-align: center;
}

.empty-state i {
  font-size: 48px;
  color: #d1d5db;
  margin-bottom: 16px;
}

/* ==================== 派发任务表单 ==================== */
.task-form-container {
  background: white;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  max-width: 800px;
  margin: 0 auto;
}

.task-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-group label .required {
  color: #ef4444;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  color: #111827;
  transition: all 0.3s ease;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.category-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 24px;
  border-top: 2px solid #f3f4f6;
}

.form-actions .btn {
  padding: 12px 32px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-actions .btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.form-actions .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.form-actions .btn-secondary {
  background: #f3f4f6;
  color: #6b7280;
}

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

/* ==================== 任务仓库 ==================== */
.task-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.task-filters input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 10px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
}

.task-filters input[type="text"]:focus {
  outline: none;
  border-color: #667eea;
}

.task-filters select {
  padding: 10px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  background: white;
  cursor: pointer;
}

.task-filters select:focus {
  outline: none;
  border-color: #667eea;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.task-card {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.task-card:hover {
  border-color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.task-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.task-card-title {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin: 0;
  flex: 1;
}

.task-card-body {
  margin-bottom: 16px;
}

.task-description {
  font-size: 14px;
  color: #6b7280;
  margin: 0 0 12px 0;
}

.task-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: #9ca3af;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.task-card-footer {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
}

/* ==================== 分页 ==================== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
}

.pagination button {
  padding: 8px 16px;
  border: 2px solid #e5e7eb;
  background: white;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pagination button:hover:not(:disabled) {
  border-color: #667eea;
  color: #667eea;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination button.active {
  background: #667eea;
  border-color: #667eea;
  color: white;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1400px) {
  .stats-container {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1024px) {
  .stats-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard-header {
    flex-direction: column;
    gap: 16px;
  }

  .header-right {
    width: 100%;
    justify-content: stretch;
  }

  .btn-action {
    flex: 1;
  }

  .stats-container {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .category-selector {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
}

