:root {
  --color-bg-dark: #0A192F;
  --color-text-light: #FFFFFF;
  --color-accent: #FADB5F; /* Heritage Tone / Gold */
  --color-accent-glow: rgba(250, 219, 95, 0.6);
  --color-overlay: rgba(10, 25, 47, 0.7);
  
  --font-title: 'Agbalumo', cursive;
  --font-body: 'Times New Roman', Times, serif;
  --font-premium: 'Cormorant Garamond', serif; /* Replacement for Lavonia Classy */
}

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

body {
  background-color: var(--color-bg-dark);
  color: var(--color-text-light);
  font-family: var(--font-body);
  overflow: hidden; /* Prevent scrolling, full app experience */
}

/* Typography */
h1, h2, h3 {
  font-family: var(--font-title);
  font-weight: normal;
}

.view-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease-in-out;
  z-index: 1;
}

.view-container.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 10;
}

/* =========================================
   0. HEADER (Cố định, Minimal, Cao cấp)
========================================= */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: 15px 25px;
  z-index: 1000;
  pointer-events: none;
  display: flex;
  justify-content: flex-start;
  transition: transform 0.8s ease, opacity 0.8s ease;
  opacity: 0; /* Hidden by default */
  transform: translateY(-20px);
}

.app-header.visible {
  opacity: 1;
  transform: translateY(0);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: auto; /* Compact width */
  min-width: 350px;
  max-width: 90%;
  pointer-events: auto;
  background: rgba(10, 25, 47, 0.6);
  backdrop-filter: blur(20px);
  padding: 8px 15px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

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

.header-icon {
  width: 32px;
  height: 32px;
  background: rgba(250, 219, 95, 0.1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
}

.header-icon svg {
  width: 18px;
  height: 18px;
}

.header-text {
  display: flex;
  flex-direction: column;
}

.header-title {
  font-family: var(--font-premium);
  font-size: 1.1rem;
  font-weight: 800; /* Increased weight */
  letter-spacing: 0.5px;
  color: #fff;
  line-height: 1.1;
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.5); /* Subtle glow to simulate thickness */
}

.header-subtitle {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-accent);
  font-weight: 700;
}

.header-right {
  display: flex;
  gap: 8px;
  margin-left: 20px;
}

.header-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.header-btn svg {
  width: 16px;
  height: 16px;
}

.header-btn:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #000;
  transform: translateY(-2px);
}

/* =========================================
   1. HERO VIEW (Cinematic Intro)
========================================= */
#hero-view {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: #000;
}

.hero-bg {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background-image: url('./assets/bg.jpg'); 
  background-size: cover;
  background-position: center center;
  z-index: 1;
  animation: bgZoomIn 20s ease-out forwards;
}

@keyframes bgZoomIn {
  from { transform: scale(1.1); }
  to { transform: scale(1); }
}

.hero-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  /* Gradient mờ ảo từ giữa xuống dưới */
  background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,0.85) 100%);
  z-index: 2;
}

.hero-content {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 40px;
  text-align: center;
  padding-bottom: 80px; /* Cách đáy 80px */
}

.hero-text {
  font-size: 1.5rem;
  line-height: 1.6;
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(40px);
  text-shadow: 
    0 0 5px rgba(0,0,0,1),
    0 0 10px rgba(0,0,0,1),
    0 4px 20px rgba(0,0,0,1),
    0 0 40px rgba(0,0,0,1),
    0 0 60px rgba(0,0,0,0.9);
}

.hero-signature {
  font-family: var(--font-premium);
  font-size: 2.2rem;
  font-weight: bold;
  color: #FFD700;
  margin-top: 30px;
  margin-bottom: 40px;
  font-style: italic;
  opacity: 0;
  transform: translateY(40px);
  text-shadow: 
    0 0 10px rgba(0,0,0,1),
    0 0 20px rgba(0,0,0,1),
    0 4px 30px rgba(0,0,0,1),
    0 0 50px rgba(0,0,0,0.8);
}

