/* 个人中心 */

/* 确保 footer 固定在底部 */
.page-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-shell main {
  flex: 1;
}

.stats-section {
  margin-top: 28px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  box-shadow: 0 4px 20px rgba(32, 24, 15, 0.06);
}

.stat-icon {
  font-size: 2.8rem;
  line-height: 1;
}

.stat-card div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-card strong {
  font-size: 1.5rem;
  color: var(--accent);
  font-weight: 700;
}

.stat-card span {
  color: var(--muted);
}

/* Tab */
.tab-bar {
  display: flex;
  gap: 0;
  margin: 28px 0 0;
  border-bottom: 2px solid var(--line);
}

.tab-btn {
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 180ms, border-color 180ms;
}

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

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Tab 面板 */
.tab-panel {
  display: none;
  padding: 20px 0;
}

.tab-panel.active {
  display: block;
}

/* 表格 */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

thead {
  background: rgba(217, 123, 45, 0.06);
}

th {
  text-align: left;
  padding: 12px 14px;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

tr:hover td {
  background: rgba(217, 123, 45, 0.03);
}

td a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

td a:hover {
  text-decoration: underline;
  color: var(--accent-deep);
}

/* 状态标签 */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-accepted {
  background: #d4edda;
  color: var(--green);
}

.status-wrong_answer,
.status-runtime_error,
.status-compile_error {
  background: #f8d7da;
  color: #a71d2a;
}

.status-time_limit_exceed,
.status-memory_limit_exceed {
  background: #fff3cd;
  color: #856404;
}

.status-pending {
  background: #e2e3e5;
  color: #383d41;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.empty-state p {
  font-size: 0.95rem;
  margin: 4px 0;
}

/* 难度标签 */
.diff-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.diff-beginner {
  background: #fde8e8;
  color: #fe4c61;
}

.diff-pop- {
  background: #fef3e2;
  color: #f39c11;
}

.diff-pop {
  background: #fff8e1;
  color: #ffc116;
}

.diff-popplus {
  background: #e8f5e9;
  color: #52c41a;
}

.diff-improve {
  background: #e0f7fa;
  color: #0abde3;
}

.diff-impplus {
  background: #e3f2fd;
  color: #3498db;
}

.diff-prov {
  background: #f3e5f5;
  color: #9b59b6;
}

.diff-noi {
  background: #1a1a2e;
  color: #eceff1;
}

/* 作业列表 */
.hw-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  align-items: start;
}

.hw-card {
  padding: 20px 24px;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  box-shadow: 0 4px 20px rgba(32, 24, 15, 0.06);
}

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

.hw-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.hw-deadline {
  font-size: 0.82rem;
  color: var(--muted);
}

.hw-toggle {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 4px 8px;
  line-height: 1;
  transition: transform 200ms ease, color 180ms;
}

.hw-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
}

.hw-toggle.open {
  transform: rotate(90deg);
}

.hw-progress-bar {
  height: 8px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.hw-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 400ms ease;
}

.hw-progress-fill.completed {
  background: var(--green);
}

.hw-progress-fill.expired {
  background: #dc3545;
}

.hw-meta {
  display: flex;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--muted);
}

.progress-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.progress-completed {
  background: #d4edda;
  color: var(--green);
}

.progress-ongoing {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.progress-pending {
  background: #e2e3e5;
  color: #383d41;
}

.progress-expired {
  background: #f8d7da;
  color: #721c24;
}

/* 分页 */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 20px 0;
}

.pagination-previous,
.pagination-next,
.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4em;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background 180ms, border-color 180ms, color 180ms;
}

.pagination-previous:hover:not(:disabled),
.pagination-next:hover:not(:disabled),
.pagination-link:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.pagination-previous:disabled,
.pagination-next:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pagination-list li {
  display: inline-flex;
}

.pagination-link.is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  cursor: default;
}

.pagination-ellipsis {
  padding: 0 4px;
  color: var(--muted);
}

/* 响应式 */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tab-bar {
    flex-wrap: wrap;
  }

  .hw-list {
    grid-template-columns: 1fr;
  }
}

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

