/* ===== 全局重置与基础 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-primary: #8B2C1C;
  --color-primary-light: #C84B31;
  --color-gold: #C9A24B;
  --color-gold-light: #E0C170;
  --color-bg: #0a0e1a;
  --color-bg-dark: #050810;
  --color-text: #e8e6e3;
  --color-text-dim: #9a9893;
  --color-text-bright: #ffffff;
  --color-panel: rgba(18, 22, 35, 0.95);
  --color-panel-border: rgba(201, 162, 75, 0.3);
  --color-card: rgba(255, 255, 255, 0.05);
  --color-card-hover: rgba(255, 255, 255, 0.08);
  --shadow-glow: 0 0 20px rgba(201, 162, 75, 0.4);
  --font-serif: 'Noto Serif SC', 'Songti SC', serif;
  --font-sans: 'Noto Sans SC', sans-serif;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  overflow: hidden;
  height: 100vh;
}

/* ===== 加载动画 ===== */
.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-bg-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.8s ease;
}

.loader.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-spinner {
  width: 60px;
  height: 60px;
  border: 3px solid rgba(201, 162, 75, 0.2);
  border-top-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

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

.loader-text {
  font-family: var(--font-serif);
  color: var(--color-gold);
  font-size: 16px;
  letter-spacing: 2px;
}

/* ===== 顶部导航 ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  background: linear-gradient(180deg, rgba(10, 14, 26, 0.9) 0%, transparent 100%);
  padding: 16px 32px;
}

.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.header-logo {
  font-size: 28px;
  color: var(--color-gold);
  text-shadow: var(--shadow-glow);
}

.header-title {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 900;
  color: var(--color-text-bright);
  letter-spacing: 4px;
}

.header-subtitle {
  font-size: 13px;
  color: var(--color-text-dim);
  letter-spacing: 1px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-link {
  color: var(--color-text-dim);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 6px;
  transition: all 0.3s ease;
  letter-spacing: 1px;
}

.nav-link:hover {
  color: var(--color-gold);
  background: rgba(201, 162, 75, 0.1);
}

.nav-link.active {
  color: var(--color-gold);
  background: rgba(201, 162, 75, 0.15);
}

.lang-switch {
  background: rgba(201, 162, 75, 0.12);
  border: 1px solid rgba(201, 162, 75, 0.4);
  color: var(--color-gold);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 1px;
  font-family: inherit;
}

.lang-switch:hover {
  background: rgba(201, 162, 75, 0.25);
  border-color: var(--color-gold);
}

/* ===== 地球仪容器 ===== */
#globe-container {
  width: 100vw;
  height: 100vh;
}

#globe-container canvas {
  outline: none;
}

/* ===== 地球提示 ===== */
.globe-hint {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 22, 35, 0.85);
  border: 1px solid var(--color-panel-border);
  border-radius: 30px;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-dim);
  z-index: 50;
  backdrop-filter: blur(10px);
  animation: fadeInUp 1s ease 1s both;
}

.hint-icon {
  color: var(--color-gold);
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ===== 地点快捷标签 ===== */
.location-chips {
  position: fixed;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
  max-height: 70vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-gold) transparent;
  padding-right: 4px;
}

.location-chips::-webkit-scrollbar {
  width: 4px;
}

.location-chips::-webkit-scrollbar-thumb {
  background: var(--color-gold);
  border-radius: 2px;
}

.location-chip {
  background: rgba(18, 22, 35, 0.8);
  border: 1px solid var(--color-panel-border);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 6px;
}

.location-chip:hover {
  background: rgba(201, 162, 75, 0.2);
  border-color: var(--color-gold);
  color: var(--color-gold);
  transform: translateX(4px);
}

.location-chip .chip-count {
  background: rgba(201, 162, 75, 0.3);
  color: var(--color-gold);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
}

/* ===== 地球仪标记 ===== */
.globe-marker {
  cursor: pointer;
  pointer-events: auto;
}

.marker-dot {
  width: 14px;
  height: 14px;
  background: var(--color-gold);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--color-gold), 0 0 24px rgba(201, 162, 75, 0.6);
  position: relative;
  transform: translate(-50%, -50%);
}

.marker-dot::before {
  content: '';
  position: absolute;
  top: -6px;
  left: -6px;
  width: 26px;
  height: 26px;
  border: 2px solid var(--color-gold);
  border-radius: 50%;
  animation: markerPulse 2s ease-out infinite;
}