.btn-explore {
  background: linear-gradient(135deg, #FFD700, #FADB5F);
  color: #000;
  border: none;
  padding: 15px 50px;
  font-size: 1.2rem;
  font-weight: bold;
  font-family: var(--font-premium);
  letter-spacing: 1px;
  border-radius: 50px; /* rounded-full */
  cursor: pointer;
  transition: all 0.4s ease;
  opacity: 0;
  transform: translateY(40px);
  box-shadow: 0 5px 20px rgba(255,215,0,0.4);
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-explore:hover {
  background: linear-gradient(135deg, #FFF080, #FFD700);
  box-shadow: 0 8px 25px rgba(255,215,0,0.6);
  transform: translateY(0) scale(1.05);
}

.btn-explore:active {
  transform: translateY(0) scale(0.95);
}

/* Animations cho Text Hero (Chạy ngay khi vào trang) */
#hero-view.active #hero-text-1 { animation: slideUpFade 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) 0.5s forwards; }
#hero-view.active #hero-text-2 { animation: slideUpFade 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) 1.5s forwards; }
#hero-view.active #hero-text-3 { animation: slideUpFade 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) 2.5s forwards; }
#hero-view.active #btn-explore { animation: slideUpFade 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) 3.5s forwards; }

@keyframes slideUpFade {
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   2. MAP VIEW (Leaflet)
========================================= */
#map-view {
  background: #000;
}

.leaflet-map {
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #000;
}

/* Ẩn các label, control mặc định của leaflet */
.leaflet-control-zoom, .leaflet-control-attribution {
  display: none !important;
}

/* Custom Markers trên Map */
.custom-marker {
  display: flex;
  align-items: center;
  justify-content: center;
}

.marker-core {
  width: 12px;
  height: 12px;
  background-color: var(--color-accent);
  border-radius: 50%;
  box-shadow: 0 0 15px var(--color-accent);
  position: relative;
  transition: transform 0.3s ease;
}

.marker-pulse {
  position: absolute;
  top: 50%; left: 50%;
  width: 30px; height: 30px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid var(--color-accent);
  animation: mapPulse 2s infinite ease-out;
  pointer-events: none;
}

@keyframes mapPulse {
  0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
}

/* Hover mượt hơn */
.custom-marker:hover .marker-core {
  transform: scale(1.3);
  background-color: #fff;
  box-shadow: 0 0 20px #fff;
}

/* Island Pulse Marker */
.island-marker .marker-core {
  background: #ff0000;
  width: 8px;
  height: 8px;
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
}

.island-marker .marker-pulse {
  border-color: rgba(255, 0, 0, 0.6);
  width: 20px;
  height: 20px;
}

/* Other Islands (White Dot) */
.island-dot-marker .marker-core {
  background: #fff;
  width: 8px;
  height: 8px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.island-dot-marker .marker-pulse {
  border-color: rgba(255, 255, 255, 0.5);
  width: 22px;
  height: 22px;
}

/* Flag style for islands */
.island-flag {
  position: absolute;
  top: -22px; /* Position above the dot */
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 15px;
  background-color: #da251d;
  border-radius: 1px;
  box-shadow: 0 0 10px rgba(218, 37, 29, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.2);
  animation: flagWave 3s infinite ease-in-out;
}
.island-flag::after {
  content: "★";
  color: #ffff00;
  font-size: 13px;
  line-height: 1;
}
.flag-pole {
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 8px;
  background: rgba(255,255,255,0.8);
}

@keyframes flagWave {
  0%, 100% { transform: translateX(-50%) rotate(0deg); }
  50% { transform: translateX(-50%) rotate(5deg); }
}

.island-tooltip {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #fff !important;
  font-family: var(--font-body) !important;
  font-size: 0.9rem !important;
  letter-spacing: 1px;
  text-shadow: 0 2px 5px #000;
  pointer-events: none;
}

/* Tooltip Leaflet custom */
.leaflet-tooltip.custom-tooltip {
  background: rgba(10, 25, 47, 0.85);
  border: 1px solid var(--color-accent-glow);
  color: #fff;
  font-family: var(--font-premium);
  font-size: 1.2rem;
  backdrop-filter: blur(5px);
  padding: 5px 15px;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}
.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
  border: none !important; /* Bỏ mũi tên mặc định */
}

/* Custom Zoom Controls */
.custom-zoom-controls {
  position: absolute;
  bottom: 40px;
  right: 40px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000; /* Trên map */
}

.zoom-btn {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--color-text-light);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.zoom-btn:hover {
  background: rgba(255,255,255,0.2);
  border-color: var(--color-accent);
  color: var(--color-accent);
  box-shadow: 0 0 15px var(--color-accent-glow);
}

/* =========================================
   3. STORY VIEW
========================================= */
#story-view {
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-bg {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background-size: cover;
  background-position: center;
  transition: background-image 1s ease;
  z-index: 1;
  /* Cinematic slow zoom effect */
  animation: storyPan 30s infinite alternate linear;
}

@keyframes storyPan {
  from { transform: scale(1.05); }
  to { transform: scale(1.15); }
}

.story-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle at center, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.8) 100%);
  z-index: 2;
}

