/* Base Styles */
html, body { 
  height: 100%; 
  margin: 0; 
  font-family: system-ui, -apple-system, sans-serif;
  cursor: default; /* Ensure default cursor */
  background: #0A2540 !important; /* Dark navy background to match new theme */
}

/* Flash animation for requirement highlighting */
@keyframes flash-red {
  0%, 100% { background-color: transparent; }
  25%, 75% { background-color: #ff6b6b; }
  50% { background-color: transparent; }
}

/* Authentication UI Styles */
.auth-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
}

#auth-logged-in {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-info {
  color: #6D9FC2;
  font-size: 14px;
  padding: 6px 12px;
  background: rgba(109, 159, 194, 0.1);
  border-radius: 4px;
  border: 1px solid rgba(80, 227, 194, 0.3);
}

.btn-primary {
  background: #6D9FC2;
  color: #0A2540;
  border: none;
  font-weight: 600;
}

.btn-primary:hover {
  background: #45d1b8;
}

.btn-secondary {
  background: rgba(109, 159, 194, 0.1);
  color: #6D9FC2;
  border: 1px solid rgba(80, 227, 194, 0.3);
}

.btn-secondary:hover {
  background: rgba(109, 159, 194, 0.2);
}

.btn-outline {
  background: transparent;
  color: #999;
  border: 1px solid #666;
  font-size: 12px;
  padding: 4px 8px;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ccc;
}

/* Layout Structure */
#map {
  height: 100%;
  background: #05192D;
  cursor: grab;
  margin-left: 300px; /* Space for left sidebar */
  margin-top: 60px; /* Space for top toolbar */
  transition: margin-left 0.3s ease;
}

#map.sidebar-collapsed {
  margin-left: 0;
}

#map:active {
  cursor: grabbing;
}

/* Sidebar Toggle Button - Vertical Tab Style */
.sidebar-toggle {
  position: fixed;
  top: 50vh; /* Center vertically */
  transform: translateY(-50%); /* Perfect center alignment */
  left: 300px; /* Flush with sidebar edge - no gap */
  z-index: 1001;
  background: linear-gradient(135deg, rgba(10,37,64,0.95), rgba(5,25,45,0.95));
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 0 12px 12px 0;
  border-left: none; /* Remove left border to eliminate gap */
  padding: 24px 10px; /* Taller vertical tab */
  color: #50e3c2;
  cursor: pointer;
  box-shadow: 3px 0 12px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover {
  background: linear-gradient(135deg, rgba(15,47,74,0.95), rgba(10,35,55,0.95));
  color: #fff;
  box-shadow: 3px 0 16px rgba(0,0,0,0.4);
  padding-right: 12px; /* Slight expand on hover */
}

.sidebar-toggle svg {
  transition: transform 0.3s ease;
}

/* Collapsed state - button moves with sidebar */
.sidebar-toggle.collapsed {
  left: 0; /* Move to left edge when sidebar is collapsed */
}

/* Left Sidebar */
.left-sidebar {
  position: fixed;
  top: 60px; /* Below toolbar */
  left: 0;
  width: 300px; /* Slightly wider for better spacing */
  height: calc(100vh - 90px); /* Extended down 30px - account for toolbar and partial status bar */
  background: linear-gradient(135deg, rgba(10,37,64,0.95), rgba(5,25,45,0.95));
  backdrop-filter: blur(10px);
  border-right: 1px solid rgba(255,255,255,0.15);
  box-shadow: 2px 0 10px rgba(0,0,0,0.2);
  color: #fff;
  overflow-x: hidden;
  overflow-y: hidden; /* Let sections handle their own scrolling */
  z-index: 1000;
  display: flex;
  transition: transform 0.3s ease;
  flex-direction: column;
}

/* Collapsed sidebar state */
.left-sidebar.collapsed {
  transform: translateX(-300px);
}

/* Rotate arrow icon when collapsed */
.sidebar-toggle.collapsed svg {
  transform: rotate(180deg);
}

.sidebar-section {
  padding: 16px 20px;
  overflow-x: hidden;
  word-wrap: break-word;
  transition: all 0.3s ease;
}

.sidebar-section.layers-section {
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex: 1 1 auto;
  min-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
}

/* Integrated results panel styling */
#resultsPanel {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
  background: transparent !important;
}

/* Draggable Divider */
.sidebar-divider {
  height: 10px;
  background: rgba(255,255,255,0.08);
  cursor: row-resize;
  border-top: 1px solid rgba(255,255,255,0.15);
  border-bottom: 1px solid rgba(255,255,255,0.15);
  position: relative;
  flex: 0 0 10px;
  transition: all 0.2s ease;
}

.sidebar-divider:hover {
  background: rgba(80,227,194,0.2);
  border-color: rgba(80,227,194,0.3);
}

.sidebar-divider::after {
  content: '⋯';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  transition: color 0.2s ease;
}

.sidebar-divider:hover::after {
  color: rgba(80,227,194,0.8);
}

/* Top Toolbar - Full Width */
/* Z-index stack (must stay above marketplace panel z-index: 10001):
   10003 (toolbar base) < 10004 (toolbar items) < 10005 (dropdown parents) < 10006 (dropdown content) */
.toolbar {
  position: fixed;
  z-index: 10003; /* Base toolbar layer - above marketplace (10001) and same as modals */
  top: 0;
  left: 0;
  right: 0;
  height: auto; /* Allow wrapping instead of fixed height */
  min-height: 60px;
  background: linear-gradient(135deg, rgba(10,37,64,0.95), rgba(5,25,45,0.95));
  backdrop-filter: blur(10px);
  padding: 8px 16px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  display: flex;
  align-items: center; /* Vertically center items within each row */
  align-content: flex-start; /* Pack rows together tightly - prevents excessive height */
  justify-content: flex-end; /* Align items to the right by default */
  flex-wrap: nowrap; /* Prevent wrapping on desktop - buttons will shrink instead */
  gap: 4px; /* Reduced from 8px - tighter horizontal spacing between items */
  row-gap: 4px; /* Tighter vertical spacing when wrapped */
  overflow: visible !important; /* CRITICAL: Allow dropdowns to extend beyond toolbar bounds */
}

/* Logo stays on the left - override the justify-content */
.logo-container {
  display: flex;
  align-items: center; /* Keep logo vertically centered */
  gap: 12px;
  margin-right: auto; /* Push everything else to the right - works because of justify-content: flex-end */
  z-index: 10004; /* Toolbar items layer */
  flex-shrink: 0; /* Logo should not shrink */
}

/* Non-dropdown toolbar items (select, label) should have lower z-index */
.toolbar > label,
.toolbar > select {
  z-index: 10004; /* Toolbar items layer - below dropdown content */
  position: relative;
  flex-shrink: 0; /* Basemap selector should not shrink */
}

.toolbar-logo {
  height: 60px; /* Full toolbar height - logo has internal padding */
  width: auto;
  max-width: 420px; /* Increased to accommodate larger height */
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
  cursor: pointer;
  transition: transform 0.2s ease;
  /* If your logo is dark, uncomment the line below */
  /* filter: brightness(0) invert(1) drop-shadow(0 2px 4px rgba(0,0,0,0.2)); */
}

.toolbar-logo:hover {
  transform: scale(1.05);
}

/* ========================================
   RESPONSIVE TOOLBAR STYLES
   ======================================== */

/* Large screens (> 1200px): All elements visible, single row */
/* Default styles above handle this */

/* Medium-Large screens (900px - 1200px): Hide logo text, abbreviate some buttons */
@media (max-width: 1200px) {
  .logo-text {
    display: none;
  }

  /* No need to override .toolbar-dropdown margin - gap handles it */
}

/* Landscape mobile & small tablets (up to 1200px): Icon-only mode */
@media (max-width: 1200px) {
  .toolbar {
    height: 60px; /* Fixed height - no wrapping */
    min-height: 60px;
    flex-wrap: nowrap; /* Keep everything on one row */
    padding: 6px 16px;
    gap: 12px; /* More spacing between buttons */
    justify-content: flex-end; /* Push to right to make room for logo */
  }

  /* Show logo on smaller screens - plenty of room now */
  .logo-container {
    display: flex !important;
    flex-shrink: 0;
    gap: 10px !important;
  }

  /* Keep logo at same size as desktop for consistency */
  .toolbar-logo {
    height: 56px !important;
    width: auto !important;
  }

  .logo-text {
    font-size: 18px !important;
    font-weight: 600 !important;
  }

  /* Hide separators - they take up space */
  .toolbar-separator {
    display: none;
  }

  /* Icon-only buttons - show only emoji, hide all text */
  .dropdown-toggle {
    font-size: 26px !important; /* Emoji size */
    padding: 0 !important; /* Remove padding */
    padding-left: 11px !important; /* Position emoji in center (48/2 - emoji_width/2) */
    white-space: nowrap !important;
    overflow: hidden !important;
    width: 48px !important; /* Fixed width */
    height: 48px !important; /* Fixed height for perfect square */
    max-width: 48px !important;
    min-width: 48px !important;
    text-overflow: clip !important; /* No ellipsis */
    text-align: left !important; /* Left align to show first char (emoji) */
    display: block !important;
    line-height: 48px !important; /* Match height for vertical centering */
    position: relative !important;
  }

  /* Hide text in Tutorials button */
  #tutorialsButton span {
    display: none;
  }

  /* Tutorials icon only */
  #tutorialsButton img {
    display: block !important;
    margin-right: 0 !important;
    width: 24px !important;
    height: 24px !important;
  }

  #tutorialsButton {
    padding: 6px 8px !important;
  }

  /* Dropdowns can shrink */
  .toolbar-dropdown {
    flex-shrink: 2;
  }

  /* Basemap selector stays compact */
  .toolbar label.small {
    font-size: 11px;
  }

  .toolbar select#basemapPicker {
    font-size: 11px;
    padding: 4px 6px;
  }
}

/* Mobile screens (< 600px): Ultra-compact single row */
@media (max-width: 600px) {
  .toolbar {
    padding: 6px 8px;
    gap: 2px; /* Very tight spacing */
    height: 56px; /* Slightly shorter */
    flex-wrap: nowrap; /* Keep on one row */
  }

  /* Hide entire logo container on mobile */
  .logo-container {
    display: none !important;
  }

  /* Extra specific - hide the logo img directly */
  .toolbar .logo-container,
  .toolbar .toolbar-logo,
  .toolbar img.toolbar-logo {
    display: none !important;
  }

  /* Dropdowns shrink even more on mobile */
  .toolbar-dropdown {
    flex-shrink: 3; /* Aggressive shrinking */
  }

  .dropdown-toggle {
    font-size: 20px; /* Keep emojis visible */
    padding: 6px 10px; /* Compact padding */
    white-space: nowrap;
    overflow: hidden;
    max-width: 40px; /* Force icon-only width */
    text-overflow: clip;
  }

  /* Hide text in Tutorials button span */
  #tutorialsButton span {
    display: none; /* Completely hide the span with text */
  }

  /* Keep the tutorial icon visible and compact */
  #tutorialsButton img {
    display: block !important;
    margin-right: 0 !important;
    width: 24px !important;
    height: 24px !important;
  }

  #tutorialsButton {
    padding: 6px 8px !important;
  }

  /* Hide logo text on mobile */
  .logo-text {
    display: none;
  }

  /* Reduce basemap selector size more */
  .toolbar label.small {
    font-size: 10px;
  }

  .toolbar select#basemapPicker {
    font-size: 10px;
    padding: 4px 4px;
  }
}

/* Extra small screens (< 400px): Extreme compact single row */
@media (max-width: 400px) {
  .toolbar {
    padding: 4px 6px;
    gap: 1px; /* Minimal spacing */
    height: 52px; /* Even shorter */
    flex-wrap: nowrap; /* Keep on one row */
  }

  /* Hide entire logo container on very small screens */
  .logo-container {
    display: none !important;
  }

  /* Extra specific - hide the logo img directly */
  .toolbar .logo-container,
  .toolbar .toolbar-logo,
  .toolbar img.toolbar-logo {
    display: none !important;
  }

  /* Dropdowns shrink maximally */
  .toolbar-dropdown {
    flex-shrink: 4; /* Maximum shrinking */
  }

  .dropdown-toggle {
    font-size: 18px; /* Keep emojis visible */
    padding: 5px 8px; /* Compact padding */
    white-space: nowrap;
    overflow: hidden;
    max-width: 36px; /* Force icon-only width */
    text-overflow: clip;
  }

  /* Hide text in Tutorials button span */
  #tutorialsButton span {
    display: none; /* Completely hide the span with text */
  }

  /* Keep the tutorial icon visible and smaller */
  #tutorialsButton img {
    display: block !important;
    margin-right: 0 !important;
    width: 22px !important;
    height: 22px !important;
  }

  #tutorialsButton {
    padding: 5px 6px !important;
  }

  /* Hide basemap label text, show only selector */
  .toolbar label.small {
    display: none;
  }

  .toolbar select#basemapPicker {
    font-size: 10px;
    padding: 4px 3px;
  }

  /* Shorten button text on extra small screens */
  #accountButton::after {
    content: '';
  }

  #accountButton {
    padding: 5px 8px;
  }

  #tutorialsButton span {
    margin-left: 0;
  }

  /* Hide dropdown arrows on very small screens */
  .dropdown-toggle::after {
    content: '';
  }

  /* Make basemap selector even smaller */
  .toolbar label.small {
    font-size: 10px;
    margin-right: 4px;
  }

  .toolbar select#basemapPicker {
    font-size: 10px;
    padding: 3px 4px;
  }
}

