/* 添加在文件开头 */
:root {
  --bg-primary: #f7f9fc;
  --bg-card: #fff;
  --text-primary: #1a1a1a;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --hover-bg: #f3f4f6;
  --code-bg: #f8f9fa;
  --error-bg: #fff2f0;
  --error-border: #ffccc7;
  --link-color: #1890ff;
  --icon-color: #9ca3af;
}

[theme-mode="dark"] {
  --bg-primary: #141414;
  --bg-card: #1f1f1f;
  --text-primary: #ffffff;
  --text-secondary: #a3a3a3;
  --border-color: #303030;
  --hover-bg: #262626;
  --code-bg: #262626;
  --error-bg: #2a1f1f;
  --error-border: #5c2223;
  --link-color: #4096ff;
  --icon-color: #666666;
}

/* 修改所有颜色相关的样式 */
.problem-info {
  color: var(--text-primary);
}

.interaction-stats {
  color: var(--text-secondary);
}

.stats-container {
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.stat-label {
  color: var(--text-secondary);
}

.stat-value {
  color: var(--text-primary);
}

.language-label {
  color: var(--text-primary);
}

.error-output {
  background: var(--error-bg);
  border-color: var(--error-border);
}

/* 链接样式 */
a {
  color: var(--link-color);
}

a:hover {
  color: var(--link-color);
  opacity: 0.8;
}

/* 图标颜色 */
.anticon {
  color: var(--icon-color);
}

/* 修改模态框和其他组件样式 */
.ant-modal-content,
.ant-modal-header,
.ant-modal-body,
.ant-modal-footer {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

.ant-modal-title {
  color: var(--text-primary) !important;
}

.ant-tabs-tab {
  color: var(--text-secondary) !important;
}

.ant-tabs-tab-active {
  color: var(--link-color) !important;
}

.ant-tabs-ink-bar {
  background: var(--link-color) !important;
}

/* 其他已有的样式保持不变 */
.problem-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 1rem;
}

.problem-info-left {
  flex: 1;
}

.problem-info-left h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
}

.problem-info-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1rem;
}

.interaction-stats {
  display: flex;
  gap: 1rem;
  color: #6b7280;
}

.stats-row {
  display: flex;
  gap: 2rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.problem-info-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}

.problem-header {
  flex: 1;
}

.stats-container {
  display: flex;
  justify-content: flex-end;
  gap: 2rem;
  color: #6b7280;
  font-size: 0.875rem;
  padding: 1rem 0;
}

.stats-group {
  display: flex;
  gap: 2rem;
  align-items: center;
  justify-content: flex-end;
}

.interaction-stats {
  display: flex;
  gap: 1rem;
  color: #6b7280;
  margin-left: 2rem;
  padding-left: 2rem;
  border-left: 1px solid #e5e7eb;
}

.problem-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.interaction-stats {
  color: #9ca3af;
}

/* 添加标签区域样式 */
.tag-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* 添加统计信息区域样式 */
.stats-container {
  display: flex;
  gap: 2rem;
  color: #6b7280;
  font-size: 0.875rem;
  border-top: 1px solid #f3f4f6;
  border-bottom: 1px solid #f3f4f6;
  padding: 1rem 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  color: #6b7280;
}

.stat-value {
  font-size: 1.125rem;
  font-weight: 500;
  color: #374151;
}

/* 已有的布局样式保持不变 */
.problem-content {
  display: flex;
  gap: 16px;
}

.problem-content.vertical {
  flex-direction: column;
}

.problem-content.horizontal {
  flex-direction: row;
}

.problem-content .description-card,
.problem-content .code-card {
  flex: 1;
}

/* 在水平布局时限制描述卡片宽度 */
.problem-content.vertical .description-card,
.problem-content.vertical .code-card {
  width: 100%;
  max-width: 100%;
}

.problem-content.horizontal .description-card {
  width: 45%;
  max-width: 45%;
}

.problem-content.horizontal .code-card {
  width: 55%;
}

.description-card {
  width: 45%;
}

.code-card {
  width: 55%;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.action-bar {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}

.language-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.language-label {
  font-size: 16px;
  font-weight: 500;
  color: #333;
}

.problem-detail {
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  background: var(--bg-card);  /* 修改为使用 --bg-card 变量 */
  position: relative;
}

.back-button {
  position: absolute;
  left: 24px;
  top: -10px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  color: #374151;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.back-button:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .back-button {
    left: 16px;
    top: 16px;
    padding: 6px 12px;
  }
}