@keyframes markerPulse {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

.marker-label {
  position: absolute;
  top: 12px;
  left: 8px;
  background: rgba(18, 22, 35, 0.9);
  border: 1px solid var(--color-panel-border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  color: var(--color-gold);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  font-family: var(--font-serif);
  font-weight: 600;
}

.globe-marker:hover .marker-label {
  opacity: 1;
}

.globe-marker:hover .marker-dot {
  background: var(--color-primary-light);
  box-shadow: 0 0 20px var(--color-primary-light), 0 0 40px var(--color-primary-light);
}

/* ===== 侧边内容面板 ===== */
.side-panel {
  position: fixed;
  top: 0;
  right: -560px;
  width: 560px;
  max-width: 100vw;
  height: 100vh;
  background: var(--color-panel);
  border-left: 1px solid var(--color-panel-border);
  z-index: 200;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(20px);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
}

.side-panel.open {
  right: 0;
}

.side-panel-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--color-panel-border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(139, 44, 28, 0.15) 0%, transparent 100%);
}

.side-panel-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 900;
  color: var(--color-text-bright);
  margin-bottom: 6px;
  letter-spacing: 2px;
}

.side-panel-desc {
  font-size: 13px;
  color: var(--color-text-dim);
  line-height: 1.6;
  max-width: 420px;
}

.side-panel-close {
  background: none;
  border: 1px solid var(--color-panel-border);
  color: var(--color-text-dim);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.side-panel-close:hover {
  color: var(--color-primary-light);
  border-color: var(--color-primary-light);
  transform: rotate(90deg);
}

.side-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px 40px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-gold) transparent;
}

.side-panel-body::-webkit-scrollbar {
  width: 6px;
}

.side-panel-body::-webkit-scrollbar-thumb {
  background: var(--color-gold);
  border-radius: 3px;
}

.side-panel-body::-webkit-scrollbar-track {
  background: transparent;
}

/* ===== 非遗项目卡片 ===== */
.heritage-item {
  background: var(--color-card);
  border: 1px solid var(--color-panel-border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.heritage-item:hover {
  background: var(--color-card-hover);
  border-color: var(--color-gold);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.heritage-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.heritage-item-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--color-gold-light);
}

.heritage-item-category {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(201, 162, 75, 0.15);
  color: var(--color-gold);
  border: 1px solid rgba(201, 162, 75, 0.3);
}

.heritage-item-desc {
  font-size: 13px;
  color: var(--color-text-dim);
  line-height: 1.6;
  margin-bottom: 12px;
}

.heritage-item-text {
  font-size: 14px;
  color: var(--color-text);
  line-height: 1.8;
  white-space: pre-wrap;
  margin-bottom: 12px;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border-left: 3px solid var(--color-gold);
}

.heritage-item-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.heritage-image {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid var(--color-panel-border);
}

.heritage-image:hover {
  transform: scale(1.05);
  border-color: var(--color-gold);
  box-shadow: var(--shadow-glow);
}

.heritage-item-video {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 12px;
  border: 1px solid var(--color-panel-border);
}

.no-content {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-dim);
  font-size: 14px;
}

/* ===== 遮罩层 ===== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

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

/* ===== 媒体查看器 ===== */
.media-viewer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.media-viewer.show {
  opacity: 1;
  pointer-events: auto;
}

.media-viewer-content {
  max-width: 90vw;
  max-height: 90vh;
}

.media-viewer-content img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
}

.media-viewer-content video {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
}

.media-viewer-close {
  position: fixed;
  top: 24px;
  right: 24px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  transition: all 0.3s ease;
}

.media-viewer-close:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-dim);
}

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

.empty-state-text {
  font-size: 14px;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .header {
    padding: 12px 16px;
  }
  
  .header-title {
    font-size: 18px;
  }
  
  .header-subtitle {
    display: none;
  }
  
  .location-chips {
    left: 8px;
    max-width: 140px;
  }
  
  .location-chip {
    font-size: 12px;
    padding: 6px 12px;
  }
  
  .side-panel {
    width: 100vw;
    right: -100vw;
  }
  
  .globe-hint {
    font-size: 11px;
    padding: 6px 14px;
    bottom: 20px;
  }
}
