/* ================================================================
   新华字典 · 丰富模块样式
   Xinhua Dictionary — Rich Module CSS
   用于汉字详情页和成语详情页的扩展模块
   ================================================================ */

/* ========== 汉字详情页扩展模块 ========== */

/* 编码信息网格 */
.code-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.code-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.code-item .code-label {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}
.code-item .code-value {
  color: var(--gold);
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}
.code-item.full-width {
  grid-column: 1 / -1;
}

/* 字源演变时间轴 */
.etymology-timeline {
  position: relative;
  padding-left: 24px;
}
.etymology-timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--gold-gradient);
  opacity: 0.3;
  border-radius: 1px;
}
.ety-item {
  position: relative;
  padding-bottom: 18px;
}
.ety-item:last-child {
  padding-bottom: 0;
}
.ety-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 4px;
  width: 10px;
  height: 10px;
  background: var(--bg-card);
  border: 2px solid var(--gold);
  border-radius: 50%;
}
.ety-item.active::before {
  background: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-glow);
}
.ety-era {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 4px;
}
.ety-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* 说文解字特殊样式 */
.shuowen-box {
  background: var(--bg-glass);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
}
.shuowen-box::before {
  content: '《说文》';
  position: absolute;
  top: -10px;
  left: 16px;
  background: var(--bg-card);
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  border: 1px solid var(--border-gold);
  border-radius: 10px;
}
.shuowen-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.9;
  font-family: var(--font-kai);
  margin-top: 8px;
}
.shuowen-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

/* 常用词组表格 */
.word-table {
  width: 100%;
  border-collapse: collapse;
}
.word-table th,
.word-table td {
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.word-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.word-table td {
  color: var(--text-primary);
}
.word-table .wt-word {
  color: var(--gold);
  font-weight: 600;
}
.word-table .wt-pinyin {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}
.word-table .wt-mean {
  color: var(--text-secondary);
}
.word-table tr:hover td {
  background: var(--bg-glass);
}
.word-table tr:last-child td {
  border-bottom: none;
}

/* 英文翻译扩展 */
.english-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.english-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--accent-blue);
  font-style: italic;
}
.english-item::before {
  content: '•';
  color: var(--gold);
}

/* 频率条 */
.freq-section {
  margin-top: 12px;
}
.freq-bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  overflow: hidden;
}
.freq-bar {
  height: 100%;
  background: var(--gold-gradient);
  border-radius: 5px;
  width: 0;
  animation: grow-bar 1.5s ease forwards 0.5s;
}
@keyframes grow-bar {
  to { width: var(--freq-width, 80%); }
}
.freq-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.freq-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--gold-glow);
  border: 1px solid var(--border-gold);
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
  margin-left: 8px;
}

/* 等级标签 */
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.level-badge.level-1 {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.level-badge.level-2 {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.level-badge.level-3 {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-orange);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ========== 成语详情页扩展模块 ========== */

/* 感情色彩标签 */
.emotion-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}
.emotion-tag.positive {
  background: rgba(34, 197, 94, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(34, 197, 94, 0.25);
}
.emotion-tag.negative {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.emotion-tag.neutral {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

/* 常用程度指示器 */
.freq-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}
.freq-dots {
  display: flex;
  gap: 4px;
}
.freq-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}
.freq-dot.active {
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold-glow);
}
.freq-label-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* 成语故事卡片 */
.story-card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.story-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold-gradient);
  opacity: 0.3;
}
.story-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 2;
  text-indent: 2em;
}
.story-source {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-muted);
}
.story-source strong {
  color: var(--gold);
}

/* 例句列表 */
.sentence-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sentence-item {
  position: relative;
  padding: 14px 0 14px 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.8;
}
.sentence-item:last-child {
  border-bottom: none;
}
.sentence-item::before {
  content: attr(data-num);
  position: absolute;
  left: 0;
  top: 14px;
  width: 22px;
  height: 22px;
  background: var(--gold-glow);
  border: 1px solid var(--border-gold);
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sentence-item strong {
  color: var(--gold);
}

/* 结构分析 */
.structure-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.structure-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.structure-label {
  flex-shrink: 0;
  width: 60px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-top: 2px;
}
.structure-value {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.7;
}

/* 成语接龙 */
.jielong-chain {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.jielong-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
}
.jielong-item:hover {
  border-color: var(--border-gold);
  transform: translateX(4px);
}
.jielong-from {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}
.jielong-arrow {
  color: var(--gold);
  font-size: 16px;
}
.jielong-to {
  font-size: 15px;
  color: var(--gold);
  font-weight: 700;
}
.jielong-next {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
}

/* 标签云 */
.tag-cloud-rich {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-rich {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  transition: var(--transition);
  cursor: pointer;
}
.tag-rich:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-glow);
  transform: translateY(-1px);
}

