/* Style Guide & Variable Tokens */
:root {
  --bg-color: #0b0f19;
  --panel-bg: rgba(17, 24, 43, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f3f4f6;
  --text-muted: #9ca3af;
  
  --accent-cyan: #06b6d4;
  --accent-purple: #8b5cf6;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-pink: #ec4899;
  
  --glow-cyan: rgba(6, 182, 212, 0.4);
  --glow-purple: rgba(139, 92, 246, 0.4);
  --glow-blue: rgba(59, 130, 246, 0.4);
  
  --font-title: 'Outfit', 'Noto Sans TC', sans-serif;
  --font-body: 'Noto Sans TC', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* Floating Ambient Orbs */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.45;
  animation: floatOrb 25s infinite alternate ease-in-out;
}

.orb-1 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, var(--accent-cyan) 0%, transparent 70%);
  top: -150px;
  left: -150px;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
  bottom: 100px;
  right: -150px;
  animation-delay: -5s;
}

.orb-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
  top: 40%;
  left: 30%;
  animation-delay: -12s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -50px) scale(1.15); }
  100% { transform: translate(-30px, 30px) scale(0.9); }
}

/* App Layout Grid */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 100vh;
}

/* Glassmorphism Card Style */
.glass-card {
  background: var(--panel-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: var(--transition-smooth);
}

/* Typography Accent Styles */
.glow-text {
  text-shadow: 0 0 15px rgba(6, 182, 212, 0.6);
}

.gradient-text {
  background: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.accent-text {
  color: var(--accent-cyan);
}

/* Navbar Style */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  margin-bottom: 8px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-title);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 16px;
  border-radius: 12px;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-links a.active {
  box-shadow: inset 0 0 0 1px rgba(6, 182, 212, 0.25);
}

/* Main Grid Layout */
.main-grid {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Hero Section */
.hero-section {
  padding: 44px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  background: radial-gradient(circle at top right, rgba(139, 92, 246, 0.1), transparent), var(--panel-bg);
}

.hero-title {
  font-family: var(--font-title);
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.25;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 780px;
  line-height: 1.65;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  margin-top: 12px;
}

/* Primary Glow Button */
.btn-primary, .btn-primary-glow {
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 15px var(--glow-cyan);
}

.btn-primary:hover, .btn-primary-glow:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--glow-cyan);
  opacity: 0.95;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px 24px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition-smooth);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

/* Chat Trigger Button in Nav */
.chat-trigger-btn {
  background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 10px 20px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px var(--glow-purple);
  transition: var(--transition-smooth);
}

.chat-trigger-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--glow-purple);
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.stat-card {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.1);
}

.icon-blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.icon-purple { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }
.icon-green { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }

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

.stat-value {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 800;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 2px;
}

/* Chart Distribution Layout */
.charts-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 20px;
}

/* Live Monitors Layout */
.live-monitors-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.monitor-card {
  position: relative;
  overflow: hidden;
}

.monitor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 5px;
}

/* Pulsing Badges */
.live-badge, .live-badge-orange {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.live-badge-orange {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.pulse-dot, .pulse-dot-orange {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 1.6s infinite;
}

.pulse-dot-orange {
  background-color: #f59e0b;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  animation: pulse-orange 1.6s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-orange {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* Reservoir Items */
.reservoir-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.reservoir-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.reservoir-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
}

.reservoir-name {
  color: white;
}

.reservoir-desc {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-left: 6px;
}

.reservoir-pct {
  font-family: var(--font-title);
  font-weight: 700;
}

.reservoir-bar-bg {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.reservoir-bar-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px var(--bar-shadow);
}

/* Power Generation Monitor */
.power-monitor-content {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
  align-items: center;
  width: 100%;
}

.power-chart-wrapper {
  position: relative;
  height: 180px;
  width: 100%;
}

.power-stats {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.power-stat-item {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 10px 14px;
  border-radius: 8px;
}

.power-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.power-value {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 800;
  margin-top: 2px;
}

.power-source-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
}

.legend-label-group {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-val {
  color: white;
  font-weight: 700;
}

.loading-placeholder {
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
  font-size: 0.9rem;
}

.chart-box {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chart-box h3 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-wrapper {
  position: relative;
  height: 250px;
  width: 100%;
}

/* Search Panel Section */
.search-panel {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.search-bar-container {
  display: flex;
  position: relative;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 20px;
  color: var(--text-muted);
  font-size: 1.1rem;
}

#search-input {
  width: 100%;
  padding: 16px 110px 16px 52px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: var(--font-body);
  transition: var(--transition-smooth);
}

#search-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.15);
}

.clear-btn {
  position: absolute;
  right: 120px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 8px;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
}

.clear-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

.clear-btn:hover {
  color: var(--text-primary);
}

.search-bar-container button.btn-primary-glow {
  position: absolute;
  right: 8px;
  padding: 10px 24px;
}

/* Filters Row */
.filters-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-group select {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.filter-group select:focus {
  outline: none;
  border-color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.08);
}

/* Results Header */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.results-count {
  font-size: 1.1rem;
  font-weight: 700;
}

.view-options {
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  gap: 12px;
}

.active-view {
  color: var(--accent-cyan);
}

/* Datasets Cards Grid */
.datasets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  min-height: 300px;
  position: relative;
}

.dataset-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.dataset-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-cyan);
  box-shadow: 0 12px 30px rgba(6, 182, 212, 0.15);
}

