/* CSS Custom Properties */
:root {
  /* Colors - 九份主題配色 */
  --primary-gold: #d87c04;
  --primary-color: #FF6B6B;
  --secondary-color: #FF8E53;
  --secondary-brown: #8B4513;
  --background-cream: #FFF8DC;
  --accent-red: #DC143C;
  --text-dark: #2C1810;
  --text-color: #2C1810;
  --text-secondary: #8A6B47;
  --text-light: #F5F5DC;
  --text-muted: #8A6B47;
  --info-color: #3498DB;
  
  /* UI Colors */
  --white: #FFFFFF;
  --gray-50: #FAFAFA;
  --gray-100: #F5F5F5;
  --gray-200: #EEEEEE;
  --gray-300: #E0E0E0;
  --gray-400: #BDBDBD;
  --gray-500: #9E9E9E;
  --gray-600: #757575;
  --gray-700: #616161;
  --gray-800: #424242;
  --gray-900: #212121;
  
  /* Shadows */
  --shadow-soft: rgba(139, 69, 19, 0.15);
  --shadow-medium: rgba(139, 69, 19, 0.25);
  --shadow-strong: rgba(139, 69, 19, 0.35);
  
  /* Gradients */
  --gradient-warm: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  --gradient-cool: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
  --gradient-overlay: linear-gradient(135deg, rgba(255, 215, 0, 0.9) 0%, rgba(255, 165, 0, 0.8) 100%);
  
  /* Typography */
  --font-primary: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
  --font-serif: 'Noto Serif TC', serif;
  --font-mono: 'SF Mono', 'Monaco', monospace;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-dark);
  background: var(--background-cream);
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-dark);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: var(--space-md);
  color: var(--text-muted);
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
  color: white;
}

.loading-logo h1 {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  color: white;
}

.loading-lantern {
  font-size: 4rem;
  animation: float 2s ease-in-out infinite alternate;
}

@keyframes float {
  from { transform: translateY(-10px); }
  to { transform: translateY(10px); }
}

.loading-bar {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-full);
  margin: var(--space-lg) auto;
  overflow: hidden;
}

.loading-progress {
  height: 100%;
  background: white;
  border-radius: var(--radius-full);
  animation: loading-progress 2s ease-in-out infinite;
}

@keyframes loading-progress {
  0% { width: 0%; }
  50% { width: 70%; }
  100% { width: 100%; }
}

/* Navigation */
.main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--gray-200);
  z-index: 1000;
  transition: var(--transition-normal);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-dark);
}

.nav-icon {
  font-size: 1.5rem;
}

.nav-menu {
  display: flex;
  gap: var(--space-lg);
}

.nav-item {
  background: none;
  border: none;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.nav-item:hover,
.nav-item.active {
  background: var(--gradient-warm);
  color: white;
  transform: translateY(-1px);
}

/* Main Content */
.main-content {
  margin-top: 70px;
  min-height: calc(100vh - 70px);
}

/* Page Management */
.page {
  display: none;
  min-height: calc(100vh - 70px);
  padding: var(--space-2xl) 0;
}

.page.active {
  display: block;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* Hero Section */
.hero-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3xl);
  align-items: center;
  min-height: 70vh;
  padding: var(--space-3xl) var(--space-lg);
  max-width: 1200px;
  margin: 0 auto;
}

.hero-content {
  animation: slideInLeft 0.8s ease-out;
}

.hero-title {
  font-size: 3.5rem;
  line-height: 1.2;
  margin-bottom: var(--space-lg);
  color: var(--text-dark);
}

.hero-accent {
  background: var(--gradient-warm);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: 1.25rem;
  line-height: 1.6;
  margin-bottom: var(--space-2xl);
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
}

.hero-visual {
  display: flex;
  justify-content: center;
  animation: slideInRight 0.8s ease-out;
}

.hero-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: 0 20px 60px var(--shadow-soft);
  transform: rotate(-2deg);
  transition: var(--transition-normal);
}

.hero-card:hover {
  transform: rotate(0deg) scale(1.05);
}

.hero-image {
  width: 300px;
  height: 200px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--gradient-warm);
}

.placeholder-image {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 3rem;
}

.placeholder-image p {
  margin: var(--space-sm) 0 0 0;
  font-size: 1rem;
  color: white;
}

/* Features Section */
.features-section {
  padding: var(--space-3xl) 0;
  background: white;
}

.section-title {
  text-align: center;
  margin-bottom: var(--space-2xl);
  color: var(--text-dark);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-xl);
}

.feature-card {
  background: white;
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px var(--shadow-soft);
  text-align: center;
  transition: var(--transition-normal);
  border: 1px solid var(--gray-100);
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 48px var(--shadow-medium);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: var(--space-lg);
}

.feature-card h3 {
  margin-bottom: var(--space-md);
  color: var(--text-dark);
}

.feature-card p {
  color: var(--text-muted);
  margin-bottom: 0;
}

/* Page Headers */
.page-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.page-title {
  margin-bottom: var(--space-md);
}

.page-subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* Map Container */
.map-container {
  position: relative;
  width: 100%;
  height: 600px; /* Or any desired height */
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 32px var(--shadow-soft);
  border: 1px solid var(--gray-200);
}

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

.map-controls {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.map-control-btn {
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--shadow-soft);
  transition: var(--transition-fast);
}

.map-control-btn:hover {
  background: var(--gray-50);
  transform: scale(1.05);
}

/* 地圖標記角色要求狀態 */
.custom-marker {
  cursor: pointer;
  transition: all 0.2s ease;
}

.custom-marker:hover {
  transform: scale(1.1);
}

/* 當沒有選擇角色時的標記狀態 */
body:not(.character-selected) .custom-marker {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(50%);
}

body:not(.character-selected) .custom-marker:hover {
  transform: none;
  opacity: 0.7;
}

body:not(.character-selected) .custom-marker .marker-label::after {
  content: " (請先選擇導遊)";
  font-size: 0.7rem;
  color: #666;
  font-weight: normal;
}

/* 當已選擇角色時的狀態 */
body.character-selected .custom-marker {
  opacity: 1;
  filter: none;
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero-section {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    text-align: center;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-actions {
    justify-content: center;
  }
  
  .nav-menu {
    display: none;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
  }
  
  .container {
    padding: 0 var(--space-md);
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-description {
    font-size: 1rem;
  }
  
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }
}

/* Animations */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
