:root {
  --primary-blue: #1f7cf4;
  --primary-blue-hover: #0d47a1;
  --secondary-purple: #5b2c87;
  --accent-teal: #18d0cd;
  --bg-main: #0f1419; 
  --bg-panel: #242730;
  --bg-card: #2a2f38;
  --bg-input: #353a44;
  --border-color: #3c414c;
  --text-primary: #f7f8fa;
  --text-secondary: #a0a7b4;
  --text-muted: #6b7280;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  --gradient-primary: linear-gradient(135deg, #1f7cf4, #5b2c87);
  --gradient-accent: linear-gradient(135deg, #18d0cd, #1f7cf4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  font-size: 14px;
  overflow: hidden;
}

#map {
  position: fixed;
  inset: 0;
  background: var(--bg-main);
  /* Dynamic offset based on panel state */
  transform: translateX(60px);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  /* Optimize rendering performance */
  will-change: transform;
  transform-style: preserve-3d;
}

/* Hide map during login */
body.login-page #map {
  display: none;
}

/* Show map after login */
body.logged-in #map {
  display: block;
}

/* Star Constellation Canvas Background */
#star-constellation-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.8;
  pointer-events: none;
  /* Optimize canvas performance */
  will-change: opacity;
  backface-visibility: hidden;
}

.wishlist-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #666;
    transition: all 0.3s ease;
}

.wishlist-btn:hover {
    color: #ff6b6b;
    transform: scale(1.1);
}

.wishlist-btn.active {
    color: #ff6b6b;
}

.wishlist-btn.active svg {
    fill: currentColor;
    animation: heartBeat 0.3s ease;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.wishlist-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modern Glassmorphism Login - Optimized for performance */
#login-form {
  position: fixed;
  inset: 0;
  background: 
    /* Simplified gradient for faster rendering */
    radial-gradient(ellipse at 50% 50%, rgba(8, 12, 30, 0.9) 0%, rgba(2, 3, 10, 1) 100%),
    linear-gradient(135deg, #0a0e27 0%, #030510 50%, #0a0e27 100%);
  /* Reduced blur for performance */
  backdrop-filter: blur(10px);
  z-index: 1000;
  overflow: hidden;
}

/* Loading Indicator - Beautiful Minimalist Design */
#loading-indicator {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0f1419 0%, #1a1f2e 50%, #0f1419 100%);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-content {
  text-align: center;
  min-width: 280px;
  padding: 40px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.loading-spinner {
  width: 60px;
  height: 60px;
  margin: 0 auto 30px;
  position: relative;
}

.loading-spinner::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #18d0cd;
  border-right-color: #18d0cd;
  animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.loading-spinner::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-bottom-color: #5b9bf4;
  border-left-color: #5b9bf4;
  animation: spin 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) reverse infinite;
}

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

.loading-text {
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 25px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  opacity: 0.8;
}

.loading-progress {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 15px;
  position: relative;
}

.loading-progress::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.1) 50%, 
    transparent 100%);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.loading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #5b9bf4 0%, #18d0cd 50%, #5b9bf4 100%);
  border-radius: 100px;
  width: 0%;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 20px rgba(24, 208, 205, 0.5);
  position: relative;
}

.loading-progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 4px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.5); }
}

.loading-percentage {
  color: rgba(255, 255, 255, 0.6);
  font-size: 24px;
  font-weight: 200;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
  letter-spacing: 2px;
}

/* Earth Planet Formation - Disabled for performance */
#login-form::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none; /* Disabled complex backgrounds for performance */
  background: 
    /* Earth's Core - Americas (Green/Brown landmasses) */
    radial-gradient(1.5px 1.5px at 45% 50%, rgba(34,139,34,0.9), transparent 15%),
    radial-gradient(1px 1px at 43% 48%, rgba(139,69,19,0.8), transparent 12%),
    radial-gradient(1.2px 1.2px at 47% 52%, rgba(34,139,34,0.85), transparent 14%),
    radial-gradient(0.8px 0.8px at 44% 45%, rgba(60,179,113,0.7), transparent 10%),
    radial-gradient(1px 1px at 46% 55%, rgba(139,69,19,0.75), transparent 13%),
    
    /* Africa and Europe */
    radial-gradient(1.3px 1.3px at 52% 47%, rgba(34,139,34,0.8), transparent 14%),
    radial-gradient(1px 1px at 53% 45%, rgba(139,69,19,0.75), transparent 11%),
    radial-gradient(0.9px 0.9px at 51% 42%, rgba(34,139,34,0.7), transparent 12%),
    radial-gradient(1.1px 1.1px at 54% 49%, rgba(60,179,113,0.8), transparent 13%),
    
    /* Asia */
    radial-gradient(1.4px 1.4px at 58% 45%, rgba(34,139,34,0.85), transparent 15%),
    radial-gradient(1px 1px at 60% 43%, rgba(139,69,19,0.8), transparent 12%),
    radial-gradient(1.2px 1.2px at 57% 47%, rgba(60,179,113,0.75), transparent 14%),
    radial-gradient(0.8px 0.8px at 61% 46%, rgba(34,139,34,0.7), transparent 10%),
    
    /* Australia */
    radial-gradient(1px 1px at 62% 58%, rgba(139,69,19,0.8), transparent 12%),
    radial-gradient(0.8px 0.8px at 63% 60%, rgba(34,139,34,0.7), transparent 10%),
    
    /* Oceans - Pacific */
    radial-gradient(1px 1px at 35% 45%, rgba(30,144,255,0.6), transparent 20%),
    radial-gradient(0.8px 0.8px at 33% 50%, rgba(65,105,225,0.5), transparent 18%),
    radial-gradient(1.2px 1.2px at 37% 55%, rgba(30,144,255,0.65), transparent 22%),
    radial-gradient(0.9px 0.9px at 32% 40%, rgba(65,105,225,0.55), transparent 19%),
    radial-gradient(1.1px 1.1px at 36% 62%, rgba(30,144,255,0.6), transparent 21%),
    
    /* Atlantic Ocean */
    radial-gradient(1px 1px at 48% 40%, rgba(30,144,255,0.65), transparent 20%),
    radial-gradient(0.8px 0.8px at 49% 58%, rgba(65,105,225,0.6), transparent 18%),
    radial-gradient(1.1px 1.1px at 47% 35%, rgba(30,144,255,0.7), transparent 21%),
    
    /* Indian Ocean */
    radial-gradient(1px 1px at 55% 55%, rgba(30,144,255,0.6), transparent 20%),
    radial-gradient(0.9px 0.9px at 57% 52%, rgba(65,105,225,0.55), transparent 19%),
    
    /* Cloud formations */
    radial-gradient(0.6px 0.6px at 40% 35%, rgba(255,255,255,0.4), transparent 15%),
    radial-gradient(0.5px 0.5px at 55% 60%, rgba(255,255,255,0.35), transparent 12%),
    radial-gradient(0.7px 0.7px at 45% 65%, rgba(255,255,255,0.4), transparent 16%),
    radial-gradient(0.5px 0.5px at 58% 38%, rgba(255,255,255,0.3), transparent 13%);
    
  background-size: 100% 100%;
  /* animation: earthRotation 120s linear infinite; - Disabled for performance */
  z-index: 1;
  opacity: 0.9;
}

/* Earth Continental Triangulation Network - Disabled for performance */
#login-form::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none; /* Disabled complex SVG backgrounds for performance */
  background: url("data:image/svg+xml,%3Csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3C/defs%3E%3C!-- North America Outline --%3E%3Cline x1='43%25' y1='40%25' x2='45%25' y2='35%25' stroke='rgba(34,139,34,0.6)' stroke-width='0.8' opacity='0.8'/%3E%3Cline x1='45%25' y1='35%25' x2='47%25' y2='38%25' stroke='rgba(34,139,34,0.6)' stroke-width='0.8' opacity='0.8'/%3E%3Cline x1='47%25' y1='38%25' x2='43%25' y2='40%25' stroke='rgba(34,139,34,0.5)' stroke-width='0.7' opacity='0.7'/%3E%3Cline x1='43%25' y1='40%25' x2='41%25' y2='55%25' stroke='rgba(34,139,34,0.6)' stroke-width='0.8' opacity='0.8'/%3E%3Cline x1='41%25' y1='55%25' x2='47%25' y2='60%25' stroke='rgba(34,139,34,0.5)' stroke-width='0.7' opacity='0.7'/%3E%3Cline x1='47%25' y1='60%25' x2='47%25' y2='38%25' stroke='rgba(34,139,34,0.4)' stroke-width='0.6' opacity='0.6'/%3E%3C!-- South America --%3E%3Cline x1='44%25' y1='58%25' x2='46%25' y2='65%25' stroke='rgba(34,139,34,0.6)' stroke-width='0.8' opacity='0.8'/%3E%3Cline x1='46%25' y1='65%25' x2='48%25' y2='70%25' stroke='rgba(34,139,34,0.6)' stroke-width='0.8' opacity='0.8'/%3E%3Cline x1='48%25' y1='70%25' x2='44%25' y2='58%25' stroke='rgba(34,139,34,0.5)' stroke-width='0.7' opacity='0.7'/%3E%3C!-- Africa Outline --%3E%3Cline x1='51%25' y1='38%25' x2='53%25' y2='35%25' stroke='rgba(139,69,19,0.6)' stroke-width='0.8' opacity='0.8'/%3E%3Cline x1='53%25' y1='35%25' x2='55%25' y2='42%25' stroke='rgba(139,69,19,0.6)' stroke-width='0.8' opacity='0.8'/%3E%3Cline x1='55%25' y1='42%25' x2='52%25' y2='65%25' stroke='rgba(139,69,19,0.6)' stroke-width='0.8' opacity='0.8'/%3E%3Cline x1='52%25' y1='65%25' x2='51%25' y2='38%25' stroke='rgba(139,69,19,0.5)' stroke-width='0.7' opacity='0.7'/%3E%3C!-- Europe Connection --%3E%3Cline x1='51%25' y1='38%25' x2='52%25' y2='32%25' stroke='rgba(34,139,34,0.5)' stroke-width='0.6' opacity='0.7'/%3E%3Cline x1='52%25' y1='32%25' x2='55%25' y2='35%25' stroke='rgba(34,139,34,0.5)' stroke-width='0.6' opacity='0.7'/%3E%3C!-- Asia Major Outline --%3E%3Cline x1='55%25' y1='35%25' x2='62%25' y2='30%25' stroke='rgba(34,139,34,0.7)' stroke-width='0.9' opacity='0.8'/%3E%3Cline x1='62%25' y1='30%25' x2='65%25' y2='40%25' stroke='rgba(34,139,34,0.7)' stroke-width='0.9' opacity='0.8'/%3E%3Cline x1='65%25' y1='40%25' x2='60%25' y2='50%25' stroke='rgba(34,139,34,0.6)' stroke-width='0.8' opacity='0.7'/%3E%3Cline x1='60%25' y1='50%25' x2='55%25' y2='42%25' stroke='rgba(34,139,34,0.6)' stroke-width='0.8' opacity='0.7'/%3E%3Cline x1='55%25' y1='42%25' x2='55%25' y2='35%25' stroke='rgba(34,139,34,0.5)' stroke-width='0.7' opacity='0.6'/%3E%3C!-- Australia --%3E%3Cline x1='60%25' y1='58%25' x2='64%25' y2='60%25' stroke='rgba(139,69,19,0.6)' stroke-width='0.8' opacity='0.8'/%3E%3Cline x1='64%25' y1='60%25' x2='62%25' y2='62%25' stroke='rgba(139,69,19,0.6)' stroke-width='0.8' opacity='0.8'/%3E%3Cline x1='62%25' y1='62%25' x2='60%25' y2='58%25' stroke='rgba(139,69,19,0.5)' stroke-width='0.7' opacity='0.7'/%3E%3C!-- Ocean Current Lines - Pacific --%3E%3Cline x1='30%25' y1='45%25' x2='35%25' y2='50%25' stroke='rgba(30,144,255,0.4)' stroke-width='0.5' opacity='0.6'/%3E%3Cline x1='35%25' y1='50%25' x2='38%25' y2='55%25' stroke='rgba(30,144,255,0.4)' stroke-width='0.5' opacity='0.6'/%3E%3Cline x1='38%25' y1='55%25' x2='35%25' y2='60%25' stroke='rgba(30,144,255,0.4)' stroke-width='0.5' opacity='0.6'/%3E%3Cline x1='35%25' y1='60%25' x2='30%25' y2='45%25' stroke='rgba(30,144,255,0.3)' stroke-width='0.4' opacity='0.5'/%3E%3C!-- Atlantic Currents --%3E%3Cline x1='48%25' y1='35%25' x2='49%25' y2='55%25' stroke='rgba(30,144,255,0.4)' stroke-width='0.5' opacity='0.6'/%3E%3Cline x1='49%25' y1='55%25' x2='50%25' y2='40%25' stroke='rgba(30,144,255,0.3)' stroke-width='0.4' opacity='0.5'/%3E%3C!-- Indian Ocean --%3E%3Cline x1='55%25' y1='52%25' x2='58%25' y2='58%25' stroke='rgba(30,144,255,0.4)' stroke-width='0.5' opacity='0.6'/%3E%3Cline x1='58%25' y1='58%25' x2='56%25' y2='55%25' stroke='rgba(30,144,255,0.3)' stroke-width='0.4' opacity='0.5'/%3E%3C!-- Cloud Movement Patterns --%3E%3Cline x1='40%25' y1='30%25' x2='45%25' y2='32%25' stroke='rgba(255,255,255,0.3)' stroke-width='0.3' opacity='0.4'/%3E%3Cline x1='55%25' y1='58%25' x2='58%25' y2='62%25' stroke='rgba(255,255,255,0.3)' stroke-width='0.3' opacity='0.4'/%3E%3Cline x1='42%25' y1='65%25' x2='47%25' y2='68%25' stroke='rgba(255,255,255,0.3)' stroke-width='0.3' opacity='0.4'/%3E%3C/svg%3E") no-repeat;
  background-size: 100% 100%;
  /* animation: earthTriangulation 20s ease-in-out infinite; - Disabled for performance */
  z-index: 2;
  opacity: 0.7;
}

@keyframes earthRotation {
  0% { transform: translateX(0) scale(1); }
  25% { transform: translateX(-5px) scale(1.01); }
  50% { transform: translateX(-10px) scale(1.02); }
  75% { transform: translateX(-5px) scale(1.01); }
  100% { transform: translateX(0) scale(1); }
}

@keyframes earthTriangulation {
  0%, 100% { 
    opacity: 0.7;
    filter: brightness(1) hue-rotate(0deg);
  }
  25% { 
    opacity: 0.6;
    filter: brightness(1.1) hue-rotate(5deg);
  }
  50% { 
    opacity: 0.8;
    filter: brightness(1.2) hue-rotate(10deg);
  }
  75% { 
    opacity: 0.65;
    filter: brightness(1.05) hue-rotate(5deg);
  }
}

@keyframes continentPulse {
  0%, 100% { 
    opacity: 1;
    transform: scale(1);
    filter: brightness(1) hue-rotate(0deg);
  }
  25% { 
    opacity: 0.8;
    transform: scale(0.95);
    filter: brightness(1.1) hue-rotate(5deg);
  }
  50% { 
    opacity: 1.1;
    transform: scale(1.05);
    filter: brightness(1.2) hue-rotate(10deg);
  }
  75% { 
    opacity: 0.9;
    transform: scale(1.02);
    filter: brightness(1.05) hue-rotate(5deg);
  }
}

@keyframes oceanFlow {
  0%, 100% { 
    opacity: 0.9;
    transform: scale(1) rotate(0deg);
    filter: brightness(1) hue-rotate(0deg);
  }
  25% { 
    opacity: 0.7;
    transform: scale(0.9) rotate(90deg);
    filter: brightness(1.1) hue-rotate(10deg);
  }
  50% { 
    opacity: 1;
    transform: scale(1.1) rotate(180deg);
    filter: brightness(1.3) hue-rotate(20deg);
  }
  75% { 
    opacity: 0.8;
    transform: scale(1.05) rotate(270deg);
    filter: brightness(1.15) hue-rotate(10deg);
  }
}

@keyframes cloudDrift {
  0%, 100% { 
    opacity: 0.8;
    transform: scale(1) translateX(0);
    filter: brightness(1);
  }
  33% { 
    opacity: 0.6;
    transform: scale(0.85) translateX(2px);
    filter: brightness(0.9);
  }
  66% { 
    opacity: 1;
    transform: scale(1.15) translateX(-2px);
    filter: brightness(1.2);
  }
}

#login-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 22, 45, 0.02);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(91, 155, 244, 0.3);
  padding: 24px;
  border-radius: 20px;
  width: 336px;
  animation: cosmicEntry 1s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
  overflow: visible;
}


/* Continent Nodes - Blue-Green Constellation Theme */
.continent-node {
  position: absolute;
  width: 3px;
  height: 3px;
  background: radial-gradient(circle, rgba(32, 178, 170, 1) 0%, rgba(0, 139, 139, 0.8) 40%, rgba(64, 224, 208, 0.6) 80%, transparent 100%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 6;
  animation: continentPulse 8s infinite ease-in-out;
  box-shadow: 
    0 0 6px rgba(32, 178, 170, 0.7),
    0 0 12px rgba(0, 139, 139, 0.4),
    0 0 18px rgba(64, 224, 208, 0.3);
}

.continent-node::before {
  content: '';
  position: absolute;
  top: -0.5px;
  left: 50%;
  transform: translateX(-50%);
  width: 0.6px;
  height: 4px;
  background: linear-gradient(to bottom, transparent, rgba(32, 178, 170, 0.8), transparent);
}

.continent-node::after {
  content: '';
  position: absolute;
  left: -0.5px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 0.6px;
  background: linear-gradient(to right, transparent, rgba(32, 178, 170, 0.8), transparent);
}

/* Ocean Nodes - Enhanced Blue Constellation Theme */
.ocean-node {
  position: absolute;
  width: 2.5px;
  height: 2.5px;
  background: radial-gradient(circle, rgba(0, 191, 255, 0.9) 0%, rgba(30, 144, 255, 0.7) 40%, rgba(70, 130, 180, 0.5) 80%, transparent 100%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 5;
  animation: oceanFlow 10s infinite ease-in-out;
  box-shadow: 
    0 0 5px rgba(0, 191, 255, 0.7),
    0 0 10px rgba(30, 144, 255, 0.4),
    0 0 15px rgba(70, 130, 180, 0.2);
}

.ocean-node::before {
  content: '';
  position: absolute;
  top: -0.4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0.5px;
  height: 3.3px;
  background: linear-gradient(to bottom, transparent, rgba(0, 191, 255, 0.7), transparent);
}

.ocean-node::after {
  content: '';
  position: absolute;
  left: -0.4px;
  top: 50%;
  transform: translateY(-50%);
  width: 3.3px;
  height: 0.5px;
  background: linear-gradient(to right, transparent, rgba(0, 191, 255, 0.7), transparent);
}

/* Cloud Nodes - Blue-Green Atmospheric Theme */
.cloud-node {
  position: absolute;
  width: 2px;
  height: 2px;
  background: radial-gradient(circle, rgba(173, 216, 230, 0.8) 0%, rgba(135, 206, 235, 0.6) 50%, transparent 100%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 4;
  animation: cloudDrift 12s infinite ease-in-out;
  box-shadow: 
    0 0 4px rgba(173, 216, 230, 0.5),
    0 0 8px rgba(135, 206, 235, 0.3),
    0 0 12px rgba(102, 205, 170, 0.2);
}

.cloud-node::before {
  content: '';
  position: absolute;
  top: -0.3px;
  left: 50%;
  transform: translateX(-50%);
  width: 0.4px;
  height: 2.6px;
  background: linear-gradient(to bottom, transparent, rgba(173, 216, 230, 0.6), transparent);
}

.cloud-node::after {
  content: '';
  position: absolute;
  left: -0.3px;
  top: 50%;
  transform: translateY(-50%);
  width: 2.6px;
  height: 0.4px;
  background: linear-gradient(to right, transparent, rgba(173, 216, 230, 0.6), transparent);
}

@keyframes fadeIn {
  from { 
    opacity: 0; 
    transform: translate(-50%, -50%) scale(0.95); 
  }
  to { 
    opacity: 1; 
    transform: translate(-50%, -50%) scale(1); 
  }
}

@keyframes fadeInWithBubbles {
  0% { 
    opacity: 0; 
    transform: translate(-50%, -50%) scale(0.8); 
  }
  50% {
    opacity: 0.7;
    transform: translate(-50%, -50%) scale(1.05);
  }
  100% { 
    opacity: 1; 
    transform: translate(-50%, -50%) scale(1); 
  }
}

@keyframes cosmicEntry {
  0% { 
    opacity: 0; 
    transform: translate(-50%, -50%) scale(0.6) rotateY(180deg);
    filter: blur(10px);
  }
  30% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1.1) rotateY(90deg);
    filter: blur(5px);
  }
  70% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(0.95) rotateY(30deg);
    filter: blur(2px);
  }
  100% { 
    opacity: 1; 
    transform: translate(-50%, -50%) scale(1) rotateY(0deg);
    filter: blur(0px);
  }
}