.logo-text {
  font-size: 16px;
  font-weight: 600;
  color: #A9C0DE;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.row { 
  display: flex; 
  gap: 12px; 
  flex-wrap: wrap; 
  align-items: center; 
}

.btn { 
  cursor: pointer; 
  border: 1px solid rgba(255,255,255,0.2); 
  background: linear-gradient(135deg, rgba(0,104,158,0.85), rgba(109,159,194,0.85));
  color: white;
  padding: 8px 14px; 
  border-radius: 10px; 
  transition: all 0.3s ease;
  font-weight: 500;
  user-select: none;
}

.btn:hover { 
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,104,158,0.4);
  background: linear-gradient(135deg, rgba(0,104,158,1), rgba(109,159,194,1));
}

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

.btn-danger { 
  background: linear-gradient(135deg, rgba(255,82,82,0.85), rgba(255,107,107,0.85)); 
}

.btn-success { 
  background: linear-gradient(135deg, rgba(76,217,100,0.85), rgba(52,199,89,0.85)); 
}

.small { 
  font-size: 12px; 
  color: #b0b0b0; 
}

.panel { 
  background: rgba(255,255,255,0.05); 
  border: 1px solid rgba(255,255,255,0.1); 
  border-radius: 8px; 
  padding: 12px;
  backdrop-filter: blur(5px);
  color: #fff;
  margin-bottom: 12px;
}

/* Toolbar Dropdown Styles */
.toolbar-dropdown {
  position: relative;
  margin: 0; /* No margin - gap property handles spacing */
  z-index: 10005; /* Dropdown parent layer - allows child dropdown-content to be z-index 10006 */
  flex-shrink: 1; /* Allow dropdown containers to shrink when space is tight */
  min-width: 0; /* Allow shrinking below content size */
}

/* Toolbar separator - Dual purpose:
   Desktop: Visible vertical divider between toolbar sections
   Tablet/Mobile: Invisible line-breaker to force new rows (see @media queries below) */
.toolbar-separator {
  width: 1px;
  height: 32px;
  background: linear-gradient(to bottom,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.15) 20%,
    rgba(255,255,255,0.15) 80%,
    rgba(255,255,255,0) 100%
  );
  margin: 0 6px; /* Extra spacing for visual separation between sections */
  align-self: center;
  flex-shrink: 0; /* Separator should not shrink */
}

.dropdown-toggle {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: 500;
  position: relative;
  z-index: 1; /* Keep all buttons at low z-index so dropdowns appear above */
  white-space: nowrap; /* Prevent text wrapping inside buttons */
  overflow: hidden; /* Hide overflow when text is too long */
  text-overflow: ellipsis; /* Show ... when text is truncated */
  max-width: 100%; /* Don't exceed container width */
}

.dropdown-toggle:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.3);
}

/* Special styling for premium/featured buttons */
.dropdown-toggle.featured {
  background: linear-gradient(135deg, #00689E 0%, #005387 100%);
  border: none;
  font-weight: 600;
}

.dropdown-toggle.featured:hover {
  background: linear-gradient(135deg, #007bb5 0%, #00689E 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,104,158,0.3);
  z-index: 1; /* Keep button z-index low so dropdown appears above it */
}

/* Active state when dropdown is open */
.dropdown-toggle.active {
  background: rgba(255,255,255,0.15);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.3), 0 2px 8px rgba(80,227,194,0.2);
  transform: translateY(1px);
  border-color: rgba(80,227,194,0.4);
  z-index: 1; /* Keep button z-index low so dropdown appears above it */
}

.dropdown-toggle.featured.active {
  background: linear-gradient(135deg, #005387 0%, #003d65 100%);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.4), 0 2px 8px rgba(0,104,158,0.3);
  z-index: 1; /* Keep button z-index low so dropdown appears above it */
  transform: translateY(1px);
}

/* MINDEX Filters Dropdown - Slide-in & Pulse Animations */
@keyframes slideInFromAbove {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(80, 227, 194, 0.7);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(80, 227, 194, 0);
  }
}

.toolbar-dropdown.mindex-filters {
  animation: slideInFromAbove 0.4s ease-out;
}

.toolbar-dropdown.mindex-filters.pulse {
  animation: slideInFromAbove 0.4s ease-out, pulseGlow 1.5s ease-out 0.4s 3;
}

/* ACTIVE badge for MINDEX filters dropdown */
.dropdown-toggle .badge-active {
  display: inline-block;
  background: #50e3c2;
  color: #0a2540;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
  animation: subtlePulse 3s ease-in-out infinite;
}

@keyframes subtlePulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(0.95);
  }
}

.dropdown-content {
  position: absolute;
  top: 100%;
  left: 0;
  background: linear-gradient(135deg, rgb(10,37,64), rgb(5,25,45)); /* Fully opaque - no transparency */
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 0;
  margin-top: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  display: none;
  z-index: 10006; /* Dropdown content layer - highest in toolbar stack, above marketplace (10001) */
  min-width: 280px;
  max-height: 80vh;
  overflow-y: auto;
}

/* Right-aligned dropdowns (for buttons on the right side of toolbar) */
.dropdown-content.align-right {
  left: auto;
  right: 0;
}

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

/* Unified dropdown header */
.dropdown-header {
  padding: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: rgba(80,227,194,0.05);
}

.dropdown-header-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #50e3c2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-header-subtitle {
  margin: 4px 0 0 0;
  font-size: 12px;
  color: #999;
}

/* Dropdown body - content padding */
.dropdown-body {
  padding: 12px;
}

/* Unified section styling */
.dropdown-section {
  margin-bottom: 0;
  padding: 0;
  background: none;
  border: none;
}

.dropdown-section:last-child {
  margin-bottom: 0;
}

.dropdown-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #50e3c2;
  margin: 0 0 10px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Button group standardization */
.dropdown-button-group {
  display: flex;
  gap: 6px;
  margin: 8px 0;
  justify-content: center;
  flex-wrap: wrap;
}

.dropdown-button-group .btn {
  flex: 1;
  min-width: 80px;
  font-size: 11px;
}

/* Collapsible details styling with indicators */
.dropdown-section > summary,
.dropdown-body details > summary {
  list-style: none;
  position: relative;
  padding-left: 24px;
  user-select: none;
}

.dropdown-section > summary::-webkit-details-marker,
.dropdown-body details > summary::-webkit-details-marker {
  display: none;
}

.dropdown-section > summary::before,
.dropdown-body details > summary::before {
  content: '▶';
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  transition: transform 0.2s ease;
  color: #50e3c2;
}

.dropdown-section[open] > summary::before,
.dropdown-body details[open] > summary::before {
  transform: translateY(-50%) rotate(90deg);
}

/* Tenement Overlay - Color-coded sections */
.dropdown-section-holder {
  border-color: rgba(80,227,194,0.3) !important;
  background: rgba(80,227,194,0.03) !important;
}

.dropdown-section-tenement {
  border-color: rgba(255,193,7,0.3) !important;
  background: rgba(255,193,7,0.03) !important;
}

.dropdown-section-title-tenement {
  color: #ffc107 !important;
}

/* Dropdown subsections (nested details) */
.dropdown-subsection {
  margin: 10px 0;
  padding: 6px;
  background: rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
}

.dropdown-subsection-title {
  font-size: 12px;
  font-weight: 600;
  color: #50e3c2;
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding-left: 20px;
  position: relative;
}

.dropdown-subsection-title-tenement {
  color: #ffc107 !important;
}

.dropdown-subsection-title::-webkit-details-marker {
  display: none;
}

.dropdown-subsection-title::before {
  content: '▶';
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  transition: transform 0.2s ease;
  color: inherit;
}

.dropdown-subsection[open] > .dropdown-subsection-title::before {
  transform: translateY(-50%) rotate(90deg);
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  color: #50e3c2;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding: 0 8px;
}

.dropdown-subsection-content {
  margin-top: 10px;
}

/* Input styling for dropdowns */
.input-search {
  width: 100%;
  padding: 8px 10px;
  font-size: 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: #fff;
  box-sizing: border-box;
  margin-bottom: 10px;
  transition: all 0.2s ease;
}

.input-search:focus {
  background: rgba(255,255,255,0.12);
  border-color: rgba(80,227,194,0.4);
  outline: none;
  box-shadow: 0 0 0 2px rgba(80,227,194,0.15);
}

.input-search::placeholder {
  color: rgba(255,255,255,0.4);
}

.input-compact {
  flex: 1;
  padding: 6px 8px;
  font-size: 11px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  color: #fff;
  transition: all 0.2s ease;
}

.input-compact:focus {
  background: rgba(255,255,255,0.12);
  border-color: rgba(80,227,194,0.4);
  outline: none;
}

.input-compact::placeholder {
  color: rgba(255,255,255,0.35);
}

/* Input-button group (for "Group name" + "Create" button) */
.input-button-group {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.btn-compact {
  padding: 6px 12px !important;
  font-size: 11px !important;
  white-space: nowrap;
}

/* Scrollable list styling - override .list default 3-column grid */
.scrollable-list {
  max-height: 180px;
  overflow-y: auto;
  overflow-x: hidden;
  margin-top: 8px;
  padding: 4px;
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.05);
  display: block !important;
  box-sizing: border-box;
}

.scrollable-list:empty {
  display: none;
}

/* Tenement list uses 2 columns for compact IDs */
#tenementList {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 2px 4px !important;
}

/* Make count info and search prompt span both columns in tenement grid */
#tenementList .small,
#tenementList .search-prompt {
  grid-column: 1 / -1;
}

/* Mode toggle container */
.mode-toggle-container {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 8px;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
}

.mode-toggle-btn {
  flex: 1;
  padding: 10px 16px;
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: #999;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-toggle-btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
  color: #fff;
}

.mode-toggle-btn.active {
  background: linear-gradient(135deg, #50e3c2 0%, #3a9d88 100%);
  border-color: #50e3c2;
  color: #0a0e27;
  box-shadow: 0 2px 8px rgba(80,227,194,0.3);
}

/* Selection status bar */
.selection-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
  margin-bottom: 10px;
  border: 1px solid rgba(255,255,255,0.08);
}

.selection-count {
  font-size: 12px;
  font-weight: 600;
  color: #50e3c2;
  flex: 1;
}

.btn-link {
  background: none;
  border: none;
  color: #6D9FC2;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-link:hover {
  background: rgba(109,159,194,0.2);
  color: #fff;
}

.btn-link:active {
  transform: scale(0.95);
}

/* Color swatch for holder/tenement items */
.color-swatch {
  display: inline-block;
  width: 12px !important;
  height: 12px !important;
  border-radius: 2px;
  margin-right: 4px;
  border: 1px solid rgba(255,255,255,0.2);
  vertical-align: middle;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

/* Prevent Pickr from changing swatch size when active */
.color-swatch.pcr-app {
  width: 12px !important;
  height: 12px !important;
  transform: none !important;
}

/* Color swatch hover effect - scale up with cyan glow */
.color-swatch:hover {
  transform: scale(1.3);
  border: 2px solid rgba(80, 227, 194, 0.8);
  box-shadow: 0 0 8px rgba(80, 227, 194, 0.4);
  z-index: 10;
}

/* Add a small edit icon that appears on hover */
.color-swatch::after {
  content: '✏️';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.color-swatch:hover::after {
  opacity: 1;
}

/* Holder/tenement item styling with swatch */
.holder-item,
.tenement-item {
  display: flex;
  align-items: center;
  padding: 4px 6px;
  margin: 2px 0;
  border-radius: 4px;
  transition: all 0.2s ease;
  cursor: pointer;
  min-width: 0; /* Allow items to shrink below content size */
  max-width: 100%; /* Prevent overflow */
}

.holder-item:hover,
.tenement-item:hover {
  background: rgba(255,255,255,0.05);
}

.holder-item input[type="checkbox"],
.tenement-item input[type="checkbox"] {
  margin-right: 4px;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.holder-item.selected,
.tenement-item.selected {
  background: rgba(80,227,194,0.08);
  border-left: 2px solid #50e3c2;
  padding-left: 4px;
}

.holder-name,
.tenement-name {
  flex: 1;
  font-size: 11px;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0; /* Critical for text-overflow to work in flex */
}

.item-count {
  font-size: 9px;
  color: #999;
  margin-left: 4px;
  flex-shrink: 0;
}

/* Search prompt (shown when search is empty) */
.search-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: #999;
}

.search-prompt-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.search-prompt-text {
  font-size: 14px;
  font-weight: 600;
  color: #6D9FC2;
  margin-bottom: 8px;
}

.search-prompt-count {
  font-size: 12px;
  color: #999;
}

/* Enhanced sidebar input styling */
.left-sidebar input[type="text"], 
.left-sidebar input[type="date"],
.left-sidebar input[type="range"],
.left-sidebar select {
  max-width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 6px 10px;
  color: #fff;
  transition: all 0.2s ease;
  margin-top: 4px;
}

.left-sidebar input[type="text"]:focus,
.left-sidebar input[type="date"]:focus,
.left-sidebar select:focus {
  background: rgba(255,255,255,0.15);
  border-color: rgba(80,227,194,0.5);
  outline: none;
  box-shadow: 0 0 0 2px rgba(80,227,194,0.2);
}

.left-sidebar input[type="checkbox"] {
  margin-right: 8px;
  accent-color: #6D9FC2;
}

.left-sidebar label {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  display: flex;
  align-items: center;
  margin-bottom: 0;
  line-height: 1.1;
  cursor: pointer;
  transition: color 0.2s ease;
}

.left-sidebar label:hover {
  color: rgba(255,255,255,0.9);
}

/* Section headers */
.sidebar-section .small[style*="font-weight:600"] {
  color: rgba(80,227,194,0.9);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 12px !important;
  margin-bottom: 8px !important;
}

/* Enhanced scrollbar styling */
.sidebar-section::-webkit-scrollbar,
#expiringList::-webkit-scrollbar {
  width: 6px;
}

.sidebar-section::-webkit-scrollbar-track,
#expiringList::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
}