.story-content {
  position: relative;
  z-index: 3;
  width: 90%;
  max-width: 800px;
  text-align: center;
}

.story-title {
  font-size: 5rem;
  color: var(--color-accent);
  margin-bottom: 20px;
  text-shadow: 0 5px 25px rgba(0,0,0,0.9);
  opacity: 0;
  transform: translateY(30px);
  transition: all 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) 0.5s;
}

.story-hook {
  font-size: 1.8rem;
  font-family: var(--font-premium);
  font-style: italic;
  margin-bottom: 20px;
  line-height: 1.4;
  opacity: 0;
  transition: opacity 1.2s ease 1s;
}

.story-desc {
  font-size: 1.2rem;
  line-height: 1.8;
  color: #ddd;
  opacity: 0;
  transform: translateY(10px);
  transition: all 1.2s ease 1.5s;
}

.memorial-text {
  margin-top: 40px;
  font-family: var(--font-premium);
  font-size: 2rem;
  font-style: italic;
  color: #FADB5F;
  text-shadow: 0 0 25px rgba(250, 219, 95, 0.6);
  transition: opacity 1.5s ease;
  line-height: 1.4;
}

.story-content.animate-in .story-title { opacity: 1; transform: translateY(0); }
.story-content.animate-in .story-hook { opacity: 1; }
.story-content.animate-in .story-desc { opacity: 1; transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, #FADB5F, #D4AF37);
  color: #000;
  border: none;
  padding: 16px 35px;
  font-size: 1.2rem;
  font-family: var(--font-title);
  border-radius: 30px;
  cursor: pointer;
  margin-top: 40px;
  box-shadow: 0 5px 20px var(--color-accent-glow);
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(20px);
}

.story-content.animate-in .btn-primary {
  opacity: 1;
  transform: translateY(0);
  transition: all 1s ease 2s; 
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px var(--color-accent-glow);
}

.btn-back {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  padding: 10px 25px;
  border-radius: 25px;
  cursor: pointer;
  position: fixed; /* Changed to fixed to stay in corner */
  top: 25px;
  right: 25px;
  backdrop-filter: blur(15px);
  transition: all 0.3s ease;
  font-family: var(--font-premium);
  letter-spacing: 1px;
  z-index: 1000;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.btn-back:hover {
  background: rgba(255,255,255,0.2);
  border-color: var(--color-accent);
  box-shadow: 0 0 15px var(--color-accent-glow);
  transform: translateY(-2px);
}

/* =========================================
   4. VR VIEW
========================================= */
#vr-view {
  background: #000;
}

#vr-iframe {
  width: 100%;
  height: 100%;
  border: none;
  position: absolute;
  top: 0; left: 0;
  z-index: 1;
}

.vr-loading {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2;
  transition: opacity 0.8s ease;
}

