/* ===== 政治页面专用样式（依赖 css/style.css） ===== */

/* ===== 2026 中期选举全国结果 ===== */
.midterm-national {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-top: 24px;
  box-shadow: var(--shadow);
}

.mn-head h2 {
  font-size: 20px;
  color: var(--text);
}

.mn-head h2 span {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-light);
  margin-left: 6px;
}

.mn-meta {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 3px;
}

.mn-meta strong {
  color: var(--accent);
}

.mn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.mn-card {
  background: var(--bg);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 12px 14px;
}

.mn-card:nth-child(2) {
  border-left-color: #7c3aed;
}

.mn-card:nth-child(3) {
  border-left-color: #059669;
}

.mn-card:nth-child(4) {
  border-left-color: #f59e0b;
}

.mn-label {
  font-size: 11px;
  color: var(--text-light);
  letter-spacing: 0.3px;
}

.mn-nums {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  margin: 2px 0;
}

.mn-nums.mn-text {
  font-size: 22px;
  color: #7c3aed;
}

.mn-d {
  color: #1d4ed8;
}

.mn-r {
  color: #b91c1c;
}

.mn-vs {
  color: #9ca3af;
  font-weight: 400;
  margin: 0 4px;
}

.mn-sub {
  font-size: 10.5px;
  color: var(--text-light);
  line-height: 1.45;
}

.mn-note {
  font-size: 11.5px;
  color: var(--text-light);
  line-height: 1.7;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

/* 卡片内的中期选举结果 */
.midterm-block {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.mt-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
}

.mt-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mt-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 6px;
  font-size: 11.5px;
  line-height: 1.5;
}

.mt-office {
  color: var(--text-light);
  font-weight: 500;
}

.mt-result {
  color: var(--text);
  word-break: break-word;
}

.mt-flip {
  display: inline-block;
  background: #fef3c7;
  color: #b45309;
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  border-radius: 4px;
}

.mt-pending {
  color: #92400e;
}

.mt-hold {
  color: #6b7280;
}

.mt-house {
  color: #047857;
}

.mt-empty {
  font-size: 11px;
  color: var(--text-light);
}

/* 弹窗中的中期选举 */
.mt-official-row {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
}

.mt-official-row .person-name {
  grid-column: 1;
  grid-row: 1;
  font-size: 14px;
}

.mt-official-row .mt-office {
  grid-column: 1;
  grid-row: 2;
  font-size: 11px;
  color: var(--text-light);
}

.mt-official-row .mt-status {
  grid-column: 1;
  grid-row: 3;
  font-size: 11px;
  color: var(--text-light);
}

.mt-official-row .official-party {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
}

.mt-national-note {
  font-size: 11px;
  color: var(--text-light);
  line-height: 1.6;
  margin-top: 8px;
}

@media (max-width: 768px) {
  .mn-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* 地图保持可读尺寸，横向滑动查看 */
  .map-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
  }

  .map-wrapper svg {
    min-width: 640px;
  }

  #usMap .state-label {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .mn-grid {
    grid-template-columns: 1fr;
  }

  .map-wrapper svg {
    min-width: 560px;
  }
}

/* 数据说明条 */
.data-notice {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-left: 5px solid #f59e0b;
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-top: 24px;
  box-shadow: var(--shadow);
}

.notice-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.notice-badge {
  background: #f59e0b;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

.notice-head strong {
  font-size: 18px;
  color: #92400e;
}

.notice-sub {
  font-size: 12px;
  color: #a16207;
}

.notice-text {
  font-size: 13px;
  color: #78350f;
  line-height: 1.75;
}

.notice-text a {
  color: #b45309;
  font-weight: 600;
}

.source-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #78350f;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid #fcd34d;
  border-radius: 20px;
  padding: 3px 10px;
  text-decoration: none;
  transition: var(--transition);
}

.source-chip:hover {
  background: #fff;
  border-color: #f59e0b;
}

/* 卡片网格 */
.pol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
  align-items: start;
}