.sidebar-section::-webkit-scrollbar-thumb,
#expiringList::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  transition: background 0.2s ease;
}

.sidebar-section::-webkit-scrollbar-thumb:hover,
#expiringList::-webkit-scrollbar-thumb:hover {
  background: rgba(80,227,194,0.4);
}

/* Style the main analytics dashboard scrollbar to be subtle */
.analytics-dashboard::-webkit-scrollbar {
  width: 4px;
}
.analytics-dashboard::-webkit-scrollbar-track {
  background: transparent;
}
.analytics-dashboard::-webkit-scrollbar-thumb {
  background: rgba(109, 159, 194, 0.2);
  border-radius: 2px;
}
.analytics-dashboard::-webkit-scrollbar-thumb:hover {
  background: rgba(109, 159, 194, 0.4);
}
.analytics-dashboard {
  scrollbar-width: thin;
  scrollbar-color: rgba(109, 159, 194, 0.2) transparent;
}

/* Apply slim scrollbar styling to nested analytics elements */
.analytics-dashboard *::-webkit-scrollbar,
.chart-container::-webkit-scrollbar,
.holder-bar-chart::-webkit-scrollbar,
.trends-chart::-webkit-scrollbar,
.insights-list::-webkit-scrollbar,
#map::-webkit-scrollbar,
.leaflet-container::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.analytics-dashboard::-webkit-scrollbar-track,
.analytics-dashboard *::-webkit-scrollbar-track,
.chart-container::-webkit-scrollbar-track,
.holder-bar-chart::-webkit-scrollbar-track,
.trends-chart::-webkit-scrollbar-track,
.insights-list::-webkit-scrollbar-track,
#map::-webkit-scrollbar-track,
.leaflet-container::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
}

.analytics-dashboard::-webkit-scrollbar-thumb,
.analytics-dashboard *::-webkit-scrollbar-thumb,
.chart-container::-webkit-scrollbar-thumb,
.holder-bar-chart::-webkit-scrollbar-thumb,
.trends-chart::-webkit-scrollbar-thumb,
.insights-list::-webkit-scrollbar-thumb,
#map::-webkit-scrollbar-thumb,
.leaflet-container::-webkit-scrollbar-thumb {
  background: rgba(109, 159, 194, 0.3);
  border-radius: 3px;
  transition: background 0.2s ease;
}

.analytics-dashboard::-webkit-scrollbar-thumb:hover,
.analytics-dashboard *::-webkit-scrollbar-thumb:hover,
.chart-container::-webkit-scrollbar-thumb:hover,
.holder-bar-chart::-webkit-scrollbar-thumb:hover,
.trends-chart::-webkit-scrollbar-thumb:hover,
.insights-list::-webkit-scrollbar-thumb:hover,
#map::-webkit-scrollbar-thumb:hover,
.leaflet-container::-webkit-scrollbar-thumb:hover {
  background: rgba(109, 159, 194, 0.5);
}

/* Spacing improvements */
.sidebar-section .small {
  margin-bottom: 0;
}

.sidebar-section .small:last-child {
  margin-bottom: 0;
}

/* Progress bar styling */
#deadClipProgress {
  display: none;
  margin-left: 16px;
  margin-top: 8px;
  align-items: center;
  gap: 8px;
}

#deadClipProgress > div {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
}

#deadClipProgressBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6D9FC2, #00689E);
  transition: width 0.3s ease;
}

/* Result items styling for better integration */
#resultList, #featureInfo, #expiringList {
  padding: 0;
  margin: 0;
}

#resultList {
  display: block !important;
  visibility: visible !important;
}

#resultList .result-item {
  margin-bottom: 2px;
  padding: 6px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  transition: all 0.2s ease;
  cursor: pointer;
}

#resultList .result-item:hover {
  background: rgba(80,227,194,0.1);
  border-color: rgba(80,227,194,0.3);
}

#resultList .result-item.selected {
  background: rgba(80,227,194,0.25) !important;
  border-color: rgba(80,227,194,0.8) !important;
  border-left: 4px solid rgba(80,227,194,1) !important;
  font-weight: 600 !important;
  color: rgba(255,255,255,1) !important;
  box-shadow: 0 2px 8px rgba(80,227,194,0.3) !important;
  transform: translateX(2px);
}

#featureInfo {
  background: rgba(80,227,194,0.03);
  border-radius: 4px;
  padding: 8px;
  margin-top: 8px;
  border: 1px solid rgba(80,227,194,0.15);
  border-left: 3px solid rgba(80,227,194,0.5);
}

#featureInfo:empty {
  display: none;
}

#expiringList .small {
  margin-bottom: 2px;
  padding: 4px 6px;
  border-radius: 3px;
  background: rgba(255,193,7,0.05);
  border: 1px solid rgba(255,193,7,0.1);
  transition: all 0.2s ease;
}

#expiringList .small:hover {
  background: rgba(255,193,7,0.1);
  border-color: rgba(255,193,7,0.3);
}

/* Diagnostic Messages */
#diag { 
  position: absolute; 
  left: 50%; 
  transform: translateX(-50%); 
  top: 70px; 
  z-index: 1001; 
  background: linear-gradient(135deg, rgba(255,193,7,0.95), rgba(255,152,0,0.95)); 
  color: #663c00; 
  border: 1px solid rgba(255,235,59,0.5); 
  padding: 8px 12px; 
  border-radius: 10px; 
  box-shadow: 0 4px 15px rgba(0,0,0,.2); 
  display: none; 
  max-width: 80%;
  backdrop-filter: blur(10px);
}

/* List Layouts */
.list { 
  display: grid; 
  grid-template-columns: repeat(3, minmax(160px, 1fr)); 
  gap: 4px 10px; 
  max-height: 220px; 
  overflow: auto; 
}

#groupList { 
  display: grid; 
  grid-template-columns: repeat(2, minmax(160px, 1fr)); 
  gap: 4px 10px; 
  max-height: 220px; 
  overflow: auto; 
}

/* Legend */
.legend {
  position: fixed;
  right: 16px;
  bottom: 35px; /* Closer to status bar */
  z-index: 1000;
  background: linear-gradient(135deg, rgba(10,37,64,0.95), rgba(5,25,45,0.95));
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  padding: 10px 12px;
  border-radius: 8px 8px 0 0; /* Rounded top, flat bottom to sit on status bar */
  box-shadow: 0 6px 25px rgba(0,0,0,.3);
  font: 12px/1.4 system-ui;
  transition: right 0.3s ease-in-out;
}

/* Shift legend left when marketplace panel is open */
.legend.shifted-left {
  right: 466px; /* 450px panel width + 16px margin */
}

/* Shift bottom toolbar buttons when marketplace panel is open */
.status-indicator.shifted-left {
  margin-right: 450px; /* Match marketplace panel width */
  transition: margin-right 0.3s ease;
}

.legend div { 
  margin: 3px 0; 
}

.legend .swatch { 
  display: inline-block; 
  width: 14px; 
  height: 14px; 
  margin-right: 8px; 
  border-radius: 3px; 
  border: 1px solid rgba(255,255,255,0.3); 
  vertical-align: middle; 
}

/* Results Panel - Now integrated into sidebar flow */

#resultsPanel div.result-item.small {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#resultsPanel div.result-item.small:hover {
  background: rgba(80,227,194,0.1);
}

#resultsPanel div.result-item.selected {
  background: rgba(80,227,194,0.25) !important;
  border-left: 4px solid rgba(80,227,194,1) !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 8px rgba(80,227,194,0.3) !important;
}

/* Enhanced visibility for result list when feature is selected */
#resultList {
  border: 1px solid rgba(80,227,194,0.2);
  border-radius: 4px;
  background: rgba(0,0,0,0.1);
}

#resultList:not(:empty) {
  box-shadow: 0 2px 12px rgba(80,227,194,0.1);
}

/* Statistics Panel */
#statsPanel {
  display: none;
  position: fixed;
  right: 10px;
  top: 70px;
  z-index: 2000;
  width: 200px;
  max-height: 240px;
  overflow-y: auto;
  background: linear-gradient(135deg, rgba(10,37,64,0.95), rgba(5,25,45,0.95));
  backdrop-filter: blur(10px);
  border: 1px solid rgba(80, 227, 194, 0.4);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  color: #fff;
}

/* Form Controls */
input, select { 
  background: rgba(255,255,255,0.1); 
  border: 1px solid rgba(255,255,255,0.2); 
  color: #fff; 
  border-radius: 6px; 
  padding: 4px 8px; 
}

input:focus, select:focus { 
  outline: none; 
  border-color: rgba(80,227,194,0.8); 
  box-shadow: 0 0 10px rgba(80,227,194,0.3); 
}

/* Range Slider Styles */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  height: 20px;
}

/* Track */
input[type="range"]::-webkit-slider-track {
  background: rgba(255,255,255,0.2);
  height: 6px;
  border-radius: 3px;
  border: none;
}

input[type="range"]::-moz-range-track {
  background: rgba(255,255,255,0.2);
  height: 6px;
  border-radius: 3px;
  border: none;
}

/* Thumb */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: #6D9FC2;
  border: 2px solid rgba(255,255,255,0.3);
  cursor: pointer;
  transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb {
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: #6D9FC2;
  border: 2px solid rgba(255,255,255,0.3);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

/* Hover and focus states */
input[type="range"]::-webkit-slider-thumb:hover {
  background: #40d3b2;
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(80,227,194,0.5);
}

input[type="range"]::-moz-range-thumb:hover {
  background: #40d3b2;
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(80,227,194,0.5);
}

input[type="range"]:focus {
  outline: none;
}

input[type="range"]:focus::-webkit-slider-thumb {
  box-shadow: 0 0 15px rgba(80,227,194,0.7);
}

/* Cluster Styles */
.marker-cluster.zero { 
  display: none; 
}

/* MINDEX cluster styling - more specific selectors to override defaults */
.marker-cluster-mindex div,
.marker-cluster-mindex.marker-cluster-small div,
.marker-cluster-mindex.marker-cluster-medium div,
.marker-cluster-mindex.marker-cluster-large div { 
  background: linear-gradient(135deg, rgba(255,215,0,0.85), rgba(255,193,7,0.85)) !important; 
  color: #333 !important; 
  border: 2px solid rgba(255,255,255,.95) !important;
  box-shadow: 0 4px 15px rgba(255,215,0,0.5) !important;
  text-align: center !important;
  font-weight: 700 !important;
  border-radius: 50% !important;
  width: 40px !important;
  height: 40px !important;
  line-height: 36px !important;
  margin-left: -20px !important;
  margin-top: -20px !important;
}

.marker-cluster-mindex,
.marker-cluster-mindex.marker-cluster-small,
.marker-cluster-mindex.marker-cluster-medium,
.marker-cluster-mindex.marker-cluster-large {
  background: linear-gradient(135deg, rgba(255,215,0,0.3), rgba(255,193,7,0.3)) !important;
}

/* MINDEX custom shape markers */
.mindex-shape-marker {
  background: transparent !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.mindex-shape-marker div {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mindex-shape-marker svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.mindex-shape-marker svg polygon,
.mindex-shape-marker svg rect,
.mindex-shape-marker svg circle {
  stroke-width: 0.5;
  cursor: pointer;
}

.mindex-shape-marker:hover svg polygon,
.mindex-shape-marker:hover svg rect,
.mindex-shape-marker:hover svg circle {
  stroke-width: 1.5;
  filter: brightness(1.2);
}

/* Drillhole cluster styling - more specific selectors to override defaults */
.marker-cluster-drill div,
.marker-cluster-drill.marker-cluster-small div,
.marker-cluster-drill.marker-cluster-medium div,
.marker-cluster-drill.marker-cluster-large div { 
  background: linear-gradient(135deg, rgba(64,64,64,0.9), rgba(32,32,32,0.9)) !important; 
  color: #fff !important; 
  border: 2px solid rgba(255,255,255,.95) !important;
  box-shadow: 0 4px 15px rgba(0,0,0,0.6) !important;
  text-align: center !important;
  font-weight: 700 !important;
  border-radius: 50% !important;
  width: 40px !important;
  height: 40px !important;
  line-height: 36px !important;
  margin-left: -20px !important;
  margin-top: -20px !important;
}

.marker-cluster-drill,
.marker-cluster-drill.marker-cluster-small,
.marker-cluster-drill.marker-cluster-medium,
.marker-cluster-drill.marker-cluster-large { 
  background: linear-gradient(135deg, rgba(64,64,64,0.3), rgba(32,32,32,0.3)) !important; 
}

/* Geochemistry cluster styling - blue theme to match geochem points (#2196F3) */
.marker-cluster-geochem div,
.marker-cluster-geochem.marker-cluster-small div,
.marker-cluster-geochem.marker-cluster-medium div,
.marker-cluster-geochem.marker-cluster-large div { 
  background: linear-gradient(135deg, rgba(33,150,243,0.85), rgba(100,181,246,0.85)) !important; 
  color: #fff !important; 
  border: 2px solid rgba(255,255,255,.95) !important;
  box-shadow: 0 4px 15px rgba(33,150,243,0.5) !important;
  text-align: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  position: relative !important;
  left: -18px !important;
  top: -18px !important;
}

.marker-cluster-geochem,
.marker-cluster-geochem.marker-cluster-small,
.marker-cluster-geochem.marker-cluster-medium,
.marker-cluster-geochem.marker-cluster-large { 
  background: linear-gradient(135deg, rgba(33,150,243,0.3), rgba(100,181,246,0.3)) !important; 
}

/* Ensure cluster text is properly centered and sized */
.marker-cluster-mindex span,
.marker-cluster-drill span,
.marker-cluster-geochem span {
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 36px !important;
  display: block !important;
  width: 100% !important;
  text-align: center !important;
  margin: 0 !important;
  padding: 0 !important;
}

.marker-cluster.singleton { 
  display: none !important; 
}

/* Drillhole Icons */
.drill-sq { 
  width: 10px; 
  height: 10px; 
  background: linear-gradient(135deg, #000, #333); 
  border: 2px solid #fff; 
  box-sizing: border-box; 
  border-radius: 2px; 
  box-shadow: 0 2px 8px rgba(0,0,0,0.3); 
}

/* Popup Styles */
.leaflet-popup-content-wrapper { 
  max-width: 800px; 
  background: linear-gradient(135deg, rgba(10,37,64,0.95), rgba(5,25,45,0.95));
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
}

.leaflet-popup-content { 
  width: 780px !important; 
  margin: 12px; 
}

.popup td {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 4px 8px;
  color: #eee;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.popup td.key {
  font-weight: 600;
  color: #6D9FC2;
  white-space: normal;
  width: 40%;
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.popup table {
  border-collapse: collapse;
  font-size: 12px;
  width: 100%;
  table-layout: fixed;
}

/* Layer Section Collapsible Styles */
.layer-section {
  margin-bottom: 4px;
}

.layer-section-header {
  font-weight: 600;
  cursor: pointer;
  position: relative;
  padding-left: 18px;
  user-select: none;
  list-style: none;
}

.layer-section-header::-webkit-details-marker {
  display: none;
}

.layer-section-header::before {
  content: '▶';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  transition: transform 0.2s ease;
  color: #50e3c2;
}

.layer-section[open] > .layer-section-header::before {
  transform: translateY(-50%) rotate(90deg);
}

.layer-section-content {
  padding-left: 4px;
  margin-top: 4px;
}

/* Hover Tooltips */
.hoverTip { 
  background: #fff; 
  border: 1px solid #ddd; 
  border-radius: 6px; 
  box-shadow: 0 2px 8px rgba(0,0,0,.15); 
  padding: 2px 6px; 
  font-size: 12px; 
}

/* Spinner Animation */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(80,227,194,0.2);
  border-left-color: #6D9FC2;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 4px;
  vertical-align: middle;
  box-sizing: content-box;
  flex-shrink: 0;
}

/* Tiny buttons for group management */
.btn-tiny {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  cursor: pointer;
  border-radius: 2px;
  font-size: 10px;
  padding: 2px 4px;
  margin: 0 1px;
}

.btn-tiny:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.3);
}

/* Keyboard Help Overlay */
#keyboardHelp {
  display: none;
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 16px;
  border-radius: 10px;
  z-index: 3000;
  max-width: 300px;
  text-align: left;
  line-height: 1.4;
}

#keyboardHelp.show {
  display: block;
}