@keyframes cosmicPulse {
  0%, 100% { 
    transform: scale(1) rotate(0deg);
    opacity: 0.3;
  }
  33% { 
    transform: scale(1.3) rotate(120deg);
    opacity: 0.6;
  }
  66% { 
    transform: scale(0.8) rotate(240deg);
    opacity: 0.4;
  }
}

@keyframes cosmicFloat {
  0%, 100% { 
    transform: translateY(0) translateX(0) scale(1) rotate(0deg);
    opacity: 0.6;
  }
  25% { 
    transform: translateY(-30px) translateX(10px) scale(1.2) rotate(90deg);
    opacity: 0.8;
  }
  50% { 
    transform: translateY(-15px) translateX(-5px) scale(0.9) rotate(180deg);
    opacity: 1;
  }
  75% { 
    transform: translateY(-40px) translateX(15px) scale(1.1) rotate(270deg);
    opacity: 0.7;
  }
}

@keyframes twinkle {
  0%, 100% { 
    opacity: 0.3;
    transform: scale(1);
  }
  50% { 
    opacity: 1;
    transform: scale(1.5);
  }
}

@keyframes naturalTwinkle {
  0%, 100% { 
    opacity: 0.7;
    transform: scale(1);
    filter: brightness(1);
  }
  25% { 
    opacity: 0.5;
    transform: scale(0.8);
    filter: brightness(0.8);
  }
  50% { 
    opacity: 1;
    transform: scale(1.2);
    filter: brightness(1.3);
  }
  75% { 
    opacity: 0.6;
    transform: scale(0.9);
    filter: brightness(0.9);
  }
}

.login-background-logo {
  position: absolute;
  bottom: 20px;
  left: 20px;
  transform: none;
  z-index: -1;
  opacity: 0.7;
}

.login-background-logo img {
  filter: none;
}

#login-box h3 {
  margin: 0 0 20px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-input {
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg-input);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.login-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(31, 124, 244, 0.1);
}

.login-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--gradient-primary);
  color: white;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.login-btn:active {
  transform: translateY(0);
}

/* Modern Top Navigation */
#topbar {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Geocoding Search Toggle Button */
#geocoder-toggle {
  position: fixed;
  top: 196px; /* 5. Search Location - fifth position (bottom) */
  right: 12px;
  z-index: 950;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #2a2a2a;
  border: 2px solid rgba(255, 255, 255, 0.9);
  color: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0.85;
  color: #e0e0e0;
  user-select: none;
  opacity: 0.85;
}

/* Removed pseudo-elements for clean styling */

#geocoder-toggle svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

#geocoder-toggle:hover {
  background: #404040;
  border-color: rgba(255, 255, 255, 1);
  color: #ffffff;
  transform: translateY(-1px);
  opacity: 1;
}

#geocoder-toggle:active {
  transform: translateY(0);
}

/* Prevent text selection and ensure proper click handling */
#geocoder-toggle * {
  pointer-events: none;
}

/* Buffer Analysis Toggle (Right Side) */
#buffer-analysis-toggle {
  position: fixed !important;
  top: 240px !important; /* Between geocoder (196px) and live tracker (285px) */
  right: 12px !important;
  z-index: 1000 !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 6px;
  background: #404040 !important;
  border: 2px solid rgba(255, 255, 255, 0.9) !important;
  color: #b0b0b0;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  opacity: 1 !important;
  visibility: visible !important;
}

#buffer-analysis-toggle svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

#buffer-analysis-toggle:hover {
  background: #505050;
  border-color: rgba(255, 255, 255, 1);
  color: #ffffff;
  transform: translateY(-1px);
  opacity: 1;
}

#buffer-analysis-toggle:active {
  transform: translateY(0);
}

/* Prevent text selection and ensure proper click handling */
#buffer-analysis-toggle * {
  pointer-events: none;
}

/* Override hidden class for buffer analysis toggle when it should be visible */
#buffer-analysis-toggle:not(.force-hidden) {
  display: flex !important;
}

/* Only show buffer analysis toggle after login and when explicitly unhidden */
body:not(.logged-in) #buffer-analysis-toggle {
  display: none !important;
}

body.logged-in #buffer-analysis-toggle.hidden {
  display: none !important;
}

body.logged-in #buffer-analysis-toggle:not(.hidden) {
  display: flex !important;
}

/* Geocoding Search Container */
#geocoder-container {
  position: fixed;
  top: calc(104px + 2cm); /* Align with reset button */
  right: 31px; /* Shifted 0.5cm (19px) to left from original 12px */
  z-index: 900;
  width: 260px;
  transition: all 0.3s ease;
}

/* Minimized state */
#geocoder-container.geocoder-minimized {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

/* Expanded state */
#geocoder-container.geocoder-expanded {
  transform: translateX(0);
  opacity: 1;
  pointer-events: all;
}

/* Hide toggle when geocoder is expanded - controlled via JavaScript */
#geocoder-toggle.hidden-when-expanded {
  opacity: 0;
  pointer-events: none;
}

/* Custom geocoder styling */
#geocoder-container .mapboxgl-ctrl-geocoder {
  background: rgba(36, 39, 48, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  position: relative;
}

/* Minimize button for geocoder */
.geocoder-close-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: all 0.2s ease;
  z-index: 10;
  border: none;
}

.geocoder-close-btn:hover {
  background: var(--error);
  color: white;
}

#geocoder-container .mapboxgl-ctrl-geocoder--input {
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  padding: 12px 40px 12px 40px !important; /* Proper padding for icon and close button */
}

#geocoder-container .mapboxgl-ctrl-geocoder--input::placeholder {
  color: var(--text-muted);
}

#geocoder-container .mapboxgl-ctrl-geocoder--icon-search {
  fill: var(--text-muted);
  width: 18px !important;
  height: 18px !important;
  top: 50% !important;
  left: 12px !important;
  transform: translateY(-50%) !important;
}

#geocoder-container .mapboxgl-ctrl-geocoder--suggestions {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-xl);
}

#geocoder-container .mapboxgl-ctrl-geocoder--suggestion {
  color: var(--text-primary) !important;
  background: var(--bg-card) !important;
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px !important;
}

#geocoder-container .mapboxgl-ctrl-geocoder--suggestion:hover,
#geocoder-container .mapboxgl-ctrl-geocoder--suggestion.mapboxgl-ctrl-geocoder--suggestion-selected {
  background: var(--primary-blue) !important;
  color: white !important;
}

/* Fix for text inside suggestions */
#geocoder-container .mapboxgl-ctrl-geocoder--suggestion > * {
  color: inherit !important;
}

#geocoder-container .mapboxgl-ctrl-geocoder--suggestion-title {
  color: inherit !important;
}

#geocoder-container .mapboxgl-ctrl-geocoder--suggestion-address {
  color: var(--text-muted) !important;
}

#geocoder-container .mapboxgl-ctrl-geocoder--suggestion:hover .mapboxgl-ctrl-geocoder--suggestion-address,
#geocoder-container .mapboxgl-ctrl-geocoder--suggestion.mapboxgl-ctrl-geocoder--suggestion-selected .mapboxgl-ctrl-geocoder--suggestion-address {
  color: rgba(255, 255, 255, 0.8) !important;
}

.toolbar-btn {
  background: rgba(36, 39, 48, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg);
  user-select: none;
  position: relative;
  overflow: hidden;
}

.toolbar-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.6s ease;
}

.toolbar-btn:hover::before {
  left: 100%;
}

.toolbar-btn:hover {
  background: var(--primary-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.toolbar-btn:active {
  transform: translateY(0);
}

.toolbar-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Enhanced Zoom to Fit Button */
.zoom-fit-btn {
  background: #2a2a2a;
  border: 2px solid rgba(255, 255, 255, 0.9);
  color: #e0e0e0;
  opacity: 0.85;
}

.zoom-fit-btn:hover {
  background: #404040;
  border-color: rgba(255, 255, 255, 1);
  color: #ffffff;
  transform: translateY(-1px);
  opacity: 1;
}

.zoom-fit-btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.zoom-fit-btn:hover svg {
  transform: none;
}

.zoom-fit-btn span {
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* Prevent click conflicts on toolbar button icons */
.toolbar-btn * {
  pointer-events: none;
}

/* Enhanced Side Panel */
#panel {
  position: fixed;
  top: 0;
  left: 0;
  height: calc(100vh - 20px);
  width: 320px;
  max-width: 90vw;
  background: rgba(36, 39, 48, 0.85); /* Reduced opacity from 0.95 to 0.85 for 10% transparency */
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-color);
  padding: 8px;
  margin-top: 5px;
  z-index: 800;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  border-radius: 0 8px 8px 0;
}

#panel.hide {
  transform: translateX(-100%);
}

/* Map full width when panel is hidden */
#map.panel-hidden {
  transform: translateX(0);
}

#panel::-webkit-scrollbar {
  width: 6px;
}

#panel::-webkit-scrollbar-track {
  background: transparent;
}

#panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.panel-header {
  margin-bottom: 16px;
  text-align: center;
}

.panel-title {
  font-size: 18px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin: 8px 0 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.section-title::before {
  content: '';
  width: 2px;
  height: 12px;
  background: var(--gradient-accent);
  border-radius: 2px;
}

/* Add Data Icon Button */
.add-data-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  margin-right: 8px;
  flex-shrink: 0;
  vertical-align: top;
  overflow: hidden;
}

.add-data-icon-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.2);
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
  z-index: 0;
}

.add-data-icon-btn:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.4);
  color: var(--primary-blue);
  transform: translateY(-1px);
}

.add-data-icon-btn:hover:not(:disabled)::before {
  width: 100%;
  height: 100%;
}

.add-data-icon-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.2);
}

/* SVG icon styling for consistency */
.add-data-icon-btn svg {
  width: 19px;
  height: 19px;
  transition: transform 0.2s ease;
  position: relative;
  z-index: 1;
}

/* Enhanced Form Controls */
.form-control {
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 12px;
  background: var(--bg-input);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(31, 124, 244, 0.1);
}

.btn {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-small {
  padding: 4px 8px;
  font-size: 10px;
}

/* Search Section */
.search-section {
  margin-bottom: 6px;
}

/* Layers Section */
.layers-section {
  overflow: hidden; /* Prevent any unwanted scrollbars on the section itself */
}

/* Layers Container */
#layers-container {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
  /* Smooth scrolling */
  scroll-behavior: smooth;
  /* Ensure proper flex behavior and prevent overflow */
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  max-height: calc(100vh - 250px);
  position: relative;
}

#layers-container::-webkit-scrollbar {
  width: 4px;
}

#layers-container::-webkit-scrollbar-track {
  background: transparent;
}

#layers-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  transition: background 0.2s ease;
}

#layers-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* When scrolling, show a more prominent scrollbar */
#layers-container:hover::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.4);
}

/* Visual indicator when content is scrollable */
#layers-container.has-scroll {
  position: relative;
}

/* Disabled scroll fade gradients to prevent mirror line artifacts */
#layers-container.has-scroll::before {
  display: none;
}

#layers-container.has-scroll::after {
  display: none;
}

/* Enhanced Layer Cards */
.layer-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 8px; /* Slightly increased for better separation */
  position: relative;
  transition: all 0.3s ease;
  cursor: default;
  /* Optimize for vertical space usage */
  min-height: fit-content;
  max-width: 100%;
}

.layer-card:hover {
  border-color: var(--primary-blue);
  box-shadow: var(--shadow-lg);
}

.layer-card:active {
  cursor: grabbing;
}

.layer-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
  cursor: grabbing;
}

.layer-card.drag-over {
  border-color: var(--accent-teal);
  background: rgba(24, 208, 205, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(24, 208, 205, 0.3);
}

/* Layer minimize/maximize states */
.layer-card.minimized {
  padding: 6px 8px;
  margin-bottom: 4px;
}

.layer-card.minimized .layer-header {
  margin-bottom: 0;
}

.layer-content {
  overflow-y: auto; /* Allow scrolling within layer if needed, but prefer full visibility */
  overflow-x: hidden; /* Prevent horizontal scrolling */
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  max-height: 1200px; /* Accommodate both expanded sections */
  opacity: 1;
  /* Custom scrollbar for layer content */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.layer-content::-webkit-scrollbar {
  width: 3px;
}

.layer-content::-webkit-scrollbar-track {
  background: transparent;
}

.layer-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.layer-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.layer-content.minimized {
  max-height: 0;
  opacity: 0;
  margin: 0;
  overflow: hidden; /* Hide all content when minimized */
  pointer-events: none;
}

/* Layer Control Buttons - Consistent Theme */
.layer-control-btn {
  padding: 4px;
  min-width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.layer-control-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease;
}

.layer-control-btn:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.4);
  color: var(--primary-blue);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.layer-control-btn:hover:not(:disabled)::before {
  width: 100%;
  height: 100%;
}

.layer-control-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.2);
}

.layer-control-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.02);
}

.layer-control-btn svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}

/* Specific button styles */
.layer-control-btn.minimized svg {
  /* No rotation needed - using different icons */
  transform: none;
}

.layer-control-btn[data-action="move-up"]:hover:not(:disabled) svg {
  transform: translateY(-2px);
}

.layer-control-btn[data-action="move-down"]:hover:not(:disabled) svg {
  transform: translateY(2px);
}

.layer-remove-btn:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.layer-remove-btn:hover:not(:disabled) svg {
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

/* Section chevron animations */
.section-chevron {
  transition: transform 0.2s ease;
  display: inline-block;
}

.section-chevron.collapsed {
  transform: rotate(-90deg);
}

/* Data viz and labels section styling */
.data-viz-section, .labels-section {
  position: relative;
  margin-bottom: 8px; /* Clean spacing between sections */
}

/* Ensure clean visual separation without harsh lines */
.data-viz-section {
  /* Data visualization section at the top */
}

.labels-section {
  /* Labels section follows with natural spacing */
}

.viz-content, .labels-content {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible; /* Allow content to be fully visible */
  min-height: auto; /* Let content determine height naturally */
  padding: 0 2px; /* Small padding to prevent content touching edges */
}

/* Labels section visual improvements */
.labels-content {
  position: relative;
  /* Clean separation using only spacing */
}

/* Performance optimizations for smooth scrolling and transitions */
.data-viz-section, .labels-section {
  will-change: auto;
  contain: layout style;
}

.viz-content, .labels-content {
  will-change: auto;
  contain: layout;
}

/* Optimize form controls for better touch and interaction */
.data-viz-section select,
.data-viz-section input[type="range"],
.data-viz-section input[type="color"],
.data-viz-section input[type="number"] {
  transition: all 0.2s ease;
}

.data-viz-section select:focus,
.data-viz-section input:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

/* Improve readability of section headers */
.data-viz-section .section-chevron,
.labels-section .section-chevron {
  flex-shrink: 0;
}

/* Add drag handle visual cue */
.layer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  cursor: default;
  gap: 12px;
  min-height: 32px;
}

/* Drag handle specific styling */
.drag-handle {
  cursor: grab !important;
  padding: 2px;
  border-radius: 3px;
  transition: background-color 0.2s ease;
}

.drag-handle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.drag-handle:active {
  cursor: grabbing !important;
}

/* Prevent dragging on interactive elements */
.layer-controls,
.color-picker,
.data-viz-select,
input[type="color"],
select,
button {
  -webkit-user-drag: none;
  -moz-user-select: none;
  user-drag: none;
  cursor: default !important;
}

/* Allow proper cursor for range inputs */
input[type="range"],
.opacity-slider {
  -webkit-user-drag: none;
  -moz-user-select: none;
  user-drag: none;
  cursor: pointer !important;
  touch-action: pan-x; /* Better touch support */
}

input[type="range"]::-webkit-slider-thumb,
.opacity-slider::-webkit-slider-thumb {
  cursor: grab !important;
}

/* Dragging state for sliders */
input[type="range"].dragging,
.opacity-slider.dragging {
  cursor: grabbing !important;
}

input[type="range"].dragging::-webkit-slider-thumb,
.opacity-slider.dragging::-webkit-slider-thumb {
  cursor: grabbing !important;
  transform: scale(1.2);
}

input[type="range"].dragging::-moz-range-thumb,
.opacity-slider.dragging::-moz-range-thumb {
  cursor: grabbing !important;
  transform: scale(1.2);
}

input[type="range"]::-webkit-slider-thumb:active,
.opacity-slider::-webkit-slider-thumb:active {
  cursor: grabbing !important;
}

input[type="range"]::-moz-range-thumb,
.opacity-slider::-moz-range-thumb {
  cursor: grab !important;
}

input[type="range"]::-moz-range-thumb:active,
.opacity-slider::-moz-range-thumb:active {
  cursor: grabbing !important;
}

