/* 青瓷深色主题 — 与主站同源色彩，明暗翻转 */
:root {
  --bg-deep: #1a2220;
  --bg-dark: #2a3a35;
  --bg-card: #344842;
  --bg-card-hover: #3e564e;
  --accent: #8FB3A5;
  --accent-light: #a8d5c0;
  --accent-dim: #6B8E7B;
  --gold: #c9a96e;
  --gold-light: #e0c990;
  --text: #e0ebe6;
  --text-dim: #8a9f96;
  --text-bright: #f0faf5;
  --border: #3a5048;
  --border-accent: rgba(143, 179, 165, 0.3);
}

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

body {
  font-family: "LXGW WenKai", "Georgia", "Noto Serif SC", serif;
  background: var(--bg-deep);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
}

/* 顶部导航 */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: 56px;
  background: linear-gradient(180deg, var(--bg-deep) 0%, rgba(26,34,32,0.95) 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  backdrop-filter: blur(12px);
}

.top-bar .logo {
  font-size: 18px;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: 4px;
  text-transform: uppercase;
}

.top-bar .logo span {
  color: var(--text-dim);
  font-weight: 300;
  font-size: 13px;
  letter-spacing: 2px;
  margin-left: 12px;
}

.period-tabs {
  display: flex;
  gap: 4px;
  margin-left: 48px;
}

.period-tab {
  padding: 6px 20px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  letter-spacing: 1px;
}

.period-tab:hover {
  border-color: var(--accent-dim);
  color: var(--text);
}

.period-tab.active {
  background: linear-gradient(135deg, rgba(143,179,165,0.15), rgba(143,179,165,0.05));
  border-color: var(--accent);
  color: var(--accent);
}

/* 主布局 */
.main-layout {
  display: flex;
  height: calc(100vh - 56px);
  margin-top: 56px;
}

/* 地图区域 */
.map-container {
  flex: 0 0 60%;
  position: relative;
  background: var(--bg-deep);
}

.map-container #map {
  width: 100%;
  height: 100%;
}

/* Leaflet 暗色覆盖 */
.leaflet-container {
  background: #000 !important;
}

/* Tailwind CDN 会设置 img { max-width:100% } — 必须覆盖以保护瓦片渲染 */
.leaflet-container img {
  max-width: none !important;
  max-height: none !important;
}

/* 无瓦片 — 纯黑底 */

.leaflet-control-zoom {
  border: 1px solid var(--border) !important;
}

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--bg-card-hover) !important;
  color: var(--accent) !important;
}

/* 自定义tooltip */
.kiln-tooltip {
  background: var(--bg-card) !important;
  border: 1px solid var(--accent-dim) !important;
  color: var(--text-bright) !important;
  font-family: inherit !important;
  font-size: 13px !important;
  padding: 8px 14px !important;
  border-radius: 4px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
}

.kiln-tooltip::before {
  border-top-color: var(--bg-card) !important;
}

.leaflet-tooltip-top:before {
  border-top-color: var(--bg-card) !important;
}
.leaflet-tooltip-bottom:before {
  border-bottom-color: var(--bg-card) !important;
}
.leaflet-tooltip-left:before {
  border-left-color: var(--bg-card) !important;
}
.leaflet-tooltip-right:before {
  border-right-color: var(--bg-card) !important;
}

/* 详情面板 */
.detail-panel {
  flex: 0 0 40%;
  background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-deep) 100%);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 32px 28px;
  position: relative;
}

.detail-panel::-webkit-scrollbar {
  width: 4px;
}

.detail-panel::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* 面板内容 */
.panel-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.close-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  line-height: 1;
}

.close-btn:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
  background: rgba(143,179,165,0.08);
}

.panel-header h2 {
  font-size: 28px;
  color: var(--accent);
  margin-bottom: 4px;
  font-weight: 400;
}

.panel-header .en-name {
  font-size: 14px;
  color: var(--text-dim);
  letter-spacing: 2px;
}

.aoc-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 12px;
  border-radius: 3px;
  font-size: 12px;
  letter-spacing: 1px;
}

.aoc-badge.guo-bao {
  background: linear-gradient(135deg, rgba(201,169,110,0.2), rgba(201,169,110,0.1));
  border: 1px solid var(--gold);
  color: var(--gold-light);
}

.aoc-badge.sheng-bao {
  background: rgba(143,179,165,0.12);
  border: 1px solid var(--accent);
  color: var(--accent-light);
}

.aoc-badge.shi-bao {
  background: rgba(107,142,123,0.1);
  border: 1px solid var(--accent-dim);
  color: var(--accent-dim);
}

.aoc-badge.xian-bao {
  background: rgba(138,159,150,0.05);
  border: 1px dashed var(--text-dim);
  color: var(--text-dim);
}

/* 工艺特征 */
.terroir-section {
  margin-bottom: 28px;
}