/* Basemap Picker */
.toolbar select#basemapPicker {
  background: #0A2540 !important;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,0.25) !important;
}

.toolbar select#basemapPicker option {
  background: #0A2540 !important;
  color: #fff !important;
}

label.small { 
  color: #e0e0e0; 
}

/* Enhanced Status Bar */
.status-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, rgba(10,37,64,0.95), rgba(5,25,45,0.95));
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 8px 16px;
  color: #fff;
  font-size: 12px;
  z-index: 1500;
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4CAF50;
  animation: pulse 2s infinite;
}

.status-dot.loading {
  background: #FFC107;
  animation: spin 1s linear infinite;
}

.status-dot.error {
  background: #F44336;
  animation: flash 1s infinite;
}

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

@keyframes flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Connection Status */
.connection-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #b0b0b0;
}

.connection-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4CAF50;
}

.connection-dot.offline {
  background: #F44336;
}

/* Progress Bar Component */
.progress-container {
  flex: 1;
  max-width: 200px;
  height: 8px;
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
  overflow: hidden;
  display: none;
  border: 1px solid rgba(255,255,255,0.3);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #6D9FC2, #005387);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 3px;
  box-shadow: 0 0 4px rgba(80,227,194,0.5);
}

/* Scrollable Layers Panel - removed duplicate rule, styling handled by .sidebar-section.layers-section */

/* Cursor Fix - Allow natural hover behavior */
.leaflet-container {
  cursor: grab;
}

.leaflet-container:active {
  cursor: grabbing;
}

.leaflet-interactive {
  cursor: pointer !important;
}

.leaflet-marker-icon {
  cursor: pointer !important;
}

.leaflet-clickable {
  cursor: pointer !important;
}

.leaflet-control {
  cursor: default;
}

.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
  cursor: pointer;
}

/* Position zoom controls below toolbar */
.leaflet-top.leaflet-left {
  top: 70px !important; /* Position below toolbar */
}

/* Hide any right-side map controls that might interfere with analytics */
.leaflet-top.leaflet-right,
.leaflet-bottom.leaflet-right {
  display: none !important;
}
/* Style map scrollbars to match LHS containers */
.leaflet-container {
  scrollbar-width: thin;
  scrollbar-color: rgba(109, 159, 194, 0.3) rgba(255,255,255,0.05);
}

/* Firefox scrollbar support for analytics panel */
.analytics-dashboard,
.analytics-dashboard *,
.chart-container,
.holder-bar-chart,
.trends-chart,
.insights-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(109, 159, 194, 0.3) rgba(255,255,255,0.05);
}

/* Date preset buttons */
.date-preset-btn {
  background: rgba(45, 55, 75, 0.8);
  border: 1px solid rgba(109, 159, 194, 0.3);
  color: #bbb;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.date-preset-btn:hover {
  background: rgba(109, 159, 194, 0.2);
  border-color: rgba(109, 159, 194, 0.5);
  color: #ddd;
}

.date-preset-btn:active,
.date-preset-btn.active {
  background: rgba(109, 159, 194, 0.4);
  border-color: #6D9FC2;
  color: #fff;
}

/* Allow natural cursor inheritance */
#map {
  cursor: grab;
}

/* Ensure polygon outlines are preserved */
.leaflet-overlay-pane svg path {
  pointer-events: auto;
  cursor: pointer;
}

/* Enhanced styling for better visibility */
.tenure-highlight {
  stroke: #00BCD4 !important;
  stroke-width: 3 !important;
  fill-opacity: 0.3 !important;
  stroke-opacity: 1 !important;
}

/* Ensure tenure overlay checkbox always appears enabled and visible */
#chkTenureOverlay {
  opacity: 1 !important;
  pointer-events: auto !important;
}

#chkTenureOverlay:disabled {
  opacity: 1 !important;
  pointer-events: auto !important;
}

label:has(#chkTenureOverlay) {
  opacity: 1 !important;
  color: #fff !important;
}

/* Scale control styling - anchored to RHS of sidebar */
.leaflet-control-scale {
  background: rgba(10,37,64,0.95) !important;
  border: 1px solid rgba(255,255,255,0.2) !important;
  border-radius: 4px !important;
  padding: 6px 10px !important;
  color: #ffffff !important;
  font-family: system-ui, -apple-system, sans-serif !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  text-rendering: geometricPrecision !important;
  -webkit-font-smoothing: subpixel-antialiased !important;
  text-shadow: none !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25) !important;
  z-index: 1000 !important;
  position: fixed !important;
  bottom: 40px !important; /* Just above 60px status bar with 10px gap */
  left: 345px !important; /* 5px to right of 340px sidebar to avoid overlap */
  transform: none !important;
  margin: 0 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.leaflet-control-scale-line {
  border: 2px solid #4CAF50 !important;
  border-top: none !important;
  color: #ffffff !important;
  background: transparent !important;
  line-height: 1.3 !important;
  padding: 2px 5px 1px 5px !important;
  font-family: system-ui, -apple-system, sans-serif !important;
  font-weight: 500 !important;
  font-size: 10px !important;
  text-rendering: geometricPrecision !important;
  -webkit-font-smoothing: subpixel-antialiased !important;
  text-shadow: none !important;
  letter-spacing: 0.2px !important;
}

