/* ===== LGSports 任务库页面样式 ===== */
/* 适用于 tasks.html — 顶部Tab筛选 + 热门比赛 + 任务列表 */

/* ========================================
   1. 页面容器
   ======================================== */

.task-library-page {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--dashboard-bg, #f5f7fa);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  min-height: 0;
}

.task-library-page::-webkit-scrollbar {
  display: none;
}

/* ========================================
   2. 筛选Tab（内联于任务列表头部）
   ======================================== */

.tl-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-left: auto;
  max-width: 60%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

.tl-tabs::-webkit-scrollbar {
  display: none;
}

.tl-tab {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary, #888);
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e8e8e8);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.tl-tab.active {
  background: var(--primary-blue, #2563eb);
  color: #fff;
  border-color: var(--primary-blue, #2563eb);
  font-weight: 600;
}

/* ========================================
   3. 区块通用
   ======================================== */

.tl-section {
  padding: 0 16px;
  margin-bottom: 8px;
}

.tl-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 0 10px;
}

.tl-section-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0;
  margin-right: auto;
  flex-shrink: 0;
}

.tl-sort-btn {
  font-size: 13px;
  color: var(--text-secondary, #888);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* ========================================
   4. 热门比赛卡片
   ======================================== */

.tl-hot-matches {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.tl-hot-matches::-webkit-scrollbar {
  display: none;
}

.tl-hot-card {
  flex-shrink: 0;
  width: 160px;
  background: var(--card-bg, #fff);
  border-radius: var(--card-radius, 16px);
  box-shadow: var(--card-shadow, 0 2px 12px rgba(0, 0,0,0.06));
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s;
}

.tl-hot-card:active {
  transform: scale(0.97);
}

.tl-card-body {
  padding: 10px 12px 12px;
}

.tl-card-league {
  font-size: 11px;
  color: var(--text-secondary, #888);
  margin-bottom: 2px;
}

.tl-card-time {
  font-size: 12px;
  color: var(--primary-blue, #2563eb);
  font-weight: 600;
  margin-bottom: 6px;
}

.tl-card-vs {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1.3;
  margin-bottom: 8px;
}

.tl-card-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--primary-blue, #2563eb);
  background: var(--primary-blue-light, #eff6ff);
  margin-bottom: 4px;
}

.tl-card-count {
  font-size: 11px;
  color: var(--text-secondary, #888);
}

/* ========================================
   5. 任务列表卡片
   ======================================== */

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

.tl-task-card {
  background: var(--card-bg, #fff);
  border-radius: var(--card-radius, 16px);
  box-shadow: var(--card-shadow, 0 2px 12px rgba(0,0,0,0.06));
  padding: 14px 16px;
  cursor: pointer;
  transition: transform 0.15s;
}

.tl-task-card:active {
  transform: scale(0.98);
}

.tl-task-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.tl-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}

.tl-status-badge.ongoing {
  background: var(--accent-green, #10b981);
}

.tl-status-badge.pending {
  background: var(--accent-orange, #f59e0b);
}

.tl-status-badge.finished {
  background: var(--accent-purple, #8b5cf6);
}

.tl-status-badge.waiting {
  background: #eab308;
}

.tl-status-badge.failed {
  background: var(--accent-red, #ef4444);
}

.tl-my-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--primary-blue, #2563eb);
  background: var(--primary-blue-light, #eff6ff);
}

.tl-delete-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary, #888);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.tl-delete-btn:active {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.tl-task-body {
  margin-bottom: 10px;
}

.tl-task-match {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1.3;
  margin-bottom: 4px;
}

.tl-task-league {
  font-size: 12px;
  color: var(--text-secondary, #888);
  margin-bottom: 2px;
}

.tl-task-time {
  font-size: 13px;
  color: var(--text-secondary, #888);
}

.tl-task-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.tl-match-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary, #888);
  background: rgba(136, 136, 136, 0.1);
}

.tl-intel-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent-green, #10b981);
  background: rgba(16, 185, 129, 0.1);
}

.tl-match-tag.not-started {
  color: var(--primary-blue, #2563eb);
  background: rgba(37, 99, 235, 0.1);
}

/* 完赛全场比分标签（橙色系，视觉层级高于已开赛/半场） */
.tl-match-tag.finished {
  color: var(--accent-orange, #f59e0b);
  background: rgba(245, 158, 11, 0.1);
  font-variant-numeric: tabular-nums;
}

/* 半场比分标签（灰色系，视觉层级次于全场比分） */
.tl-match-tag.half {
  color: var(--text-secondary, #888);
  background: rgba(136, 136, 136, 0.08);
  font-variant-numeric: tabular-nums;
}

.tl-intel-tag.no-intel {
  color: var(--text-secondary, #888);
  background: rgba(136, 136, 136, 0.1);
}

.tl-task-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tl-task-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary, #888);
  flex: 1;
  min-width: 0;
}

.tl-task-meta span {
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.tl-report-link {
  color: var(--primary-blue, #2563eb);
  font-weight: 500;
  cursor: pointer;
}

.tl-avatar-group {
  display: flex;
  flex-shrink: 0;
}

.tl-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--card-bg, #fff);
  margin-left: -6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
}

.tl-avatar:first-child {
  margin-left: 0;
}

.tl-avatar:nth-child(1) { background: #667eea; }
.tl-avatar:nth-child(2) { background: #f59e0b; }
.tl-avatar:nth-child(3) { background: #10b981; }

/* ========================================
   6. 底部"没有更多了"
   ======================================== */

.tl-no-more {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary, #888);
  padding: 20px 0 24px;
}

.tl-load-more {
  border: 1px solid var(--border-color, #e8e8e8);
  background: var(--card-bg, #fff);
  color: var(--accent, #6366f1);
  font-size: 13px;
  padding: 8px 28px;
  border-radius: 999px;
  cursor: pointer;
}

.tl-load-more:active {
  opacity: 0.7;
}

/* ========================================
   7. Toast 提示（全局补丁）
   ======================================== */

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
}

/* ========================================
   8. 暗色模式（对齐比赛页色板）
   ======================================== */

body.dark-mode .task-library-page {
  background: #111827;
}

body.dark-mode .tl-tab {
  background: #374151;
  border-color: #4b5563;
  color: #9ca3af;
}

body.dark-mode .tl-section-header h3,
body.dark-mode .tl-task-match,
body.dark-mode .tl-card-vs {
  color: #f3f4f6;
}

body.dark-mode .tl-sort-btn {
  color: #9ca3af;
}

body.dark-mode .tl-hot-card,
body.dark-mode .tl-task-card {
  background: #1f2937;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

body.dark-mode .tl-card-league,
body.dark-mode .tl-task-league {
  color: #6b7280;
}

body.dark-mode .tl-card-time,
body.dark-mode .tl-task-time {
  color: #9ca3af;
}

body.dark-mode .tl-card-badge {
  background: #374151;
  color: #93c5fd;
}

body.dark-mode .tl-card-count {
  color: #6b7280;
}

body.dark-mode .tl-my-tag {
  background: #374151;
  color: #93c5fd;
}

body.dark-mode .tl-delete-btn {
  color: #6b7280;
}

body.dark-mode .tl-status-badge.failed {
  background: #dc2626;
}

body.dark-mode .tl-match-tag {
  background: rgba(107, 114, 128, 0.15);
  color: #6b7280;
}

body.dark-mode .tl-intel-tag {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

body.dark-mode .tl-match-tag.not-started {
  background: rgba(37, 99, 235, 0.15);
  color: #93c5fd;
}

body.dark-mode .tl-match-tag.finished {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

body.dark-mode .tl-match-tag.half {
  background: rgba(107, 114, 128, 0.12);
  color: #9ca3af;
}

body.dark-mode .tl-intel-tag.no-intel {
  background: rgba(107, 114, 128, 0.15);
  color: #6b7280;
}

body.dark-mode .tl-no-more {
  color: #6b7280;
}

body.dark-mode .tl-avatar {
  border-color: #1f2937;
}

/* ========================================
   9. 移动端响应式
   ======================================== */

@media (max-width: 768px) {
  .tl-section {
    padding: 0 8px;
  }

  /* 头部换行：第一行标题+排序按钮，第二行整行展示筛选Tab */
  .tl-section-header {
    flex-wrap: wrap;
  }

  .tl-tabs {
    order: 3;
    flex-basis: 100%;
    max-width: 100%;
    margin-left: 0;
  }

  .tl-tab {
    padding: 5px 12px;
  }
}
