/* ============================================================================
 * OJ Training Chapter 3-Block Sections (课上练习 / 课后作业 / 拓展训练)
 * ============================================================================ */

/* Hide default plain student table immediately on training routes & once enhanced */
html.htp-route-training-problems .problem-list > .vxe-table,
.problem-list.htp-enhanced > .vxe-table {
  display: none !important;
}

#htp-sectioned-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* Compact Top Controls & Quick-Jump Bar (matching approved OJ table layout) */
.htp-summary-card {
  background: #ffffff;
  border: 1px solid #dfe7f1;
  border-radius: 10px;
  padding: 9px 14px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.htp-summary-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.htp-quick-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.htp-jump-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #dfe7f1;
  font-size: 13.5px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.htp-jump-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.06);
}

.htp-jump-pill.type-class { border-left: 4px solid #2563eb; }
.htp-jump-pill.type-homework { border-left: 4px solid #0d9488; }
.htp-jump-pill.type-extend { border-left: 4px solid #7c3aed; }

.htp-jump-count {
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-variant-numeric: tabular-nums;
}

.htp-legend-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 7px;
  border-top: 1px dashed #e2e8f0;
  font-size: 13px;
  color: #475569;
}

.htp-legend-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.htp-legend-items {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.htp-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.htp-legend-swatch {
  width: 13px;
  height: 13px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  display: inline-block;
}

.htp-search-input {
  height: 32px;
  width: 205px;
  padding: 0 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  color: #1e293b;
  outline: none;
  background: #ffffff;
}

.htp-search-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.htp-tag-toggle-btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.htp-tag-toggle-btn:hover {
  border-color: #93c5fd;
  color: #1d4ed8;
  background: #eff6ff;
}

.htp-tag-toggle-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.htp-summary-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.htp-summary-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.htp-summary-count {
  font-size: 12px;
  font-weight: 700;
  color: #1d4ed8;
  background: #dbeafe;
  padding: 3px 10px;
  border-radius: 999px;
}

.htp-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.htp-segmented {
  display: inline-flex;
  background: #e2e8f0;
  padding: 3px;
  border-radius: 10px;
  gap: 2px;
}

.htp-seg-btn {
  border: none;
  background: transparent;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.htp-seg-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

.htp-stats-grid {
  display: grid;
  grid-template-columns: 1.25fr repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.htp-stat-overall {
  background: #ffffff;
  border: 1px solid #dbe7f7;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.htp-stat-overall-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.htp-stat-overall-pct {
  font-size: 19px;
  font-weight: 800;
  color: #2563eb;
  font-variant-numeric: tabular-nums;
}

.htp-progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.htp-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  transition: width 0.35s ease;
}

.htp-mini-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.htp-mini-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
}

.htp-mini-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}

.htp-mini-card.type-class .htp-mini-icon { background: #eff6ff; color: #2563eb; }
.htp-mini-card.type-homework .htp-mini-icon { background: #f0fdfa; color: #0d9488; }
.htp-mini-card.type-extend .htp-mini-icon { background: #faf5ff; color: #7c3aed; }

.htp-mini-copy small {
  display: block;
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

.htp-mini-copy strong {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

/* 3 Module Sections */
.htp-modules-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.htp-module-block {
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --accent-border: #bfdbfe;
  --accent-text: #1e40af;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.htp-module-block.type-homework {
  --accent: #0d9488;
  --accent-soft: #f0fdfa;
  --accent-border: #99f6e4;
  --accent-text: #115e59;
}

.htp-module-block.type-extend {
  --accent: #7c3aed;
  --accent-soft: #faf5ff;
  --accent-border: #ddd6fe;
  --accent-text: #5b21b6;
}

.htp-module-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 16px;
  background: linear-gradient(90deg, var(--accent-soft) 0%, #ffffff 74%);
  border-bottom: 1px solid #e9eff6;
  border-left: 4px solid var(--accent);
  cursor: pointer;
  user-select: none;
}

.htp-module-title-area {
  display: flex;
  align-items: center;
  gap: 9px;
}

.htp-module-badge-icon {
  font-size: 18px;
  line-height: 1;
}

.htp-module-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.htp-module-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  line-height: 1.3;
}

.htp-module-pill {
  font-size: 12.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent-text);
  border: 1px solid var(--accent-border);
}

.htp-module-desc {
  display: none;
}

.htp-module-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.htp-module-progress-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  font-variant-numeric: tabular-nums;
}

.htp-bar-mini {
  width: 68px;
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.htp-bar-mini > i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.htp-collapse-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  font-size: 12px;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease;
}

.htp-module-block.collapsed .htp-collapse-btn {
  transform: rotate(-90deg);
}

.htp-module-block.collapsed .htp-module-body {
  display: none;
}

.htp-module-body {
  padding: 0;
}

.htp-module-body.is-card-mode {
  padding: 14px 16px 16px;
}

/* Cards Grid */
.htp-problem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(295px, 1fr));
  gap: 12px;
}

.htp-problem-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 11px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 13px;
  padding: 13px 15px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.htp-problem-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.htp-problem-card.status-todo {
  background: #ffffff;
  border-color: #e2e8f0;
}

.htp-problem-card.status-ac {
  background: linear-gradient(180deg, #dcfce7 0%, #bbf7d0 100%);
  border-color: #4ade80;
}

.htp-problem-card.status-ac:hover {
  border-color: #16a34a;
}

.htp-problem-card.status-pac {
  background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
  border-color: #60a5fa;
}

.htp-problem-card.status-pac:hover {
  border-color: #2563eb;
}

.htp-problem-card.status-fail {
  background: linear-gradient(180deg, #fee2e2 0%, #fecaca 100%);
  border-color: #f87171;
}

.htp-problem-card.status-fail:hover {
  border-color: #dc2626;
}

.htp-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.htp-id-group {
  display: flex;
  align-items: center;
  gap: 7px;
}

.htp-order-num {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 800;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}

.htp-pid-code {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  padding: 3px 9px;
  border-radius: 6px;
  white-space: nowrap;
}

.htp-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 999px;
  white-space: nowrap;
}

.htp-status-badge.ac { background: rgba(255, 255, 255, 0.9); color: #15803d; border: 1px solid #4ade80; }
.htp-status-badge.pac { background: rgba(255, 255, 255, 0.9); color: #1d4ed8; border: 1px solid #60a5fa; }
.htp-status-badge.fail { background: rgba(255, 255, 255, 0.9); color: #dc2626; border: 1px solid #f87171; }
.htp-status-badge.trying { background: #fef3c7; color: #b45309; }
.htp-status-badge.todo { background: #f1f5f9; color: #64748b; }

.htp-card-title {
  font-size: 16.5px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.4;
  margin: 9px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.htp-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.htp-kp-tag {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  background: #3b82f6;
  padding: 2px 9px;
  border-radius: 6px;
}

.htp-card-rate-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: #475569;
  font-variant-numeric: tabular-nums;
}

.htp-card-rate-label {
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
}

.htp-card-rate-bar {
  flex: 1;
  min-width: 48px;
  height: 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.10);
  overflow: hidden;
}

.htp-card-rate-bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
  transition: width 0.25s ease;
}

.htp-card-rate-text {
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

.htp-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed #e2e8f0;
  font-size: 12px;
}

.htp-meta-left {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #64748b;
}

.htp-diff-badge {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  line-height: 1.4;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
  white-space: nowrap;
}

.htp-go-btn {
  border: none;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 13.5px;
  font-weight: 700;
  padding: 6px 13px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.htp-problem-card:hover .htp-go-btn {
  background: var(--accent);
  color: #ffffff;
}

/* Table Layout */
.htp-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: none;
  border-radius: 0;
}

.htp-table {
  width: 100%;
  min-width: 860px;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 15px;
  text-align: left;
}

.htp-table th {
  background: #f8fafc;
  color: #475569;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.htp-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}

.htp-table-title-cell {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 15.5px;
  line-height: 1.45;
}

.htp-table tbody tr {
  cursor: pointer;
  transition: background 0.14s ease;
}

.htp-table tbody tr.status-ac td {
  background: #dcfce7;
  border-bottom-color: #bbf7d0;
}

.htp-table tbody tr.status-ac:hover td {
  background: #bbf7d0;
}

.htp-table tbody tr.status-pac td {
  background: #dbeafe;
  border-bottom-color: #bfdbfe;
}

.htp-table tbody tr.status-pac:hover td {
  background: #bfdbfe;
}

.htp-table tbody tr.status-fail td {
  background: #fee2e2;
  border-bottom-color: #fecaca;
}

.htp-table tbody tr.status-fail:hover td {
  background: #fecaca;
}

.htp-table tbody tr.status-todo td {
  background: #ffffff;
}

.htp-table tbody tr.status-todo:hover td {
  background: #f8fafc;
}

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

.htp-rate-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: #334155;
  font-weight: 600;
  white-space: nowrap;
}

.htp-rate-bar {
  flex: 1;
  max-width: 95px;
  min-width: 48px;
  height: 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.14);
  overflow: hidden;
  flex-shrink: 0;
}

.htp-rate-bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
}

.htp-rate-num {
  white-space: nowrap;
  flex-shrink: 0;
}

.htp-empty-tip {
  padding: 24px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px dashed #cbd5e1;
}

/* ============================================================================
 * Admin Modal & Problem Row Section Selector
 * ============================================================================ */
.htp-admin-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #dbe7f7;
  border-radius: 12px;
}

.htp-picker-label {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
}

.htp-picker-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.htp-pill {
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.htp-pill:hover {
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.htp-pill.class.active {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.25);
}

.htp-pill.homework.active {
  background: #0d9488;
  border-color: #0f766e;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(13, 148, 136, 0.25);
}

.htp-pill.extend.active {
  background: #7c3aed;
  border-color: #6d28d9;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(124, 58, 237, 0.25);
}

.htp-picker-tip {
  font-size: 12px;
  color: #64748b;
}

.htp-admin-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 9px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13px;
}

.htp-admin-summary-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.htp-admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.htp-admin-chip.class { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.htp-admin-chip.homework { background: #f0fdfa; color: #0f766e; border: 1px solid #99f6e4; }
.htp-admin-chip.extend { background: #faf5ff; color: #6d28d9; border: 1px solid #ddd6fe; }

.htp-row-sec-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  background: #f1f5f9;
  padding: 2px;
  border-radius: 8px;
}

.htp-row-sec-btn {
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.14s ease;
  white-space: nowrap;
}

.htp-row-sec-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.7);
}

.htp-row-sec-btn.class.active { background: #2563eb; color: #ffffff; }
.htp-row-sec-btn.homework.active { background: #0d9488; color: #ffffff; }
.htp-row-sec-btn.extend.active { background: #7c3aed; color: #ffffff; }

@media (max-width: 760px) {
  .htp-stats-grid { grid-template-columns: 1fr; }
  .htp-problem-grid { grid-template-columns: 1fr; }
}

/* ============================================================================
 * Training List Title Pill Uniform Width & Alignment (训练页面题单名称框对齐一致)
 * ============================================================================ */
.el-row:has(#hcode-training-groups) .vxe-table .vxe-body--column.col--center > .vxe-cell:has(> .el-link.el-link--primary) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.el-row:has(#hcode-training-groups) .vxe-table .vxe-body--column .el-link.el-link--primary {
  width: min(300px, 100%) !important;
  min-height: 36px !important;
  padding: 6px 14px !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}

.el-row:has(#hcode-training-groups) .vxe-table .vxe-body--column .el-link.el-link--primary .el-link--inner {
  width: 100% !important;
  text-align: center !important;
  line-height: 1.35 !important;
  white-space: normal !important;
  word-break: break-word !important;
}

.el-row:has(#hcode-training-groups) .vxe-table .vxe-body--column .el-link.el-link--primary:hover {
  transform: translateY(-1px) !important;
}