/* Mapbox Scale Control - Dark Navy Theme */
.mapboxgl-ctrl-scale {
  background: rgba(10, 37, 64, 0.95) !important;
  border: 1px solid rgba(109, 159, 194, 0.5) !important;
  color: #A9C0DE !important;
  font-size: 11px !important;
  padding: 2px 5px !important;
  border-radius: 4px !important;
  backdrop-filter: blur(10px) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

/* MapLibre GL layers - ensure transparency for stacking multiple layers */
.leaflet-pane .maplibregl-map,
.leaflet-pane .mapboxgl-map {
  background: transparent !important;
}
.leaflet-pane .maplibregl-canvas-container,
.leaflet-pane .mapboxgl-canvas-container {
  background: transparent !important;
}
.maplibregl-canvas,
.mapboxgl-canvas {
  background: transparent !important;
}

/* Measuring tool popup styling */
.measure-popup .leaflet-popup-content {
  background: rgba(10,37,64,0.95) !important;
  color: #e0e0e0 !important;
  font-weight: 500 !important;
  border-radius: 4px !important;
  padding: 6px 10px !important;
  margin: 0 !important;
  min-width: 0 !important;
  max-width: 140px !important;
  width: fit-content !important;
  white-space: nowrap !important;
  font-size: 11px !important;
  line-height: 1.3 !important;
  text-align: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.measure-popup .leaflet-popup-content-wrapper {
  background: rgba(10,37,64,0.95) !important;
  border: 1px solid rgba(255,255,255,0.2) !important;
  border-radius: 4px !important;
  backdrop-filter: blur(8px) !important;
  padding: 0 !important;
  margin: 0 !important;
  min-width: 0 !important;
  max-width: 140px !important;
  width: fit-content !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.measure-popup .leaflet-popup-tip {
  background: rgba(10,37,64,0.95) !important;
  border: 1px solid rgba(255,255,255,0.2) !important;
}

/* Analytics Dashboard - Essential Styles Only */
.analytics-dashboard {
  position: fixed;
  top: 60px;
  right: 0;
  width: 450px;
  height: calc(100vh - 60px);
  background: rgba(10, 37, 64, 0.95);
  border-left: 1px solid rgba(109, 159, 194, 0.3);
  backdrop-filter: blur(10px);
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
  z-index: 10000 !important;
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 12px;
}

.analytics-dashboard.dashboard-open {
  transform: translateX(0);
}

.dashboard-toggle {
  position: fixed;
  right: 0px;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, rgba(0,104,158,0.9), rgba(66,184,164,0.85));
  color: #ffffff;
  border: 2px solid rgba(80,227,194,0.5);
  border-radius: 12px 0 0 12px;
  border-right: none;
  padding: 16px 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: -6px 0 25px rgba(0,104,158,0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
  width: 42px;
}

.dashboard-toggle:hover {
  background: linear-gradient(135deg, rgba(0,123,187,0.95), rgba(80,227,194,0.9));
  color: #ffffff;
  border-color: rgba(80,227,194,0.8);
  transform: translateY(-50%) translateX(-4px);
  box-shadow: -8px 0 30px rgba(80,227,194,0.5);
}

.dashboard-toggle:active {
  transform: translateY(-50%) translateX(-1px);
  transition-duration: 0.1s;
}

.dashboard-toggle .toggle-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  line-height: 1;
  color: inherit;
  font-weight: 700;
}

.dashboard-toggle .analytics-arrow {
  display: inline-block;
  transition: transform 0.3s ease;
  font-size: 20px;
  line-height: 1;
}

.dashboard-toggle.dashboard-open .analytics-arrow {
  transform: scaleX(-1);
}

.dashboard-content {
  padding: 16px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(109, 159, 194, 0.2);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

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

.dashboard-title {
  font-size: 18px;
  font-weight: 700;
  color: #6D9FC2;
  letter-spacing: 0.5px;
}

.analytics-section {
  margin-bottom: 20px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(109, 159, 194, 0.1);
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: #6D9FC2;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.chart-container {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 16px;
  max-height: 300px;
  overflow-y: auto;
}

.holder-bar {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  border: 1px solid rgba(109, 159, 194, 0.15);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.holder-bar:hover {
  background: rgba(109, 159, 194, 0.08);
  border-color: rgba(109, 159, 194, 0.25);
  transform: translateX(2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.holder-info {
  flex: 1;
  min-width: 0;
}

.holder-name {
  font-weight: 500;
  color: #fff;
  font-size: 11px;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holder-stats {
  font-size: 10px;
  color: #999;
}

.holder-bar-chart {
  flex: 1;
  margin-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bar-fill {
  height: 10px;
  border-radius: 5px;
  transition: width 0.8s ease;
  position: relative;
}

.bar-fill::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
  border-radius: 5px 5px 0 0;
}

.bar-fill.area-bar {
  background: linear-gradient(90deg, #6D9FC2 0%, #87CEEB 100%) !important;
  box-shadow: 0 2px 4px rgba(109, 159, 194, 0.3);
}

.bar-fill.count-bar {
  background: linear-gradient(90deg, #FFA726 0%, #FF8F00 100%) !important;
  box-shadow: 0 2px 4px rgba(255, 167, 38, 0.3);
}

/* Additional Analytics CSS */
.dashboard-body {
  flex: 1;
  overflow-y: auto;
  padding-right: 10px; /* Add padding to avoid content touching edge */
  padding-bottom: 50px; /* Add bottom padding to clear status bar */
}

.section-subtitle {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 12px;
  font-style: italic;
}

.date-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.date-range-select {
  background: rgba(10, 37, 64, 0.9);
  border: 1px solid rgba(109, 159, 194, 0.3);
  color: #ffffff;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.date-range-select:focus {
  outline: none;
  border-color: rgba(109, 159, 194, 0.6);
  background: rgba(10, 37, 64, 0.95);
  box-shadow: 0 0 0 2px rgba(109, 159, 194, 0.2);
}

.date-range-select option {
  background: rgba(10, 37, 64, 0.95);
  color: #ffffff;
  padding: 4px 8px;
}

.discrete-dates {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.date-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.date-input-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.date-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(109, 159, 194, 0.3);
  color: #fff;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 11px;
  transition: all 0.2s ease;
}

.date-input:focus {
  outline: none;
  border-color: rgba(109, 159, 194, 0.6);
  background: rgba(109, 159, 194, 0.08);
  box-shadow: 0 0 0 2px rgba(109, 159, 194, 0.2);
}

.refresh-btn {
  background: rgba(109, 159, 194, 0.1);
  border: 1px solid rgba(109, 159, 194, 0.3);
  color: #6D9FC2;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  font-weight: 500;
}

.refresh-btn:hover {
  background: rgba(109, 159, 194, 0.2);
  border-color: rgba(109, 159, 194, 0.5);
  transform: scale(1.02);
}

.close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-weight: 600;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: rgba(255, 107, 107, 0.2);
  border-color: rgba(255, 107, 107, 0.4);
  color: #ff6b6b;
  transform: scale(1.05);
}

.loading-message {
  text-align: center;
  padding: 20px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
}

.toggle-label {
  font-size: 8px;
  color: #0A2540;
  font-weight: 500;
  margin-top: 2px;
}

.subsection-title {
  font-size: 12px;
  font-weight: 600;
  color: rgba(109, 159, 194, 0.9);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(109, 159, 194, 0.2);
}

.chart-legend {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 9px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-color {
  width: 10px;
  height: 6px;
  border-radius: 2px;
}

.legend-color.tenements {
  background: rgba(80, 227, 194, 0.6);
}

.legend-color.area {
  background: #6D9FC2;
}

.legend-color.acquisitions {
  background: #6D9FC2;
}

.trends-chart {
  height: 120px;
  overflow-y: auto;
}

/* Trends Chart Styling */
.trends-chart-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
}

.legend-color {
  width: 12px;
  height: 8px;
  border-radius: 2px;
}

.legend-color.acquisitions {
  background: linear-gradient(90deg, #FFA726 0%, #FF8F00 100%);
}

.legend-color.area {
  background: linear-gradient(90deg, #6D9FC2 0%, #87CEEB 100%);
}

.chart-area {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 80px;
  padding: 0 4px;
  gap: 2px;
}

.month-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.bar-container {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 60px;
  width: 100%;
  justify-content: center;
}

.acquisition-bar, .area-bar {
  width: 8px;
  min-height: 3px;
  border-radius: 2px 2px 0 0;
  transition: all 0.3s ease;
}

.acquisition-bar {
  background: linear-gradient(180deg, #FFA726 0%, #FF8F00 100%);
  box-shadow: 0 2px 4px rgba(255, 167, 38, 0.3);
}

.area-bar {
  background: linear-gradient(180deg, #6D9FC2 0%, #87CEEB 100%);
  box-shadow: 0 2px 4px rgba(109, 159, 194, 0.3);
}

.acquisition-bar:hover, .area-bar:hover {
  transform: scaleY(1.05);
  filter: brightness(1.1);
}

.month-label {
  font-size: 9px;
  color: #bbb;
  text-align: center;
  writing-mode: horizontal-tb;
  font-weight: 500;
}

.month-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 8px;
  color: #6D9FC2;
  line-height: 1.2;
  gap: 1px;
  font-weight: 600;
}

.trend-insights {
  margin-top: 12px;
}

.insights-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.insight-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 3px;
  font-size: 10px;
}

.insight-icon {
  flex-shrink: 0;
}

.insight-text {
  line-height: 1.3;
}

/* Premium gating styles for analytics dashboard */
/* COMPLETELY REMOVED - User wants no blur or transparency effects */
/* All access control is now handled inside chart containers with messages */
.analytics-section.premium-blurred {
  /* No visual effects at all - class is obsolete but kept to avoid JS errors */
}

#analytics-premium-notice {
  animation: subtle-pulse 2s ease-in-out infinite;
}

@keyframes subtle-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.3);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
  }
}


/* ============================================================================
   MARKETPLACE STYLES
   ============================================================================ */

/* Marketplace Sidebar Panel */
.marketplace-panel {
  position: fixed;
  top: 60px;
  right: 0;
  width: 450px;
  height: calc(100vh - 60px);
  background: rgba(10, 37, 64, 0.95);
  border-left: 1px solid rgba(109, 159, 194, 0.3);
  backdrop-filter: blur(10px);
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 12px;
}

.marketplace-panel.open {
  transform: translateX(0);
}

.marketplace-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid rgba(109, 159, 194, 0.2);
}

.marketplace-tabs {
  display: flex;
  border-bottom: 1px solid rgba(109, 159, 194, 0.2);
}

.marketplace-tab {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: none;
  color: rgba(109, 159, 194, 0.7);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.marketplace-tab.active {
  color: #50e3c2;
  background: rgba(80, 227, 194, 0.1);
  border-bottom: 2px solid #50e3c2;
}

.marketplace-tab:hover {
  background: rgba(109, 159, 194, 0.1);
  color: #6D9FC2;
}

.marketplace-tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 16px 16px;
}

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

.marketplace-listings {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

/* Listing Card */
.listing-card {
  background: rgba(20, 60, 90, 0.5);
  border: 1px solid rgba(109, 159, 194, 0.2);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.listing-card:hover {
  background: rgba(20, 60, 90, 0.7);
  transform: translateY(-2px);
}

.listing-card-active {
  border-color: #50e3c2 !important;
  background: rgba(20, 60, 90, 0.85) !important;
  box-shadow: 0 0 0 2px rgba(80, 227, 194, 0.4), 0 4px 16px rgba(80, 227, 194, 0.25) !important;
  transform: translateY(-2px) !important;
}

.listing-card-active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(80, 227, 194, 0.05), rgba(109, 159, 194, 0.05));
  pointer-events: none;
}

/* Flash animation when listing is clicked from map */
.listing-card-flash {
  animation: listingFlash 2s ease-out;
}

@keyframes listingFlash {
  0%, 100% {
    border-color: rgba(109, 159, 194, 0.2) !important;
    box-shadow: none !important;
  }
  15%, 35%, 55% {
    border-color: #FF6B35 !important;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.4), 0 4px 16px rgba(255, 107, 53, 0.3) !important;
    transform: translateY(-2px);
  }
  25%, 45% {
    border-color: rgba(109, 159, 194, 0.4) !important;
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2) !important;
    transform: translateY(0);
  }
}

.listing-card {
  position: relative;
}

.listing-card-clickable {
  padding: 14px;
  cursor: pointer;
}

.listing-card-details-btn {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, rgba(109, 159, 194, 0.2), rgba(80, 227, 194, 0.2));
  border: none;
  border-top: 1px solid rgba(109, 159, 194, 0.3);
  color: #6D9FC2;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.listing-card-details-btn:hover {
  filter: brightness(1.3);
  transform: translateY(-2px);
  text-decoration: underline;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.listing-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 12px;
}

.listing-tenement-id {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.listing-price {
  font-size: 16px;
  font-weight: 600;
  color: #50e3c2;
}

.listing-badges {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.listing-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.badge-type-e {
  background: rgba(109, 159, 194, 0.2);
  color: #6D9FC2;
  border: 1px solid rgba(109, 159, 194, 0.3);
}

.badge-type-p {
  background: rgba(80, 227, 194, 0.2);
  color: #50e3c2;
  border: 1px solid rgba(80, 227, 194, 0.3);
}

.badge-type-m {
  background: rgba(0, 104, 158, 0.2);
  color: #42b8a4;
  border: 1px solid rgba(0, 104, 158, 0.3);
}

.badge-status-live {
  background: rgba(80, 227, 194, 0.2);
  color: #50e3c2;
  border: 1px solid rgba(80, 227, 194, 0.3);
}

.badge-status-pending {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
  border: 1px solid rgba(255, 193, 7, 0.3);
}

.listing-description {
  color: #bbb;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.listing-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #999;
}

.listing-thumbnail {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 12px;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  z-index: 10003 !important;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  overflow: auto;
}

.modal.open {
  display: block;
}

/* NDA modal should appear above listing detail modal */
#ndaModal {
  z-index: 10004 !important;
}

.modal-content {
  background: rgba(10, 37, 64, 0.98);
  margin: 8% auto;
  border: 1px solid rgba(109, 159, 194, 0.3);
  border-radius: 12px;
  max-width: 900px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
  color: #fff;
}

.marketplace-modal {
  max-width: 700px;
}

.listing-detail-modal {
  max-width: 1000px;
  /* Centered by default */
  margin-left: auto;
  margin-right: auto;
}

/* Shift left when marketplace panel is open */
.marketplace-panel.open ~ #listingDetailModal .listing-detail-modal {
  margin-right: calc(450px + 16px);
  margin-left: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(109, 159, 194, 0.2);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid rgba(109, 159, 194, 0.2);
}

.close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Message Composition Modal */
#messageCompositionModal textarea {
  resize: vertical;
  min-height: 150px;
}

#messageCompositionModal .modal-content {
  animation: slideInFromTop 0.3s ease-out;
}

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

#btnSendMessageAndUnlock:hover:not(:disabled) {
  background: #005580;
}

#btnSendMessageAndUnlock:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* Form Sections */
.form-section {
  margin-bottom: 24px;
}

.form-section label {
  display: block;
  margin-bottom: 8px;
  color: #fff;
  font-weight: 500;
  font-size: 14px;
}

.form-section input[type="text"],
.form-section input[type="email"],
.form-section input[type="tel"],
.form-section input[type="number"],
.form-section select,
.form-section textarea {
  width: 100%;
  padding: 10px 12px;
  background: rgba(20, 60, 90, 0.4);
  border: 1px solid rgba(109, 159, 194, 0.3);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 12px;
  box-sizing: border-box;
}

.form-section input:focus,
.form-section select:focus,
.form-section textarea:focus {
  outline: none;
  border-color: #50e3c2;
  background: rgba(20, 60, 90, 0.6);
  box-shadow: 0 0 0 3px rgba(80, 227, 194, 0.1);
}

/* Style select dropdown options */
.form-section select option {
  background: #1a2332;
  color: #fff;
  padding: 8px;
}

.form-section select option:hover,
.form-section select option:checked {
  background: rgba(80, 227, 194, 0.2);
  color: #50e3c2;
}

.form-section textarea {
  resize: vertical;
  min-height: 100px;
}

/* Upload Areas */
.upload-area {
  border: 2px dashed rgba(109, 159, 194, 0.3);
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 16px;
  background: rgba(20, 60, 90, 0.2);
}

.upload-area:hover {
  border-color: #6D9FC2;
  background: rgba(109, 159, 194, 0.1);
}

.upload-area.dragover {
  border-color: #50e3c2;
  background: rgba(80, 227, 194, 0.1);
}

.upload-area p {
  margin: 0;
  color: #999;
}

/* Image Preview Grid */
.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.image-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(220, 53, 69, 0.9);
  color: #fff;
  border: none;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Document Preview List */
.document-preview-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.document-preview-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #222;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

.document-preview-item .doc-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.document-preview-item .doc-icon {
  font-size: 24px;
}

.document-preview-item .doc-name {
  color: #fff;
  font-size: 14px;
}

.document-preview-item .doc-size {
  color: #999;
  font-size: 12px;
}

.document-preview-item .remove-btn {
  background: rgba(220, 53, 69, 0.2);
  color: #dc3545;
  border: 1px solid rgba(220, 53, 69, 0.3);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
}

/* Search Results */
.search-results {
  max-height: 200px;
  overflow-y: auto;
  background: #222;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  margin-top: 8px;
}

.search-result-item {
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s ease;
}

.search-result-item:hover {
  background: rgba(37, 99, 235, 0.1);
}

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

.tenement-info {
  padding: 16px;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-radius: 8px;
  margin-bottom: 16px;
}

/* Marketplace Sort Dropdown */
.marketplace-sort {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.marketplace-sort label {
  font-size: 13px;
  color: #6D9FC2;
  font-weight: 500;
  margin: 0;
}

.marketplace-sort select {
  flex: 1;
  padding: 8px 12px;
  background: rgba(10, 37, 64, 0.8);
  color: #fff;
  border: 1px solid rgba(109, 159, 194, 0.4);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.marketplace-sort select:hover {
  border-color: rgba(80, 227, 194, 0.5);
  background: rgba(10, 37, 64, 0.95);
}

.marketplace-sort select:focus {
  border-color: #50e3c2;
  box-shadow: 0 0 0 2px rgba(80, 227, 194, 0.1);
}

/* Listing Detail View */
.listing-detail-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(10,37,64,0.4), rgba(5,25,45,0.4));
  border: 1px solid rgba(109, 159, 194, 0.2);
  border-radius: 8px;
}

.listing-detail-header .listing-badges {
  margin-bottom: 0;
  flex: 0 0 auto;
}

.listing-detail-header .listing-detail-price {
  flex: 1 1 auto;
  margin: 0;
}

.listing-detail-header button {
  flex: 0 0 auto;
  margin: 0 !important;
}