.layer-name {
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.layer-filename {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.layer-controls {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}

.layer-move-btn {
  padding: 3px;
  min-width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.layer-move-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.layer-move-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.layer-toggle {
  position: relative;
  width: 36px;
  height: 18px;
  background: var(--border-color);
  border-radius: 9px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.layer-toggle.active {
  background: var(--primary-blue);
}

.layer-toggle::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.3s;
}

.layer-toggle.active::after {
  transform: translateX(18px);
}

/* Legacy color picker - keeping for backward compatibility */
.color-picker {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.2s;
}

.color-picker:hover {
  transform: scale(1.1);
}

/* Modern Color Picker Styling */
.modern-color-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

/* Coloris Input Styling */
.coloris-input {
  width: 30px;
  height: 24px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0px; /* Hide text, show only color */
  padding: 0;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  color: transparent; /* Hide text */
  text-indent: -9999px; /* Move text off screen */
}

.coloris-input:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  border-color: rgba(0, 0, 0, 0.3);
}

.coloris-input:focus {
  outline: none;
  border-color: #1f7cf4;
  box-shadow: 0 0 0 2px rgba(31, 124, 244, 0.1);
}

.color-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Uniform Slider Styling for all controls */
.slider-control-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.slider-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  min-width: 40px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.slider-control-horizontal {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 80px;
}

/* Enhanced Universal Slider - Grey Theme */
.uniform-slider,
.terrain-slider,
input[type="range"] {
  flex: 1;
  min-width: 100px;
  height: 3px;
  background: linear-gradient(to right, 
    #2193b0 0%, 
    #6dd5ed var(--value, 50%), 
    #e2e8f0 var(--value, 50%), 
    #e2e8f0 100%);
  outline: none;
  border-radius: 2px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  box-shadow: 0 0 0 0 rgba(33, 147, 176, 0);
}

.uniform-slider:hover,
.terrain-slider:hover,
input[type="range"]:hover {
  height: 4px;
  background: linear-gradient(to right, 
    #1a7da0 0%, 
    #36d1dc var(--value, 50%), 
    #e2e8f0 var(--value, 50%), 
    #e2e8f0 100%);
  box-shadow: 0 2px 8px rgba(33, 147, 176, 0.2);
}

.uniform-slider:focus,
.terrain-slider:focus,
input[type="range"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 147, 176, 0.3);
}

/* Small Dot Slider Thumb - Minimal & Smooth */
.uniform-slider::-webkit-slider-thumb,
.terrain-slider::-webkit-slider-thumb,
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, #36d1dc 0%, #5b86e5 100%);
  border-radius: 50%;
  cursor: grab;
  border: 2px solid #ffffff;
  box-shadow: 
    0 2px 8px rgba(33, 147, 176, 0.3),
    0 4px 16px rgba(91, 134, 229, 0.15);
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
}

.uniform-slider::-webkit-slider-thumb:hover,
.terrain-slider::-webkit-slider-thumb:hover,
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  cursor: grab;
  background: linear-gradient(135deg, #2193b0 0%, #4a78f7 100%);
  box-shadow: 
    0 4px 16px rgba(33, 147, 176, 0.4),
    0 8px 32px rgba(91, 134, 229, 0.25);
  border-color: #ffffff;
}

.uniform-slider::-webkit-slider-thumb:active,
.terrain-slider::-webkit-slider-thumb:active,
input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.15);
  cursor: grabbing;
  background: linear-gradient(135deg, #1a7da0 0%, #3d68e6 100%);
  box-shadow: 
    0 2px 12px rgba(33, 147, 176, 0.5),
    0 6px 24px rgba(91, 134, 229, 0.3);
  transition: all 0.1s ease-out;
}

/* Firefox Small Dot Thumb */
.uniform-slider::-moz-range-thumb,
.terrain-slider::-moz-range-thumb,
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, #36d1dc 0%, #5b86e5 100%);
  border-radius: 50%;
  cursor: grab;
  border: 2px solid #ffffff;
  box-shadow: 
    0 2px 8px rgba(33, 147, 176, 0.3),
    0 4px 16px rgba(91, 134, 229, 0.15);
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.uniform-slider::-moz-range-thumb:hover,
.terrain-slider::-moz-range-thumb:hover,
input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.25);
  background: linear-gradient(135deg, #2193b0 0%, #4a78f7 100%);
  box-shadow: 
    0 4px 16px rgba(33, 147, 176, 0.4),
    0 8px 32px rgba(91, 134, 229, 0.25);
  border-color: #ffffff;
}

/* Firefox Thin Track */
.uniform-slider::-moz-range-track,
.terrain-slider::-moz-range-track,
input[type="range"]::-moz-range-track {
  height: 3px;
  background: #d1d5db;
  border-radius: 2px;
  border: none;
}

.slider-value {
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
  transition: all 0.15s ease;
  min-width: 35px;
  text-align: center;
}

/* Minimal value feedback */
.slider-control-horizontal:hover .slider-value {
  color: #374151;
}

/* Minimal focus feedback */
.uniform-slider:focus + .slider-value,
.terrain-slider:focus + .slider-value,
input[type="range"]:focus + .slider-value {
  color: #1f2937;
}

/* Minimal active feedback */
.uniform-slider:active + .slider-value,
.terrain-slider:active + .slider-value,
input[type="range"]:active + .slider-value {
  color: #111827;
}

.opacity-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  transition: background 0.15s ease;
  position: relative;
}

.opacity-control:hover {
  background: rgba(255, 255, 255, 0.06);
}

.opacity-control::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary-blue);
  border-radius: 6px 0 0 6px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.opacity-control:hover::before {
  opacity: 0.6;
}

.opacity-control .opacity-value {
  font-weight: 600;
  transition: none; /* Remove transition for instant color changes */
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 35px;
}

/* Horizontal Opacity Control to align with color pickers */
.opacity-control-horizontal {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 80px;
}

.opacity-control-horizontal .opacity-slider {
  flex: 1;
  min-width: 40px;
  height: 3px;
  background: linear-gradient(to right, 
    #2193b0 0%, 
    #6dd5ed var(--value, 50%), 
    #e2e8f0 var(--value, 50%), 
    #e2e8f0 100%);
  outline: none;
  border-radius: 2px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  transition: all 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.opacity-control-horizontal .opacity-slider:hover {
  height: 4px;
  background: linear-gradient(to right, 
    #1a7da0 0%, 
    #36d1dc var(--value, 50%), 
    #e2e8f0 var(--value, 50%), 
    #e2e8f0 100%);
  box-shadow: 0 2px 8px rgba(33, 147, 176, 0.2);
}

.opacity-control-horizontal .opacity-slider::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, #36d1dc 0%, #5b86e5 100%);
  border-radius: 50%;
  cursor: grab;
  box-shadow: 
    0 2px 8px rgba(33, 147, 176, 0.3),
    0 4px 16px rgba(91, 134, 229, 0.15);
  transition: all 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border: 2px solid #ffffff;
}

.opacity-control-horizontal .opacity-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  background: linear-gradient(135deg, #2193b0 0%, #4a78f7 100%);
  box-shadow: 
    0 4px 16px rgba(33, 147, 176, 0.4),
    0 8px 32px rgba(91, 134, 229, 0.25);
  border-color: #ffffff;
}

.opacity-control-horizontal .opacity-slider::-webkit-slider-thumb:active {
  transform: scale(1.15);
  background: linear-gradient(135deg, #1a7da0 0%, #3d68e6 100%);
  box-shadow: 
    0 2px 12px rgba(33, 147, 176, 0.5),
    0 6px 24px rgba(91, 134, 229, 0.3);
}

.opacity-control-horizontal .opacity-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, #36d1dc 0%, #5b86e5 100%);
  border-radius: 50%;
  cursor: grab;
  border: 2px solid #ffffff;
  box-shadow: 
    0 2px 8px rgba(33, 147, 176, 0.3),
    0 4px 16px rgba(91, 134, 229, 0.15);
  transition: all 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.opacity-control-horizontal .opacity-slider::-moz-range-thumb:hover {
  transform: scale(1.25);
  background: linear-gradient(135deg, #2193b0 0%, #4a78f7 100%);
  box-shadow: 
    0 4px 16px rgba(33, 147, 176, 0.4),
    0 8px 32px rgba(91, 134, 229, 0.25);
  border-color: #ffffff;
}

.opacity-control-horizontal .opacity-value {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  transition: color 0.1s ease;
  min-width: 30px;
  text-align: right;
}

.opacity-slider {
  flex: 1;
  height: 3px;
  background: linear-gradient(to right, 
    #2193b0 0%, 
    #6dd5ed var(--value, 50%), 
    #e2e8f0 var(--value, 50%), 
    #e2e8f0 100%);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
  appearance: none;
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  will-change: background;
}

.opacity-slider:hover {
  background: linear-gradient(to right, 
    #1a7da0 0%, 
    #36d1dc var(--value, 50%), 
    #e2e8f0 var(--value, 50%), 
    #e2e8f0 100%);
  height: 4px;
  box-shadow: 0 2px 8px rgba(33, 147, 176, 0.2);
}

.opacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, #36d1dc 0%, #5b86e5 100%);
  border: 2px solid #ffffff;
  border-radius: 50%;
  cursor: grab;
  box-shadow: 
    0 2px 8px rgba(33, 147, 176, 0.3),
    0 4px 16px rgba(91, 134, 229, 0.15);
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  z-index: 2;
}

.opacity-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  background: linear-gradient(135deg, #2193b0 0%, #4a78f7 100%);
  box-shadow: 
    0 4px 16px rgba(33, 147, 176, 0.4),
    0 8px 32px rgba(91, 134, 229, 0.25);
  border-color: #ffffff;
  cursor: grab;
}

.opacity-slider::-webkit-slider-thumb:active {
  transform: scale(1.15);
  background: linear-gradient(135deg, #1a7da0 0%, #3d68e6 100%);
  box-shadow: 
    0 2px 12px rgba(33, 147, 176, 0.5),
    0 6px 24px rgba(91, 134, 229, 0.3);
  cursor: grabbing;
}

.opacity-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, #36d1dc 0%, #5b86e5 100%);
  border: 2px solid #ffffff;
  border-radius: 50%;
  cursor: grab;
  box-shadow: 
    0 2px 8px rgba(33, 147, 176, 0.3),
    0 4px 16px rgba(91, 134, 229, 0.15);
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  z-index: 2;
}

.opacity-slider::-moz-range-thumb:hover {
  transform: scale(1.25);
  background: linear-gradient(135deg, #2193b0 0%, #4a78f7 100%);
  box-shadow: 
    0 4px 16px rgba(33, 147, 176, 0.4),
    0 8px 32px rgba(91, 134, 229, 0.25);
  border-color: #ffffff;
}

.opacity-slider::-moz-range-thumb:active {
  transform: scale(1.15);
  background: linear-gradient(135deg, #1a7da0 0%, #3d68e6 100%);
  box-shadow: 
    0 2px 12px rgba(33, 147, 176, 0.5),
    0 6px 24px rgba(91, 134, 229, 0.3);
}

/* Track styling for Firefox */
.opacity-slider::-moz-range-track {
  height: 3px;
  background: #e2e8f0;
  border-radius: 2px;
  border: none;
}

/* Focus styles */
.opacity-slider:focus {
  outline: none;
}

.opacity-slider:focus::-webkit-slider-thumb {
  box-shadow: 
    0 0 0 4px rgba(33, 147, 176, 0.4),
    0 4px 16px rgba(91, 134, 229, 0.3);
}

.opacity-slider:focus::-moz-range-thumb {
  box-shadow: 
    0 0 0 4px rgba(33, 147, 176, 0.4),
    0 4px 16px rgba(91, 134, 229, 0.3);
}

/* Switch Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 30px;
  height: 16px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 10px;
  width: 10px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
}

.switch input:checked + .slider {
  background-color: var(--primary-blue);
}

.switch input:checked + .slider:before {
  transform: translateX(14px);
}

.slider.round {
  border-radius: 20px;
}

.slider.round:before {
  border-radius: 50%;
}


.legend-opacity {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Enhanced Search */
.search-container {
  position: relative;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 12px;
  transition: all 0.3s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(31, 124, 244, 0.1);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 14px;
  height: 14px;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.search-result-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s;
  font-size: 11px;
}

.search-result-item:hover,
.search-result-item.selected {
  background: var(--primary-blue);
}

.search-result-item:last-child {
  border-bottom: none;
}

/* Panel Toggle Button */
#toggle-panel {
  position: fixed;
  top: 29px;
  left: 324px;
  z-index: 900;
  width: 28px;
  height: 28px;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: none;
  color: #3b82f6;
  user-select: none;
  filter: drop-shadow(0 2px 6px rgba(59, 130, 246, 0.5));
}

/* When panel is hidden, move toggle button to corner */
body:has(#panel.hide) #toggle-panel {
  left: 12px;
}

/* Alternative fallback for browsers that don't support :has() */
.panel-hidden #toggle-panel {
  left: 12px;
}

#toggle-panel svg {
  width: 29px;
  height: 29px;
  flex-shrink: 0;
}

#toggle-panel:hover {
  color: #3b82f6;
  filter: drop-shadow(0 4px 8px rgba(59, 130, 246, 0.4));
  transform: scale(1.1);
}

#toggle-panel:active {
  transform: scale(0.95);
  filter: drop-shadow(0 2px 6px rgba(59, 130, 246, 0.6));
}

/* Prevent click conflicts on toggle panel button */
#toggle-panel * {
  pointer-events: none;
}

/* Toast Notifications */
#toast {
  position: fixed;
  top: 80px;
  right: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 99999;
  max-width: 320px;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Simple Kepler.gl Style Data Table Panel */
.attribute-panel {
  position: fixed;
  bottom: 0;
  left: 320px;
  right: 0;
  height: 240px;
  background: #ffffff;
  border-top: 2px solid var(--primary-blue);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  z-index: 950;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 120px;
  max-height: 80vh;
}

/* Simple Resize Handle */
.attribute-resize-handle {
  position: absolute;
  top: -5px;
  left: 0;
  right: 0;
  height: 10px;
  cursor: ns-resize;
  z-index: 951;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.attribute-resize-handle:hover {
  background-color: rgba(59, 130, 246, 0.1);
}

/* Simple Resize Handle Visual Indicator */
.resize-handle-indicator {
  width: 40px;
  height: 3px;
  background: var(--primary-blue);
  border-radius: 2px;
  opacity: 0.6;
}

.attribute-resize-handle:hover .resize-handle-indicator {
  opacity: 1;
  width: 60px;
  background: #3B82F6;
}

.attribute-panel.minimized {
  display: none !important;
}

/* Simple resizing state */
.attribute-panel.resizing {
  user-select: none;
}

/* Table Tabs Styling */
.table-tabs-container {
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 6px;
  min-height: 28px;
  cursor: default;
}

.table-tabs {
  display: flex;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
}

.table-tabs::-webkit-scrollbar {
  height: 2px;
}

.table-tabs::-webkit-scrollbar-track {
  background: transparent;
}

.table-tabs::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 1px;
}

.table-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #e9ecef;
  border: 1px solid #dee2e6;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  font-size: 10px;
  color: #495057;
  white-space: nowrap;
  min-width: 100px;
  max-width: 180px;
  position: relative;
  transition: all 0.2s ease;
}

.table-tab:hover {
  background: #dee2e6;
}

.table-tab.active {
  background: #ffffff;
  color: #212529;
  border-color: #e0e0e0;
  border-bottom: 1px solid #ffffff;
  margin-bottom: -1px;
  z-index: 1;
}

/* Removed combined tab CSS - focusing on individual layer tables only */

.table-tab-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-tab-close {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  transition: all 0.2s ease;
}

.table-tab-close:hover {
  background: #dc3545;
  color: white;
}

.table-tabs-controls {
  display: flex;
  gap: 4px;
  padding-left: 8px;
}

.table-tabs-controls .action-button {
  font-size: 11px;
  padding: 4px 8px;
  background: #e9ecef;
  border: 1px solid #dee2e6;
  border-radius: 3px;
  color: #495057;
}

.table-tabs-controls .action-button:hover {
  background: #dee2e6;
}

.attribute-panel-header {
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
  padding: 6px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
  user-select: none;
  min-height: 36px;
}

/* Compact single-line header for attribute table */
.attribute-panel-header-compact {
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
  padding: 3px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: move;
  user-select: none;
  min-height: 26px;
  flex-wrap: nowrap;
  overflow-x: auto;
  font-size: 11px;
}

/* Simple Legend Panel - No bubbling issues */
.legend-panel {
  position: fixed;
  top: 120px;
  right: 16px;
  width: 300px;
  max-width: calc(100vw - 360px); /* Account for sidebar width */
  min-width: 280px;
  max-height: calc(100vh - 200px); /* More conservative height */
  background: rgba(36, 39, 48, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  z-index: 999;
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* Handle smaller screens */
@media (max-width: 1024px) {
  .legend-panel {
    max-width: calc(100vw - 40px);
    right: 20px;
  }
}

/* Mobile responsive positioning */
@media (max-width: 768px) {
  .legend-panel {
    width: calc(100vw - 32px);
    max-width: none;
    left: 16px;
    right: 16px;
    top: 100px;
  }
}

.legend-panel.hidden {
  display: none;
}

.legend-panel.minimized {
  transform: translateX(calc(100% + 32px));
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.legend-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  min-height: 40px;
}

.legend-panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.legend-panel-title svg {
  color: var(--accent-teal);
  width: 14px;
  height: 14px;
}

.legend-panel-controls {
  display: flex;
  gap: 4px;
}

.legend-panel-controls .action-button {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.legend-panel-controls .action-button:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

.legend-panel-controls .action-button svg {
  width: 12px;
  height: 12px;
}

.legend-content {
  padding: 10px 12px;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.4;
  pointer-events: auto;
}

.legend-content::-webkit-scrollbar {
  width: 6px;
}

.legend-content::-webkit-scrollbar-track {
  background: transparent;
}

.legend-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.legend-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Legend items styling - matching layer cards */
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  padding: 5px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 28px;
}

.legend-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary-blue);
}

