/* 
 * Custom Theme Overrides
 * ------------------------------------------------------------------
 * Purpose: Fix readability issues in Dark Mode while preserving the
 *          original theme's design (green background blocks).
 * Scope:   All rules are strictly scoped to [data-theme="dark"] to
 *          ensure Light Mode remains completely unaffected.
 * ------------------------------------------------------------------
 */

/* ========================================
   侧边栏菜单 - 白色文字
   (首页、归档、关于、友链、实验室)
   ======================================== */
[data-theme="dark"] .sidebar-menu-link {
  color: #ffffff !important;
}

/* ========================================
   侧边栏挂件 (最新文章、分类、标签云) - 白色文字
   (Server, 服务器科学上网配置手册 等)
   ======================================== */
[data-theme="dark"] .widget,
[data-theme="dark"] .widget a,
[data-theme="dark"] .widget li,
[data-theme="dark"] .widget span,
[data-theme="dark"] .widget ul,
[data-theme="dark"] .widget-link,
[data-theme="dark"] .tagcloud a,
[data-theme="dark"] .category-list-link,
[data-theme="dark"] .category-list-count,
[data-theme="dark"] .tag-list-link,
[data-theme="dark"] .tag-link,
[data-theme="dark"] .tag-list-count,
[data-theme="dark"] .archive-list-link,
[data-theme="dark"] .archive-list-count,
[data-theme="dark"] .flat-box {
  color: #ffffff !important;
}

[data-theme="dark"] .widget-title {
  color: #e0e0e0 !important;
}

[data-theme="dark"] .widget a:hover,
[data-theme="dark"] .tagcloud a:hover,
[data-theme="dark"] .category-list-link:hover,
[data-theme="dark"] .tag-link:hover,
[data-theme="dark"] .tag-list-link:hover,
[data-theme="dark"] .archive-list-link:hover {
  color: #ffffff !important;
  text-decoration: underline;
}

/* ========================================
   侧边栏统计 - 白色文字
   (文章、分类、标签)
   ======================================== */
[data-theme="dark"] .sidebar-state a,
[data-theme="dark"] .sidebar-state-article,
[data-theme="dark"] .sidebar-state-tag,
[data-theme="dark"] .sidebar-state-number {
  color: #ffffff !important;
}

/* ========================================
   归档页面 - 白色文字
   ======================================== */
[data-theme="dark"] .archives-tag-list-link,
[data-theme="dark"] .archives-category-list-link,
[data-theme="dark"] .archive-article-title {
  color: #ffffff !important;
}

/* ========================================
   文章页标签 - 白色文字 (绿色背景上)
   ======================================== */
[data-theme="dark"] .article-tag-list-link,
[data-theme="dark"] .article-category-link,
[data-theme="dark"] .article-date-link {
  color: #ffffff !important;
}

/* ========================================
   行内代码里的链接 - 白色文字 (优先级高于普通链接)
   ======================================== */
[data-theme="dark"] .article-entry a code,
[data-theme="dark"] .article-entry a:has(code),
[data-theme="dark"] .article-entry code,
[data-theme="dark"] code a {
  color: #ffffff !important;
}

/* ========================================
   目录 (TOC) - 亮色文字
   ======================================== */
[data-theme="dark"] .sidebar-toc-sidebar a,
[data-theme="dark"] .sidebar-toc-wrapper a,
[data-theme="dark"] .toc-div-class a,
[data-theme="dark"] .toc-title {
  color: #d0d0d0 !important;
}

[data-theme="dark"] .sidebar-toc-sidebar a:hover,
[data-theme="dark"] .sidebar-toc-sidebar a.active,
[data-theme="dark"] .sidebar-toc-wrapper a:hover,
[data-theme="dark"] .sidebar-toc-wrapper a.active {
  color: #ffffff !important;
}

/* ========================================
   文章内普通链接 - 亮蓝色
   ======================================== */
[data-theme="dark"] .article-entry a {
  color: #64b5f6 !important;
}