.listing-edit-btn {
  padding: 10px 20px;
  background: linear-gradient(135deg, rgba(109, 159, 194, 0.4) 0%, rgba(109, 159, 194, 0.3) 100%);
  border: 2px solid rgba(109, 159, 194, 0.6);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.listing-edit-btn:hover {
  background: linear-gradient(135deg, rgba(109, 159, 194, 0.6) 0%, rgba(109, 159, 194, 0.5) 100%);
  border-color: #6D9FC2;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(109, 159, 194, 0.4);
}

.listing-delete-btn {
  padding: 10px 20px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.4) 0%, rgba(239, 68, 68, 0.3) 100%);
  border: 2px solid rgba(239, 68, 68, 0.6);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.listing-delete-btn:hover {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.6) 0%, rgba(239, 68, 68, 0.5) 100%);
  border-color: #ef4444;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.listing-detail-title {
  font-size: 28px;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.listing-detail-price {
  font-size: 24px;
  font-weight: 700;
  color: #50e3c2;
}

.image-gallery {
  margin-bottom: 24px;
}

.image-gallery-main {
  width: 100%;
  height: 400px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 12px;
}

.image-gallery-thumbnails {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}

.image-gallery-thumbnail {
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s ease;
}

.image-gallery-thumbnail:hover,
.image-gallery-thumbnail.active {
  border-color: #2563eb;
}

/* Compact Image Gallery for Listing Details */
.image-gallery-compact {
  margin-bottom: 24px;
  background: rgba(109, 159, 194, 0.05);
  border: 1px solid rgba(109, 159, 194, 0.2);
  border-radius: 12px;
  padding: 16px;
}

.gallery-label {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.image-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
}

.image-thumbnail-wrapper {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.image-thumbnail-wrapper:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
}

.image-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.image-thumbnail-wrapper:hover .image-overlay {
  opacity: 1;
}

.zoom-icon {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* Scrollbar styling for image grid */
.image-gallery-grid::-webkit-scrollbar {
  width: 6px;
}

.image-gallery-grid::-webkit-scrollbar-track {
  background: rgba(109, 159, 194, 0.1);
  border-radius: 3px;
}

.image-gallery-grid::-webkit-scrollbar-thumb {
  background: rgba(109, 159, 194, 0.3);
  border-radius: 3px;
}

.image-gallery-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(109, 159, 194, 0.5);
}

.listing-detail-section {
  margin-bottom: 24px;
}

.listing-detail-section h3 {
  margin: 0 0 12px 0;
  font-size: 18px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.contact-details {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 8px;
  padding: 20px;
}

.contact-details p {
  margin: 8px 0;
  color: #fff;
}

.contact-locked {
  text-align: center;
  padding: 40px 20px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
}

.contact-locked-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.document-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.document-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #222;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  text-decoration: none;
  color: #fff;
  transition: all 0.2s ease;
}

.document-item:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: #2563eb;
}

.document-item .doc-icon {
  font-size: 24px;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, #50e3c2 0%, #45d1b8 100%);
  color: #0A2540;
  border: none;
  padding: 12px 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(80, 227, 194, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #45d1b8 0%, #3bc2a8 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(80, 227, 194, 0.4);
}

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

.btn-success {
  background: #059669;
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-success:hover {
  background: #047857;
}

.btn-secondary {
  background: rgba(109, 159, 194, 0.15);
  color: #6D9FC2;
  border: 1.5px solid rgba(109, 159, 194, 0.4);
  padding: 12px 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: rgba(109, 159, 194, 0.25);
  border-color: rgba(109, 159, 194, 0.6);
  transform: translateY(-1px);
}

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

/* Marketplace Layer on Map */
.marketplace-marker {
  background: #2563eb;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Marketplace Popup Styling */
.marketplace-popup .leaflet-popup-content-wrapper {
  background: linear-gradient(135deg, rgba(10,37,64,0.98), rgba(5,25,45,0.98)) !important;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(109,159,194,0.3) !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  padding: 0 !important;
}

.marketplace-popup .leaflet-popup-content {
  margin: 0 !important;
  width: auto !important;
}

.marketplace-popup .leaflet-popup-tip {
  background: rgba(10,37,64,0.98) !important;
  border: 1px solid rgba(109,159,194,0.3) !important;
}

.marketplace-popup a.leaflet-popup-close-button {
  color: #6D9FC2 !important;
  font-size: 20px !important;
  padding: 8px 12px !important;
}

.marketplace-popup a.leaflet-popup-close-button:hover {
  color: #50e3c2 !important;
}

/* ============================================================================
   MARKETPLACE ENHANCEMENTS - New Features
   ============================================================================ */

/* Sticky Marketplace Controls */
.marketplace-controls {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 37, 64, 0.98);
  padding: 8px 12px;
  margin: -16px -16px 0 -16px;
  border-bottom: 1px solid rgba(109, 159, 194, 0.2);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Marketplace Buttons Row */
.marketplace-buttons {
  display: flex;
  gap: 8px;
  width: 100%;
}

.marketplace-buttons .filter-toggle-btn {
  flex: 1;
}

/* Filter Toggle Button */
.filter-toggle-btn {
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(109, 159, 194, 0.2), rgba(80, 227, 194, 0.15));
  border: 1px solid rgba(109, 159, 194, 0.3);
  border-radius: 6px;
  color: #6D9FC2;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.filter-toggle-btn:hover {
  background: linear-gradient(135deg, rgba(109, 159, 194, 0.3), rgba(80, 227, 194, 0.25));
  border-color: #50e3c2;
  color: #50e3c2;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(80, 227, 194, 0.15);
}

.filter-count {
  background: #50e3c2;
  color: #0a2540;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}

/* Filters Panel */
.filters-panel {
  background: rgba(20, 60, 90, 0.5);
  border: 1px solid rgba(109, 159, 194, 0.2);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  animation: slideDown 0.3s ease-out;
}

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

.filter-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(109, 159, 194, 0.1);
}

.filter-section:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid;
}

.status-badge.active {
  background: rgba(255, 140, 0, 0.15);
  color: #FF8C00;
  border-color: rgba(255, 140, 0, 0.3);
}

.status-badge.sale-pending {
  background: rgba(255, 193, 7, 0.15);
  color: #FFC107;
  border-color: rgba(255, 193, 7, 0.3);
}

.status-badge.sold {
  background: rgba(0, 188, 212, 0.15);
  color: #00BCD4;
  border-color: rgba(0, 188, 212, 0.3);
}

.status-badge.withdrawn {
  background: rgba(117, 117, 117, 0.15);
  color: #757575;
  border-color: rgba(117, 117, 117, 0.3);
}

.status-badge.expired {
  background: rgba(0, 0, 0, 0.15);
  color: #000000;
  border-color: rgba(0, 0, 0, 0.3);
}

/* Status Change Controls */
.status-controls {
  display: flex;
  gap: 8px;
  margin: 12px 16px 16px 16px;
  padding: 12px;
  background: rgba(20, 60, 90, 0.3);
  border-radius: 6px;
  flex-wrap: wrap;
}

.status-change-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, rgba(109, 159, 194, 0.35) 0%, rgba(109, 159, 194, 0.25) 100%);
  border: 2px solid rgba(109, 159, 194, 0.5);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status-change-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(109, 159, 194, 0.5) 0%, rgba(109, 159, 194, 0.4) 100%);
  border-color: #6D9FC2;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(109, 159, 194, 0.3);
}

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

.status-change-btn.primary {
  background: linear-gradient(135deg, rgba(80, 227, 194, 0.4) 0%, rgba(80, 227, 194, 0.3) 100%);
  border: 2px solid rgba(80, 227, 194, 0.6);
  color: #fff;
}

.status-change-btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(80, 227, 194, 0.6) 0%, rgba(80, 227, 194, 0.5) 100%);
  border-color: #50e3c2;
  box-shadow: 0 4px 10px rgba(80, 227, 194, 0.3);
}

.status-change-btn.danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.4) 0%, rgba(239, 68, 68, 0.3) 100%);
  border: 2px solid rgba(239, 68, 68, 0.6);
  color: #fff;
}

.status-change-btn.danger:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.6) 0%, rgba(239, 68, 68, 0.5) 100%);
  border-color: #ef4444;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

.filter-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #6D9FC2;
  margin-bottom: 10px;
}

.price-range-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-input {
  flex: 1;
  padding: 8px 10px;
  background: rgba(10, 37, 64, 0.6);
  border: 1px solid rgba(109, 159, 194, 0.3);
  border-radius: 4px;
  color: #fff;
  font-size: 12px;
}

.filter-input:focus {
  outline: none;
  border-color: #50e3c2;
  box-shadow: 0 0 0 2px rgba(80, 227, 194, 0.1);
}

/* Filter select styling */
.filters-panel select {
  background: rgba(10, 37, 64, 0.6);
  border: 1px solid rgba(109, 159, 194, 0.3);
  border-radius: 4px;
  color: #fff;
  font-size: 12px;
  padding: 8px 10px;
}

.filters-panel select:focus {
  outline: none;
  border-color: #50e3c2;
  box-shadow: 0 0 0 2px rgba(80, 227, 194, 0.1);
}

.filters-panel select option {
  background: #1a2332;
  color: #fff;
  padding: 8px;
}

.filters-panel select option:hover,
.filters-panel select option:checked {
  background: rgba(80, 227, 194, 0.2);
  color: #50e3c2;
}

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

.filter-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(10, 37, 64, 0.4);
  border: 1px solid rgba(109, 159, 194, 0.2);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
  color: #bbb;
}

.filter-checkbox-label:hover {
  background: rgba(109, 159, 194, 0.1);
  border-color: rgba(109, 159, 194, 0.4);
}

.filter-checkbox-label input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #50e3c2;
}

.filter-checkbox-text {
  flex: 1;
}