.card-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-format {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.25);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 700;
}

.badge-category {
  background: rgba(139, 92, 246, 0.12);
  color: var(--accent-purple);
  border: 1px solid rgba(139, 92, 246, 0.25);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 700;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-desc {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 12px;
}

.card-agency {
  font-weight: 700;
  color: var(--accent-cyan);
}

/* Loading Spinner */
.loading-spinner-container {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 60px 0;
  color: var(--text-muted);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.05);
  border-top: 4px solid var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Pagination */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
}

.page-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.page-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: var(--accent-cyan);
}

.page-btn.active {
  background: var(--accent-cyan);
  color: white;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px var(--glow-cyan);
}

.page-btn.disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* AI Sidebar Chat Drawer style */
.chat-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100vh;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid var(--glass-border);
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
}

.chat-drawer.open {
  right: 0;
}

.chat-header {
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.chat-title i {
  font-size: 1.45rem;
  color: var(--accent-purple);
  text-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

.chat-title h4 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 800;
}

.chat-title span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 6px;
  transition: var(--transition-smooth);
}

.close-btn:hover {
  color: var(--text-primary);
  transform: rotate(90deg);
}

.chat-messages {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 85%;
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.msg-text {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.55;
}

.system-msg {
  align-self: flex-start;
}

.system-msg .msg-text {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.system-msg .msg-text ul {
  margin-top: 10px;
  padding-left: 20px;
}

.system-msg .msg-text li {
  margin-bottom: 6px;
}

.system-msg .msg-text a {
  color: var(--accent-cyan);
  text-decoration: underline;
  cursor: pointer;
}

.user-msg {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.user-msg .msg-avatar {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
}

.user-msg .msg-text {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: var(--text-primary);
}

/* Chat Rec Cards inside Message */
.chat-dataset-card {
  margin-top: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.chat-dataset-card:hover {
  border-color: var(--accent-purple);
  transform: translateY(-2px);
}

.chat-dataset-card h5 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.chat-dataset-card p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chat-input-area {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  gap: 10px;
}

#chat-input {
  flex-grow: 1;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
}

#chat-input:focus {
  outline: none;
  border-color: var(--accent-purple);
}

#chat-send-btn {
  background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 100%);
  color: white;
  border: none;
  border-radius: 10px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px var(--glow-purple);
  transition: var(--transition-smooth);
}

#chat-send-btn:hover {
  transform: translateY(-2px);
}

/* Modal Detail Dialog Backdrop */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 7, 12, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 36px;
  transform: scale(0.9);
  transition: var(--transition-smooth);
}

.modal-backdrop.open .modal-card {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-tag-row {
  display: flex;
  gap: 10px;
}

#modal-title {
  font-family: var(--font-title);
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 8px;
}

.modal-meta-row {
  display: flex;
  gap: 24px;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.modal-meta-row strong {
  color: var(--accent-cyan);
}

.modal-desc-box, .modal-columns-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.modal-desc-box h4, .modal-columns-box h4 {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-cyan);
  margin-bottom: 10px;
}

.modal-desc-box p {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-primary);
}

.columns-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.column-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: 8px;
  font-weight: 600;
}

.modal-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.detail-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-footer-box {
  display: flex;
  justify-content: center;
}

