/* Modern Atlas Styles - Main Site Design */

#atlas-view .content-section {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  min-height: 600px;
  max-width: 100%;
  padding: var(--spacing-md);
}

.atlas-wrapper {
  display: flex;
  flex-direction: row;
  gap: var(--spacing-md);
  flex: 1;
  min-height: 0;
  width: 100%;
}

.atlas-sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--spacing-sm);
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  flex-shrink: 0;
  order: -1; /* Place sidebar on the left */
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.atlas-sidebar-header {
  flex-shrink: 0;
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border);
}

.atlas-sidebar-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent, #ff6b35);
  color: var(--text-primary);
}

.location-counter {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.location-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  order: 2; /* Ensure categories appear after filters */
}

.location-list-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 6px var(--spacing-xs);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.location-list-item:hover {
  background: var(--bg-secondary);
  border-color: var(--accent);
  transform: translateX(4px);
}

.location-list-item.active {
  background: var(--bg-secondary);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}

.location-list-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  object-fit: contain;
}

.location-list-content {
  flex: 1;
  min-width: 0;
}

.location-list-content h4 {
  font-size: 0.8rem;
  font-weight: 500;
  margin: 0;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.location-list-content p {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Category sections in sidebar */
.location-category {
  margin-bottom: var(--spacing-md);
  flex-shrink: 0;
}

.location-category-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  padding-bottom: calc(var(--spacing-xs) + 3px);
  background: var(--bg-tertiary);
  border-radius: 4px 4px 0 0;
  border-bottom: 3px solid var(--accent, #ff6b35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s, border-bottom-color 0.2s;
}

.location-category-header:hover {
  background: var(--bg-secondary);
  border-bottom-color: var(--accent-hover, #ff8c5a);
}

.location-category-toggle-icon {
  font-size: 0.7rem;
  margin-right: 6px;
  transition: transform 0.2s;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 12px;
  display: inline-block;
}

.location-category-label {
  flex: 1;
}

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

.location-category-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.location-category-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  padding-left: var(--spacing-xs);
  margin-top: var(--spacing-xs);
  transition: opacity 0.2s;
}

.location-category.collapsed .location-category-list {
  display: none;
}

.atlas-filters {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  flex-shrink: 0;
  padding: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  order: 1; /* Ensure filters appear after header but before categories */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.filter-btn {
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  flex-shrink: 0;
  white-space: nowrap;
  box-sizing: border-box;
}

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

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* MapLibre controls - cleaner styling */
.maplibregl-ctrl-group {
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  background: var(--bg-secondary);
  overflow: hidden;
}

.maplibregl-ctrl-group button {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: none;
  border-bottom: 1px solid var(--border);
  transition: all 0.2s ease;
  width: 32px;
  height: 32px;
}

.maplibregl-ctrl-group button:hover {
  background: var(--bg-tertiary);
  color: var(--accent);
}

.maplibregl-ctrl-group button:last-child {
  border-bottom: none;
}

.maplibregl-ctrl-scale {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  color: var(--text-secondary);
  font-size: 11px;
}

/* Map container updates - cleaner rendering */
#atlas-view .map-container {
  flex: 1;
  min-height: 600px;
  height: calc(100vh - 200px);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  min-width: 0; /* Allow flex shrinking */
}

/* MapLibre container improvements */
.maplibregl-map {
  background: #2d5016;
  font-family: 'Inter', system-ui, sans-serif;
  font-smooth: always;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* MapLibre popup styling for main site - cleaner graphics */
.maplibregl-popup-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, sans-serif;
  margin: 0;
  padding: 16px;
  line-height: 1.6;
}

.maplibregl-popup-content h3 {
  color: var(--accent);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.maplibregl-popup-content p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin: 6px 0;
  line-height: 1.5;
}

.maplibregl-popup-tip {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.maplibregl-popup-close-button {
  color: var(--text-secondary);
  font-size: 22px;
  padding: 6px;
  transition: color 0.2s ease;
  width: 28px;
  height: 28px;
  line-height: 28px;
  background: transparent;
}

.maplibregl-popup-close-button:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

/* POI icon styling - cleaner graphics */
.atlas-poi-icon {
  background: transparent !important;
  border: none !important;
}

.atlas-marker-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.2s ease;
}

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

.atlas-marker-icon {
  position: relative;
  display: inline-block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
  transition: filter 0.2s ease;
}

.atlas-marker-icon:hover {
  filter: drop-shadow(0 3px 8px rgba(255, 107, 53, 0.4)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}

.atlas-icon-image {
  width: 36px;
  height: 36px;
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  transition: transform 0.2s ease;
}

.atlas-marker-wrapper:hover .atlas-icon-image {
  transform: scale(1.05);
}

.atlas-marker-label {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  text-align: center;
  pointer-events: none;
  color: #ffffff;
  margin-top: 4px;
  text-shadow: none;
  font-family: 'Inter', system-ui, sans-serif;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.atlas-marker-wrapper:hover .atlas-marker-label {
  background: rgba(0, 0, 0, 0.95);
  border-color: rgba(255, 107, 53, 0.3);
}

.atlas-detail-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  margin-top: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(21, 30, 36, 0.9);
  color: #ffffff;
  font-size: 12px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.atlas-detail-link:hover {
  border-color: #ff6b35;
  color: #ff6b35;
}

.location-list-item .atlas-detail-link {
  margin-left: auto;
  margin-top: 0;
  font-size: 11px;
  padding: 4px 10px;
}


/* Notifications */
.atlas-notification {
  position: fixed;
  top: 80px;
  right: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
  font-size: 0.875rem;
  z-index: 10000;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.3s, transform 0.3s;
  max-width: 300px;
}

.atlas-notification.show {
  opacity: 1;
  transform: translateX(0);
}

.atlas-notification-success {
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.1);
}

.atlas-notification-error {
  border-color: #f44336;
  background: rgba(244, 67, 54, 0.1);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .atlas-wrapper {
    flex-direction: column;
  }

  .atlas-sidebar {
    width: 100%;
    max-height: 300px;
  }

  #atlas-view .map-container {
    height: 400px;
    min-height: 400px;
  }

  .atlas-filters {
    flex-direction: column;
  }

  .filter-btn {
    width: 100%;
    text-align: center;
  }
}
