/* ================================================
   浅色主题颜色对比度全面修复
   修复所有蓝色背景上的蓝色文字、浅色背景上的浅色文字等问题
   ================================================ */

[data-theme="light"] {
  /* 1. 修复蓝色背景上的蓝色文字问题 */
  [style*="background: #00"],
  [style*="background:#00"],
  [style*="background-color: #00"],
  [style*="background-color:#00"],
  [style*="background: linear-gradient"][style*="#00"],
  [style*="background:linear-gradient"][style*="#00"] {
    color: #ffffff !important;
  }

  /* 2. 修复特定内联样式颜色 */
  [style*="color: #00FFFF"],
  [style*="color:#00FFFF"],
  [style*="color: #00BFFF"], 
  [style*="color:#00BFFF"],
  [style*="color: #00f3ff"],
  [style*="color:#00f3ff"],
  [style*="color: #66CCFF"],
  [style*="color:#66CCFF"] {
    color: var(--text-primary) !important;
  }

  /* 3. 修复特定元素的内联样式 */
  .details span[style*="color: #00BFFF"],
  .details span[style*="color:#00BFFF"] {
    color: var(--text-primary) !important;
  }

  /* 4. 修复标题栏文字颜色 */
  .title-bar,
  [style*="color: #00ffff"],
  [style*="color:#00ffff"] {
    color: var(--text-primary) !important;
  }

  /* 5. 修复AI消息文字颜色 */
  .ai-message,
  [style*="color: #00ffff"][class*="ai"],
  [style*="color:#00ffff"][class*="ai"] {
    color: var(--text-primary) !important;
  }

  /* 6. 修复重复文本颜色 */
  .repeat-text,
  [style*="color: #00f3ff"],
  [style*="color:#00f3ff"] {
    color: var(--text-primary) !important;
  }

  /* 7. 修复进度条相关文字 */
  .progress-text,
  .progress-info,
  [style*="color: #00a876"],
  [style*="color:#00a876"] {
    color: var(--text-primary) !important;
  }

  /* 8. 修复成功状态文字 */
  .success-text,
  [style*="color: #00c896"],
  [style*="color:#00c896"] {
    color: var(--success-text, #1a365d) !important;
  }

  /* 9. 修复所有按钮文字颜色 */
  button[style*="background: #00"],
  button[style*="background:#00"],
  button[style*="background-color: #00"],
  button[style*="background-color:#00"] {
    color: #ffffff !important;
  }

  /* 10. 修复卡片和容器内的文字 */
  .card[style*="background: #00"],
  .container[style*="background: #00"],
  .panel[style*="background: #00"] {
    color: #ffffff !important;
  }

  /* 11. 修复表格中的颜色问题 */
  table [style*="color: #00"],
  table [style*="color:#00"] {
    color: var(--text-primary) !important;
  }

  /* 12. 修复表单元素颜色 */
  input[style*="color: #00"],
  select[style*="color: #00"],
  textarea[style*="color: #00"] {
    color: var(--text-primary) !important;
  }

  /* 13. 修复统计数字颜色 */
  .stat-number[style*="color: #00"],
  .stat-value[style*="color: #00"] {
    color: var(--text-primary) !important;
  }

  /* 14. 修复标签和徽章颜色 */
  .badge[style*="background: #00"],
  .label[style*="background: #00"],
  .tag[style*="background: #00"] {
    color: #ffffff !important;
  }

  /* 15. 修复导航菜单颜色 */
  .nav-item[style*="color: #00"],
  .menu-item[style*="color: #00"] {
    color: var(--text-primary) !important;
  }

  /* 16. 修复图标旁边的文字 */
  .icon-text[style*="color: #00"],
  [class*="icon"][style*="color: #00"] {
    color: var(--text-primary) !important;
  }

  /* 17. 修复提示和工具提示 */
  .tooltip[style*="background: #00"],
  .hint[style*="background: #00"] {
    color: #ffffff !important;
  }

  /* 18. 修复模态框内容 */
  .modal[style*="background: #00"],
  .dialog[style*="background: #00"] {
    color: #ffffff !important;
  }

  /* 19. 修复页脚和页眉 */
  footer[style*="background: #00"],
  header[style*="background: #00"] {
    color: #ffffff !important;
  }

  /* 20. 修复所有其他元素 - 通用规则 */
  *[style*="background: #00"]:not([class*="btn"]):not([class*="button"]),
  *[style*="background:#00"]:not([class*="btn"]):not([class*="button"]),
  *[style*="background-color: #00"]:not([class*="btn"]):not([class*="button"]),
  *[style*="background-color:#00"]:not([class*="btn"]):not([class*="button"]) {
    color: #ffffff !important;
  }

  /* 21. 修复渐变背景上的文字 */
  *[style*="gradient"][style*="#00"] {
    color: #ffffff !important;
  }

  /* 22. 确保文字在蓝色系背景上可见 */
  *[style*="blue"],
  *[style*="#0066ff"],
  *[style*="#00d4ff"],
  *[style*="#0099ff"] {
    color: #ffffff !important;
  }

  /* 23. 修复透明度导致的对比度问题 */
  *[style*="rgba(0,"] {
 /*   background-color: var(--card-bg) !important;*/
    color: #191919 !important;
  }

  /* 24. 修复低对比度的文字阴影 
  *[style*="text-shadow"] {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
  } */

  /* 25. 修复边框颜色对比度 */
  *[style*="border-color: #00"],
  *[style*="border-color:#00"] {
    border-color: var(--border-color) !important;
  }
}

/* ================================================
   面板标题专项修复 - 修复AI全脑速记、抗遗忘训练、AI智能单词文章等
   ================================================ */

[data-theme="light"] {
  /* 修复所有面板标题文字颜色 */
  .panel-header h2,
  .panel-header h3,
  .panel-header h4 {
    color: var(--text-primary) !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
  }

  /* 修复特定面板标题 */
  #wordMemoryPanel .panel-header h2,  /* AI全脑速记 */
  #errorWordsPanel .panel-header h2,   /* 抗遗忘训练 */
  #readingComprehensionPanel .panel-header h2,  /* AI智能单词文章 */
  #compositionPanel .panel-header h2,  /* AI作文练习 */
  #englishCompositionPanel .panel-header h2,  /* AI作文辅导 */
  #grammarLearningPanel .panel-header h2,  /* AI语法学习 */
  #historyPanel .panel-header h2,      /* 学习记录 */
  #myDetailsPanel .panel-header h2,    /* 学习报告 */
  #personalCenterPanel .panel-header h2,  /* 个人中心 */
  #userManagementPanel .panel-header h2,  /* 学员管理 */
  #wordBankPanel .panel-header h2,     /* 单词库管理 */
  #importExportPanel .panel-header h2,  /* 单词导入导出 */
  #assessmentReportPanel .panel-header h2 {  /* 测评报告 */
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 24px !important;
  }

  /* 修复内联样式的面板标题 */
  .panel-header h2[style*="white-space"],
  .panel-header h2[style*="display: inline-block"],
  .panel-header h2[style*="color:"] {
    color: var(--text-primary) !important;
  }

  /* 浅色主题下所有面板标题显示为白色 */
  [data-theme="light"] #wordMemoryPanel .panel-header h2,
  [data-theme="light"] #errorWordsPanel .panel-header h2,
  [data-theme="light"] #readingComprehensionPanel .panel-header h2,
  [data-theme="light"] #compositionPanel .panel-header h2,
  [data-theme="light"] #englishCompositionPanel .panel-header h2,
  [data-theme="light"] #grammarLearningPanel .panel-header h2,
  [data-theme="light"] #historyPanel .panel-header h2,
  [data-theme="light"] #myDetailsPanel .panel-header h2,
}