.legend-item:last-child {
  margin-bottom: 0;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.legend-text {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-opacity {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 4px;
  border-radius: 3px;
}

/* Minimized Legend Icon - Matching Sidebar Style */
.legend-minimized-icon {
  position: fixed;
  bottom: 120px;
  right: 16px;
  width: 40px;
  height: 40px;
  background: rgba(36, 39, 48, 0.85);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
  backdrop-filter: blur(20px);
  z-index: 998;
  color: var(--text-primary);
}

.legend-minimized-icon:hover {
  background: rgba(36, 39, 48, 0.95);
  border-color: var(--primary-blue);
  box-shadow: var(--shadow-xl);
  color: var(--accent-teal);
}

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

/* Legend items in the new floating legend */
.legend-content .legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  pointer-events: auto;
}

.legend-content .legend-item:last-child {
  border-bottom: none;
}

.legend-content .legend-color {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.legend-content .legend-text {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  line-height: 1.3;
}

/* Floating Map Style Control */
.floating-map-style-control {
  position: fixed;
  top: 423px; /* 4. Basemap icon - aligned with other icons */
  right: 12px;
  z-index: 1000;
}

.map-style-toggle-btn {
  width: 36px;
  height: 36px;
  background: #2a2a2a;
  border: 2px solid rgba(255, 255, 255, 0.9);
  color: #e0e0e0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  opacity: 0.85;
}

/* Clean styling without pseudo-elements */

.map-style-toggle-btn:hover {
  background: #404040;
  border-color: rgba(255, 255, 255, 1);
  color: #ffffff;
  transform: translateY(-1px);
  opacity: 1;
}

.map-style-toggle-btn svg {
  width: 18px;
  height: 18px;
  stroke: #f0f0f0 !important;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.map-style-menu {
  position: absolute;
  bottom: -151px; /* Move 5cm down (5cm ≈ 189px, but using -151px to position below icon) */
  right: 38px; /* Default position 1cm left from original (1.5cm - 0.5cm = 1cm ≈ 38px) */
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 6px;
  min-width: 120px;
  transform: translateY(10px);
  opacity: 0;
  transition: all 0.2s ease;
}


.map-style-menu:not(.hidden) {
  transform: translateY(0);
  opacity: 1;
}

/* Separator for overlay layers */
.map-style-separator {
  height: 1px;
  background: rgba(0, 0, 0, 0.1);
  margin: 6px 0 4px 0;
}

/* Overlay layers section */
.map-overlay-section {
  padding-top: 2px;
}

.map-overlay-option {
  padding: 2px 10px;
}

.overlay-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  color: #374151;
  padding: 3px 0;
  transition: background-color 0.2s ease;
  border-radius: 4px;
}

.overlay-checkbox-label:hover {
  background-color: rgba(59, 130, 246, 0.1);
}

.overlay-checkbox {
  width: 14px;
  height: 14px;
  accent-color: #3B82F6;
  cursor: pointer;
}

.overlay-name {
  flex: 1;
  user-select: none;
}

/* 3D Terrain Controls */
.terrain-exaggeration-control {
  padding: 6px 10px 4px 10px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 4px;
  margin: 4px 0 2px 0;
  transition: all 0.3s ease;
}

.terrain-exaggeration-control.hidden {
  display: none;
}

.exaggeration-label {
  font-size: 10px;
  font-weight: 600;
  color: #6B7280;
  margin-bottom: 6px;
  text-align: center;
}

.exaggeration-slider-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Old terrain slider styles moved to unified system above */

.exaggeration-value {
  font-size: 10px;
  font-weight: 600;
  color: #374151;
  min-width: 30px;
  text-align: center;
  background: rgba(255, 255, 255, 0.8);
  padding: 2px 4px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.map-style-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 11px;
  font-weight: 500;
  color: #374151;
}

.map-style-option:hover {
  background: rgba(59, 130, 246, 0.1);
}

.map-style-option.active {
  background: rgba(59, 130, 246, 0.15);
  color: #1d4ed8;
}

.style-preview {
  width: 20px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

/* Style preview backgrounds */
.street-preview {
  background: linear-gradient(45deg, #f8f9fa 50%, #e9ecef 50%);
}

.light-preview {
  background: linear-gradient(45deg, #ffffff 50%, #f8f9fa 50%);
}

.dark-preview {
  background: linear-gradient(45deg, #1a1a1a 50%, #2d2d2d 50%);
}

.satellite-preview {
  background: linear-gradient(45deg, #4a5568 25%, #2d3748 25%, #2d3748 50%, #4a5568 50%, #4a5568 75%, #2d3748 75%);
  background-size: 8px 8px;
}

.outdoors-preview {
  background: linear-gradient(45deg, #68d391 50%, #48bb78 50%);
}

/* Optimize for smooth dragging */
.attribute-panel.dragging {
  will-change: transform;
  z-index: 9999;
}

.attribute-panel.dragging .attribute-panel-content {
  pointer-events: none;
}

.attribute-panel.dragging .attribute-panel-toolbar {
  pointer-events: none;
}

/* Keep control buttons clickable even during drag */
.attribute-panel.dragging .attribute-panel-controls {
  pointer-events: auto;
}

.attribute-panel.dragging .attribute-panel-controls * {
  pointer-events: auto;
}

.attribute-panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: #2c3e50;
  font-size: 12px;
}

.attribute-panel-title svg {
  width: 14px;
  height: 14px;
  color: #1f7cf4;
}

.attribute-panel-controls {
  display: flex;
  gap: 4px;
  pointer-events: auto;
  z-index: 10;
  position: relative;
}

.attribute-panel-controls .action-button {
  pointer-events: auto;
  z-index: 11;
}

/* Compact button styles for single-line header */
.compact-btn {
  padding: 2px 6px !important;
  min-height: 20px !important;
  font-size: 10px !important;
  gap: 3px !important;
  border-radius: 3px !important;
}

.compact-btn svg {
  width: 12px !important;
  height: 12px !important;
}

/* Active state for edit mode toggle button */
.action-button.active {
  background: #1f7cf4 !important;
  color: white !important;
  border-color: #1f7cf4 !important;
  box-shadow: 0 0 10px rgba(31, 124, 244, 0.3) !important;
}

.action-button.active:hover {
  background: #1e40af !important;
  border-color: #1e40af !important;
  box-shadow: 0 0 15px rgba(30, 64, 175, 0.4) !important;
}

/* Point placement mode cursor and visual feedback */
.mapboxgl-canvas {
  transition: filter 0.2s ease;
}

.point-placement-mode .mapboxgl-canvas {
  filter: brightness(1.1) saturate(1.2);
}

/* Point placement mode visual overlay */
.point-placement-overlay {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(31, 124, 244, 0.9);
  color: white;
  padding: 12px 20px;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 15px rgba(31, 124, 244, 0.3);
  z-index: 1000;
  pointer-events: none;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.point-placement-overlay::before {
  content: "📍";
  margin-right: 8px;
}

/* Newly added row highlighting */
.newly-added-row {
  background: linear-gradient(90deg, rgba(31, 124, 244, 0.1) 0%, rgba(31, 124, 244, 0.05) 100%) !important;
  border: 1px solid rgba(31, 124, 244, 0.3) !important;
  position: relative;
}

.newly-added-row::before {
  content: "NEW";
  position: absolute;
  top: 2px;
  right: 4px;
  background: #1f7cf4;
  color: white;
  font-size: 8px;
  font-weight: bold;
  padding: 1px 4px;
  border-radius: 2px;
  z-index: 10;
  opacity: 0.8;
}

.newly-added-row:hover {
  background: linear-gradient(90deg, rgba(31, 124, 244, 0.15) 0%, rgba(31, 124, 244, 0.08) 100%) !important;
  border-color: rgba(31, 124, 244, 0.5) !important;
}

/* Smooth scroll behavior for table containers */
.data-table-container {
  scroll-behavior: smooth;
}

.attribute-panel-content {
  scroll-behavior: smooth;
}

/* Ready-to-edit cell indicator */
.cell-ready-to-edit {
  animation: pulseEdit 2s ease-in-out infinite;
}

@keyframes pulseEdit {
  0%, 100% { 
    border-color: rgba(31, 124, 244, 0.5);
    background-color: rgba(31, 124, 244, 0.05);
  }
  50% { 
    border-color: rgba(31, 124, 244, 0.8);
    background-color: rgba(31, 124, 244, 0.1);
  }
}

/* Compact title styles */
.attribute-panel-header-compact .attribute-panel-title {
  font-size: 11px;
  font-weight: 600;
  gap: 4px;
  white-space: nowrap;
}

.attribute-panel-header-compact .data-view-toggle {
  border-radius: 4px;
  border: 1px solid #d1d5db;
}

.attribute-panel-header-compact .data-view-toggle button {
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 500;
}

.attribute-panel-header-compact .row-count-indicator {
  font-size: 10px;
  color: #6b7280;
  white-space: nowrap;
}

.attribute-panel-header-compact .attribute-panel-controls {
  margin-left: auto;
  gap: 2px;
}

/* Responsive behavior for compact header */
@media (max-width: 1200px) {
  .attribute-panel-header-compact {
    flex-wrap: wrap;
    min-height: auto;
    gap: 4px;
  }
  
  .attribute-panel-header-compact .compact-btn {
    font-size: 9px !important;
    padding: 1px 4px !important;
  }
  
  .attribute-panel-header-compact .compact-btn svg {
    width: 10px !important;
    height: 10px !important;
  }
}

@media (max-width: 900px) {
  .attribute-panel-header-compact {
    padding: 2px 6px;
  }
  
  .attribute-panel-header-compact .attribute-panel-title span {
    display: none;
  }
  
  .attribute-panel-header-compact .data-view-toggle button {
    padding: 1px 4px;
    font-size: 8px;
  }
}

/* Kepler.gl Style Toolbar */
.attribute-panel-toolbar {
  padding: 6px 12px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  gap: 6px;
  align-items: center;
  background: #ffffff;
  flex-wrap: wrap;
  min-height: 36px;
}

/* Data view toggle buttons (Light Mode) */
.data-view-toggle {
  display: flex;
  background: #ffffff;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  overflow: hidden;
}

.data-view-toggle button {
  background: transparent;
  border: none;
  padding: 4px 10px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.data-view-toggle button.active {
  background: var(--primary-blue);
  color: white;
}

.map-display-options {
  display: flex;
  gap: 6px;
  align-items: center;
}

.map-display-options .action-button {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.map-display-options .action-button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.map-display-options .action-button.active {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

.data-view-toggle button:hover:not(.active) {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Row count indicator */
.row-count-indicator {
  background: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
  border: 1px solid #d1d5db;
}

.row-count-indicator .count {
  color: #1f7cf4;
  font-weight: 600;
}

/* Enhanced filter controls */
.filter-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
}

.filter-input-group {
  position: relative;
  flex: 1;
  max-width: 300px;
}

.filter-input-group input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  color: #374151;
  font-size: 12px;
  transition: all 0.2s ease;
}

.filter-input-group input:focus {
  outline: none;
  border-color: #1f7cf4;
  box-shadow: 0 0 0 2px rgba(31, 124, 244, 0.2);
}

.filter-input-group .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: #9ca3af;
}

/* Selection controls */
.selection-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.selection-button {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 10px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.selection-button:hover {
  background: #f3f4f6;
  color: #374151;
}

.selection-button.active {
  background: #1f7cf4;
  color: white;
  border-color: #1f7cf4;
}

/* Action buttons */
.action-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}

.action-button {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-weight: 600;
  backdrop-filter: blur(5px);
  position: relative;
  overflow: hidden;
}

.action-button:hover {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(31, 124, 244, 0.3);
}

.action-button svg {
  width: 14px;
  height: 14px;
}

.attribute-panel-content {
  flex: 1;
  overflow: hidden;
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
}

/* Light Mode Data Table */
.data-table-container {
  flex: 1;
  overflow: auto;
  position: relative;
}

/* Column resize handle styling */
.column-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  background: transparent;
  transition: background-color 0.2s;
}

.column-resize-handle:hover {
  background: rgba(31, 124, 244, 0.3) !important;
}

.column-resize-handle:active {
  background: rgba(31, 124, 244, 0.5) !important;
}

/* Table header adjustments - Optimized for text content */
#attribute-table th {
  position: relative;
  user-select: none;
  vertical-align: middle;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: nowrap;
  line-height: 1.2;
  padding: 4px 6px;
  height: 28px;
  box-sizing: border-box;
}

#attribute-table th .column-name {
  display: inline-block;
  word-break: break-word;
  hyphens: auto;
  max-width: none;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  color: #1f2937;
  flex: 1;
  text-align: left;
  margin-left: 1px; /* Additional 0.3mm shift left */
  order: 1; /* Priority order - column name first */
}

/* Optimize header button and icon sizes */
#attribute-table .column-menu-btn {
  width: 16px;
  height: 16px;
  padding: 2px;
  margin-right: 2px;
  order: 0; /* Menu button first */
  flex-shrink: 0;
}

#attribute-table .column-menu-btn svg {
  width: 10px;
  height: 10px;
}

#attribute-table .header-content {
  display: flex;
  align-items: center;
  height: 20px;
}

#attribute-table .header-left {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
}

#attribute-table .header-text {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  margin-left: -1px; /* Shift 0.8mm closer to menu button */
}

#attribute-table .sort-icon,
#attribute-table .pin-icon {
  font-size: 10px;
  line-height: 1;
  flex-shrink: 0;
}

#attribute-table .pin-icon {
  margin-left: 3px;
  order: 2; /* Pin icon after column name */
  opacity: 0.8;
}

#attribute-table .sort-icon {
  margin-left: 2px;
  order: 3; /* Sort icon last */
  opacity: 0.7;
}

#attribute-table th:hover .column-resize-handle {
  background: rgba(31, 124, 244, 0.1);
}

/* Kepler.gl-inspired sorting and pinning animations */
.sorting-active {
  transition: all 0.3s ease;
}

.sorting-column {
  background: rgba(31, 124, 244, 0.1) !important;
  transform: scale(1.02);
  transition: all 0.2s ease;
}

.sorted-column {
  background: rgba(31, 124, 244, 0.05) !important;
  border-top: 2px solid var(--primary-blue) !important;
}

/* Sort indicator styling */
.sort-indicator {
  margin-left: 6px;
  opacity: 0.3;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
}

.sort-indicator.active {
  opacity: 1;
  color: var(--primary-blue);
  animation: sortPulse 0.3s ease;
}

.sort-indicator.asc svg path {
  fill: var(--primary-blue);
}

.sort-indicator.desc svg path {
  fill: var(--primary-blue);
}

@keyframes sortPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Pin indicator styling */
.pin-indicator {
  margin-right: 4px;
  opacity: 0.3;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
}

.pin-indicator.active {
  opacity: 1;
  color: var(--primary-blue);
  animation: pinPulse 0.4s ease;
}

.pin-indicator.active svg path {
  fill: var(--primary-blue);
}

@keyframes pinPulse {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(5deg) scale(1.1); }
  75% { transform: rotate(-5deg) scale(1.1); }
  100% { transform: rotate(0deg) scale(1); }
}

/* Pinning/unpinning animation */
.pinning-column {
  background: rgba(31, 124, 244, 0.15) !important;
  transform: translateX(10px);
  transition: all 0.3s ease;
  box-shadow: 0 0 15px rgba(31, 124, 244, 0.3);
}

.unpinning-column {
  background: rgba(200, 200, 200, 0.1) !important;
  transform: translateX(-10px);
  transition: all 0.3s ease;
}

/* Enhanced pinned column styling - Solid backgrounds */
.pinned-column {
  background: #f8faff !important;
  border-right: 2px solid var(--primary-blue) !important;
  position: relative;
}

.pinned-column::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--primary-blue);
  opacity: 0.8;
}

/* Ensure pinned columns have solid backgrounds when sticky */
#attribute-table th.pinned-column {
  background: #f8faff !important;
  z-index: 30 !important;
}

#attribute-table td.pinned-column {
  background: #ffffff !important;
  z-index: 25 !important;
}

/* Hover effects for better UX */
#attribute-table th:hover {
  background: rgba(31, 124, 244, 0.03) !important;
  transition: background-color 0.15s ease;
}

#attribute-table th:hover .sort-indicator,
#attribute-table th:hover .pin-indicator {
  opacity: 0.7;
}

/* Loading state for table operations */
.table-loading {
  position: relative;
  opacity: 0.7;
}

.table-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top: 2px solid var(--primary-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Keyboard hint animation */
@keyframes fadeInOut {
  0% { opacity: 0; transform: translateY(-10px); }
  20% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* Table header focus styling for keyboard navigation */
#attribute-table th[data-column]:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: -2px;
  background: rgba(31, 124, 244, 0.1) !important;
}

/* Keyboard shortcut styling */
kbd {
  background: #f4f4f4;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 2px 6px;
  font-family: monospace;
  font-size: 11px;
  color: #333;
  box-shadow: 0 1px 0 rgba(0,0,0,0.2);
}

.attribute-panel-content {
  flex: 1;
  overflow: hidden;
  background: #ffffff;
  display: flex;
  flex-direction: column;
}

.attribute-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  background: #ffffff;
}

/* Simple Table container */
.data-table-container {
  flex: 1;
  overflow: auto;
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  background: #ffffff;
  max-height: calc(100vh - 200px);
}

#attribute-table {
  width: 100%;
  position: relative;
  border-collapse: separate;
  border-spacing: 0;
}

#attribute-table thead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
}

#attribute-table tbody {
  position: relative;
  background: #ffffff;
}

.attribute-table th {
  background: #ffffff !important;
  color: #1f2937 !important;
  font-weight: 500;
  font-size: 11px;
  text-transform: none;
  padding: 4px 8px;
  height: 28px;
  letter-spacing: 0.2px;
  border-bottom: 2px solid #e5e7eb;
  border-right: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 100 !important;
  cursor: pointer;
  user-select: none;
  transition: none !important;
  white-space: nowrap;
  min-width: 60px;
  line-height: 1.2;
  vertical-align: middle;
  opacity: 1 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: 0 1px 0 #e5e7eb;
}

.attribute-table th:last-child {
  border-right: none;
}