.pol-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  animation: fadeIn 0.3s ease;
}

.pol-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.pol-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}

.pol-card:hover::before {
  transform: scaleX(1);
}

.pol-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.pol-state {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pol-flag {
  font-size: 26px;
  line-height: 1;
}

.pol-state-name {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}

.pol-state-en {
  font-size: 11px;
  color: var(--text-light);
}

/* 党派标签 */
.party-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
  line-height: 1.5;
}

.party-R {
  background: #fee2e2;
  color: #b91c1c;
}

.party-D {
  background: #dbeafe;
  color: #1d4ed8;
}

.party-I {
  background: #ede9fe;
  color: #6d28d9;
}

.party-O {
  background: #f3f4f6;
  color: #4b5563;
}

.gov-party-badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
}

/* 职位列表 */
.office-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.office-row {
  display: grid;
  grid-template-columns: 86px 1fr auto;
  align-items: start;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px dashed #eef2f7;
}

.office-row:last-child {
  border-bottom: none;
}

.office-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  line-height: 1.35;
  padding-top: 1px;
}

.office-label em {
  display: block;
  font-style: normal;
  font-size: 10px;
  font-weight: 400;
  color: #9ca3af;
}

.office-body {
  min-width: 0;
}

.person-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  word-break: break-word;
}

.term-line {
  font-size: 11px;
  color: var(--text-light);
  line-height: 1.45;
  margin-top: 1px;
}

.term-note {
  color: #b45309;
}

.office-vacant {
  font-size: 13px;
  color: var(--text-light);
  font-style: italic;
}

.rep-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.rep-count {
  font-size: 14px;
  font-weight: 600;
}

.rep-parties {
  font-size: 11px;
  color: var(--text-light);
}

.card-more {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--primary);
  text-align: right;
}

/* 弹窗 */
.modal-content.pol-modal {
  max-width: 760px;
}

.pol-modal .modal-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #dc2626 100%);
}

.modal-section {
  margin-bottom: 26px;
}

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

.modal-section h4 {
  font-size: 15px;
  color: var(--text);
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--primary-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-section h4 span {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-light);
}

.official-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.official-row {
  background: var(--bg);
  border-radius: 8px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: start;
}

.official-row .person-name {
  font-size: 15px;
}

.official-role {
  font-size: 11px;
  color: var(--text-light);
  grid-column: 1;
}

.official-term {
  font-size: 11px;
  color: var(--text-light);
  grid-column: 1;
}

.official-party {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
}

.reps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.rep-item {
  background: var(--bg);
  border-radius: 8px;
  padding: 9px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.rep-item .person-name {
  font-size: 13px;
}

.rep-item .rep-district {
  font-size: 10px;
  color: var(--text-light);
}

@media (max-width: 768px) {
  .pol-grid {
    grid-template-columns: 1fr;
  }

  .office-row {
    grid-template-columns: 78px 1fr auto;
  }

  .reps-grid {
    grid-template-columns: 1fr;
  }

  .official-row {
    grid-template-columns: 1fr auto;
  }
}

/* 地图图例中的方向徽标 */
.legend-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 14px;
  padding: 0 6px;
  border-radius: 7px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.legend-ramp {
  width: 44px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}

.map-swipe-hint {
  display: none;
  color: #b45309;
  font-weight: 600;
}

/* 折叠态：仅显示州名，点击展开详情 */
.pol-card {
  cursor: pointer;
}

.pol-card:not(.expanded) .office-block,
.pol-card:not(.expanded) .midterm-block,
.pol-card:not(.expanded) .card-more,
.pol-card:not(.expanded) .gov-party-badge {
  display: none;
}

/* 图例位于地图上方 */
.map-section .map-legend {
  margin-top: 0;
  margin-bottom: 14px;
}

@media (max-width: 768px) {
  .data-notice {
    padding: 14px 16px;
  }

  .notice-text {
    overflow-wrap: anywhere;
  }

  .map-swipe-hint {
    display: inline;
  }
}