/* 在小屏幕上调整padding */
@media (max-width: 1024px) {
  .problem-detail {
    padding: 16px;
    max-width: 100%;  /* 小屏幕下占满全屏 */
  }
}

@media (max-width: 480px) {
  .problem-detail {
    padding: 12px;
  }
}

.problem-info-container {
  width: 100%;
}

.problem-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.problem-title {
  font-size: 24px;
  margin: 0;
  word-break: break-word;
}

.tag-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stats-container {
  margin-bottom: 20px;
}

.stats-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  min-width: 80px;
}

.stat-label {
  font-size: 14px;
  color: #666;
}

.stat-value {
  font-size: 18px;
  font-weight: 500;
}

.interaction-stats {
  display: flex;
  gap: 16px;
  margin-left: auto;
}

.problem-content {
  display: flex;
  gap: 24px;
}

.problem-content.vertical {
  flex-direction: column;
}

.problem-content.horizontal {
  flex-direction: row;
}

.description-card, .code-card {
  flex: 1;
  min-width: 0;
}

.language-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.action-bar {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

@media (max-width: 768px) {
  .action-bar {
    flex-direction: column;
  }
  
  .action-bar button {
    width: 100%;
    margin-right: 0 !important;
  }
}

/* 响应式样式 */
@media (max-width: 1024px) {
  .problem-detail {
    padding: 16px !important;
  }
  
  .problem-content.horizontal {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .back-button-container,
  .layout-switch {
    display: none;
  }

  .stats-group {
    flex-direction: column;
    gap: 12px;
  }
  
  .stat-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  
  .language-selector {
    padding: 12px 16px !important;
  }
  
  .language-controls {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .language-controls .ant-select {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  .action-bar {
    flex-direction: column;
  }
  
  .action-bar button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .problem-detail {
    padding: 12px !important;
  }
  
  .problem-title {
    font-size: 20px;
  }
  
  .description-card, .code-card {
    padding: 16px !important;
  }
}

/* 添加以下样式到现有的CSS文件中 */

.run-result-container {
  padding: 16px 0;
}

.run-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
}

.run-loading p {
  margin-top: 16px;
  color: #666;
}

.run-tabs {
  margin-top: 24px;
}

.test-case-detail {
  padding: 16px;
  background: #f9f9f9;
  border-radius: 8px;
}

.test-case-section {
  margin-bottom: 20px;
}

.test-case-section:last-child {
  margin-bottom: 0;
}

.test-case-io {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 12px;
  margin: 0;
  overflow-x: auto;
  font-family: 'Courier New', Courier, monospace;
}

.error-output {
  background: #fff2f0;
  border-color: #ffccc7;
}

.run-result-modal .ant-modal-content {
  border-radius: 12px;
  overflow: hidden;
}

.run-result-modal .ant-modal-header {
  border-bottom: 1px solid #f0f0f0;
  padding: 16px 24px;
}

.run-result-modal .ant-modal-body {
  padding: 24px;
}

.run-result-modal .ant-result {
  padding: 24px 0;
}

.run-result-modal .ant-tabs-nav {
  margin-bottom: 16px;
}



/* 修改相关样式 */
.problem-detail {
  background: var(--bg-primary);
}

.problem-title {
  color: var(--text-primary);
}

.stats-container {
  border-color: var(--border-color);
}

.stat-label {
  color: var(--text-secondary);
}

.stat-value {
  color: var(--text-primary);
}

.interaction-stats {
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.description-card, 
.code-card {
  background: var(--bg-card) !important;
}

.language-selector {
  background: var(--code-bg) !important;
}

.back-button {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.back-button:hover {
  background: var(--hover-bg);
}

.test-case-detail {
  background: var(--code-bg);
}

.test-case-io {
  background: var(--bg-card);
  border-color: var(--border-color);
}

/* 修改运行结果模态框样式 */
.run-result-modal .ant-modal-content {
  background: var(--bg-card);
}

.run-result-modal .ant-modal-header {
  background: var(--bg-card);
  border-color: var(--border-color);
}

.run-loading p {
  color: var(--text-secondary);
}

/* 其他样式保持不变 */