.attribute-table th:hover {
  background: #f8f9fa !important;
  color: #1f2937 !important;
  opacity: 1 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.attribute-table th.sorted {
  background: #1f7cf4 !important;
  color: white !important;
  opacity: 1 !important;
}

/* Ensure no transparency during column operations */
.attribute-table th.pinned,
.attribute-table th.sorting,
.attribute-table th.pin-animation {
  background: #ffffff !important;
  opacity: 1 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Force solid backgrounds - absolute override */
.attribute-table th,
.attribute-table th:hover,
.attribute-table th:active,
.attribute-table th:focus,
.attribute-table th[style*="position: sticky"],
.attribute-table th[style*="left:"],
.attribute-table th:nth-child(n),
.attribute-table th:nth-child(n):hover,
.attribute-table th:nth-child(n):active {
  background: #ffffff !important;
  opacity: 1 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
  -webkit-filter: none !important;
}

.attribute-table th:hover {
  background: #f8f9fa !important;
}

/* Manual column resizing */
.attribute-table th {
  position: relative;
  resize: horizontal;
  overflow: auto;
}

.attribute-table th::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: col-resize;
  background: transparent;
  z-index: 100;
}

.attribute-table th::after:hover {
  background: #1f7cf4;
}

.attribute-table td {
  padding: 3px 8px;
  border-bottom: 1px solid #f3f4f6;
  border-right: 1px solid #f3f4f6;
  color: #374151;
  font-size: 11px;
  line-height: 1.3;
  height: 24px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.attribute-table td:last-child {
  border-right: none;
}

.attribute-table tbody tr {
  cursor: pointer;
}

.attribute-table tbody tr:hover {
  background-color: #f8fafc;
}

.attribute-table tbody tr:nth-child(even) {
  background-color: #f9fafb;
}

.attribute-table tbody tr:nth-child(even):hover {
  background-color: #f1f5f9;
}


.attribute-table tbody tr:hover {
  background: #f8f9fa;
}

.attribute-table tbody tr.selected {
  background: #eff6ff;
  border-left: 3px solid #1f7cf4;
}

.attribute-table tbody tr.highlighted {
  background: #f0fdfa;
  border-left: 3px solid #18d0cd;
}

/* Data type indicators */
.data-type-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  opacity: 0.7;
}

.data-type-string { background: #8e8e8e; }
.data-type-number { background: #4a90e2; }
.data-type-boolean { background: #7ed321; }
.data-type-date { background: #f5a623; }
.data-type-geometry { background: #d0021b; }

/* Column resize handle */
.column-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: col-resize;
  background: transparent;
  transition: background 0.2s ease;
}

.column-resize-handle:hover {
  background: #1f7cf4;
}

/* Sort indicators */
.sort-indicator {
  margin-left: 6px;
  font-size: 10px;
  opacity: 0.7;
}

.sort-indicator.asc::after {
  content: '↑';
  color: #1f7cf4;
  font-weight: bold;
}

.sort-indicator.desc::after {
  content: '↓';
  color: #1f7cf4;
  font-weight: bold;
}

/* File Upload Enhancement */
.file-upload {
  position: relative;
  display: inline-block;
  width: 100%;
  margin-bottom: 10px;
}

.file-upload-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.file-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
  cursor: pointer;
  transition: all 0.3s ease;
}

.file-upload-label:hover {
  border-color: var(--primary-blue);
  background: rgba(31, 124, 244, 0.05);
}

.file-upload-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.file-upload-text {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 3px;
}

.file-upload-hint {
  font-size: 10px;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* Temporary class for PDF export to hide UI elements */
.pdf-export-hidden {
  display: none !important;
  visibility: hidden !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  #panel {
    width: 100vw;
    padding: 12px;
  }
  
  /* Optimize layer content for mobile */
  .layer-content {
    max-height: 800px; /* Smaller max-height for mobile screens */
  }
  
  .data-viz-section, .labels-section {
    margin-bottom: 4px; /* Tighter spacing on mobile */
  }
  
  /* Ensure touch-friendly controls */
  .data-viz-section select,
  .data-viz-section input {
    min-height: 40px; /* Better touch targets */
  }
}
  
  #login-box {
    width: 85vw;
    max-width: 360px;
    padding: 30px 20px;
  }
  
  #topbar {
    top: 10px;
    right: 10px;
    gap: 8px;
  }
  
  #toggle-panel {
    top: 27px;
    left: 2px;
  }
  
  .toolbar-btn {
    padding: 10px 12px;
  }
  
  .toolbar-btn span {
    display: none;
  }


/* Custom Scrollbars */
.search-results::-webkit-scrollbar,
.data-table-container::-webkit-scrollbar {
  width: 8px;
}

.search-results::-webkit-scrollbar-track,
.data-table-container::-webkit-scrollbar-track {
  background: #f8f9fa;
  border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb,
.data-table-container::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
}

.search-results::-webkit-scrollbar-thumb:hover,
.data-table-container::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* PDF Export Modal */
.pdf-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.pdf-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 90vw;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.pdf-modal-header {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pdf-modal-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.pdf-modal-body {
  padding: 14px 18px;
}

.pdf-modal-footer {
  padding: 12px 18px 14px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Progress Components */
.progress-container {
  margin-bottom: 10px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-blue);
  margin-bottom: 6px;
}

.progress-status {
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
}

/* Filter Panel Styles (Kepler.gl inspired) */
.filter-panel {
  position: fixed;
  top: 0.5cm; /* 0.5 cm from top */
  right: 2cm; /* 2 cm from right */
  width: 280px;
  max-height: 420px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(20px);
  z-index: 1000;
  overflow: hidden;
  cursor: default;
}

.filter-panel.dragging {
  opacity: 0.9;
  cursor: move;
}

.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--gradient-primary);
  border-bottom: 1px solid var(--border-color);
  cursor: move;
  user-select: none;
}

.filter-panel-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}

.filter-panel-title svg {
  width: 14px;
  height: 14px;
  stroke: white;
}

.filter-panel-controls {
  display: flex;
  gap: 4px;
}

.filter-panel-content {
  padding: 8px;
  max-height: calc(420px - 40px);
  overflow-y: auto;
}

.filter-section {
  margin-bottom: 10px;
}

.filter-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-controls-container {
  background: var(--bg-card);
  border-radius: 4px;
  padding: 8px;
  border: 1px solid var(--border-color);
}

.filter-row {
  margin-bottom: 6px;
  display: flex;
  gap: 4px;
}

.filter-row:last-child {
  margin-bottom: 0;
}

.filter-select {
  flex: 1;
  padding: 6px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  transition: all 0.2s ease;
}

.filter-select:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 2px rgba(31, 124, 244, 0.2);
}

.filter-input {
  flex: 1;
  padding: 6px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  transition: all 0.2s ease;
}

.filter-input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 2px rgba(31, 124, 244, 0.2);
}

.filter-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.filter-btn.primary {
  background: var(--gradient-primary);
  color: white;
}

.filter-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(31, 124, 244, 0.3);
}

.filter-btn.secondary {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.filter-btn.secondary:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.active-filters-section {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.active-filters-list {
  min-height: 40px;
  max-height: 120px;
  overflow-y: auto;
  background: var(--bg-card);
  border-radius: 6px;
  padding: 8px;
  border: 1px solid var(--border-color);
}

.no-filters-message {
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  padding: 12px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-blue);
  color: white;
  padding: 4px 8px;
  border-radius: 16px;
  font-size: 12px;
  margin: 2px;
}

.filter-chip .remove-filter {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 2px;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

.filter-chip .remove-filter:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Fixed Filter Icon - Always visible on right side */
.filter-minimized-icon {
  position: fixed !important;
  top: 331px !important; /* 2. Filter icon - aligned with other icons */
  right: 12px !important;
  width: 36px;
  height: 36px;
  background: #2a2a2a;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 6px;
  display: none; /* Hidden by default, shown via JS */
  align-items: center;
  justify-content: center;
  color: #e0e0e0;
  cursor: pointer;
  opacity: 0.85;
  user-select: none;
  z-index: 1000 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.filter-minimized-icon:hover {
  background: #404040;
  border-color: rgba(255, 255, 255, 1);
  color: #ffffff;
  transform: translateY(-1px);
  opacity: 1;
}

/* Clean styling without pseudo-elements */

.filter-minimized-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.attribute-minimized-icon {
  position: fixed;
  top: 377px; /* 3. Attribute table icon - aligned with other icons */
  right: 12px;
  width: 36px;
  height: 36px;
  background: #2a2a2a;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e0e0e0;
  cursor: pointer;
  opacity: 0.85;
  user-select: none;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.attribute-minimized-icon:hover {
  background: #404040;
  border-color: rgba(255, 255, 255, 1);
  color: #ffffff;
  transform: translateY(-1px);
  opacity: 1;
}

/* Show filter icon when not hidden and not on login page */
body:not(.login-page) .filter-minimized-icon:not(.hidden) {
  display: flex !important;
}

/* Show filter icon after login only when not hidden */
body.logged-in .filter-minimized-icon:not(.hidden) {
  display: flex !important;
}

/* Make attribute icon visible when not hidden */
.attribute-minimized-icon:not(.hidden) {
  display: flex !important;
}

.attribute-minimized-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* Create Layer Minimized Icon */
.create-layer-minimized-icon {
  position: fixed;
  top: calc(232px + 2cm); /* 6. Create Layer icon - sixth position */
  right: 12px;
  width: 36px;
  height: 36px;
  background: #2a2a2a;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0.85;
  user-select: none;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.create-layer-minimized-icon:hover {
  background: #3b82f6;
  border-color: rgba(255, 255, 255, 1);
  color: #ffffff;
  transform: translateY(-1px);
  opacity: 1;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.create-layer-minimized-icon:not(.hidden) {
  display: flex !important;
}

.create-layer-minimized-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* Active marking state for minimized icon */
.create-layer-minimized-icon.active-marking {
  background: #3b82f6;
  border-color: #1d4ed8;
  animation: pulse-marking 2s infinite;
}

.create-layer-minimized-icon.active-marking:hover {
  background: #2563eb;
}

@keyframes pulse-marking {
  0%, 100% { 
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3); 
  }
  50% { 
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.6); 
  }
}

/* Create Layer Panel - Matching Main Layer Panel Theme */
.compact-create-panel {
  position: fixed;
  top: 80px;
  right: 16px;
  width: 320px;
  background: rgba(36, 39, 48, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: var(--shadow-xl);
  z-index: 1002;
  font-size: 11px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  color: var(--text-secondary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
}

.compact-create-panel.hidden {
  display: none !important;
}

/* Create Layer Panel Header - Matching Main Layer Panel */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: move;
  user-select: none;
  min-height: 44px;
}

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

.layer-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--gradient-primary);
  border-radius: 4px;
  color: var(--text-primary);
  flex-shrink: 0;
}

.header-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.panel-title-main {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.panel-subtitle {
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.2;
  font-weight: 400;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.kepler-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.kepler-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.kepler-btn:active {
  background: var(--bg-input);
}

.point-count-badge {
  background: rgba(24, 208, 205, 0.2);
  color: var(--accent-teal);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--accent-teal);
}

.panel-controls {
  display: flex;
  gap: 6px;
}

.panel-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.panel-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--accent-teal);
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(24, 208, 205, 0.3);
}

/* Panel Body - Matching Main Layer Panel */
.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  background: rgba(36, 39, 48, 0.85);
}

.panel-section {
  border-bottom: 1px solid var(--border-color);
}

.panel-section:last-child {
  border-bottom: none;
}

/* Section Toggles - Matching Main Layer Panel */
.section-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-panel);
  cursor: pointer;
  transition: background 0.2s ease;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  min-height: 32px;
}

.section-toggle:hover {
  background: var(--bg-card);
}

.section-toggle.active {
  background: var(--bg-card);
  color: var(--text-primary);
}

.section-toggle.collapsed {
  color: var(--text-muted);
}

.section-toggle span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.toggle-icon {
  transition: transform 0.2s ease;
}

.section-toggle.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

/* Section Content - Matching Main Layer Panel */
.section-content {
  padding: 12px;
  max-height: 500px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  background: rgba(36, 39, 48, 0.85);
}

.section-content.collapsed {
  max-height: 0;
  padding: 0 12px;
}

/* Form Elements - Matching Main Layer Panel */
.compact-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 11px;
  background: var(--bg-input);
  color: var(--text-primary);
  transition: all 0.2s ease;
  font-family: inherit;
}

.compact-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 2px rgba(31, 124, 244, 0.2);
  background: var(--bg-card);
}

.compact-btn {
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  font-family: inherit;
  min-height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  color: var(--text-primary);
}

.compact-btn.primary {
  background: var(--primary-blue);
  color: var(--text-dark);
  border-color: var(--primary-blue);
  font-weight: 600;
}

.compact-btn.primary:hover {
  background: var(--primary-blue-hover);
  border-color: var(--primary-blue-hover);
}

.compact-btn.primary:disabled {
  background: var(--text-secondary);
  border-color: var(--text-secondary);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.compact-btn.secondary {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.compact-btn.secondary:hover {
  background: var(--bg-card);
  border-color: var(--primary-blue);
  color: var(--text-primary);
}

.compact-btn.secondary:disabled {
  background: var(--bg-panel);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.compact-btn.full-width {
  width: 100%;
}

/* Optimized Marking Controls */
.marking-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.controls-row {
  display: flex;
  gap: 4px;
}

.controls-row .compact-btn {
  flex: 1;
  font-size: 10px;
  padding: 5px 8px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  margin-top: 2px;
}

.status-text {
  font-weight: 600;
  color: var(--primary-blue);
}

.marking-status {
  color: var(--text-muted);
  font-size: 10px;
  font-style: italic;
}

.marking-status.active {
  color: var(--success);
  font-weight: 500;
}

/* Compact Table - Dark Theme */
.compact-table-container {
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-input);
}

.compact-table {
  width: 100%;
  font-size: 11px;
  border-collapse: collapse;
  color: var(--text-primary);
}

.compact-table th {
  background: var(--bg-card);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  color: var(--text-primary);
}

.compact-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.compact-table tr:hover {
  background: var(--bg-card);
}

.compact-table tr.selected {
  background: rgba(31, 124, 244, 0.2);
  border-left: 3px solid var(--primary-blue);
}

.compact-table .empty-row td {
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
  padding: 20px 10px;
}

/* Optimized Panel Footer */
.panel-footer {
  padding: 8px 12px;
  background: var(--bg-input);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.panel-footer .compact-btn {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
}

/* New Kepler.gl-style Table Styling */
.table-header {
  background: #f5f5f5 !important; /* Light gray header background */
  color: #333333 !important; /* Dark text */
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
  border-bottom: 2px solid #e0e0e0 !important;
  font-weight: 600;
  padding: 3px 6px !important; /* Reduced vertical padding */
  height: 26px !important; /* Fixed compact height */
  position: sticky !important; /* Make headers sticky */
  top: 0 !important; /* Stick to top */
  z-index: 100 !important; /* Above table rows */
}

.table-header:hover {
  background: #eeeeee !important; /* Slightly darker on hover */
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  height: 100%;
}

.column-name {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1;
}

.sort-icon {
  font-size: 10px;
  color: var(--primary-blue);
  min-width: 10px;
  margin-left: 2px;
}

.table-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
  background: #ffffff !important; /* White background for odd rows */
  height: 24px !important; /* Fixed compact height */
  position: relative !important; /* Ensure proper stacking */
  z-index: 1 !important; /* Below headers */
}

.table-row:nth-child(even) {
  background: #f8f9fa !important; /* Off-white background for even rows */
}

.table-row:hover {
  background: #e3f2fd !important; /* Light blue hover */
}

.table-row.selected {
  background: rgba(25, 118, 210, 0.15) !important; /* Blue selection */
}

.table-row.selected:hover {
  background: rgba(25, 118, 210, 0.25) !important;
}

.table-row.selected:nth-child(even) {
  background: rgba(25, 118, 210, 0.15) !important; /* Ensure selected rows override alternating colors */
}

.table-cell {
  font-size: 11px;
  color: #333333 !important; /* Dark text on white background */
  border: 1px solid #e0e0e0 !important;
  border-left: none !important;
  border-right: none !important;
  padding: 2px 6px !important; /* Significantly reduced padding */
  height: 24px !important; /* Fixed height matching row */
  line-height: 20px !important; /* Proper text alignment */
  transition: background-color 0.15s ease;
}

/* Enhanced Header Styling */
.header-content {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  padding: 2px 4px;
  height: 100%;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  height: 100%;
}

.header-text {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.column-menu-btn {
  background: transparent;
  border: none;
  padding: 2px;
  cursor: pointer;
  border-radius: 3px;
  color: #9ca3af; /* Grey color */
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

.column-menu-btn:hover {
  color: #6b7280; /* Darker grey on hover */
  opacity: 1;
  transform: scale(1.1);
  background: rgba(156, 163, 175, 0.1);
}

.column-menu-btn:active {
  transform: scale(0.95);
  color: #4b5563; /* Even darker grey when clicked */
}

.column-menu-btn.menu-active {
  background: rgba(31, 124, 244, 0.1);
  color: var(--primary-blue);
  opacity: 1;
  transform: scale(1.05);
  box-shadow: 0 1px 4px rgba(31, 124, 244, 0.2);
}

/* Pinned Column Styling - Optimized for performance */
.table-header.pinned {
  background: rgba(31, 124, 244, 0.08) !important;
  border-right: 2px solid var(--primary-blue) !important;
  position: sticky !important;
  left: 0 !important;
  z-index: 150 !important; /* Higher than regular headers */
  will-change: transform;
  transition: none !important;
}

td.pinned-column {
  background: rgba(31, 124, 244, 0.03) !important;
  border-right: 2px solid rgba(31, 124, 244, 0.3) !important;
  position: sticky !important;
  left: 0 !important;
  z-index: 5 !important;
}

/* Sorted Column Styling - Optimized */
.table-header.sorted {
  background: rgba(31, 124, 244, 0.05) !important;
  transition: background-color 0.15s ease;
}

.table-header.sorted .sort-icon {
  color: var(--primary-blue);
  font-weight: bold;
  margin-left: 6px;
  animation: sortIndicatorPulse 0.3s ease;
}

@keyframes sortIndicatorPulse {
  0% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.pin-icon {
  font-size: 10px;
  margin-right: 2px;
  opacity: 0.8;
}

.table-row .table-cell:nth-child(n+1) {
  /* Dynamic styling for pinned columns will be applied via JS */
}

/* Column Menu Dropdown - Compact Version */
.column-menu-dropdown {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 3px;
  min-width: 45px;
  backdrop-filter: blur(10px);
  animation: menuSlideIn 0.15s ease;
}

@keyframes menuSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
  border-radius: 8px;
  position: relative;
}

/* Compact menu item style */
.menu-item.compact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 6px;
  cursor: pointer;
  color: #374151;
  font-size: 16px;
  transition: all 0.15s ease;
  border-radius: 4px;
  position: relative;
  min-height: 24px;
  min-width: 32px;
}

.menu-item.compact .menu-icon {
  font-size: 14px;
}

.menu-item.compact .check {
  font-size: 10px;
  color: var(--primary-blue);
  position: absolute;
  top: 2px;
  right: 2px;
}

.menu-item:hover {
  background: rgba(31, 124, 244, 0.12);
  color: var(--primary-blue);
  transform: translateX(1px);
  transition: all 0.15s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.menu-item.compact:hover {
  background: rgba(31, 124, 244, 0.1);
  transform: scale(1.1);
  transition: all 0.15s ease;
}

.menu-item.active {
  background: rgba(31, 124, 244, 0.08);
  color: var(--primary-blue);
  font-weight: 500;
}

.menu-item.active::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 70%;
  background: var(--primary-blue);
  border-radius: 2px;
  animation: activeIndicator 0.2s ease-out;
}

@keyframes activeIndicator {
  from {
    width: 0;
    opacity: 0;
  }
  to {
    width: 3px;
    opacity: 1;
  }
}

.menu-item svg {
  color: currentColor;
  flex-shrink: 0;
}

.menu-item span {
  flex: 1;
}

.sort-indicator, .pin-indicator {
  margin-left: auto;
  font-size: 12px;
  opacity: 0.8;
}

.menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* Resizable Table */
.attribute-panel {
  resize: both;
  overflow: hidden;
  min-width: 400px;
  min-height: 200px;
  max-width: 95vw;
  max-height: 80vh;
}

/* Draggable Header */
.attribute-panel-header {
  cursor: move;
  user-select: none;
}

/* Filtered row highlighting */
.table-row.filtered-highlight {
  background-color: rgba(52, 152, 219, 0.1) !important;
  border-left: 3px solid #3498db;
}

.table-row.filtered-highlight:hover {
  background-color: rgba(52, 152, 219, 0.2) !important;
}

/* Enhanced Multi-Filter Groups - Kepler.gl Style */
.filter-section {
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-card);
  overflow: hidden;
}

.filter-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(31, 124, 244, 0.1);
  border-bottom: 1px solid var(--border-color);
}

.section-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.clear-section-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.clear-section-btn:hover {
  color: var(--text-primary);
  background: var(--bg-input);
}

.filter-group {
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-card);
  transition: all 0.2s ease;
}