[data-theme="dark"] .article-entry a:hover {
  color: #90caf9 !important;
}

/* ========================================
   Mermaid Diagram Styling
   ======================================== */
/* ========================================
   Mermaid Diagram Styling
   ======================================== */
.mermaid {
  background: #f0f0f0; /* Light mode default */
  border-radius: 8px;
  padding: 1rem;
  margin: 2rem 0;
  text-align: center;
  overflow-x: auto;
}

[data-theme="dark"] .mermaid {
  background: #2a2d33; /* Dark mode background matching theme */
  border: 1px solid #3b3e45;
}

.mermaid svg {
  max-width: 100%;
  height: auto;
  min-height: 300px; /* Ensure it's not too short */
}

/* ========================================
   Typography Improvements
   ======================================== */
/* Increase line height for better readability */
.article-entry p,
.article-entry li {
  line-height: 1.8;
  margin-bottom: 1.2rem;
}

/* Cleaner Headings (Remove default # prefix if possible via CSS, 
   though usually it's in the HTML template. 
   Here we just add spacing) */
.article-entry h1,
.article-entry h2,
.article-entry h3 {
  margin-top: 2.5rem;
  margin-bottom: 1.5rem;
}

/* Callout/Blockquote styling */
.article-entry blockquote {
  border-left: 4px solid var(--red-1);
  background: var(--red-6);
  padding: 1rem;
  border-radius: 0 4px 4px 0;
  margin: 2rem 0;
}

/* ========================================
   APlayer 暗黑模式 - 歌曲名恢复为白色
   ======================================== */
[data-theme="dark"] .aplayer-title,
[data-theme="dark"] .aplayer-list-title,
[data-theme="dark"] .aplayer-music,
[data-theme="dark"] .aplayer-list ol li .aplayer-list-index,
[data-theme="dark"] .aplayer-list ol li .aplayer-list-author {
  color: #ffffff !important;
}

#aplayer-custom .aplayer-list ol li.aplayer-playlist-switcher {
  display: flex;
  align-items: stretch;
  padding: 0;
  cursor: default;
}

#aplayer-custom .aplayer-playlist-switcher-btn {
  flex: 1;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0.75rem 0.55rem;
  line-height: 1.2;
  cursor: pointer;
}

#aplayer-custom .aplayer-playlist-switcher-btn.is-active {
  color: var(--color-link);
  font-weight: 700;
}

#aplayer-custom .aplayer-playlist-switcher-btn.is-loading,
#aplayer-custom .aplayer-playlist-switcher-btn:disabled {
  opacity: 0.65;
}

#aplayer-custom .aplayer-playlist-switcher-divider {
  width: 1px;
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] #aplayer-custom .aplayer-playlist-switcher-divider {
  background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
  #aplayer-custom .aplayer-playlist-switcher-btn {
    padding: 0.78rem 0.35rem;
    font-size: 0.82rem;
  }
}

/* ========================================
   APlayer 歌词 - 红梅配色（亮色+暗色通用）
   当前播放行：橙红；未播放行：粉红色
   ======================================== */
.aplayer-lrc p {
  color: #f4a0b0 !important;  /* 粉红 - 未播放 */
  opacity: 0.7;
}

.aplayer-lrc p.aplayer-lrc-current {
  color: #e8603c !important;  /* 橙红梅 - 当前播放 */
  opacity: 1;
}

.kugou-monitor {
  margin-top: 1.5rem;
}

.kugou-status-page {
  margin-top: 1.2rem;
}

.kugou-status-hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: stretch;
  padding: 1.2rem 1.3rem;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(232, 96, 60, 0.08), rgba(255, 255, 255, 0.92));
  border: 1px solid rgba(232, 96, 60, 0.12);
  margin-bottom: 1rem;
}

.kugou-status-kicker {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b13f22;
}

.kugou-status-hero h2 {
  margin: 0 0 0.4rem;
}

.kugou-status-hero p {
  margin: 0;
}