/* 出处原文引用 */
.source-quote {
  background: var(--bg-glass);
  border-left: 3px solid var(--gold);
  padding: 14px 18px;
  margin: 12px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.source-quote .quote-text {
  font-size: 14px;
  color: var(--text-primary);
  font-family: var(--font-kai);
  line-height: 1.8;
}
.source-quote .quote-source {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* 英文翻译区域 */
.english-trans {
  font-size: 15px;
  color: var(--accent-blue);
  font-style: italic;
  line-height: 1.7;
  padding: 10px 0;
}

/* 逐字拆解增强 */
.char-breakdown-rich {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.cb-card {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 10px;
  text-align: center;
  transition: var(--transition);
}
.cb-card:hover {
  border-color: var(--border-gold);
  transform: translateY(-2px);
}
.cb-card .cb-char-main {
  font-size: 32px;
  font-family: var(--font-kai);
  color: var(--text-primary);
  line-height: 1.2;
}
.cb-card .cb-pinyin {
  font-size: 12px;
  color: var(--gold);
  margin-top: 4px;
  font-weight: 600;
}
.cb-card .cb-stroke {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.cb-card .cb-mean {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.4;
}

/* 响应式 */
@media (max-width: 900px) {
  .code-grid {
    grid-template-columns: 1fr;
  }
  .char-breakdown-rich {
    grid-template-columns: repeat(2, 1fr);
  }
  .word-table {
    font-size: 12px;
  }
  .word-table th,
  .word-table td {
    padding: 8px;
  }
}

@media (max-width: 600px) {
  .char-breakdown-rich {
    grid-template-columns: 1fr;
  }
  .jielong-item {
    flex-wrap: wrap;
  }
  .jielong-next {
    margin-left: 0;
    width: 100%;
    text-align: right;
  }
}

/* ========== 空数据提示 ========== */
.empty-hint {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
}
.empty-hint .empty-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 12px;
  opacity: 0.5;
}
.empty-hint p {
  font-size: 14px;
  margin: 0 0 6px;
  color: var(--text-secondary);
}
.empty-hint .empty-sub {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ========== 高优扩展：汉字7维度 ========== */

/* 繁体字标签 */
.char-traditional {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.trad-char {
  font-size: 20px;
  font-family: var(--font-kai);
  color: var(--accent-gold);
  margin: 0 4px;
  vertical-align: middle;
}

/* 多音字读音 */
.polyphone-list { display: flex; flex-direction: column; gap: 10px; }
.poly-item {
  padding: 10px 12px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-gold);
}
.poly-pinyin {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
}
.poly-mean { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.poly-example { font-size: 12px; color: var(--text-muted); margin-top: 2px; font-style: italic; }
.poly-note { font-size: 11px; color: var(--accent-gold); margin-top: 4px; }

/* 成语典故 */
.idiom-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.idiom-item {
  padding: 12px 14px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
}
.idiom-item:hover { border-color: var(--accent); transform: translateY(-1px); }
.idiom-char { font-size: 18px; font-weight: 700; color: var(--text-primary); font-family: var(--font-kai); }
.idiom-py { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); margin-top: 2px; }
.idiom-mean { font-size: 13px; color: var(--text-secondary); margin-top: 4px; line-height: 1.5; }

/* 古籍用例 */
.classics-list { display: flex; flex-direction: column; gap: 12px; }
.classic-item {
  padding: 12px 16px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}
.classic-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.classic-book { font-size: 14px; font-weight: 600; color: var(--accent); }
.classic-dynasty { font-size: 11px; color: var(--text-muted); background: var(--bg-card); padding: 1px 8px; border-radius: 10px; }
.classic-text { font-size: 14px; line-height: 1.8; color: var(--text-secondary); font-family: var(--font-kai); }

/* 名句引用 */
.quotes-list { display: flex; flex-direction: column; gap: 14px; }
.quote-item {
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--bg-hover), var(--bg-card));
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-gold);
}
.quote-text { font-size: 15px; line-height: 1.8; color: var(--text-primary); font-family: var(--font-kai); }
.quote-meta { font-size: 12px; color: var(--text-muted); margin-top: 6px; text-align: right; }

/* 易混淆辨析 */
.confusable-list { display: flex; flex-direction: column; gap: 12px; }
.conf-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
}
.conf-char {
  font-size: 28px;
  font-family: var(--font-kai);
  color: var(--accent-red);
  min-width: 40px;
  text-align: center;
  line-height: 1.2;
  flex-shrink: 0;
}
.conf-diff { font-size: 13px; line-height: 1.7; color: var(--text-secondary); }

/* ========== 高优扩展：成语3维度 ========== */

/* 用法辨析 */
.usage-note-box {
  padding: 14px 16px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-green);
}
.usage-note-box p { font-size: 14px; line-height: 1.9; color: var(--text-secondary); margin: 0; }

/* 误用提醒 */
.misusage-box {
  padding: 14px 16px;
  background: rgba(239,68,68,0.06);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-red);
}
.misusage-box p { font-size: 14px; line-height: 1.9; color: var(--text-secondary); margin: 0; }

/* 近义辨析 */
.syn-compare-list { display: flex; flex-direction: column; gap: 10px; }
.syncomp-item {
  padding: 10px 14px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.syncomp-idiom { font-size: 16px; font-weight: 700; color: var(--accent); font-family: var(--font-kai); }
.syncomp-diff { font-size: 13px; line-height: 1.7; color: var(--text-secondary); margin-top: 4px; }