.spinner {
  width: 60px; height: 60px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

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

.vr-ui-top {
  position: absolute;
  top: 80px; /* Dưới header cố định */
  left: 30px; right: 30px;
  display: flex;
  justify-content: flex-end; /* Push location name and audio to right if needed, or space-between */
  gap: 20px;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}

.vr-ui-top > * { pointer-events: auto; }

.btn-back-vr {
  position: fixed;
  top: 25px;
  left: 25px; /* Back to top-left for VR mode */
  z-index: 2147483647;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  padding: 10px 25px;
  border-radius: 25px;
  cursor: pointer;
  backdrop-filter: blur(15px);
  font-family: var(--font-premium);
  transition: all 0.3s ease;
  pointer-events: all !important;
  display: none; /* Hide globally by default */
}

body.in-vr .btn-back-vr {
  display: block; /* Show only when VR is active */
}

.btn-back-vr:hover { background: rgba(0,0,0,0.8); border-color: var(--color-accent); transform: scale(1.05); }

.vr-ui-fading {
  transition: opacity 1s ease;
}

#vr-view.vr-loaded .vr-ui-fading {
  opacity: 0;
  pointer-events: none;
}

body.in-vr .app-header {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.vr-location-name {
  background: rgba(0,0,0,0.6);
  padding: 8px 25px;
  border-radius: 25px;
  backdrop-filter: blur(10px);
  color: var(--color-accent);
  font-family: var(--font-title);
  letter-spacing: 1px;
}

.btn-audio {
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  width: 45px; height: 45px;
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(10px);
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
}
.btn-audio:hover { border-color: var(--color-accent); }

.vr-ui-bottom {
  position: absolute;
  bottom: 40px; left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 90%;
  max-width: 650px;
  pointer-events: none;
}

.vr-guide-box {
  background: rgba(10, 25, 47, 0.7);
  border: 1px solid rgba(250, 219, 95, 0.3);
  border-left: 4px solid var(--color-accent);
  border-radius: 12px;
  padding: 15px 25px;
  display: flex;
  align-items: center;
  gap: 20px;
  backdrop-filter: blur(15px);
  box-shadow: 0 15px 40px rgba(0,0,0,0.6);
}

.guide-avatar {
  width: 55px; height: 55px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, #eee);
  padding: 3px;
  border: 2px solid var(--color-accent);
}

.guide-text {
  font-size: 1.15rem;
  line-height: 1.5;
  font-style: italic;
  font-family: var(--font-premium);
  color: #fff;
}

/* =========================================
   5. DASHBOARD FLOATING PANEL
========================================= */
.dashboard-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

/* Map Blur when Dashboard is active */
body.dashboard-active #map-view {
    filter: blur(6px) brightness(0.6);
    transition: filter 0.4s ease;
}

.dashboard-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  width: 80vw; /* Reduced from 95vw */
  height: 80vh; /* Reduced from 90vh */
  max-width: 1200px;
  background: rgba(10, 10, 15, 0.88);
  backdrop-filter: blur(30px) saturate(160%);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  padding: 30px 40px; 
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
  box-shadow: 0 50px 100px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 3100;
}

.dashboard-overlay.active .dashboard-panel {
  opacity: 1;
  transform: translate(-50%, -45%) scale(1); /* Landing position shifted down */
}

/* Header */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.header-info h2 {
  font-size: 22px; /* Smaller title */
  color: #fff;
  font-family: var(--font-title);
  margin-bottom: 2px;
}

.last-updated {
  font-size: 13px; /* Increased from 11px */
  color: #94a3b8;
  display: block;
}

/* Close Button */
.btn-close-dashboard {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.2rem;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 3100;
}

.btn-close-dashboard:hover {
  background: #ef4444;
  transform: rotate(90deg);
}

.panel-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden; /* NO SCROLL */
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.header-info {
  display: flex;
  flex-direction: column;
}

/* Row 1: KPI Cards (3 Columns) */
.kpi-row {
  display: flex;
  gap: 15px;
  margin-left: auto;
}

.stat-card {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  padding: 8px 15px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 140px;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-accent);
}