.filter-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.btn-filter-apply,
.btn-filter-reset {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-filter-apply {
  background: linear-gradient(135deg, #50e3c2, #42b8a4);
  color: #0a2540;
}

.btn-filter-apply:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(80, 227, 194, 0.3);
}

.btn-filter-reset {
  background: rgba(109, 159, 194, 0.2);
  border: 1px solid rgba(109, 159, 194, 0.3);
  color: #6D9FC2;
}

.btn-filter-reset:hover {
  background: rgba(109, 159, 194, 0.3);
  border-color: #6D9FC2;
}

/* Floating Action Button (FAB) */
.marketplace-fab {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF6B35, #E5521A);
  color: #fff;
  font-size: 28px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
  z-index: 9999;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.marketplace-fab:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 8px 30px rgba(255, 107, 53, 0.6);
}

.marketplace-fab:active {
  transform: scale(0.95) rotate(90deg);
}

/* Hide FAB when marketplace panel is open */
.marketplace-panel.open ~ .marketplace-fab {
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

/* Load More Button */
.load-more-btn {
  width: calc(100% - 32px);
  margin: 16px 16px 0 16px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(109, 159, 194, 0.2), rgba(80, 227, 194, 0.15));
  border: 1px solid rgba(109, 159, 194, 0.3);
  border-radius: 8px;
  color: #6D9FC2;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.load-more-btn:hover {
  background: linear-gradient(135deg, rgba(109, 159, 194, 0.3), rgba(80, 227, 194, 0.25));
  border-color: #50e3c2;
  color: #50e3c2;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(80, 227, 194, 0.15);
}

.load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Loading Skeleton Screens */
.listing-card-skeleton {
  background: linear-gradient(90deg, rgba(20,60,90,0.3) 25%, rgba(109,159,194,0.1) 50%, rgba(20,60,90,0.3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border: 1px solid rgba(109, 159, 194, 0.2);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 16px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-thumbnail {
  width: 100%;
  height: 120px;
  background: rgba(109, 159, 194, 0.15);
  border-radius: 6px;
  margin-bottom: 12px;
}

.skeleton-line {
  height: 14px;
  background: rgba(109, 159, 194, 0.15);
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-line-short {
  width: 60%;
}

/* Enhanced Empty States */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state-icon {
  font-size: 72px;
  margin-bottom: 20px;
  opacity: 0.6;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.empty-state-text {
  font-size: 18px;
  font-weight: 600;
  color: #6D9FC2;
  margin-bottom: 12px;
}

.empty-state-subtext {
  font-size: 14px;
  color: #999;
  margin-bottom: 24px;
}

.empty-state-cta {
  display: inline-block;
  padding: 12px 24px;
  background: linear-gradient(135deg, #50e3c2, #42b8a4);
  color: #0a2540;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.empty-state-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(80, 227, 194, 0.3);
}

/* Enhanced Badge System with Icons & Animations */
.badge-new {
  background: linear-gradient(135deg, #FF6B35, #E5521A);
  color: #fff;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.7);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(255, 107, 53, 0);
  }
}

.badge-hot {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  animation: wiggle 1s ease-in-out infinite;
}

@keyframes wiggle {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-3deg);
  }
  75% {
    transform: rotate(3deg);
  }
}

.badge-verified {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: 1px solid rgba(16, 185, 129, 0.5);
  cursor: help;
  position: relative;
}

.badge-verified:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.badge-abn-verified {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border: 1px solid rgba(59, 130, 246, 0.5);
  cursor: help;
  position: relative;
}

.badge-abn-verified:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.badge-verified-owner {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: 1px solid rgba(16, 185, 129, 0.5);
  cursor: help;
  position: relative;
}

.badge-verified-owner:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.badge-sale-pending {
  background: rgba(255, 193, 7, 0.2);
  color: #FFC107;
  border: 1px solid rgba(255, 193, 7, 0.3);
}

.badge-sold {
  background: rgba(0, 188, 212, 0.2);
  color: #00BCD4;
  border: 1px solid rgba(0, 188, 212, 0.3);
}

.badge-withdrawn {
  background: rgba(117, 117, 117, 0.2);
  color: #757575;
  border: 1px solid rgba(117, 117, 117, 0.3);
}

/* Quick Action Buttons */
.listing-quick-actions {
  display: flex;
  gap: 0;
  margin-top: 10px;
}

.quick-action-btn {
  flex: 1;
  padding: 6px 10px;
  background: rgba(20, 60, 90, 0.5);
  border: 1px solid rgba(109, 159, 194, 0.2);
  border-radius: 0;
  border-right: none;
  color: #6D9FC2;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0.8;
}

.quick-action-btn:last-child {
  border-right: 1px solid rgba(109, 159, 194, 0.2);
}

.quick-action-btn:hover {
  background: rgba(109, 159, 194, 0.2);
  border-color: #6D9FC2;
  border-right: 1px solid #6D9FC2;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  opacity: 1;
  z-index: 1;
}

.quick-action-btn.favorited {
  background: rgba(255, 193, 7, 0.2);
  border-color: rgba(255, 193, 7, 0.4);
  color: #ffc107;
}

.quick-action-btn.favorited:hover {
  background: rgba(255, 193, 7, 0.3);
}

/* Ripple Effect for Buttons */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
  width: 200px;
  height: 200px;
}

/* Image Lightbox */
.image-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  cursor: zoom-in;
  transition: transform 0.3s ease;
}

.lightbox-content img.zoomed {
  cursor: zoom-out;
  transform: scale(1.5);
}

.lightbox-caption {
  margin-top: 20px;
  color: #fff;
  font-size: 16px;
  text-align: center;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 32px;
  padding: 12px 20px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  z-index: 100001;
}

.lightbox-close {
  top: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  font-size: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-prev {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-close:hover {
  transform: scale(1.1);
}

/* Listing Card Animations - Stagger Effect */
.listing-card {
  animation: slideInUp 0.4s ease-out backwards;
}

.listing-card:nth-child(1) { animation-delay: 0.05s; }
.listing-card:nth-child(2) { animation-delay: 0.1s; }
.listing-card:nth-child(3) { animation-delay: 0.15s; }
.listing-card:nth-child(4) { animation-delay: 0.2s; }
.listing-card:nth-child(5) { animation-delay: 0.25s; }

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

/* Count-Up Animation for Stats */
.stat-number {
  display: inline-block;
  transition: all 0.3s ease;
}

.stat-number.counting {
  color: #50e3c2;
  transform: scale(1.2);
}

/* Better Visual Hierarchy - Increased Spacing */
.listing-card-clickable {
  padding: 16px;
}

.listing-card-header {
  margin-bottom: 14px;
}

.listing-badges {
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.listing-description {
  margin-bottom: 14px;
}

.listing-stats {
  gap: 18px;
}

/* Subtle Dividers */
.listing-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(109, 159, 194, 0.2), transparent);
  margin: 14px 0;
}

/* Listing Detail Sections with Background Cards */
.listing-detail-section {
  background: rgba(20, 60, 90, 0.3);
  padding: 18px;
  border-radius: 8px;
  margin-bottom: 18px;
  border: 1px solid rgba(109, 159, 194, 0.1);
}

.listing-detail-section h3 {
  color: #6D9FC2;
  font-size: 15px;
  margin-bottom: 14px;
  font-weight: 600;
}

/* Price More Prominent */
.listing-price {
  font-size: 18px !important;
  font-weight: 700 !important;
}

.listing-detail-price {
  font-size: 28px !important;
  font-weight: 700 !important;
  color: #50e3c2 !important;
  text-shadow: 0 0 15px rgba(80, 227, 194, 0.4);
  margin-bottom: 20px;
}

/* Loading Spinner */
.loading-spinner {
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #2563eb;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

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

.empty-state-text {
  font-size: 16px;
  margin-bottom: 8px;
}

.empty-state-subtext {
  font-size: 14px;
  color: #666;
}

/* ============================================
   Clerk Embedded Authentication Modal Styles
   ============================================ */

#clerk-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

#clerk-modal-container {
  position: relative;
  background: white;
  border-radius: 12px;
  padding: 0;
  max-width: 480px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

#clerk-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.05);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #666;
  z-index: 10;
  transition: all 0.2s;
}

#clerk-modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #000;
  transform: scale(1.1);
}

#clerk-signin-container,
#clerk-signup-container {
  min-height: 400px;
}

/* Hide the container that's not being shown */
#clerk-modal-overlay.show-signin #clerk-signup-container {
  display: none;
}

#clerk-modal-overlay.show-signup #clerk-signin-container {
  display: none;
}

/* ========================================
   Floating In-Map Results Popup
   ======================================== */

/* Main popup container */
.in-map-popup {
  position: fixed;
  left: 10px;
  bottom: 40px;
  width: 320px;
  max-height: calc(100vh - 50vh - 120px); /* Leave space for toggle button and top toolbar */
  background: linear-gradient(135deg, rgba(10,37,64,0.98), rgba(5,25,45,0.98));
  backdrop-filter: blur(12px);
  border: 1px solid rgba(80,227,194,0.3);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  color: #fff;
  z-index: 9999; /* Above everything when open */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideInFromBottom 0.3s ease;
}

@keyframes slideInFromBottom {
  from {
    transform: translateY(calc(100% + 60px));
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Popup header */
.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.popup-title {
  font-weight: 600;
  font-size: 14px;
  color: rgba(80,227,194,0.95);
  display: flex;
  align-items: center;
  gap: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-count-badge {
  background: rgba(80,227,194,0.2);
  color: rgba(80,227,194,1);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0px;
  text-transform: none;
}

.popup-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.popup-nav-btn {
  padding: 5px 11px;
  font-size: 12px;
  background: rgba(80,227,194,0.15);
  border: 1px solid rgba(80,227,194,0.3);
  border-radius: 6px;
  color: rgba(80,227,194,0.85);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}

.popup-nav-btn:hover {
  background: rgba(80,227,194,0.28);
  color: #50e3c2;
  border-color: rgba(80,227,194,0.5);
  transform: scale(1.05);
}

.popup-close-btn {
  padding: 4px 11px;
  font-size: 20px;
  background: rgba(220,53,69,0.2);
  border: 1px solid rgba(220,53,69,0.35);
  border-radius: 6px;
  color: rgba(220,53,69,0.9);
  cursor: pointer;
  line-height: 1;
  transition: all 0.2s ease;
  font-weight: 600;
}

.popup-close-btn:hover {
  background: rgba(220,53,69,0.35);
  color: #dc3545;
  border-color: rgba(220,53,69,0.6);
  transform: scale(1.05);
}

/* Popup body */
.popup-body {
  padding: 16px 18px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  font-size: 13px;
  line-height: 1.6;
}

/* Property table styling inside popup */
.popup-body .popup {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}

.popup-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.popup-body table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  vertical-align: top;
  word-break: break-word;
}

.popup-body table tr:last-child td {
  border-bottom: none;
}

.popup-body a {
  color: #50e3c2;
  text-decoration: none;
  transition: color 0.2s ease;
}

.popup-body a:hover {
  color: #7ff3d8;
  text-decoration: underline;
}

/* Hide navigation buttons when single result */
.in-map-popup.single-result .popup-nav-btn {
  display: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .in-map-popup {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-height: calc(100vh - 80px); /* Nearly full height on mobile - just leave space for top toolbar */
  }
}

/* Landscape mobile - even taller since vertical space is limited */
@media (max-width: 1200px) and (max-height: 600px) {
  .in-map-popup {
    max-height: calc(100vh - 70px); /* Maximum height on landscape mobile */
    bottom: 5px;
  }
}

/* Scrollbar styling for popup body */
.popup-body::-webkit-scrollbar {
  width: 8px;
}

.popup-body::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
}

.popup-body::-webkit-scrollbar-thumb {
  background: rgba(80,227,194,0.3);
  border-radius: 4px;
}

.popup-body::-webkit-scrollbar-thumb:hover {
  background: rgba(80,227,194,0.5);
}
/* Compact Mining Popup Styles */
/* Compact Mining Popup Styles */
.compact-mining-popup .leaflet-popup-content-wrapper {
  min-width: 125px !important;
  max-width: 150px !important;
  padding: 0 !important;
}

.compact-mining-popup .leaflet-popup-content {
  min-width: 125px !important;
  max-width: 150px !important;
  margin: 13px 19px !important;
}

/* Auto-width popups for Major Projects and Operating Mines */
.compact-mining-popup-narrow .leaflet-popup-content-wrapper {
  min-width: 115px !important;
  max-width: 150px !important;
  padding: 0 !important;
}

.compact-mining-popup-narrow .leaflet-popup-content {
  min-width: 115px !important;
  max-width: 150px !important;
  margin: 13px 19px !important;
}

/* Tenement Hover Tooltip Styles - Subtle appearance */
.tenement-tooltip {
  background: rgba(10, 37, 64, 0.85) !important;
  border: 1px solid rgba(109, 159, 194, 0.25) !important;
  border-radius: 3px !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  padding: 6px 10px !important;
  font-size: 10px !important;
  max-width: 220px !important;
  opacity: 0.95 !important;
  transition: opacity 0.1s ease-out !important;
  pointer-events: none !important;
}

/* Hide default Leaflet tooltip arrows - not needed for sticky tooltips */
.tenement-tooltip::before,
.tenement-tooltip::after {
  display: none !important;
}

/* ============================================================================
   TOAST NOTIFICATIONS
   Modern, non-intrusive notifications for export feedback
   ============================================================================ */

#toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 10002;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: #0F1C2E;
  border-radius: 6px;
  padding: 12px 16px;
  min-width: 200px;
  max-width: 240px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(109, 159, 194, 0.2);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: auto;
  cursor: pointer;
  animation: toast-slide-in 0.3s ease-out;
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
  backdrop-filter: blur(8px);
}

.toast:hover {
  opacity: 0.95;
  transform: translateX(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(109, 159, 194, 0.3);
}

.toast.toast-hiding {
  animation: toast-slide-out 0.3s ease-out forwards;
}

/* Toast icon */
.toast-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

/* Toast content */
.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 3px;
  color: #E5F1F8;
}

.toast-message {
  font-size: 12px;
  color: #9CB4C6;
  line-height: 1.4;
  word-wrap: break-word;
}

/* Toast close button */
.toast-close {
  font-size: 18px;
  color: #6D9FC2;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
  padding: 0 3px;
  transition: color 0.2s;
}

.toast-close:hover {
  color: #50E3C2;
}

/* Toast types */
.toast.toast-success {
  border-left: 3px solid #50E3C2;
  background: #0F1C2E;
}

.toast.toast-success .toast-icon {
  color: #50E3C2;
}

.toast.toast-error {
  border-left: 3px solid #FF6B6B;
  background: #0F1C2E;
}

.toast.toast-error .toast-icon {
  color: #FF6B6B;
}

.toast.toast-warning {
  border-left: 3px solid #FFB84D;
  background: #0F1C2E;
}

.toast.toast-warning .toast-icon {
  color: #FFB84D;
}

.toast.toast-info {
  border-left: 3px solid #6D9FC2;
  background: #0F1C2E;
}

.toast.toast-info .toast-icon {
  color: #6D9FC2;
}

/* Animations */
@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-slide-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* Progress bar for auto-dismiss */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.15);
  animation: toast-progress 5s linear;
}

@keyframes toast-progress {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

/* Mobile responsiveness */
@media (max-width: 640px) {
  #toast-container {
    left: 10px;
    right: 10px;
    top: 70px;
  }

  .toast {
    min-width: 0;
    max-width: 280px;
  }
}

/* ========================================
   Datapack Autocomplete Styles
   ======================================== */

/* Autocomplete container */
#datapackTenementAutocomplete {
  background: rgba(40, 40, 40, 0.98);
  border: 1px solid rgba(80, 227, 194, 0.3);
  border-top: none;
  max-height: 250px;
  overflow-y: auto;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border-radius: 0 0 6px 6px;
  backdrop-filter: blur(8px);
}

/* Autocomplete item */
.autocomplete-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s ease, transform 0.1s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
  border-radius: 0 0 6px 6px;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background: rgba(80, 227, 194, 0.15);
}

.autocomplete-item:active {
  transform: scale(0.98);
}

/* Scrollbar styling for autocomplete */
#datapackTenementAutocomplete::-webkit-scrollbar {
  width: 8px;
}

#datapackTenementAutocomplete::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0 0 6px 0;
}

#datapackTenementAutocomplete::-webkit-scrollbar-thumb {
  background: rgba(80, 227, 194, 0.3);
  border-radius: 4px;
}

#datapackTenementAutocomplete::-webkit-scrollbar-thumb:hover {
  background: rgba(80, 227, 194, 0.5);
}

/* ===== MARKETPLACE LISTING ENHANCEMENTS ===== */
/* Note: Using marketplace- prefix to avoid conflicts with other features */

/* Size variants for marketplace badges */
.listing-badge-xs {
  padding: 2px 6px !important;
  font-size: 9px !important;
  border-radius: 6px !important;
  font-weight: 600 !important;
}

.listing-badge-large {
  padding: 4px 10px !important;
  font-size: 11px !important;
  border-radius: 6px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
}

/* Project stage badges */
.marketplace-stage-badge {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
}

/* Resource compliance badges */
.marketplace-compliance-badge {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
}

/* Transaction type badges */
.marketplace-transaction-badge {
  display: inline-block;
  background: rgba(80, 227, 194, 0.15);
  color: #50e3c2;
  border: 1px solid rgba(80, 227, 194, 0.3);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

/* Browse Marketplace button hover (when NOT active) */
.btn-browse-marketplace:not(.marketplace-active):hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(80,227,194,0.6) !important;
}