.filter-group.enabled {
  border-color: rgba(31, 124, 244, 0.3);
  box-shadow: 0 2px 4px rgba(31, 124, 244, 0.1);
}

.filter-group.disabled {
  opacity: 0.6;
  border-color: var(--text-muted);
}

.filter-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(31, 124, 244, 0.08);
  border-bottom: 1px solid var(--border-color);
}

.group-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.group-name-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background 0.2s ease;
}

.group-name-input:hover {
  background: var(--bg-input);
}

.group-name-input:focus {
  outline: none;
  background: var(--bg-input);
  border: 1px solid var(--primary-blue);
}

.layer-name {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.group-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logic-toggle {
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 32px;
}

.logic-toggle.and {
  border-color: var(--success);
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
}

.logic-toggle.or {
  border-color: var(--warning);
  color: var(--warning);
  background: rgba(245, 158, 11, 0.1);
}

.logic-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  margin: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--text-muted);
  border-radius: 18px;
  transition: 0.3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
}

input:checked + .slider {
  background-color: var(--primary-blue);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

.remove-group-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.remove-group-btn:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.filter-conditions {
  padding: 8px 12px;
}

.filter-condition {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin-bottom: 6px;
  background: var(--bg-input);
  border-radius: 4px;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.filter-condition:hover {
  border-color: var(--primary-blue);
  background: rgba(31, 124, 244, 0.05);
}

.condition-field {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 12px;
}

.condition-operator {
  color: var(--text-secondary);
  font-size: 11px;
  padding: 2px 6px;
  background: var(--bg-card);
  border-radius: 3px;
  text-transform: lowercase;
}

.condition-value {
  color: var(--accent-teal);
  font-size: 12px;
  flex: 1;
  text-align: right;
}

.remove-condition-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.remove-condition-btn:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.add-condition {
  margin-top: 8px;
}

.add-condition-btn {
  width: 100%;
  padding: 8px;
  border: 1px dashed var(--border-color);
  background: none;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
}

.add-condition-btn:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
  background: rgba(31, 124, 244, 0.05);
}

.add-filter-group-btn {
  margin-top: 16px;
}

.create-group-btn {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--primary-blue);
  background: rgba(31, 124, 244, 0.1);
  color: var(--primary-blue);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.create-group-btn:hover {
  background: rgba(31, 124, 244, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(31, 124, 244, 0.2);
}

.create-group-btn .icon {
  font-size: 16px;
  font-weight: bold;
}

/* Enhanced Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--bg-panel);
  border-radius: 8px;
  padding: 20px;
  min-width: 320px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
}

.modal-content h3 {
  margin: 0 0 16px 0;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 13px;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 2px rgba(31, 124, 244, 0.2);
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

.btn-primary {
  padding: 8px 16px;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(31, 124, 244, 0.3);
}

.btn-success {
  padding: 8px 16px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
  padding: 8px 16px;
  background: none;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  color: var(--text-primary);
  background: var(--bg-input);
}

.hidden {
  display: none !important;
}

/* Legacy filter styling for backward compatibility */
.filter-item.legacy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  margin-bottom: 4px;
  background: var(--bg-input);
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.filter-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.filter-content .layer-name {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.filter-details {
  font-size: 11px;
  color: var(--text-primary);
}

.remove-filter-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.remove-filter-btn:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* Kepler.gl Style Legend Components - Sidebar Matching */
.kepler-legend-item {
  padding: 8px 10px;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transition: all 0.3s ease;
}

.kepler-legend-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--primary-blue);
  box-shadow: 0 2px 8px rgba(31, 124, 244, 0.1);
}

.kepler-legend-item:last-child {
  margin-bottom: 0;
}

.kepler-legend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.kepler-legend-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.kepler-legend-type {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: rgba(24, 208, 205, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid rgba(24, 208, 205, 0.2);
  flex-shrink: 0;
}

.kepler-color-scale {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kepler-gradient-bar {
  height: 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.kepler-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
}

.kepler-scale-labels span {
  background: var(--bg-input);
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid var(--border-color);
}

.kepler-categorical-scale {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.kepler-category-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  min-height: 20px;
}

.kepler-category-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.kepler-category-label {
  color: var(--text-primary);
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kepler-category-more {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
  text-align: center;
  padding: 2px 6px;
  background: var(--bg-input);
  border-radius: 3px;
}

.kepler-solid-color {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 0;
}

.kepler-color-swatch {
  width: 24px;
  height: 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Enhanced legend content styling */
.legend-content {
  padding: 16px;
  max-height: calc(70vh - 80px);
  overflow-y: auto;
}

.legend-content::-webkit-scrollbar {
  width: 6px;
}

.legend-content::-webkit-scrollbar-track {
  background: var(--bg-input);
  border-radius: 3px;
}

.legend-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.legend-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Fix hover bubbling issues in legend */
.legend-item {
  position: relative;
  isolation: isolate;
}

.legend-item * {
  pointer-events: none;
}

.legend-item button,
.legend-item input,
.legend-item select,
.legend-item .legend-toggle-btn {
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

.kepler-legend-item {
  position: relative;
  isolation: isolate;
}

.kepler-legend-item * {
  pointer-events: none;
}

.kepler-legend-item button,
.kepler-legend-item input {
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

/* Prevent hover propagation to parent */
.legend-content {
  position: relative;
}

.legend-panel:hover .legend-item:not(:hover) {
  transition: none;
}

/* Custom Compass Control */
#custom-compass {
  position: fixed;
  top: calc(134px + 2cm - 3cm - 0.5cm); /* Shifted additional 0.5cm upward */
  right: calc(-6px + 0.4cm - 0.2cm); /* Shifted left by 0.2cm (right from user perspective) */
  width: 63.21px; /* Increased by 10% from 57.46px (57.46 × 1.1) */
  height: 63.21px; /* Increased by 10% from 57.46px */
  z-index: 950;
  cursor: pointer;
  transition: transform 0.2s ease;
}

#custom-compass:hover {
  transform: scale(1.05);
}

#custom-compass:active {
  transform: scale(0.98);
}

#custom-compass svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
  border-radius: 50%;
}

#custom-compass .compass-needle {
  transition: transform 0.1s ease-out;
  transform-origin: 18px 18px;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
  #custom-compass {
    width: 52.67px; /* Increased by 10% from 47.88px (47.88 × 1.1) */
    height: 52.67px;
    top: calc(124px + 2cm - 3cm - 0.5cm); /* Shifted additional 0.5cm upward on mobile */
    right: calc(-2px + 0.4cm - 0.2cm); /* Shifted left by 0.2cm (right from user perspective) on mobile */
  }
}

/* Responsive legend panel positioning */
@media (max-width: 1200px) {
  .legend-panel {
    max-width: calc(100vw - 60px);
    width: 280px;
  }
}

@media (max-width: 768px) {
  .legend-panel {
    width: calc(100vw - 32px);
    max-width: 300px;
    right: 16px;
    left: 16px;
    top: 110px;
    max-height: calc(100vh - 170px);
  }
  
  .legend-content {
    max-height: calc(100vh - 250px);
    padding: 8px 10px;
  }
  
  .legend-minimized-icon {
    right: 16px;
    bottom: 160px;
    width: 36px;
    height: 36px;
  }
  
  .legend-minimized-icon svg {
    width: 16px;
    height: 16px;
  }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
  .legend-panel {
    width: calc(100vw - 24px);
    right: 12px;
    left: 12px;
    top: 100px;
    max-height: calc(100vh - 160px);
  }
  
  .kepler-legend-item {
    padding: 6px 8px;
    margin-bottom: 4px;
  }
  
  .kepler-legend-title {
    font-size: 11px;
    max-width: 140px;
  }
  
  .legend-minimized-icon {
    right: 12px;
    bottom: 140px;
    width: 36px;
    height: 36px;
  }
}

/* Ensure legend doesn't overlap with sidebar when both are visible */
@media (min-width: 769px) {
  .legend-panel {
    /* Account for sidebar being 320px wide */
    right: max(16px, calc((100vw - 320px) * 0.02));
    max-width: calc(100vw - 380px); /* Sidebar width + margins */
  }
  
  /* When sidebar is hidden, allow legend to use more space */
  #panel.hide ~ .legend-panel {
    max-width: calc(100vw - 100px);
  }
}

/* Prevent overlap with map style control */
.legend-panel {
  /* Ensure bottom margin to avoid map style control */
  bottom: max(80px, 10vh);
}

/* Adjust minimized icon position based on other controls */
.legend-minimized-icon {
  /* Stack above other floating controls */
  z-index: 999;
}

/* Legend empty state */
.legend-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  min-height: 120px;
}

.legend-empty-state svg {
  width: 32px;
  height: 32px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.legend-empty-state p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}

.legend-empty-state .empty-subtitle {
  font-size: 11px;
  margin-top: 4px;
  opacity: 0.8;
}

/* Enhanced Add Data Modal Styles */
.data-source-tabs {
  display: flex;
  gap: 0;
}

.data-source-tab {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.data-source-tab.active {
  color: var(--primary-blue);
  border-bottom-color: var(--primary-blue);
  background: rgba(31, 124, 244, 0.05);
}

.data-source-tab:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

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

/* File Drop Zone */
.file-drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.01);
  transition: all 0.3s ease;
  cursor: pointer;
}

.file-drop-zone:hover {
  border-color: var(--primary-blue);
  background: rgba(31, 124, 244, 0.02);
}

.file-drop-zone.drag-over {
  border-color: var(--primary-blue);
  background: rgba(31, 124, 244, 0.05);
  transform: scale(1.02);
}

.drop-zone-content h4 {
  margin: 0 0 8px 0;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
}

.drop-zone-content p {
  margin: 0 0 16px 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.supported-formats {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  padding: 12px 16px;
  margin: 16px 0;
}

.supported-formats strong {
  color: var(--text-primary);
  font-size: 12px;
}

.format-list {
  color: var(--text-secondary);
  font-size: 12px;
  margin-left: 8px;
}

/* Server Data List */
.server-data-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.01);
}

.server-data-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.2s ease;
}

.server-data-item:last-child {
  border-bottom: none;
}

.server-data-item:hover {
  background: rgba(31, 124, 244, 0.05);
}

.server-data-item.selected {
  background: rgba(31, 124, 244, 0.1);
}

.server-data-info {
  flex: 1;
}

.server-data-name {
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 4px;
}

.server-data-meta {
  color: var(--text-secondary);
  font-size: 12px;
}

.loading-state {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

/* Upload Modal Styles */
.upload-type-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.radio-option {
  display: flex;
  flex-direction: column;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.01);
}

.radio-option:hover {
  border-color: var(--primary-blue);
  background: rgba(31, 124, 244, 0.02);
}

.radio-option input[type="radio"] {
  margin: 0 8px 8px 0;
  align-self: flex-start;
}

.radio-option span {
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 4px;
}

.radio-option small {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.upload-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.upload-section.active {
  display: block;
}

/* Form Controls Enhancement */
.form-control {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 2px rgba(31, 124, 244, 0.1);
}

.form-control::placeholder {
  color: var(--text-muted);
}

/* Select dropdown styling */
.form-control option {
  background: var(--bg-panel);
  color: var(--text-primary);
}

/* Textarea specific */
textarea.form-control {
  resize: vertical;
  min-height: 80px;
  line-height: 1.4;
}

/* Divider */
.divider {
  border-bottom: 1px solid var(--border-color);
  margin: 20px 0;
}

/* Enhanced button states */
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--bg-input) !important;
  color: var(--text-muted) !important;
}

.btn:not(:disabled):hover {
  transform: translateY(-1px);
}

/* Loading spinner for server operations */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  border-top-color: var(--primary-blue);
  animation: spin 1s ease-in-out infinite;
  margin-right: 8px;
}

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

/* Create Layer Modal Styles */
.create-layer-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.create-layer-section:last-child {
  border-bottom: none;
}

.create-layer-section h4 {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
}

.csv-import-section {
  transition: all 0.2s ease;
}

.csv-import-section:hover {
  background: rgba(255, 255, 255, 0.04) !important;
}

/* Custom columns list */
#custom-columns-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
  border-radius: 4px;
}

/* Custom scrollbar for columns list */
#custom-columns-list::-webkit-scrollbar {
  width: 6px;
}

#custom-columns-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

#custom-columns-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

#custom-columns-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.custom-column-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.custom-column-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.custom-column-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.custom-column-name {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 14px;
}

.custom-column-type {
  color: var(--text-secondary);
  font-size: 12px;
}

.custom-column-actions {
  display: flex;
  gap: 4px;
}

.custom-column-btn {
  padding: 4px 8px;
  font-size: 11px;
  min-width: auto;
  height: auto;
  border-radius: 4px;
}

/* Point marking controls */
.point-marking-info {
  transition: all 0.2s ease;
}

#point-count-display {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  border: 1px solid var(--border-color);
  font-weight: 500;
}

/* Optimized Create Layer Table */
.create-layer-table-container {
  background: #1f2329;
  border: 1px solid #3a414b;
  border-radius: 2px;
  overflow: hidden;
  max-height: 200px;
  overflow-y: auto;
}

#create-layer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

#create-layer-table th {
  background: #242730;
  color: #a0a7b4;
  font-weight: 600;
  font-size: 10px;
  padding: 6px 8px;
  border-bottom: 1px solid #3a414b;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 1;
}

#create-layer-table td {
  padding: 4px 8px;
  border-bottom: 1px solid #3a414b;
  font-size: 10px;
  color: #ffffff;
}

#create-layer-table tbody tr:hover {
  background: rgba(92, 198, 255, 0.08);
}

#create-layer-table tbody tr.selected {
  background: rgba(92, 198, 255, 0.15);
}

/* Editable table cells */
.editable-cell {
  cursor: text;
  min-height: 18px;
  padding: 2px 6px;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.editable-cell:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Edit mode active state */
.editable-cell.edit-mode-active {
  background: rgba(31, 124, 244, 0.05);
  border: 1px solid rgba(31, 124, 244, 0.2);
  cursor: pointer;
}

.editable-cell.edit-mode-active:hover {
  background: rgba(31, 124, 244, 0.1);
  border-color: rgba(31, 124, 244, 0.4);
}

.editable-cell.editing {
  background: var(--bg-input);
  outline: 1px solid var(--primary-blue);
}

.editable-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 12px;
  width: 100%;
  padding: 0;
}

/* Map cursor states */
.map-point-marking {
  cursor: crosshair !important;
}

.map-point-marking * {
  cursor: crosshair !important;
}

/* Point marking mode indicator */
.point-marking-active {
  position: fixed;
  top: 80px;
  right: 20px;
  background: rgba(31, 124, 244, 0.9);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
}

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

/* Enhanced table row selection */
.create-layer-table-container table tbody tr {
  cursor: pointer;
}

.create-layer-table-container table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.01);
}

/* Column type indicators */
.column-type-indicator {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.column-type-string {
  background: rgba(59, 130, 246, 0.2);
  color: #60A5FA;
}

.column-type-number {
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
}

.column-type-boolean {
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
}

.column-type-date {
  background: rgba(168, 85, 247, 0.2);
  color: #C084FC;
}

/* CSV Import Section - Kepler.gl Dark Theme */
.compact-create-panel .csv-import-section {
  margin-bottom: 12px;
  padding: 10px;
  background: #1f2329;
  border-radius: 2px;
  border: 1px solid #3a414b;
}

.compact-create-panel .csv-label {
  display: block;
  margin-bottom: 6px;
  font-size: 10px;
  color: #6a7485;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.compact-create-panel .csv-file-input {
  width: 100%;
  padding: 6px;
  margin-bottom: 6px;
  background: #242730;
  border: 1px solid #3a414b;
  border-radius: 2px;
  color: #ffffff;
  font-size: 10px;
  cursor: pointer;
}

.compact-create-panel .csv-file-input::-webkit-file-upload-button {
  background: #5cc6ff;
  border: none;
  color: #0f1419;
  padding: 4px 8px;
  border-radius: 2px;
  font-size: 10px;
  cursor: pointer;
  margin-right: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.compact-create-panel .csv-file-input::-webkit-file-upload-button:hover {
  background: #73d1ff;
}

.compact-create-panel .divider {
  border-bottom: 1px solid #3a414b;
  margin: 12px 0;
}

/* Layer Import Section - Kepler.gl Dark Theme */
.compact-create-panel .layer-import-section {
  margin-bottom: 12px;
  padding: 10px;
  background: #1f2329;
  border-radius: 2px;
  border: 1px solid #3a414b;
}

.compact-create-panel .layer-select {
  width: 100%;
  padding: 6px;
  margin-bottom: 6px;
  background: #242730;
  border: 1px solid #3a414b;
  border-radius: 2px;
  color: #ffffff;
  font-size: 10px;
  cursor: pointer;
  max-height: 120px;
  overflow-y: auto;
}

.compact-create-panel .layer-select:focus {
  outline: none;
  border-color: #5cc6ff;
  box-shadow: 0 0 0 1px #5cc6ff;
}

.compact-create-panel .layer-select option {
  padding: 8px;
  background: #242730;
  color: #ffffff;
  border-bottom: 1px solid #3a414b;
}

.compact-create-panel .layer-select option:hover {
  background: #2a2f38;
}

.compact-create-panel .layer-select option:checked {
  background: #5cc6ff;
  color: #0f1419;
}

/* Add Data Modal - Standardized Tab Content */
.tab-content {
  min-height: 400px;
  display: flex;
  flex-direction: column;
  text-align: center;
}

.tab-content:not(.active) {
  display: none;
}

.tab-content .server-data-section,
.tab-content .remote-data-section,
.tab-content .file-drop-zone {
  padding:2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 360px;
  justify-content: flex-start;
}

.tab-content h4 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.tab-content svg {
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.tab-content .form-control,
.tab-content .btn {
  width: 100%;
  max-width: 400px;
}

.tab-content .btn {
  margin-top: 8px;
}

/* Server Data Specific */
.server-selector-section {
  width: 100%;
}

.server-selector-section label {
  text-align: left;
}

.server-layer-selector {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
}

.server-layers-list {
  width: 100%;
}

.server-data-list {
  width: 100%;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.server-data-list:empty {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.server-data-item {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s ease;
}

.server-data-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.server-data-item:last-child {
  border-bottom: none;
}

.server-data-info {
  flex: 1;
  text-align: left;
}

.server-data-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-size: 14px;
}

.server-data-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  gap: 8px;
  align-items: center;
}

.server-data-item .btn {
  margin-left: 12px;
  min-width: 80px;
}

.loading-state {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
}

/* Modal Close Button */
.close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px !important;
  min-width: 32px;
  min-height: 32px;
  border-radius: 6px;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--text-secondary);
  transform: scale(1.05);
}

.close-btn svg {
  transition: transform 0.2s ease;
}

.close-btn:hover svg {
  transform: rotate(90deg);
}

/* Create Layer Panel */
.create-layer-panel {
  position: fixed;
  top: 100px;
  left: 20px;
  width: 380px;
  max-height: calc(100vh - 120px);
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  font-family: var(--font-family);
  display: flex;
  flex-direction: column;
}

.create-layer-panel .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: 8px 8px 0 0;
  cursor: move;
  min-height: 60px;
}