.stat-label {
  font-size: 14px; /* Increased from 12px */
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 22px; /* Increased from 18px */
  font-weight: 700;
  color: #fff;
  font-family: var(--font-premium);
}

/* Row 2: Charts */
.charts-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr; /* Satisfaction chart slightly wider */
  gap: 20px;
  flex: 1; /* This is key to taking up all space */
}

.chart-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 20px 25px; 
  display: flex;
  flex-direction: column;
  height: 100%; /* Fill parent */
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.chart-box:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

.chart-title {
  font-size: 16px; /* Increased from 13px */
  color: var(--color-accent);
  margin-bottom: 20px;
  font-family: var(--font-premium);
  opacity: 1; /* More clear */
}

.chart-canvas-wrapper {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 250px; /* More space for the canvas */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Rating UI Styles */
.rating-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.rating-emojis {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    width: 100%;
    padding: 10px 0;
}

.emoji-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 10px;
    border-radius: 12px;
}

.emoji-icon {
    font-size: 3rem;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3));
    transition: transform 0.3s ease;
}

.emoji-label {
    font-size: 0.75rem;
    color: #94a3b8;
    font-family: var(--font-body);
    opacity: 0.7;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.emoji-btn:hover {
    transform: translateY(-10px) scale(1.1);
    background: rgba(255, 255, 255, 0.05);
}

.emoji-btn:hover .emoji-icon {
    transform: scale(1.15);
}

.emoji-btn:hover .emoji-label {
    opacity: 1;
    color: var(--color-accent);
}

/* Color specific hover effects */
.emoji-btn[data-score="1"]:hover .emoji-icon { filter: drop-shadow(0 0 15px rgba(239, 68, 68, 0.6)); }
.emoji-btn[data-score="2"]:hover .emoji-icon { filter: drop-shadow(0 0 15px rgba(249, 115, 22, 0.6)); }
.emoji-btn[data-score="3"]:hover .emoji-icon { filter: drop-shadow(0 0 15px rgba(245, 158, 11, 0.6)); }
.emoji-btn[data-score="4"]:hover .emoji-icon { filter: drop-shadow(0 0 15px rgba(163, 230, 53, 0.6)); }
.emoji-btn[data-score="5"]:hover .emoji-icon { filter: drop-shadow(0 0 15px rgba(34, 197, 94, 0.6)); }

/* Transition Helpers */
.chart-result-container {
    height: 100%;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-out {
    opacity: 0 !important;
    transform: scale(0.9);
    pointer-events: none;
}

.fade-in {
    opacity: 1 !important;
    transform: scale(1) !important;
}

/* Responsive */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .dashboard-container { width: 95%; max-height: 90vh; }
  .dashboard-content { padding: 25px; }
  .header-info h2 { font-size: 1.6rem; }
  .kpi-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 20px; }
}

