/* ── Law Module — XUANJI 書院風 ── */

/* Shared platform variables (same as other pages) */
:root {
  --navy: #003A70;
  --gold: #C5A258;
  --bg: #F7F8FA;
  --card: #fff;
  --red: #D32F2F;
  --green: #2E7D32;
  --orange: #EF6C00;
  --blue: #1565C0;
  --gray: #6B7280;
  /* Law-specific palette (書院風) */
  --law-navy: #1B2D4F;
  --law-navy-light: #2E4A6E;
  --law-gold: #8B7355;
  --law-gold-bg: #F5F0E8;
  --law-green: #1B6B3A;
  --law-green-bg: #E8F5ED;
  --law-red: #8B2020;
  --law-red-bg: #FDE8E8;
  --law-amber: #7A5C00;
  --law-amber-bg: #FFF8E1;
  --law-blue: #1A4B8C;
  --law-blue-bg: #E8F0FD;
  --law-purple: #5B2D8E;
  --law-purple-bg: #F3E8FD;
  --law-border: #E2DFD8;
  --law-muted: #6B6560;
  --law-light: #F5F3EF;
  --law-bg: #FAFAF8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Segoe UI', system-ui, 'Noto Sans TC', sans-serif;
  background: var(--bg);
  color: #1a1a1a;
  line-height: 1.6;
}