#modal-download-btn {
  padding: 14px 36px;
  font-size: 1rem;
}

/* App Footer */
.app-footer {
  text-align: center;
  padding: 24px 0 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: auto;
}

.busuanzi-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.busuanzi-stats .stat-count {
  color: var(--accent-cyan);
  font-weight: 600;
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.busuanzi-stats .stat-separator {
  color: rgba(255, 255, 255, 0.1);
}

/* Topics Section Specific Styles */
.topic-selector-tabs {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 16px;
}

.topic-tab-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.topic-tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.topic-tab-btn.active {
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.25);
}

.topic-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 24px;
}

/* Wide Stats Cards */
.stat-card-wide {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
}

/* Tourism Table Styles */
.tourism-table-container {
  overflow-x: auto;
  width: 100%;
}

.tourism-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.tourism-table th, .tourism-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tourism-table th {
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 2px solid rgba(255, 255, 255, 0.08);
}

.tourism-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.tourism-table .rank-num {
  font-weight: 800;
  color: var(--accent-cyan);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .hero-title { font-size: 1.95rem; }
  .navbar { padding: 12px 18px; }
  .logo span { display: none; }
  .charts-container { grid-template-columns: 1fr; }
  .modal-card { padding: 20px; }
  .chat-drawer { width: 100vw; right: -100vw; }
}

.weather-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: var(--transition-smooth);
}

.weather-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent-cyan);
  transform: translateY(-5px);
}

.weather-city {
  font-weight: 800;
  font-size: 1.1rem;
  color: white;
  margin-bottom: 8px;
}

.weather-icon-large {
  font-size: 2.5rem;
  margin: 10px 0;
  color: var(--accent-orange);
  filter: drop-shadow(0 0 8px rgba(249, 115, 22, 0.4));
}

.weather-cond {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.weather-temp {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--accent-cyan);
}

/* -------------------------------------------------------
   Live Dashboard Specific Extended Styles
   ------------------------------------------------------- */
.live-badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.live-badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.aqi-rank-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: 280px;
  padding-right: 5px;
}

.aqi-rank-list::-webkit-scrollbar {
  width: 4px;
}
.aqi-rank-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

.aqi-rank-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 12px 16px;
  transition: var(--transition-smooth);
}

.aqi-rank-item:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(4px);
}

.aqi-rank-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.aqi-rank-num {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.2rem;
  width: 24px;
  color: var(--text-muted);
}

.aqi-rank-item:nth-child(1) .aqi-rank-num { color: #fbbf24; }
.aqi-rank-item:nth-child(2) .aqi-rank-num { color: #94a3b8; }
.aqi-rank-item:nth-child(3) .aqi-rank-num { color: #b45309; }

.aqi-city-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.aqi-rank-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.aqi-rank-val {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.1rem;
}

.aqi-tag-good { color: #10b981; background: rgba(16, 185, 129, 0.1); padding: 2px 8px; border-radius: 6px; font-size: 0.75rem; border: 1px solid rgba(16, 185, 129, 0.2); }
.aqi-tag-fair { color: #fbbf24; background: rgba(251, 191, 36, 0.1); padding: 2px 8px; border-radius: 6px; font-size: 0.75rem; border: 1px solid rgba(251, 191, 36, 0.2); }

.yb-area-chart {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.yb-bar-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.yb-bar-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
}

.yb-bar-label {
  color: var(--text-muted);
}

.yb-bar-val {
  color: var(--text-primary);
  font-weight: 700;
}

.yb-bar-outer {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.yb-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
  border-radius: 10px;
  width: 0%;
  transition: width 1.5s cubic-bezier(0.19, 1, 0.22, 1);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.mini-live-card {
  border-top: 2px solid rgba(255, 255, 255, 0.05);
}
.mini-live-card .stat-icon {
  background: rgba(255,255,255,0.05);
}
.mini-live-card .icon-green { border: 1px solid rgba(16, 185, 129, 0.3); color: #10b981; }
.mini-live-card .icon-cyan { border: 1px solid rgba(6, 182, 212, 0.3); color: #06b6d4; }
.mini-live-card .icon-blue { border: 1px solid rgba(37, 99, 235, 0.3); color: #3b82f6; }

@media (max-width: 768px) {
  .live-monitors-container.big-grid {
    grid-template-columns: 1fr !important;
  }
}