.terroir-section h3 {
  font-size: 13px;
  color: var(--accent-dim);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.terroir-section p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
}

.terroir-meta {
  display: flex;
  gap: 24px;
  margin-top: 16px;
}

.terroir-meta-item {
  flex: 1;
}

.terroir-meta-item .label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.terroir-meta-item .value {
  font-size: 14px;
  color: var(--text);
  margin-top: 4px;
}

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  text-align: center;
  transition: all 0.3s;
}

.stat-card:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
}

.stat-card .number {
  font-size: 28px;
  color: var(--accent);
  font-weight: 300;
  display: block;
}

.stat-card .unit {
  font-size: 14px;
  color: var(--accent-dim);
}

.stat-card .desc {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
  letter-spacing: 1px;
}

/* 器物图表 */
.chart-section {
  margin-bottom: 28px;
}

.chart-section h3 {
  font-size: 13px;
  color: var(--accent-dim);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.chart-container {
  height: 180px;
  position: relative;
}

/* 窑址标签 */
.villages-section {
  margin-bottom: 28px;
}

.villages-section h3 {
  font-size: 13px;
  color: var(--accent-dim);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.village-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.village-tag {
  padding: 4px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 12px;
  color: var(--text-dim);
  transition: all 0.3s;
}

.village-tag.grand-cru {
  border-color: var(--accent-dim);
  color: var(--accent);
}

/* 重要遗址 */
.grand-crus-section {
  margin-bottom: 28px;
}

.grand-crus-section h3 {
  font-size: 13px;
  color: var(--accent-dim);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.grand-cru-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.grand-cru-item {
  padding: 4px 12px;
  background: linear-gradient(135deg, rgba(143,179,165,0.10), rgba(107,142,123,0.06));
  border: 1px solid var(--accent-dim);
  border-radius: 3px;
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.5px;
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--text-dim);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 14px;
  line-height: 1.8;
}

/* 面板过渡 */
.panel-content {
  animation: fadeSlideIn 0.4s ease-out;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 加载动画 */
.loading-spinner {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* 椭圆窑群标记 */
.kiln-ellipse-wrapper {
  background: none !important;
  border: none !important;
}

.kiln-ellipse {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.35s ease;
  cursor: pointer;
  overflow: hidden;
}

.kiln-ellipse.hover {
  filter: brightness(1.5);
  transform: scale(1.06);
  box-shadow: 0 0 24px rgba(143,179,165,0.2);
}

.kiln-ellipse.active {
  filter: brightness(1.6);
  transform: scale(1.1);
  box-shadow: 0 0 30px rgba(143,179,165,0.3);
}

.kiln-ellipse.dimmed {
  opacity: 0.35;
}

.kiln-ellipse-name {
  color: var(--text-bright);
  font-size: 10px;
  font-family: "LXGW WenKai", Georgia, serif;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
  line-height: 1.2;
  padding: 4px 10px;
  overflow: hidden;
  max-height: 100%;
  word-break: keep-all;
}

/* 椭圆 Tooltip 内容 */
.kiln-tooltip-wide {
  max-width: 240px !important;
}

.kiln-tip strong {
  font-size: 13px;
}

.kiln-tip-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 10px;
  letter-spacing: 0.5px;
  background: rgba(143,179,165,0.15);
  color: var(--accent);
  border: 1px solid rgba(143,179,165,0.3);
}

.kiln-tip p {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* 地图国保标记 — 金色仅用于此处 */
.heritage-marker {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold), 0 0 24px rgba(201,169,110,0.3);
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from { box-shadow: 0 0 8px var(--gold), 0 0 16px rgba(201,169,110,0.2); }
  to { box-shadow: 0 0 16px var(--gold), 0 0 32px rgba(201,169,110,0.4); }
}

/* 响应式 */
@media (max-width: 1024px) {
  .main-layout {
    flex-direction: column;
  }
  .map-container {
    flex: 0 0 50vh;
  }
  .detail-panel {
    flex: 1;
    border-left: none;
    border-top: 1px solid var(--border);
  }
}

/* 手机适配 */
@media (max-width: 640px) {
  .top-bar {
    height: 48px;
    padding: 0 12px;
  }
  .top-bar .logo {
    font-size: 15px;
    letter-spacing: 2px;
  }
  .top-bar .logo span {
    display: none;
  }
  .period-tabs {
    margin-left: 12px;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .period-tabs::-webkit-scrollbar {
    display: none;
  }
  .period-tab {
    padding: 4px 12px;
    font-size: 12px;
    white-space: nowrap;
  }
  .main-layout {
    flex-direction: column;
  }
  .map-container {
    flex: 0 0 40vh;
  }
  .detail-panel {
    flex: 1;
    border-left: none;
    border-top: 1px solid var(--border);
    min-width: unset;
    overflow-y: auto;
  }
  .detail-panel h2 {
    font-size: 1.1rem;
  }
  .detail-panel p {
    font-size: 0.85rem;
  }
}