/* Browse Marketplace button active state */
#btnOpenMarketplace.marketplace-active {
  background: linear-gradient(135deg, #3ba892 0%, #2d8a75 100%) !important;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.3), 0 2px 8px rgba(80,227,194,0.4) !important;
  transform: translateY(1px) !important;
  border-color: rgba(255,255,255,0.1) !important;
  pointer-events: auto !important; /* Ensure button remains clickable */
}

#btnOpenMarketplace.marketplace-active:hover {
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.3), 0 4px 12px rgba(80,227,194,0.5) !important;
  transform: translateY(1px) !important; /* Keep pressed look on hover */
  pointer-events: auto !important; /* Ensure button remains clickable */
}

/* Marketplace loading spinner */
.marketplace-loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  min-height: 300px;
}

.marketplace-loading-spinner p {
  margin-top: 20px;
  color: #6D9FC2;
  font-size: 14px;
  font-weight: 500;
}

.spinner-ring {
  width: 80px;
  height: 80px;
  border: 8px solid rgba(80, 227, 194, 0.1);
  border-top-color: #50e3c2;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ============================================
   TUTORIAL SYSTEM STYLES
   ============================================ */

/* Tutorial Gallery Modal */
.tutorial-modal-content {
  max-width: 1200px;
  width: 95%;
  height: 90vh;
  max-height: 900px;
  background: linear-gradient(135deg, rgba(10, 14, 39, 0.98) 0%, rgba(15, 20, 50, 0.98) 100%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(80, 227, 194, 0.1);
  overflow: visible !important;
}

/* Enhanced Modal Header */
.tutorial-modal-header {
  background: linear-gradient(135deg, rgba(109, 159, 194, 0.15) 0%, rgba(74, 127, 168, 0.15) 100%);
  border-bottom: 2px solid rgba(80, 227, 194, 0.2);
  padding: 6px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tutorial-modal-header h2 {
  background: linear-gradient(135deg, #50e3c2 0%, #6D9FC2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 10px rgba(80, 227, 194, 0.3);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  margin: 0;
}

.tutorial-modal-header .close {
  font-size: 48px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
  line-height: 0.8;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.tutorial-modal-header .close:hover {
  color: #50e3c2;
  background: rgba(80, 227, 194, 0.1);
  border-color: rgba(80, 227, 194, 0.3);
  transform: rotate(90deg);
  box-shadow: 0 4px 12px rgba(80, 227, 194, 0.3);
}

.tutorial-container {
  display: flex;
  gap: 24px;
  height: calc(100% - 132px); /* Account for header with 120px logo */
  overflow: hidden;
  padding: 20px 24px;
  isolation: isolate; /* Create new stacking context */
}

/* Tutorial Sidebar */
.tutorial-sidebar {
  width: 260px;
  background: linear-gradient(180deg, rgba(10, 14, 39, 0.6) 0%, rgba(10, 14, 39, 0.3) 100%);
  border: 1px solid rgba(80, 227, 194, 0.1);
  border-radius: 12px;
  padding: 20px;
  overflow-y: auto;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  /* No position or z-index - keep it in normal flow */
}

.tutorial-sidebar h3 {
  color: #50e3c2;
  font-size: 15px;
  margin: 0 0 16px 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(80, 227, 194, 0.2);
  text-shadow: 0 2px 8px rgba(80, 227, 194, 0.3);
}

/* Category Buttons */
.tutorial-category-btn {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tutorial-category-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, #50e3c2 0%, #6D9FC2 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tutorial-category-btn:hover {
  background: linear-gradient(135deg, rgba(80, 227, 194, 0.1) 0%, rgba(109, 159, 194, 0.08) 100%);
  border-color: rgba(80, 227, 194, 0.3);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(80, 227, 194, 0.2), 0 0 20px rgba(80, 227, 194, 0.1);
}

.tutorial-category-btn:hover::before {
  opacity: 1;
}

.tutorial-category-btn.active {
  background: linear-gradient(135deg, rgba(80, 227, 194, 0.2) 0%, rgba(58, 157, 136, 0.15) 100%);
  border-color: #50e3c2;
  box-shadow: 0 4px 16px rgba(80, 227, 194, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.tutorial-category-btn.active::before {
  opacity: 1;
}

.category-icon {
  font-size: 20px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.category-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-count {
  font-size: 10px;
  color: #50e3c2;
  font-weight: 600;
  opacity: 0.8;
  flex-shrink: 0;
}

/* Tutorial Content Area */
.tutorial-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: visible;
  padding-right: 12px;
  /* No position or z-index - keep in normal flow so cards can escape on hover */
}

.tutorial-content h3 {
  background: linear-gradient(135deg, #50e3c2 0%, #6D9FC2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 22px;
  margin: 0 0 24px 0;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 10px rgba(80, 227, 194, 0.2);
}

/* Video Grid */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  overflow: visible;
}

/* Video Card */
.video-card {
  background: linear-gradient(135deg, rgba(10, 14, 39, 0.6) 0%, rgba(15, 20, 50, 0.4) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
}

.video-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(80, 227, 194, 0);
  transition: box-shadow 0.3s ease;
  pointer-events: none;
}

.video-card:hover {
  border-color: rgba(80, 227, 194, 0.5);
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 12px 32px rgba(80, 227, 194, 0.3), 0 0 0 1px rgba(80, 227, 194, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 999; /* Very high to appear above sidebar */
}

.video-card:hover::after {
  box-shadow: inset 0 0 0 2px rgba(80, 227, 194, 0.3);
}

/* Video Thumbnail */
.video-thumbnail {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 aspect ratio */
  background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
  overflow: hidden;
}

.video-thumbnail::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.4) 100%);
  z-index: 1;
  pointer-events: none;
}

.video-thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.video-card:hover .video-thumbnail img {
  transform: scale(1.05);
}

.video-duration {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.8) 100%);
  color: #50e3c2;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  z-index: 2;
  border: 1px solid rgba(80, 227, 194, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.5px;
}

/* Category Badge (for All Videos view) */
.video-category-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  letter-spacing: 0.3px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9),
               0 2px 6px rgba(0, 0, 0, 0.7),
               0 0 1px rgba(0, 0, 0, 1);
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.1) 100%);
}

.play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, #50e3c2 0%, #3ab899 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #0a0e27;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 8px 24px rgba(80, 227, 194, 0.5), 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.video-card:hover .play-overlay {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

/* Video Info */
.video-info {
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(10, 14, 39, 0.4) 0%, rgba(10, 14, 39, 0.2) 100%);
}

.video-info h4 {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 8px 0;
  line-height: 1.4;
  letter-spacing: 0.2px;
}

.video-info p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  margin: 0;
  line-height: 1.5;
}

/* Video Player Modal */
.tutorial-player-modal {
  max-width: 1100px;
  width: 90%;
  max-height: 90vh;
  background: linear-gradient(135deg, rgba(10, 14, 39, 0.98) 0%, rgba(15, 20, 50, 0.98) 100%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(80, 227, 194, 0.1);
}

.tutorial-player-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
}

/* Video Wrapper (maintains aspect ratio) */
.video-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 aspect ratio */
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(80, 227, 194, 0.1);
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-description {
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(80, 227, 194, 0.05) 0%, rgba(109, 159, 194, 0.05) 100%);
  border: 1px solid rgba(80, 227, 194, 0.15);
  border-radius: 8px;
}

.video-description p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  line-height: 1.7;
  margin: 0;
  font-weight: 400;
}

/* Tutorial Quick Links (in dropdown) */
.tutorial-quick-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.tutorial-quick-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, #50e3c2 0%, #6D9FC2 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tutorial-quick-link:hover {
  background: linear-gradient(135deg, rgba(80, 227, 194, 0.1) 0%, rgba(109, 159, 194, 0.08) 100%);
  border-color: rgba(80, 227, 194, 0.3);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(80, 227, 194, 0.15);
}

.tutorial-quick-link:hover::before {
  opacity: 1;
}

/* Contextual Help Icons (Phase 2) */
.contextual-help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #6D9FC2 0%, #4A7FA8 100%);
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: bold;
  margin-left: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  vertical-align: middle;
}

.contextual-help-icon:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 8px rgba(109, 159, 194, 0.4);
}

/* Scrollbar Styling for Tutorial Modals */
.tutorial-sidebar::-webkit-scrollbar,
.tutorial-content::-webkit-scrollbar {
  width: 6px;
}

.tutorial-sidebar::-webkit-scrollbar-track,
.tutorial-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 3px;
}

.tutorial-sidebar::-webkit-scrollbar-thumb,
.tutorial-content::-webkit-scrollbar-thumb {
  background: rgba(80, 227, 194, 0.3);
  border-radius: 3px;
}

.tutorial-sidebar::-webkit-scrollbar-thumb:hover,
.tutorial-content::-webkit-scrollbar-thumb:hover {
  background: rgba(80, 227, 194, 0.5);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .tutorial-container {
    flex-direction: column;
  }

  .tutorial-sidebar {
    width: 100%;
    max-height: 200px;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .tutorial-player-modal {
    width: 95%;
  }
}

/* ====================================
   SITE BANNERS
   ==================================== */

#site-banners-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10004; /* Above toolbar (10003) and everything else */
  height: 0; /* Will be set by JS based on banner height */
  overflow: visible; /* Allow banners to show */
  pointer-events: none; /* Allow clicks to pass through container */
}

/* When container has banners, it gets a minimum height */
#site-banners-container:not(:empty) {
  height: auto;
  min-height: 48px; /* Approximate minimum banner height */
}

.site-banner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2),
              0 1px 3px rgba(0, 0, 0, 0.1),
              inset 0 1px 0 rgba(255, 255, 255, 0.2); /* Multi-layer shadow + inset highlight */
  transition: all 0.3s ease;
  pointer-events: auto; /* Re-enable clicks on banner itself */
  z-index: 1; /* Stack banners on top of each other */
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: visible; /* Don't clip dismiss button */
}

/* Subtle pattern overlay for depth */
.site-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 10px,
      rgba(255, 255, 255, 0.03) 10px,
      rgba(255, 255, 255, 0.03) 20px
    );
  pointer-events: none;
  z-index: 1;
}

/* Only show the first (topmost) banner */
.site-banner:not(:first-child) {
  display: none;
}

.site-banner-content {
  max-width: 1200px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 2; /* Ensure content is above the pattern overlay */
  padding-right: 60px; /* Space for absolutely positioned dismiss button */
}

.site-banner-icon {
  font-size: 20px;
  flex-shrink: 0;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

.site-banner-text {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.site-banner-title {
  font-weight: 600;
  margin-right: 4px;
}

.site-banner-message {
  flex: 1;
}

.site-banner-link {
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s ease;
  padding: 4px 10px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.site-banner-link:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.site-banner-dismiss {
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  color: inherit;
  opacity: 0.85;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-weight: 700;
  z-index: 3;
}

.site-banner-dismiss:hover {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.site-banner-dismiss:active {
  transform: translateY(-50%) scale(0.95);
}

/* Banner Types - Brand Colors */

.site-banner-info {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); /* Blue gradient */
  color: white;
}

.site-banner-info .site-banner-link {
  color: #dbeafe;
}

.site-banner-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); /* Orange/amber gradient */
  color: white;
}

.site-banner-warning .site-banner-link {
  color: #fef3c7;
}

.site-banner-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%); /* Green gradient */
  color: white;
}

.site-banner-success .site-banner-link {
  color: #d1fae5;
}

.site-banner-announcement {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); /* Bright orange gradient */
  color: white;
}

.site-banner-announcement .site-banner-link {
  color: #fed7aa;
}

/* Adjust toolbar position when banners are present */
body:has(.site-banner) .toolbar {
  top: 0; /* Will be adjusted via JS based on banner height */
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .site-banner {
    padding: 10px 12px;
    font-size: 13px;
  }

  .site-banner-content {
    gap: 8px;
    padding-right: 55px;
  }

  .site-banner-icon {
    font-size: 16px;
    margin-top: 2px; /* Align with text baseline */
  }

  .site-banner-text {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0; /* Allow text to shrink */
  }

  .site-banner-title {
    margin-right: 0;
    font-size: 13px;
  }

  .site-banner-message {
    font-size: 12px;
    line-height: 1.4;
  }

  .site-banner-link {
    align-self: flex-start;
    font-size: 12px;
    padding: 3px 8px;
  }

  .site-banner-dismiss {
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    padding: 4px 8px;
    font-size: 18px;
  }

  .site-banner-dismiss:hover {
    transform: translateY(-50%) scale(1.05);
  }

  .site-banner-dismiss:active {
    transform: translateY(-50%) scale(0.95);
  }
}

/* Extra small devices and landscape phones */
@media (max-width: 480px) {
  .site-banner {
    padding: 8px 10px;
    font-size: 12px;
  }

  .site-banner-content {
    gap: 6px;
    padding-right: 50px;
  }

  .site-banner-icon {
    font-size: 14px;
    display: none; /* Hide icon on very small screens to save space */
  }

  .site-banner-text {
    gap: 3px;
  }

  .site-banner-title {
    font-size: 12px;
    font-weight: 600;
  }

  .site-banner-message {
    font-size: 11px;
    line-height: 1.3;
  }

  .site-banner-link {
    font-size: 11px;
    padding: 2px 6px;
  }

  .site-banner-dismiss {
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    padding: 3px 6px;
    font-size: 16px;
  }

  .site-banner-dismiss:hover {
    transform: translateY(-50%) scale(1.05);
  }

  .site-banner-dismiss:active {
    transform: translateY(-50%) scale(0.95);
  }
}