/* ── Nav (platform standard) ── */
nav {
  background: var(--navy);
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 52px;
  gap: 4px;
  overflow-x: auto;
}
nav a {
  color: rgba(255,255,255,.75);
  text-decoration: none;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 6px 6px 0 0;
  white-space: nowrap;
  transition: all .2s;
}
nav a:hover, nav a.active { color: #fff; background: rgba(255,255,255,.15); }
nav .logo { color: var(--gold); font-weight: 700; font-size: 15px; margin-right: 16px; letter-spacing: 1px; }

/* ── Container ── */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* ── Law Header ── */
.law-header {
  background: linear-gradient(135deg, var(--law-navy) 0%, var(--law-navy-light) 100%);
  padding: 20px 24px 16px;
}
.law-header-inner { max-width: 1200px; margin: 0 auto; }
.law-header-row { display: flex; justify-content: space-between; align-items: flex-start; }
.law-brand { font-size: 10px; color: var(--law-gold); letter-spacing: 3px; font-weight: 600; }
.law-title {
  margin: 4px 0 0;
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  font-family: 'Noto Serif TC', Georgia, serif;
}
.law-stat-big {
  font-size: 28px;
  font-weight: 900;
  color: var(--law-gold);
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
}
.law-stat-sub { font-size: 10px; color: #9DB5CC; text-align: right; }

/* ── Search ── */
.law-search {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  outline: none;
  box-sizing: border-box;
  margin-top: 14px;
}
.law-search::placeholder { color: rgba(255,255,255,0.5); }

/* ── Filter Buttons ── */
.filter-row { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.filter-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all .15s;
}
.filter-btn.active { color: #fff; }
.filter-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.filter-controls .count { font-size: 11px; color: var(--law-muted); }
.btn-outline {
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--law-border);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  color: var(--law-muted);
}

/* ── Issue Cards ── */
.issue-card {
  background: var(--card);
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--law-border);
  transition: all 0.2s;
}
.issue-card.expanded { box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.issue-header {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.issue-id-col { min-width: 60px; padding-top: 2px; }
.issue-id {
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 10px;
  color: var(--law-muted);
}
.issue-title-col { flex: 1; }
.issue-title {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
  font-family: 'Noto Serif TC', Georgia, serif;
  line-height: 1.4;
}
.issue-articles { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 2px; }
.issue-meta {
  font-size: 10px;
  color: var(--law-muted);
  margin-left: 4px;
  line-height: 18px;
}
.issue-tags { display: flex; align-items: center; gap: 8px; }
.expand-arrow {
  font-size: 14px;
  color: var(--law-muted);
  transition: transform 0.2s;
}
.issue-card.expanded .expand-arrow { transform: rotate(180deg); }

/* ── Badges ── */
.badge-imp {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.badge-imp.MUST { color: var(--law-red); background: var(--law-red-bg); }
.badge-imp.HIGH { color: var(--law-amber); background: var(--law-amber-bg); }
.badge-imp.MID { color: var(--law-blue); background: var(--law-blue-bg); }
.badge-imp.LOW { color: var(--law-muted); background: var(--law-light); }

.badge-subj {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
}

.badge-article {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  color: var(--law-navy);
  background: var(--law-gold-bg);
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  margin-right: 3px;
  margin-bottom: 2px;
}

/* ── Expanded Content ── */
.issue-body { padding: 0 16px 16px; border-top: 1px solid var(--law-border); display: none; }
.issue-card.expanded .issue-body { display: block; }

.trigger-box {
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--law-gold-bg);
  border-left: 3px solid var(--law-gold);
}
.trigger-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--law-gold);
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.trigger-text {
  font-size: 13px;
  color: #1a1a1a;
  font-family: 'Noto Serif TC', Georgia, serif;
  line-height: 1.6;
}

/* Views */
.view-card {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 6px;
  border-left: 3px solid;
}
.view-card.practice { background: var(--law-green-bg); border-color: var(--law-green); }
.view-card.view-a { background: var(--law-light); border-color: var(--law-blue); }
.view-card.view-b { background: var(--law-light); border-color: var(--law-purple); }
.view-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.view-camp { font-size: 12px; font-weight: 700; }
.view-camp.practice { color: var(--law-green); }
.view-camp.view-a { color: var(--law-blue); }
.view-camp.view-b { color: var(--law-purple); }
.view-supporters { font-size: 10px; color: var(--law-muted); }
.view-content { font-size: 12px; color: #1a1a1a; line-height: 1.7; }

/* Answer Template */
.answer-box {
  padding: 10px 14px;
  border-radius: 6px;
  background: rgba(27,45,79,0.04);
  border: 1px solid rgba(27,45,79,0.08);
  margin: 12px 0 10px;
}
.answer-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--law-navy);
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.answer-text {
  font-size: 12px;
  color: #1a1a1a;
  line-height: 1.8;
  white-space: pre-wrap;
  margin: 0;
}

/* Footer */
.issue-footer { display: flex; gap: 16px; font-size: 11px; color: var(--law-muted); }
.issue-footer .note { color: var(--law-red); font-weight: 600; }
.keyword-tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.keyword-tag {
  font-size: 10px;
  color: var(--law-muted);
  background: var(--law-light);
  padding: 2px 8px;
  border-radius: 10px;
}

/* ── Source Badge ── */
.badge-source {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  margin-left: 4px;
}
.badge-source.LLM { color: var(--law-amber); background: var(--law-amber-bg); }
.badge-source.USER { color: var(--law-blue); background: var(--law-blue-bg); }
.badge-source.BOOK { color: var(--law-green); background: var(--law-green-bg); }

/* ── Law Landing Page ── */
.law-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.stat-card h3 { font-size: 14px; color: var(--gray); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; }
.stat-num { font-size: 36px; font-weight: 700; color: var(--navy); }
.stat-sub { font-size: 14px; color: var(--gray); margin-top: 4px; }

.entry-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.entry-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--card);
  border-radius: 10px;
  text-decoration: none;
  color: var(--navy);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  transition: transform .15s;
  border-left: 4px solid;
}
.entry-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.entry-card .icon { font-size: 32px; }
.entry-card .label { font-weight: 600; font-size: 16px; }
.entry-card .desc { font-size: 12px; color: var(--gray); }
.entry-card.issues { border-color: var(--law-navy); }
.entry-card.exams { border-color: var(--law-gold); }
.entry-card.mindmap { border-color: var(--gray); opacity: 0.5; }

/* ── Subject Distribution ── */
.subj-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.subj-bar-label { width: 80px; font-weight: 600; color: var(--law-navy); text-align: right; }
.subj-bar-track { flex: 1; height: 20px; background: #eee; border-radius: 4px; overflow: hidden; }
.subj-bar-fill { height: 100%; border-radius: 4px; transition: width .3s; }
.subj-bar-count { width: 30px; font-size: 12px; color: var(--law-muted); }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 40px 0; color: var(--law-muted); }
.empty-state .icon { font-size: 32px; margin-bottom: 8px; }

/* ── Hint Box ── */
.hint-box {
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: 8px;
  background: var(--law-gold-bg);
  border: 1px solid rgba(139,115,85,0.2);
}
.hint-title { font-size: 12px; font-weight: 700; color: var(--law-gold); margin-bottom: 6px; }
.hint-text { font-size: 11px; color: #1a1a1a; line-height: 1.7; }