/* 作业题目列表 */
.hw-detail {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.hw-prob-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.hw-prob-table th {
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.8rem;
  border-bottom: 1px solid var(--line);
}

.hw-prob-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.hw-prob-table tr:last-child td {
  border-bottom: none;
}

.hw-prob-table tr:hover td {
  background: rgba(0,0,0,0.04);
}

.hw-prob-table a {
  color: var(--accent);
  text-decoration: none;
}

.hw-prob-table a:hover {
  text-decoration: underline;
}

/* ========== 提交详情弹窗 ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  overscroll-behavior: contain;
}

.modal-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sub-detail-modal {
  max-width: 1000px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 1.4rem;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms, color 150ms;
}

.modal-close:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  overscroll-behavior: contain;
}

.sub-detail-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.sd-status-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.85rem;
}

.sd-status-badge.ac { background: #d4edda; color: #155724; }
.sd-status-badge.wa { background: #f8d7da; color: #721c24; }
.sd-status-badge.tle { background: #fff3cd; color: #856404; }
.sd-status-badge.mle { background: #fff3cd; color: #856404; }
.sd-status-badge.re { background: #f8d7da; color: #721c24; }
.sd-status-badge.ce { background: #ffeaa7; color: #6c5200; }
.sd-status-badge.pending { background: #e2e3e5; color: #383d41; }

.sd-info-text {
  color: var(--muted);
  font-size: 0.85rem;
}

.sd-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px 0;
}

.sd-test-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
  margin-bottom: 20px;
}

.sd-bottom-row {
  display: flex;
  gap: 16px;
}

.sd-bottom-left {
  flex: 0 0 45%;
  min-width: 280px;
  max-width: 50%;
}

.sd-bottom-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sd-bottom-left .sd-test-list {
  margin-bottom: 0;
}

.sd-test-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 0.7rem;
}

.sd-test-card.pass { border-color: #c3e6cb; background: #f0faf3; }
.sd-test-card.fail { border-color: #f5c6cb; background: #fdf2f3; }

.sd-test-card.sd-clickable {
  cursor: pointer;
  user-select: none;
  transition: box-shadow 0.15s;
}
.sd-test-card.sd-clickable:hover {
  box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25);
}
.sd-test-card.sd-expanded {
  grid-column: 1 / -1;
}

.sd-test-head {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.sd-expand-arrow {
  font-size: 0.55rem;
  color: var(--muted);
  flex-shrink: 0;
}

.sd-test-idx {
  font-size: 0.68rem;
  color: var(--muted);
}

.sd-test-status {
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: auto;
}

.sd-test-status.ac { color: #28a745; }
.sd-test-status.wa { color: #dc3545; }
.sd-test-status.tle { color: #e0a800; }
.sd-test-status.mle { color: #e0a800; }
.sd-test-status.re { color: #dc3545; }

.sd-test-detail {
  font-size: 0.65rem;
  color: var(--muted);
  width: 100%;
}

.sd-test-err {
  font-size: 0.65rem;
  color: #dc3545;
  margin-top: 3px;
  line-height: 1.3;
  text-align: left;
}

.sd-test-expand {
  margin-top: 10px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
  text-align: left;
}

.sd-io-block {
  margin-bottom: 8px;
}
.sd-io-block:last-child { margin-bottom: 0; }

.sd-io-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  display: block;
  margin-bottom: 3px;
}

.sd-io-content {
  margin: 0;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 3px;
  padding: 6px 8px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 120px;
  overflow-y: auto;
}

.sd-io-content.sd-io-err {
  color: #dc3545;
  background: rgba(220, 53, 69, 0.06);
}

.sd-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.sd-section-header .sd-section-title { margin-bottom: 0; }

.sd-copy-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 4px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
}

.sd-copy-btn:hover { background: var(--accent-deep); }
.sd-copy-btn.copied { background: var(--green); }

.sd-code-block {
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  max-height: 300px;
  overflow-y: auto;
}

/* 详情按钮 */
.ps-detail-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.2s;
}
.ps-detail-btn:hover { background: var(--accent-deep); }

/* 提交记录作业筛选 */
.sub-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.sub-filter-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.sub-filter-select {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
  min-width: 180px;
  outline: none;
  transition: border-color 180ms;
}

.sub-filter-select:focus {
  border-color: var(--accent);
}

/* 隐藏提交提示 */
.hidden-submissions-note {
  background: #fff3cd;
  color: #856404;
  padding: 8px 16px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 0.88rem;
  border: 1px solid #ffc107;
}

/* 代码隐藏提示 */
.sd-code-hidden {
  background: #f0f4ff;
  color: #5b6abf;
  padding: 40px 20px;
  text-align: center;
  border-radius: 8px;
  font-size: 0.95rem;
  border: 1px dashed #b0bfff;
}