/* 暗色主题下移除抗遗忘训练面板头部渐变背景 */
[data-theme="dark"] #errorWordsPanel .panel-header {
  background: var(--card-bg) !important;
}
  [data-theme="light"] #personalCenterPanel .panel-header h2,
  [data-theme="light"] #userManagementPanel .panel-header h2,
  [data-theme="light"] #wordBankPanel .panel-header h2,
  [data-theme="light"] #importExportPanel .panel-header h2,
  [data-theme="light"] #assessmentReportPanel .panel-header h2 {
    color: white !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  }

  /* 修复面板头部背景上的文字 - 蓝色渐变背景使用白色文字 */
  .panel-header[style*="background"] h2,
  .panel-header[style*="gradient"] h2,
  .panel-header[style*="blue"] h2,
  .panel-header[style*="#00"] h2,
  .panel-header[style*="linear-gradient"] h2,
  .panel-header[style*="radial-gradient"] h2 {
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
    font-weight: 700 !important;
  }

  /* 特殊处理蓝色渐变背景的面板标题 - 使用更强大的选择器覆盖内联样式 */
  [data-theme="light"] .panel-header {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end)) !important;
  }

  /* 使用属性选择器覆盖内联样式 */
  [data-theme="light"] .panel-header h2,
  [data-theme="light"] .panel-header h2[style*="color:"] {
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
    font-weight: 700 !important;
    font-size: 24px !important;
  }

  /* 专门针对特定面板的标题修复 */
  [data-theme="light"] #wordMemoryPanel .panel-header h2,
  [data-theme="light"] #errorWordsPanel .panel-header h2,
  [data-theme="light"] #readingComprehensionPanel .panel-header h2,
  [data-theme="light"] #compositionPanel .panel-header h2,
  [data-theme="light"] #myDetailsPanel .panel-header h2,
  [data-theme="light"] #personalCenterPanel .panel-header h2 {
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
    font-weight: 700 !important;
    font-size: 24px !important;
  }
}