/* Remove old chart-box definition to avoid conflict */
.chart-title {
  font-size: 16px;
  color: var(--color-accent);
  margin-bottom: 15px;
  font-family: var(--font-premium);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Donut Chart CSS Simplified */
.donut-chart-container {
  display: flex;
  justify-content: center;
  margin-bottom: 25px;
}

.donut-chart {
  position: relative;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: conic-gradient(
    #D4AF37 0deg 240deg,
    #8BC34A 240deg 300deg,
    #FFC107 300deg 330deg,
    #FF5722 330deg 345deg,
    #F44336 345deg 360deg
  );
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.donut-hole {
  position: absolute;
  top: 10%; left: 10%;
  width: 80%; height: 80%;
  background: #0A192F; /* Match container bg */
  border-radius: 50%;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #999;
}

.chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Bar Chart CSS Simplified */
.bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 220px;
  padding-top: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.bar-item {
  width: 10%;
  background: var(--color-accent);
  border-radius: 4px 4px 0 0;
  height: var(--h);
  position: relative;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0.8;
}

.bar-item:hover {
  opacity: 1;
  box-shadow: 0 0 15px var(--color-accent-glow);
  transform: scaleX(1.1);
}

.bar-label {
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.75rem;
  color: #666;
}

.bar-value {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.bar-item:hover .bar-value {
  opacity: 1;
}

/* =========================================
   6. TRANSITION OVERLAY
========================================= */
.transition-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #000;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease-in-out;
}

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

/* Responsive */
@media (max-width: 768px) {
  .hero-text { font-size: 1.2rem; }
  .story-title { font-size: 3.5rem; }
  .story-hook { font-size: 1.4rem; }
  .header-logo { font-size: 1.4rem; }
  .vr-guide-box { flex-direction: column; text-align: center; }
  .vr-ui-top { flex-direction: column; gap: 15px; top: 60px; }
  .vr-location-name { order: -1; }
}

.header-logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  margin-right: 4px;
  filter: drop-shadow(0 0 5px rgba(250, 219, 95, 0.3));
}

/* Decorative Islands Glow */
.decorative-island-glow {
    filter: blur(2px);
    transition: opacity 0.5s ease;
}

.decorative-island-glow:hover {
    fill-opacity: 0.8 !important;
}

/* =========================================
   7. AI CHAT WIDGET
========================================= */
#ai-chat-widget {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 2147483640;
  display: none; /* Hidden by default on Hero Screen */
  flex-direction: column;
  align-items: flex-start;
}

.chat-toggle-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FADB5F, #D4AF37);
  color: #000;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 14px rgba(250, 219, 95, 0.35);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: pulse-glow 2.5s infinite;
}

.chat-toggle-btn:hover {
  transform: scale(1.12);
  box-shadow: 0 5px 20px rgba(250, 219, 95, 0.55);
}

.chat-toggle-btn svg {
  width: 22px;
  height: 22px;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(250, 219, 95, 0.5); }
  70% { box-shadow: 0 0 0 15px rgba(250, 219, 95, 0); }
  100% { box-shadow: 0 0 0 0 rgba(250, 219, 95, 0); }
}

.chat-window {
  position: absolute;
  bottom: 58px;
  left: 0;
  width: 340px;
  height: 420px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
  transform-origin: bottom left;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-window.hidden {
  opacity: 0;
  transform: scale(0.5);
  pointer-events: none;
}

.chat-header {
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, #eee);
  border: 2px solid var(--color-accent);
}

.chat-title {
  color: #fff;
  font-family: var(--font-premium);
  font-size: 1.1rem;
  margin: 0 0 2px 0;
}

.chat-status {
  color: #10b981;
  font-size: 0.8rem;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-status::before {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 5px #10b981;
}

.chat-close-btn {
  background: transparent;
  color: #94a3b8;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.chat-close-btn:hover {
  color: #ef4444;
}

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
}

.message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.4;
  font-family: var(--font-body);
  word-wrap: break-word;
}

.msg-ai {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border-bottom-left-radius: 4px;
}

.msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(250, 219, 95, 0.2), rgba(212, 175, 55, 0.2));
  color: #FADB5F;
  border: 1px solid rgba(250, 219, 95, 0.3);
  border-bottom-right-radius: 4px;
}

.chat-input-area {
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

#chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 14px;
  border-radius: 18px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.45;
  outline: none;
  transition: border-color 0.3s;
  resize: none;
  min-height: 38px;
  max-height: calc(1.45em * 3 + 20px); /* ~3 visible lines */
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

#chat-input::-webkit-scrollbar {
  width: 4px;
}

#chat-input::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}

#chat-input:focus {
  border-color: rgba(250, 219, 95, 0.5);
}

#chat-input::placeholder {
  color: #64748b;
}

.chat-send-btn {
  background: linear-gradient(135deg, #FADB5F, #D4AF37);
  color: #000;
  border: none;
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  font-weight: bold;
}

.chat-send-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(250, 219, 95, 0.4);
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 5px 10px;
  align-items: center;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #cbd5e1;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

@media (max-width: 480px) {
  .chat-window {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    height: 70vh;
    border-radius: 20px 20px 0 0;
  }
}
