/**
 * 全国业务数据看板
 * 全局样式与组件样式
 */

:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --panel-border: #2a3a52;
  --text: #e8edf4;
  --text-muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.15);
  --success: #22c55e;
  --warning: #f59e0b;
  --map-bg: #121a24;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-border);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon,
.hub-logo {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: auto;
  min-width: 0;
  min-height: 44px;
  padding: 8px 24px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 5px;
  font-weight: 700;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.logo h1 {
  font-size: 18px;
  font-weight: 600;
}

.logo p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb span.active {
  color: var(--accent);
  font-weight: 500;
}

.breadcrumb .sep {
  opacity: 0.4;
}

.site-nav .btn.active {
  color: var(--accent);
  font-weight: 500;
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.12);
}

.header-page-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #2563eb;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

main {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 0;
}

.map-section {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  background: var(--map-bg);
  border-right: 1px solid var(--panel-border);
  position: relative;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(26, 35, 50, 0.8);
  border-bottom: 1px solid var(--panel-border);
}

.map-toolbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.map-toolbar .hint {
  font-size: 12px;
  color: var(--text-muted);
}

.map-toolbar .hint code {
  font-size: 11px;
}

.region-province-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.region-province-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 11px;
  color: var(--text);
  cursor: pointer;
  line-height: 1.3;
  transition: background 0.15s, border-color 0.15s;
}

.region-province-tag:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.region-province-tag .dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
}

.region-province-tag-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.region-province-tag-name {
  white-space: nowrap;
}

.region-province-tag.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.medical-region-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(139, 92, 246, 0.08));
}

.medical-region-banner-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.35);
}

.medical-region-banner-text h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.medical-region-banner-text p {
  font-size: 12px;
  color: var(--text-muted);
}

.medical-province-card {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.medical-province-card--clickable {
  cursor: pointer;
}

.medical-province-card--clickable:hover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.06);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
}

.medical-province-card--active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.medical-province-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.medical-province-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.medical-province-head .dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 4px;
}

.medical-province-head-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.medical-province-head h4 {
  font-size: 15px;
  font-weight: 600;
}

.medical-province-head .badge {
  font-size: 11px;
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  flex-shrink: 0;
}

.medical-province-hospital {
  flex-shrink: 0;
  max-width: 48%;
  text-align: right;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(168, 85, 247, 0.95);
}

.medical-province-hospital .label {
  color: var(--text-muted);
  margin-right: 4px;
}

.medical-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.medical-stat-item {
  padding: 10px 0px;
  border-radius: 10px;
  border: 1px solid transparent;
  text-align: center;
  min-width: 0;
}

.medical-stat-item--population {
  background: linear-gradient(160deg, rgba(59, 130, 246, 0.28), rgba(59, 130, 246, 0.08));
  border-color: rgba(59, 130, 246, 0.3);
}

.medical-stat-item--gdp {
  background: linear-gradient(160deg, rgba(6, 182, 212, 0.28), rgba(6, 182, 212, 0.08));
  border-color: rgba(6, 182, 212, 0.3);
}

.medical-stat-item--gdpPerCapita {
  background: linear-gradient(160deg, rgba(34, 197, 94, 0.28), rgba(34, 197, 94, 0.08));
  border-color: rgba(34, 197, 94, 0.3);
}

.medical-stat-item--disposableIncome {
  background: linear-gradient(160deg, rgba(245, 158, 11, 0.28), rgba(245, 158, 11, 0.08));
  border-color: rgba(245, 158, 11, 0.3);
}

.medical-stat-item--tertiaryHospitals {
  background: linear-gradient(160deg, rgba(168, 85, 247, 0.28), rgba(168, 85, 247, 0.08));
  border-color: rgba(168, 85, 247, 0.3);
}

.medical-stat-item .label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.medical-stat-item .value {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.medical-note {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.medical-city-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin: 4px 0 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.medical-city-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.medical-city-list {
  margin-top: 0;
  padding-top: 10px;
}

.medical-city-list summary {
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 8px;
}

.medical-city-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

.medical-city-row strong {
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}

.medical-city-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  line-height: 1.5;
}

.medical-city-row-hospital {
  color: rgba(168, 85, 247, 0.95);
}

.medical-panel-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
}

.medical-panel-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.medical-panel-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.medical-panel-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.medical-panel-pane {
  display: none;
}

.medical-panel-pane.active {
  display: block;
}

.medical-legend-section {
  margin-bottom: 20px;
}

.medical-legend-section-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
}

.medical-legend-section-title::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.medical-legend-section--population .medical-legend-section-title::before { background: #3b82f6; }
.medical-legend-section--gdp .medical-legend-section-title::before { background: #06b6d4; }
.medical-legend-section--gdpPerCapita .medical-legend-section-title::before { background: #06b6d4; }
.medical-legend-section--disposableIncome .medical-legend-section-title::before { background: #f59e0b; }
.medical-legend-section--tertiaryHospitals .medical-legend-section-title::before { background: #a855f7; }

.medical-legend-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.medical-legend-row {
  display: grid;
  grid-template-columns: 76px 1fr;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.medical-legend-name {
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.medical-legend-bar-wrap {
  position: relative;
  height: 20px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  overflow: hidden;
}

.medical-legend-bar {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  border-radius: 8px;
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.medical-legend-bar-value {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  z-index: 1;
  pointer-events: none;
}

.region-legend-panel {
  width: fit-content;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 12px;
  background: rgba(18, 26, 36, 0.95);
  border-right: 1px solid var(--panel-border);
  z-index: 4;
}

.region-legend-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-align: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--panel-border);
}

.region-legend {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.region-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 11px;
  color: var(--text);
  cursor: pointer;
  line-height: 1.3;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.region-tag:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.region-tag.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.region-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
}

.region-tag-name {
  white-space: nowrap;
}

.region-national-btn {
  width: 100%;
  justify-content: center;
  font-family: inherit;
  font-weight: 600;
}

.map-body {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

.map-chart-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
}

#mapChart {
  width: 100%;
  height: 100%;
}

.zoom-controls {
  display: flex;
  gap: 6px;
}

.zoom-controls button {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoom-controls button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.zoom-controls .btn-map-back {
  width: auto;
  min-width: 56px;
  padding: 0 12px;
  font-size: 13px;
  white-space: nowrap;
}

.zoom-controls .btn-map-back:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.zoom-controls .btn-map-back:disabled:hover {
  border-color: var(--panel-border);
  color: var(--text);
}

.data-section {
  flex: 0.8;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  overflow: hidden;
}

.data-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--panel-border);
}

.data-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

.data-header .subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.data-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px;
}

.stat-card .label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.stat-card .change {
  font-size: 12px;
  margin-top: 6px;
}

.change.up { color: var(--success); }
.change.down { color: #ef4444; }

.section-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rank-list {
  list-style: none;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.rank-item:last-child {
  border-bottom: none;
}

.rank-num {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rank-item:nth-child(1) .rank-num {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

.rank-info {
  flex: 1;
  min-width: 0;
}

.rank-name {
  font-size: 14px;
  font-weight: 500;
}

.rank-bar-wrap {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.rank-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.rank-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

.mini-chart-wrap {
  height: 180px;
  margin-top: 8px;
}

#trendChart {
  width: 100%;
  height: 100%;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 20, 25, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.loading-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--panel-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-tip {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}