/* ================================================
   辅助样式 - 增强可读性
   ================================================ */

[data-theme="light"] {
  /* 增加文字粗细 */
  .low-contrast-text {
    font-weight: 600 !important;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5) !important;
  }

  /* 为浅色文字添加深色阴影 */
  .light-text {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
  }

  /* 为深色文字添加浅色阴影 */
  .dark-text {
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5) !important;
  }

  /* 确保链接可见性 */
  a[style*="color: #00"],
  a[style*="color:#00"] {
    color: var(--primary-color) !important;
    text-decoration: underline !important;
  }

  /* 修复占位符文字 */
  ::placeholder {
    color: var(--text-secondary) !important;
    opacity: 1 !important;
  }

  /* 修复选择文字的背景色 */
  ::selection {
    background-color: var(--primary-color) !important;
    color: #ffffff !important;
  }

  /* 修复鼠标悬停状态 */
  *[style*="color: #00"]:hover,
  *[style*="color:#00"]:hover {
    color: var(--text-primary) !important;
  }
}

/* ================================================
   响应式修复 - 不同设备下的对比度优化
   ================================================ */

@media (max-width: 768px) {
  [data-theme="light"] {
    /* 在移动设备上增加字体大小 */
    *[style*="color: #00"] {
      font-size: 16px !important;
      font-weight: 600 !important;
    }
    
    /* 移动设备上的按钮文字 */
    button[style*="background: #00"] {
      font-size: 16px !important;
      font-weight: 600 !important;
    }
  }
}

@media (prefers-color-scheme: light) {
  /* 系统级浅色主题支持 */
  :root:not([data-theme="dark"]) {
    *[style*="color: #00"] {
      color: var(--text-primary) !important;
    }
    
    *[style*="background: #00"] {
      color: #ffffff !important;
    }
  }
}

/* ================================================
   打印样式 - 确保打印时的对比度
   ================================================ */

@media print {
  [data-theme="light"] {
    *[style*="color: #00"] {
      color: #000000 !important;
    }
    
    *[style*="background: #00"] {
      background-color: #ffffff !important;
      color: #000000 !important;
      -webkit-print-color-adjust: exact !important;
      print-color-adjust: exact !important;
    }
  }
}

/* ================================================
   高对比度模式支持
   ================================================ */

@media (prefers-contrast: high) {
  [data-theme="light"] {
    *[style*="color: #00"] {
      color: #000000 !important;
      font-weight: 700 !important;
    }
    
    *[style*="background: #00"] {
      background-color: #000000 !important;
      color: #ffffff !important;
      border: 2px solid #000000 !important;
    }
  }
}

/* ================================================
   动画效果 - 平滑的颜色过渡
   ================================================ */

[data-theme="light"] {
  *[style*="color: #00"] {
    transition: color 0.3s ease-in-out !important;
  }
  
  *[style*="background: #00"] {
    transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out !important;
  }
}

/* ================================================
   重要提示：这些修复只应用于浅色主题
   暗色主题保持原有样式不变
   ================================================ */