.create-layer-panel .header-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.create-layer-panel .header-icon {
  color: var(--primary-color);
  opacity: 0.9;
  flex-shrink: 0;
}

.create-layer-panel .header-info {
  flex: 1;
  min-width: 0;
}

.create-layer-panel .panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.create-layer-panel .header-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.create-layer-panel .layer-type {
  font-size: 12px;
  color: var(--text-secondary);
}

.create-layer-panel .point-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-color);
}

.create-layer-panel .header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.create-layer-panel .header-btn {
  padding: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.create-layer-panel .header-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.create-layer-panel .panel-body {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 220px);
}

.create-layer-panel .form-section {
  margin-bottom: 20px;
}

.create-layer-panel .form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.create-layer-panel .control-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.create-layer-panel .button-group {
  display: flex;
  gap: 8px;
}

.create-layer-panel .status-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 6px;
}

.create-layer-panel .status-counter {
  font-weight: 600;
  color: var(--primary-color);
}

.create-layer-panel .status-separator {
  opacity: 0.5;
}

.create-layer-panel .status-text {
  color: var(--text-secondary);
}

/* Collapsible Sections */
.create-layer-panel .collapsible-section {
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}

.create-layer-panel .collapsible-section.collapsed {
  border-color: rgba(var(--border-color-rgb), 0.3);
}