.kugou-status-total {
  min-width: 180px;
  border-radius: 18px;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.kugou-status-total span,
.kugou-status-total small {
  color: rgba(0, 0, 0, 0.6);
}

.kugou-status-total strong {
  display: block;
  margin: 0.35rem 0;
  font-size: 2rem;
  line-height: 1;
}

.kugou-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.kugou-status-card {
  border-radius: 18px;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.kugou-status-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.kugou-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.6rem;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 700;
}

.kugou-status-badge.is-good {
  background: rgba(60, 179, 113, 0.16);
  color: #1b7a47;
}

.kugou-status-badge.is-bad {
  background: rgba(230, 96, 60, 0.16);
  color: #b13f22;
}

.kugou-status-badge.is-warn,
.kugou-status-badge.is-loading {
  background: rgba(230, 168, 60, 0.18);
  color: #9a6400;
}

.kugou-status-label {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.kugou-status-detail {
  margin: 0.55rem 0 0.95rem;
  color: rgba(0, 0, 0, 0.62);
}

.kugou-status-meta {
  display: grid;
  gap: 0.45rem;
  font-size: 0.95rem;
}

.kugou-status-meta span {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.kugou-status-footnote {
  margin-top: 1rem;
  color: rgba(0, 0, 0, 0.62);
}

.kugou-monitor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.kugou-monitor-card {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.kugou-monitor-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.kugou-monitor-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.6rem;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 700;
}

.kugou-monitor-badge.is-good {
  background: rgba(60, 179, 113, 0.16);
  color: #1b7a47;
}

.kugou-monitor-badge.is-bad {
  background: rgba(230, 96, 60, 0.16);
  color: #b13f22;
}

.kugou-monitor-badge.is-warn,
.kugou-monitor-badge.is-loading {
  background: rgba(230, 168, 60, 0.18);
  color: #9a6400;
}

.kugou-monitor-list {
  margin: 0;
}

.kugou-monitor-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}

.kugou-monitor-list div:last-child {
  border-bottom: 0;
}

.kugou-monitor-list dt {
  color: rgba(0, 0, 0, 0.58);
}

.kugou-monitor-list dd {
  margin: 0;
  text-align: right;
  font-weight: 600;
  word-break: break-word;
}

.kugou-monitor-meta,
.kugou-monitor-traffic {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.8rem;
  margin: 1rem 0;
}

.kugou-monitor-meta-item,
.kugou-monitor-traffic-item {
  border-radius: 14px;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.kugou-monitor-meta-item span,
.kugou-monitor-traffic-item span {
  display: block;
  font-size: 0.88rem;
  color: rgba(0, 0, 0, 0.6);
  margin-bottom: 0.3rem;
}

.kugou-monitor-meta-item strong,
.kugou-monitor-traffic-item strong {
  font-size: 1rem;
}

[data-theme="dark"] .kugou-monitor-card,
[data-theme="dark"] .kugou-monitor-meta-item,
[data-theme="dark"] .kugou-monitor-traffic-item,
[data-theme="dark"] .kugou-status-card,
[data-theme="dark"] .kugou-status-total {
  background: rgba(28, 32, 38, 0.88);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

[data-theme="dark"] .kugou-status-hero {
  background: linear-gradient(135deg, rgba(232, 96, 60, 0.14), rgba(28, 32, 38, 0.92));
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .kugou-monitor-list div {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .kugou-monitor-list dt,
[data-theme="dark"] .kugou-monitor-meta-item span,
[data-theme="dark"] .kugou-monitor-traffic-item span,
[data-theme="dark"] .kugou-status-detail,
[data-theme="dark"] .kugou-status-total span,
[data-theme="dark"] .kugou-status-total small,
[data-theme="dark"] .kugou-status-footnote {
  color: rgba(255, 255, 255, 0.62);
}

@media (max-width: 700px) {
  .kugou-status-hero {
    flex-direction: column;
  }

  .kugou-status-total {
    min-width: 0;
  }
}