.create-layer-panel .section-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.create-layer-panel .section-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.create-layer-panel .section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.create-layer-panel .section-description {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.create-layer-panel .section-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.create-layer-panel .toggle-icon {
  transition: transform 0.2s ease;
  color: var(--text-secondary);
}

.create-layer-panel .collapsible-section.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.create-layer-panel .section-content {
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.create-layer-panel .section-content.collapsed {
  display: none;
}

/* Table Styling */
.create-layer-panel .table-container {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
}

.create-layer-panel .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.create-layer-panel .data-table th,
.create-layer-panel .data-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.create-layer-panel .data-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
}

.create-layer-panel .data-table td {
  color: var(--text-secondary);
}

.create-layer-panel .data-table .empty-row td {
  text-align: center;
  font-style: italic;
  color: var(--text-muted);
  padding: 20px;
}

.create-layer-panel .table-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.create-layer-panel .hint-text {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Form Groups in Advanced Options */
.create-layer-panel .form-group {
  margin-bottom: 16px;
}

.create-layer-panel .input-group {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.create-layer-panel .input-group .form-control {
  flex: 1;
}

.create-layer-panel .file-input {
  font-size: 12px;
}

.create-layer-panel .full-width {
  width: 100%;
}

.create-layer-panel .custom-columns {
  margin-top: 12px;
}

/* Panel Footer */
.create-layer-panel .panel-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-radius: 0 0 8px 8px;
}

/* Advanced Options Grid Layout */
.create-layer-panel .advanced-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}

.create-layer-panel .subsection-title {
  margin: 0 0 12px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.create-layer-panel .import-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.create-layer-panel .import-option {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.create-layer-panel .option-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.create-layer-panel .option-controls {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.create-layer-panel .option-controls .form-control.compact {
  flex: 1;
  font-size: 12px;
  padding: 6px 8px;
}

.create-layer-panel .file-input {
  flex: 1;
  font-size: 11px;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-panel);
  color: var(--text-primary);
}

.create-layer-panel .custom-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.create-layer-panel .custom-columns-list {
  margin-top: 8px;
  min-height: 20px;
}

.create-layer-panel .btn-small {
  padding: 6px 12px;
  font-size: 11px;
  border-radius: 4px;
  white-space: nowrap;
}


/* Simple Draggable Panel for Create Layer - Dark Theme */
.simple-draggable-panel {
  position: fixed;
  top: max(10px, calc(50% - min(275px, 40vh)));
  left: calc(50% - 175px);
  width: min(350px, 90vw);
  background: var(--bg-panel, #2d3748);
  border-radius: 8px;
  border: 1px solid var(--border-color, #4a5568);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 40px);
  color: var(--text-primary, #e2e8f0);
}

.simple-panel-header {
  padding: 10px 14px;
  background: var(--bg-header, #1a202c);
  border-bottom: 1px solid var(--border-color, #4a5568);
  border-radius: 8px 8px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
  user-select: none;
}

.simple-panel-header span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
}

.simple-close-btn {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  font-size: 16px;
  font-weight: bold;
  color: var(--text-primary, #ffffff);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
  z-index: 10000;
  position: relative;
  flex-shrink: 0;
}

.simple-close-btn:hover {
  background: #ef4444;
  border-color: #dc2626;
  color: #ffffff;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.simple-panel-body {
  padding: 12px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-panel, #2d3748);
  min-height: 0;
  max-height: calc(100vh - 120px);
}

.simple-section {
  margin-bottom: 12px;
}

.simple-section:last-child {
  margin-bottom: 0;
}

.simple-section label {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary, #a0aec0);
}

.simple-section input[type="text"] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border-color, #4a5568);
  border-radius: 4px;
  font-size: 11px;
  background: var(--bg-input, #1a202c);
  color: var(--text-primary, #e2e8f0);
  transition: border-color 0.2s ease;
}

.simple-section input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-blue, #1f7cf4);
  box-shadow: 0 0 0 2px rgba(31, 124, 244, 0.2);
}

.simple-section input[type="text"]::placeholder {
  color: var(--text-muted, #718096);
}

.simple-btn-row {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}

.simple-btn {
  padding: 4px 10px;
  border: 1px solid var(--border-color, #4a5568);
  background: var(--bg-card, #1a202c);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-primary, #e2e8f0);
  cursor: pointer;
  transition: all 0.2s ease;
}

.simple-btn:hover:not(:disabled) {
  background: var(--bg-hover, #2d3748);
  border-color: var(--primary-blue, #1f7cf4);
  transform: translateY(-1px);
}

.simple-btn.primary {
  background: var(--primary-blue, #1f7cf4);
  color: white;
  border-color: var(--primary-blue, #1f7cf4);
}

.simple-btn.primary:hover:not(:disabled) {
  background: #1e40af;
  border-color: #1e40af;
  box-shadow: 0 2px 8px rgba(31, 124, 244, 0.3);
}

.simple-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.marking-indicator {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background-color: #00ff00;
  border-radius: 50%;
  border: 1px solid #ffffff;
  box-shadow: 0 0 4px rgba(0, 255, 0, 0.5);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% {
    box-shadow: 0 0 4px rgba(0, 255, 0, 0.5);
  }
  50% {
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.8);
  }
  100% {
    box-shadow: 0 0 4px rgba(0, 255, 0, 0.5);
  }
}

/* Resizable handles */
.resize-handle {
  position: absolute;
  background: transparent;
  z-index: 10;
}

.resize-handle-e {
  top: 0;
  right: -2px;
  width: 4px;
  height: 100%;
  cursor: e-resize;
}

.resize-handle-s {
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 4px;
  cursor: s-resize;
}

.resize-handle-se {
  bottom: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  cursor: se-resize;
}

.resize-handle:hover {
  background: rgba(31, 124, 244, 0.3);
}

/* Make the create layer panel resizable */
.simple-draggable-panel {
  position: relative;
  min-width: 300px;
  min-height: 200px;
  max-width: 90vw;
  max-height: 90vh;
  resize: none;
}

.simple-status {
  font-size: 9px;
  color: var(--text-muted, #718096);
}

.simple-table-container {
  max-height: 280px; /* Increased to show ~10 rows (28px per row) */
  min-height: 200px; /* Minimum height to ensure good visibility */
  overflow-y: auto;
  border: 1px solid var(--border-color, #4a5568);
  border-radius: 6px;
  background: var(--bg-input, #1a202c);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.simple-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.simple-table thead {
  background: var(--bg-header, rgba(26, 32, 44, 0.9));
  position: sticky;
  top: 0;
  z-index: 10;
}

.simple-table th {
  padding: 6px 8px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border-color, #4a5568);
  color: var(--text-secondary, #a0aec0);
  font-size: 10px;
  background: var(--bg-header, rgba(26, 32, 44, 0.9));
}

.simple-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-light, rgba(74, 85, 104, 0.3));
  color: var(--text-primary, #e2e8f0);
  line-height: 1.4;
}

.simple-table tr:hover {
  background: var(--bg-hover, rgba(255, 255, 255, 0.08));
}

.simple-table tr.selected {
  background: rgba(31, 124, 244, 0.2);
  border: 1px solid rgba(31, 124, 244, 0.4);
}

.simple-table tr.selected td {
  color: #ffffff;
  font-weight: 500;
}

.simple-table td.empty {
  text-align: center;
  color: var(--text-muted, #718096);
  font-style: italic;
  padding: 8px;
}

.simple-panel-footer {
  padding: 8px 12px;
  background: var(--bg-header, #1a202c);
  border-top: 1px solid var(--border-color, #4a5568);
  border-radius: 0 0 8px 8px;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

/* Enhanced Route Management Styles */
.route-waypoint-marker {
  transition: transform 0.2s ease;
}

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

.route-waypoint-number {
  color: white;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Route Management Minimized Icon */
.simple-minimized-icon.active-marking {
  animation: pulse-blue 2s infinite;
}

@keyframes pulse-blue {
  0% {
    box-shadow: 0 0 4px rgba(0, 123, 191, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 123, 191, 0.8);
  }
  100% {
    box-shadow: 0 0 4px rgba(0, 123, 191, 0.5);
  }
}

/* Route Management Tab Navigation */
.route-tab-nav {
  display: flex;
  background: var(--bg-header, #1a202c);
  border-bottom: 1px solid var(--border-color, #4a5568);
}

.route-tab {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: var(--text-secondary, #a0aec0);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
}

.route-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary, #ffffff);
}

.route-tab.active {
  color: var(--text-primary, #ffffff);
  background: rgba(0, 123, 191, 0.1);
  border-bottom-color: #007cbf;
}

.route-tab-content {
  display: block;
}

.route-tab-content.hidden {
  display: none;
}

/* Route Statistics Grid */
.route-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 4px;
}

.route-stat {
  background: rgba(0, 123, 191, 0.08);
  border: 1px solid rgba(0, 123, 191, 0.15);
  border-radius: 3px;
  padding: 4px;
}

/* Compact UI Overrides for Route Management */
#route-management-modal .simple-section {
  margin-bottom: 6px;
}

#route-management-modal .simple-section label {
  font-size: 10px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 4px;
  display: block;
}

#route-management-modal input,
#route-management-modal select {
  font-size: 10px;
  padding: 4px;
  border: 1px solid #ddd;
  border-radius: 3px;
}

#route-management-modal .simple-btn {
  font-size: 9px;
  padding: 4px 6px;
  border-radius: 3px;
}

#route-management-modal .simple-table {
  font-size: 9px;
}

#route-management-modal .simple-table th,
#route-management-modal .simple-table td {
  padding: 3px;
}

/* Compact Route Cards */
.route-card {
  background: #2a2d3a;
  border: 1px solid #4a5568;
  border-radius: 5px;
  margin-bottom: 5px;
  padding: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.route-card:hover {
  background: #3a3d4a;
  border-color: #007cbf;
  box-shadow: 0 2px 6px rgba(0,123,191,0.2);
  transform: translateY(-1px);
}

.route-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  padding-bottom: 2px;
  border-bottom: 1px solid #4a5568;
}

.route-name {
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.route-priority {
  font-size: 8px;
  padding: 2px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.route-priority.high {
  background: #dc3545;
  color: #ffffff;
}

.route-priority.medium {
  background: #ffc107;
  color: #000000;
}

.route-priority.low {
  background: #28a745;
  color: #ffffff;
}

.route-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 5px;
  font-size: 9px;
  color: #a0aec0;
  line-height: 1.3;
}

.route-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1px 0;
}

.route-info-label {
  color: #9ca3af;
  font-weight: 500;
}

.route-info-value {
  color: #ffffff;
  font-weight: 600;
  text-align: right;
}

.route-actions {
  display: flex;
  gap: 3px;
  justify-content: flex-end;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid #4a5568;
}

.route-action-btn {
  font-size: 8px;
  padding: 3px 5px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 32px;
  font-weight: 500;
}

.route-action-btn.view {
  background: #007cbf;
  color: #ffffff;
}

.route-action-btn.view:hover {
  background: #0056b3;
}

.route-action-btn.edit {
  background: #28a745;
  color: #ffffff;
}

.route-action-btn.edit:hover {
  background: #1e7e34;
}

.route-action-btn.copy {
  background: #6c757d;
  color: #ffffff;
}

.route-action-btn.copy:hover {
  background: #545b62;
}

.route-action-btn.delete {
  background: #dc3545;
  color: #ffffff;
}

.route-action-btn.delete:hover {
  background: #c82333;
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 10px;
  color: var(--text-secondary, #a0aec0);
  margin-bottom: 2px;
}

.stat-value {
  display: block;
  font-size: 12px;
  font-weight: bold;
  color: #007cbf;
}

/* Simple Select Styling */
.simple-select {
  background: var(--bg-input, #2d3748);
  border: 1px solid var(--border-color, #4a5568);
  border-radius: 4px;
  color: var(--text-primary, #ffffff);
  padding: 6px 8px;
  font-size: 12px;
  width: 100%;
}

.simple-select:focus {
  outline: none;
  border-color: #007cbf;
  box-shadow: 0 0 0 2px rgba(0, 123, 191, 0.2);
}

/* Saved Routes List */
.saved-routes-list {
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg-input, #2d3748);
  border: 1px solid var(--border-color, #4a5568);
  border-radius: 4px;
  margin-top: 8px;
}

.no-routes-message {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary, #a0aec0);
  font-style: italic;
  font-size: 12px;
}

.saved-route-item {
  padding: 12px;
  border-bottom: 1px solid var(--border-color, #4a5568);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.saved-route-item:last-child {
  border-bottom: none;
}

.saved-route-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

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

.route-item-name {
  font-weight: bold;
  color: var(--text-primary, #ffffff);
  font-size: 13px;
}

.route-item-priority {
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
}

.priority-high {
  background: #dc3545;
  color: white;
}

.priority-medium {
  background: #ffc107;
  color: #212529;
}

.priority-low {
  background: #28a745;
  color: white;
}

.route-item-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary, #a0aec0);
}

.route-item-user {
  color: #007cbf;
  font-weight: 500;
}

.route-item-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.route-action-btn {
  padding: 4px 8px;
  background: transparent;
  border: 1px solid var(--border-color, #4a5568);
  border-radius: 3px;
  color: var(--text-secondary, #a0aec0);
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.route-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary, #ffffff);
}

.route-action-btn.primary {
  background: #007cbf;
  color: white;
  border-color: #007cbf;
}

.route-action-btn.danger {
  background: #dc3545;
  color: white;
  border-color: #dc3545;
}

/* Route Optimization Indicator */
.route-optimizing {
  position: relative;
  overflow: hidden;
}

.route-optimizing::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 123, 191, 0.4), transparent);
  animation: optimizing-shimmer 1.5s infinite;
}

@keyframes optimizing-shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Enhanced route line styling for optimized routes */
.optimized-route-line {
  filter: drop-shadow(0 0 4px rgba(0, 123, 191, 0.6));
}

/* Route waypoint marker with priority indication */
.route-waypoint-marker.priority-high {
  border-color: #dc3545 !important;
  box-shadow: 0 0 8px rgba(220, 53, 69, 0.5);
}

.route-waypoint-marker.priority-medium {
  border-color: #ffc107 !important;
  box-shadow: 0 0 8px rgba(255, 193, 7, 0.5);
}

.route-waypoint-marker.priority-low {
  border-color: #28a745 !important;
  box-shadow: 0 0 8px rgba(40, 167, 69, 0.5);
}

/* Make panel draggable */
.simple-draggable-panel.dragging {
  opacity: 0.9;
  cursor: move;
}

/* Advanced Options - Dark Theme & Optimized */
.simple-expandable-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 3px 0;
  border-bottom: 1px solid var(--border-color, #4a5568);
  margin-bottom: 6px;
}

.simple-expandable-header:hover {
  background: var(--bg-hover, rgba(255, 255, 255, 0.05));
  margin: 0 -4px 6px -4px;
  padding: 3px 4px;
  border-radius: 3px;
}

.simple-toggle-icon {
  font-size: 11px;
  color: var(--text-muted, #718096);
  transition: transform 0.2s ease;
}

.simple-toggle-icon.expanded {
  transform: rotate(-180deg);
}

.simple-advanced-content {
  max-height: 250px;
  overflow-y: auto;
}

.simple-advanced-section {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light, rgba(74, 85, 104, 0.3));
}

.simple-advanced-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.simple-import-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.simple-import-label {
  font-size: 9px;
  color: var(--text-muted, #718096);
  min-width: 60px;
  flex-shrink: 0;
}

.simple-file-input {
  flex: 1;
  font-size: 9px;
  padding: 2px 4px;
  border: 1px solid var(--border-color, #4a5568);
  border-radius: 3px;
  background: var(--bg-input, #1a202c);
  color: var(--text-primary, #e2e8f0);
}

.simple-select {
  flex: 1;
  font-size: 9px;
  padding: 2px 4px;
  border: 1px solid var(--border-color, #4a5568);
  border-radius: 3px;
  background: var(--bg-input, #1a202c);
  color: var(--text-primary, #e2e8f0);
}

.simple-select option {
  background: var(--bg-input, #1a202c);
  color: var(--text-primary, #e2e8f0);
}

.simple-columns-list {
  max-height: 80px;
  overflow-y: auto;
  font-size: 9px;
  border: 1px solid var(--border-color, #4a5568);
  border-radius: 3px;
  background: var(--bg-input, #1a202c);
  padding: 4px;
}

.simple-columns-list::-webkit-scrollbar {
  width: 4px;
}

.simple-columns-list::-webkit-scrollbar-track {
  background: var(--bg-input, #1a202c);
}

.simple-columns-list::-webkit-scrollbar-thumb {
  background: var(--border-color, #4a5568);
  border-radius: 2px;
}

.simple-column-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 4px;
  background: var(--bg-card, rgba(26, 32, 44, 0.5));
  border: 1px solid var(--border-light, rgba(74, 85, 104, 0.3));
  border-radius: 2px;
  margin-bottom: 2px;
  color: var(--text-primary, #e2e8f0);
}

.simple-column-item:last-child {
  margin-bottom: 0;
}

.simple-column-item:hover {
  background: var(--bg-hover, rgba(255, 255, 255, 0.05));
}

.simple-column-remove {
  background: #e53e3e;
  color: white;
  border: none;
  border-radius: 2px;
  padding: 1px 3px;
  font-size: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.simple-column-remove:hover {
  background: #c53030;
}

/* ===== KEPLER.GL STYLE TOOLTIP - White Theme ===== */

/* Main popup container - Dense compact design with fixed hover */
.enhanced-popup .mapboxgl-popup-content {
  background: #FFFFFF !important;
  border: 1px solid #D1D5DB !important;
  border-radius: 2px !important;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.12) !important;
  padding: 0 !important;
  font-family: ff-clan-web-pro, "Helvetica Neue", Helvetica, sans-serif !important;
  max-width: 280px !important;
  min-width: 180px !important;
  font-size: 10px !important;
  line-height: 1.3 !important;
  transform: translateY(0) scale(1) !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  animation: popupFadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  pointer-events: auto !important;
  overflow: hidden !important;
}

/* Popup animation keyframes */
@keyframes popupFadeIn {
  0% {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Sticky popup enhanced styling */
.enhanced-popup.sticky .mapboxgl-popup-content {
  border: 2px solid #3B82F6 !important;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.15), 0 2px 14px rgba(0, 0, 0, 0.15) !important;
  animation: none !important;
}

/* Pin button in header - compact and integrated */
.enhanced-popup .popup-pin-button {
  background: transparent !important;
  border: none !important;
  color: #6A7485 !important;
  font-size: 12px !important;
  width: 18px !important;
  height: 18px !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 2px !important;
  opacity: 0.8 !important;
  margin-left: 8px !important;
  flex-shrink: 0 !important;
  padding: 0 !important;
  position: relative !important;
  z-index: 10 !important;
}

.enhanced-popup .popup-pin-button:hover {
  color: #3B82F6 !important;
  background: rgba(59, 130, 246, 0.1) !important;
  transform: scale(1.1) !important;
  opacity: 1 !important;
}

.enhanced-popup.sticky .popup-pin-button {
  color: #3B82F6 !important;
  background: rgba(59, 130, 246, 0.1) !important;
  opacity: 1 !important;
}

.enhanced-popup.sticky .popup-pin-button:hover {
  background: rgba(59, 130, 246, 0.15) !important;
  transform: scale(1.05) !important;
}

/* Close button - positioned to avoid pin button */
.enhanced-popup .mapboxgl-popup-close-button {
  background: transparent !important;
  border: none !important;
  color: #6A7485 !important;
  font-size: 16px !important;
  font-weight: normal !important;
  padding: 0 !important;
  width: 18px !important;
  height: 18px !important;
  top: 3px !important;
  right: 3px !important;
  line-height: 1 !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  border-radius: 2px !important;
  opacity: 0.8 !important;
  z-index: 11 !important;
}

.enhanced-popup .mapboxgl-popup-close-button:hover {
  color: #EF4444 !important;
  background: rgba(239, 68, 68, 0.1) !important;
  transform: scale(1.1) !important;
  opacity: 1 !important;
}

/* Popup arrow - white theme */
.enhanced-popup .mapboxgl-popup-tip {
  border-top-color: #FFFFFF !important;
  border-bottom-color: #FFFFFF !important;
}

/* Header styling - Ultra compact with pin button space */
.enhanced-popup h4 {
  margin: 0 !important;
  padding: 6px 40px 4px 12px !important;
  color: #1F2937 !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
  background: #FFFFFF !important;
  border-bottom: 1px solid #D1D5DB !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 10 !important;
  transition: all 0.2s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

/* Popup title text */
.enhanced-popup .popup-title {
  flex: 1 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  margin-right: 8px !important;
}

/* Property container */
.enhanced-popup .mapboxgl-popup-content > div {
  max-width: none !important;
  background: #FFFFFF !important;
}

/* Scrollable content area - Ultra compact with fixed hover behavior */
.enhanced-popup .mapboxgl-popup-content > div > div {
  max-height: min(180px, 25vh) !important;
  overflow-y: auto !important;
  padding: 2px 0 4px 0 !important;
  margin: 0 !important;
  background: #FFFFFF !important;
  scroll-behavior: smooth !important;
  pointer-events: auto !important;
}

/* Compact mode for smaller screens */
@media (max-height: 600px) {
  .enhanced-popup .mapboxgl-popup-content > div > div {
    max-height: min(120px, 20vh) !important;
  }
}

/* White theme scrollbar */
.enhanced-popup .mapboxgl-popup-content > div > div::-webkit-scrollbar {
  width: 4px !important;
}

.enhanced-popup .mapboxgl-popup-content > div > div::-webkit-scrollbar-track {
  background: #F3F4F6 !important;
}

.enhanced-popup .mapboxgl-popup-content > div > div::-webkit-scrollbar-thumb {
  background: #D1D5DB !important;
  border-radius: 2px !important;
}

.enhanced-popup .mapboxgl-popup-content > div > div::-webkit-scrollbar-thumb:hover {
  background: #9CA3AF !important;
}

/* Property row styling - Fixed bottom hover issue */
.enhanced-popup .mapboxgl-popup-content div[style*="margin-bottom: 6px"] {
  margin: 0 !important;
  padding: 3px 12px !important;
  border-bottom: none !important;
  display: block !important;
  background: #FFFFFF !important;
  transition: background-color 0.15s ease !important;
  position: relative !important;
  overflow: hidden !important;
}

/* Alternating row colors - denser off-white for better contrast */
.enhanced-popup .mapboxgl-popup-content div[style*="margin-bottom: 6px"]:nth-child(even) {
  background: #F3F4F6 !important;
}

.enhanced-popup .mapboxgl-popup-content div[style*="margin-bottom: 6px"]:hover {
  background: #E5E7EB !important;
}

.enhanced-popup .mapboxgl-popup-content div[style*="margin-bottom: 6px"]:last-child {
  border-bottom: none !important;
  margin-bottom: 0 !important;
  padding-bottom: 4px !important;
}

/* Property key styling - compact */
.enhanced-popup strong {
  color: #6B7280 !important;
  font-weight: 500 !important;
  font-size: 10px !important;
  display: inline !important;
  margin-right: 6px !important;
  min-width: auto !important;
}

.enhanced-popup strong:after {
  content: ": " !important;
}

/* Property value styling - compact dark text */
.enhanced-popup span[style*="color: #666"] {
  color: #1F2937 !important;
  font-size: 10px !important;
  font-weight: 400 !important;
  line-height: 1.3 !important;
  word-break: break-word !important;
}

/* No properties message - compact */
.enhanced-popup em {
  color: #9CA3AF !important;
  font-style: italic !important;
  font-size: 10px !important;
  padding: 8px 12px !important;
  text-align: center !important;
  display: block !important;
  background: #FFFFFF !important;
}

/* ===== MAP LAYOUT STYLES ===== */

/* Layout container that overlays the map */
.layout-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1500;
  display: none;
  background: white;
}

.layout-container.active {
  display: block;
}

/* Page dimensions - A4 and A3 */
.layout-page {
  margin: 20px auto;
  background: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border: 0.5px solid #000;
  position: relative;
  overflow: hidden;
}

/* A4 dimensions: 794px × 1123px with 30px margins */
.layout-page.a4 {
  width: 794px;
  height: 1123px;
  padding: 30px;
}

/* A3 dimensions: 1123px × 1587px with 30px margins */
.layout-page.a3 {
  width: 1123px;
  height: 1587px;
  padding: 30px;
}

/* Main map area - square and centered */
.layout-map-area {
  background: #f5f5f5;
  border: 1px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Times New Roman', serif;
  color: #666;
  font-size: 14px;
  position: relative;
  margin: 0 auto;
}

/* A4 map area - square fitting between margins */
.layout-page.a4 .layout-map-area {
  width: 734px;
  height: 734px;
  margin-top: 60px;
}

/* A3 map area - square fitting between margins */
.layout-page.a3 .layout-map-area {
  width: 1063px;
  height: 1063px;
  margin-top: 60px;
}

/* Title and subtitle positioning */
.layout-title-section {
  text-align: center;
  margin-bottom: 20px;
  font-family: 'Times New Roman', serif;
}

.layout-title {
  margin: 0 0 8px 0;
  font-weight: bold;
  color: #000;
}

.layout-subtitle {
  margin: 0;
  color: #333;
}

/* A4 title sizes */
.layout-page.a4 .layout-title {
  font-size: 18px;
}

.layout-page.a4 .layout-subtitle {
  font-size: 16px;
}

/* A3 title sizes */
.layout-page.a3 .layout-title {
  font-size: 20px;
}

.layout-page.a3 .layout-subtitle {
  font-size: 14px;
}

/* Right panel for legend and description */
.layout-right-panel {
  position: absolute;
  right: 30px;
  top: 120px;
  width: 200px;
}

/* Legend box */
.layout-legend {
  border: 0.5px solid #000;
  padding: 12px;
  margin-bottom: 15px;
  background: white;
  font-family: 'Times New Roman', serif;
  font-size: 12px;
}

.layout-legend-title {
  font-weight: bold;
  margin-bottom: 8px;
  text-align: center;
}

/* Description box */
.layout-description {
  border: 0.5px solid #000;
  padding: 12px;
  background: white;
  font-family: 'Times New Roman', serif;
  font-size: 12px;
}

.layout-description-title {
  font-weight: bold;
  margin-bottom: 8px;
  text-align: center;
}

/* Bottom elements */
.layout-bottom-left {
  position: absolute;
  bottom: 30px;
  left: 30px;
  font-family: 'Times New Roman', serif;
  font-size: 10px;
  color: #666;
}

.layout-bottom-right {
  position: absolute;
  bottom: 30px;
  right: 30px;
  width: 80px;
  height: 40px;
  border: 1px dashed #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #999;
}

/* North arrow */
.layout-north-arrow {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 15px;
  height: 15px;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="black"><path d="M12 2l6 8h-4v12h-4V10H6z"/></svg>') no-repeat center;
  background-size: contain;
}

/* Layout controls panel */
.layout-controls {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  z-index: 1600;
  min-width: 200px;
  display: none;
}

.layout-controls.active {
  display: block;
}

.layout-controls h3 {
  margin: 0 0 15px 0;
  color: var(--text-primary);
  font-size: 16px;
}

.layout-size-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.layout-size-btn {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
}

.layout-size-btn:hover {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
}

.layout-size-btn.active {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
  color: white;
}

.layout-input-group {
  margin-bottom: 10px;
}

.layout-input-group label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-size: 12px;
}

.layout-input-group input,
.layout-input-group textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
}

.layout-input-group textarea {
  resize: vertical;
  min-height: 60px;
}

.layout-actions {
  display: flex;
  gap: 8px;
  margin-top: 15px;
}

.layout-action-btn {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
}

.layout-action-btn:hover {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
}

.layout-action-btn.primary {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
  color: white;
}

/* Print styles */
@media print {
  .layout-container {
    position: static !important;
    width: auto !important;
    height: auto !important;
    background: white !important;
  }
  
  .layout-controls {
    display: none !important;
  }
  
  .layout-page {
    margin: 0 !important;
    box-shadow: none !important;
    page-break-after: always;
  }
}

/* ============================================================================= */
/* RESPONSIVE UI OVERFLOW FIXES */
/* ============================================================================= */

/* Ensure cross icons are always visible and properly styled */
.simple-close-btn,
.action-button,
#pdf-modal-close,
#add-data-modal-close,
#upload-data-modal-close,
#create-layer-modal-close,
#route-management-modal-close,
#buffer-analysis-modal-close,
#add-column-modal-close,
#add-column-create-modal-close {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: all !important;
  z-index: 10001 !important;
  position: relative !important;
  min-width: 24px !important;
  min-height: 24px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Fix attribute panel resize handle visibility */
#attribute-resize-handle {
  z-index: 10000 !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Mobile and small screen optimizations */
@media (max-height: 700px) {
  #panel {
    height: calc(100vh - 5px);
    margin-top: 2px;
  }
  
  .simple-draggable-panel {
    max-height: calc(100vh - 20px);
    top: max(5px, calc(50% - min(200px, 35vh)));
  }
  
  .simple-panel-body {
    max-height: calc(100vh - 80px);
    padding: 8px;
  }
  
  .pdf-modal-content {
    max-height: calc(100vh - 40px);
  }
  
  .attribute-panel {
    max-height: calc(100vh - 40px);
  }
}

@media (max-height: 600px) {
  #panel {
    height: calc(100vh - 2px);
    margin-top: 1px;
    padding: 4px;
  }
  
  .simple-draggable-panel {
    max-height: calc(100vh - 10px);
    top: 5px;
  }
  
  .simple-panel-body {
    max-height: calc(100vh - 60px);
    padding: 6px;
  }
  
  .simple-section {
    margin-bottom: 8px;
  }
  
  .pdf-modal-content {
    max-height: calc(100vh - 20px);
  }
}

/* Extra small screens */
@media (max-height: 500px) {
  #panel {
    height: 100vh;
    margin-top: 0;
    padding: 2px;
  }
  
  .simple-draggable-panel {
    max-height: 100vh;
    top: 0;
    border-radius: 0;
  }
  
  .simple-panel-body {
    max-height: calc(100vh - 50px);
    padding: 4px;
  }
  
  .simple-section {
    margin-bottom: 6px;
  }
  
  .simple-panel-header {
    padding: 6px 10px;
  }
  
  .pdf-modal-content {
    max-height: 100vh;
    border-radius: 0;
  }
}

/* Fix panel overflow on very wide screens */
@media (min-width: 1920px) {
  #panel {
    max-width: 400px;
  }
}

/* Mobile portrait optimizations */
@media (max-width: 768px) {
  #panel {
    width: calc(100vw - 20px);
    max-width: none;
    left: 10px;
    right: 10px;
    border-radius: 8px;
    margin-top: 10px;
    height: calc(100vh - 20px);
  }
  
  .simple-draggable-panel {
    width: calc(100vw - 20px);
    left: 10px;
    right: 10px;
  }
  
  .pdf-modal-content {
    width: calc(100vw - 20px);
    max-width: none;
    left: 10px;
    right: 10px;
  }
}

/* Fix layers container scrolling */
#layers-container {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Ensure all modal dialogs respect screen boundaries */
.pdf-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.pdf-modal-content {
  max-width: min(600px, 90vw);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  position: relative;
}

/* Fix attribute table height calculations */
.attribute-panel {
  max-height: calc(100vh - 60px);
}

.attribute-panel-content {
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

/* Geocoder container responsive fixes */
#geocoder-container {
  max-width: calc(100vw - 80px);
}

@media (max-width: 480px) {
  #geocoder-container {
    right: 10px;
    top: 80px;
    width: calc(100vw - 20px);
  }
  
  #topbar {
    right: 10px;
    flex-direction: column;
    gap: 4px;
  }
}

/* -------------------------------------------------------------------------- */
/* API Datasets — stronger visual weight for server data list                   */
/* -------------------------------------------------------------------------- */
.server-data-list {
  /* allow more rows visible and slightly rounder container */
  max-height: 360px !important;
  border-radius: 10px !important;
  padding: 6px !important;
  box-shadow: 0 4px 18px rgba(6, 11, 21, 0.35);
}

.server-data-item {
  padding: 18px 20px !important;
  border-bottom: 1px solid rgba(255,255,255,0.04) !important;
  background: linear-gradient(180deg, rgba(255,255,255,0.01), transparent) !important;
  transition: background-color 0.18s ease, transform 0.12s ease !important;
}

.server-data-item:hover {
  background: rgba(31,124,244,0.06) !important;
  transform: translateY(-1px) !important;
}

.server-data-name {
  font-weight: 700 !important;
  font-size: 15px !important;
  color: var(--text-primary) !important;
  letter-spacing: 0.15px !important;
}

.server-data-meta {
  font-weight: 600 !important;
  color: var(--text-secondary) !important;
  font-size: 13px !important;
}

.server-data-item .btn {
  min-width: 88px !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
}

.server-data-item .btn:first-of-type {
  /* make the primary action more prominent */
  box-shadow: 0 6px 18px rgba(31,124,244,0.12) !important;
}

.server-data-info { /* ensure text flows nicely */
  line-height: 1.35 !important;
}

/* Small responsive tweak so items keep readable spacing on narrow screens */
@media (max-width: 720px) {
  .server-data-item { padding: 12px 14px !important; }
  .server-data-name { font-size: 14px !important; }
  .server-data-item .btn { min-width: 72px !important; padding: 7px 10px !important; }
}

/* Professional refinements for API Datasets */
.api-datasets-header {
  margin: 14px 6px 12px 6px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.25px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.server-data-item {
  display: grid !important;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.server-data-name .layer-format-badge {
  display: inline-block;
  margin-left: 10px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.layer-format-badge.dataset {
  background: linear-gradient(90deg,#eef2ff,#e6f2ff);
  color: #0f172a;
}

.layer-tags {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.layer-tags span {
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.server-data-meta { /* tighter, single-line meta */
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--text-secondary);
}

.server-data-actions {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
}

.server-data-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  min-width: 88px;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.12s ease;
  box-shadow: 0 4px 10px rgba(4,8,20,0.12);
  border: 1px solid rgba(255,255,255,0.04);
}

.server-data-actions .btn svg { width: 16px; height: 16px; opacity: 0.95; display: block; margin: 0; align-self: center; }

/* Additional safeguard for any inline-icon wrappers inside buttons */
.server-data-actions .btn > svg, .server-data-actions .btn .icon, .server-data-actions .btn .btn-icon {
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  vertical-align: middle !important;
  align-self: center !important;
}

/* Primary and success buttons keep their color but align to new sizing */
.server-data-actions .btn.btn-primary {
  background: linear-gradient(180deg, #2f7cf7, #1e5fe0) !important;
  border-color: rgba(30,95,224,0.95) !important;
  color: #fff !important;
}

.server-data-actions .btn.btn-success {
  background: linear-gradient(180deg,#16a34a,#059669) !important;
  border-color: rgba(5,150,105,0.95) !important;
  color: #fff !important;
}

/* Smaller neutral info button */
.server-data-actions .btn.btn-secondary {
  background: rgba(255,255,255,0.02) !important;
  color: var(--text-secondary) !important;
  min-width: 44px !important;
  width: 44px !important;
  padding: 0 !important;
  border-radius: 10px !important;
  height: 40px !important;
  justify-content: center !important;
}

.server-data-actions .btn:focus {
  outline: 3px solid rgba(47,124,247,0.12);
  outline-offset: 2px;
}

.server-data-actions .btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(4,8,20,0.18);
}

.server-data-actions .btn:active {
  transform: translateY(-1px) scale(0.995);
}

/* Responsive: smaller buttons on narrow screens */
@media (max-width: 720px) {
  .server-data-actions .btn { height: 36px; min-width: 72px; padding: 0 10px; font-size: 12px; }
  .server-data-actions .btn.btn-secondary { width: 36px; min-width: 36px; height: 36px; }
}

.server-data-list::-webkit-scrollbar {
  width: 10px;
}
.server-data-list::-webkit-scrollbar-track {
  background: transparent;
}
.server-data-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.server-data-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.12);
}

/* Make the 'no data' state subtle but centered */
.no-data-state {
  padding: 18px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Keep actions stacked on very narrow screens */
@media (max-width: 460px) {
  .server-data-item { grid-template-columns: 1fr; }
  .server-data-actions { justify-content: flex-start; margin-top: 10px; }
}


