/* Enhanced Data Detail Styles with Advanced Filters */

/* Filter Mode Selection Styles - Compact and Professional */
.filter-mode-section {
  margin-bottom: 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.filter-mode-section h4 {
  font-size: 9px;
  font-weight: 600;
  color: #64748b;
  margin: 0 0 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-mode-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.mode-option {
  display: flex;
  align-items: center;
  padding: 3px 6px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  font-size: 11px;
  width: fit-content;
}

.mode-option:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: #3b82f6;
}

.mode-option input[type="radio"] {
  margin-right: 5px;
  width: 12px;
  height: 12px;
  accent-color: #3b82f6;
}

.mode-option input[type="radio"]:checked + .mode-label {
  color: #1e40af;
  font-weight: 500;
}

.mode-option:has(input:checked) {
  background: rgba(59, 130, 246, 0.12);
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.15);
}

.mode-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 400;
  user-select: none;
  transition: color 0.15s ease;
}


.mode-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.mode-label i {
  font-size: 12px;
  width: 14px;
  text-align: center;
}

/* Base styles from original file */
.tab-button {
  transition: all 0.3s ease;
}

.tab-button.active {
  color: var(--primary-600);
  border-color: var(--primary-600);
}

.tab-button:hover:not(.active) {
  color: var(--primary-500);
  border-color: var(--primary-200);
}

/* Enhanced Map Control Buttons */
.map-control-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #475569;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 10; /* Modal'dan düşük z-index */
}

.map-control-btn:hover {
  background: rgba(248, 250, 252, 0.98);
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.map-control-btn.filters-btn {
  position: relative;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: #667eea;
}

.map-control-btn.filters-btn:hover {
  background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
  border-color: #5a67d8;
}

.filters-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Advanced Filters Panel - Compact Design */
.advanced-filters-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 340px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 40px);
  
  /* Clean Modern Background */
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  
  /* Subtle Border with Theme Colors */
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  z-index: 9999;
  overflow: hidden;
  
  /* Smooth Modern Animation */
  transform: translateX(calc(100% + 40px)) scale(0.9);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: right center;
}

.advanced-filters-panel.show {
  transform: translateX(0) scale(1);
  opacity: 1;
}

.advanced-filters-panel.dragging {
  transition: none;
  z-index: 10000;
  transform: scale(1.01);
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.95) inset;
}

.advanced-filters-panel.dragging .draggable-header {
  cursor: grabbing;
  background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
  color: white;
}

/* Clean Modern Header Design */
.filters-panel-header {
  background: linear-gradient(135deg, #fdf2f2 0%, #fde8e8 100%);
  border-bottom: 1px solid #fbd5d5;
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.filters-panel-header.draggable-header {
  cursor: move;
  cursor: grab;
  user-select: none;
  transition: all 0.3s ease;
}

.filters-panel-header.draggable-header:active {
  cursor: grabbing;
}

.filters-panel-header.draggable-header:hover {
  background: linear-gradient(135deg, #fde8e8 0%, #fbd5d5 100%);
  border-bottom-color: #f8b4b4;
}

.filters-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filters-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  color: #1f2937;
  font-size: 18px;
  letter-spacing: -0.025em;
  margin-bottom: 2px;
}

.filters-title i {
  color: #dc2626;
  font-size: 18px;
  opacity: 0.8;
}

.filters-actions {
  display: flex;
  gap: 8px;
}

.filter-action-btn {
  width: 24px;
  height: 24px;
  border: 1px solid #fbd5d5;
  background: linear-gradient(135deg, #fdf2f2 0%, #fde8e8 100%);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #9b1c1c;
  transition: all 0.3s ease;
  
  /* Clean modern shadow */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.filter-action-btn:hover {
  background: linear-gradient(135deg, #fde8e8 0%, #fbd5d5 100%);
  color: #771d1d;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  border-color: #f8b4b4;
}

.filter-action-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Tab Navigation */
.filters-tab-navigation {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 12px;
  gap: 2px;
}

.filter-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-radius: 6px 6px 0 0;
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
}

.filter-tab:hover {
  background: #f9fafb;
  color: #374151;
}

.filter-tab.active {
  background: #f3f4f6;
  color: #dc2626;
  border-bottom-color: #dc2626;
}

.filter-tab i {
  font-size: 10px;
}

/* Tab Content */
.filters-tab-content {
  min-height: 200px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Compact Content Container */
.filters-panel-content {
  padding: 16px;
  overflow-y: auto;
  max-height: calc(100vh - 120px);
  
  /* Custom Scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #e5e7eb transparent;
}

.filters-panel-content::-webkit-scrollbar {
  width: 6px;
}

.filters-panel-content::-webkit-scrollbar-track {
  background: #f9fafb;
  border-radius: 3px;
}

.filters-panel-content::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
  transition: background 0.3s ease;
}

.filters-panel-content::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Compact Section Cards */
.filter-section {
  background: white;
  border: 1px solid #f3f4f6;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  transition: all 0.3s ease;
  
  /* Clean modern shadow */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.filter-section:hover {
  border-color: #fbd5d5;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.filter-section:last-child {
  margin-bottom: 0;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 600;
  color: #374151;
  font-size: 13px;
  letter-spacing: -0.015em;
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 6px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.section-header:hover {
  color: #dc2626;
}

/* Enhanced styling for Active Filters section header */
.active-filters-section .section-header {
  background: transparent;
  color: #374151;
  margin: -20px -20px 16px -20px; /* Extend to container edges */
  padding: 12px 20px 8px 20px;
  border-radius: 12px 12px 0 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.025em;
  box-shadow: none;
}

.active-filters-section .section-header:hover {
  color: #1f2937;
  background: rgba(249, 250, 251, 0.5);
}

.active-filters-section .section-header i {
  color: #6b7280;
}

.section-header.collapsed {
  margin-bottom: 8px;
}

.section-header .collapse-icon {
  margin-left: auto;
  font-size: 10px;
  color: #9ca3af;
  transition: transform 0.2s ease;
}

.section-header.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.section-content {
  transition: all 0.2s ease;
  overflow: hidden;
}

.section-content.collapsed {
  height: 0;
  opacity: 0;
  margin: 0;
  padding: 0;
}

.section-header i {
  font-size: 12px;
  opacity: 0.7;
}

/* Modern Clear All Button - Smaller and Compact */
.clear-all-btn {
  margin-left: auto;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  border: 1px solid #b91c1c;
  padding: 4px 8px; /* Reduced from 8px 16px */
  border-radius: 4px; /* Reduced from 6px */
  font-size: 10px; /* Reduced from 12px */
  font-weight: 500; /* Reduced from 600 */
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 4px; /* Reduced from 6px */
  
  /* Smaller shadow */
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.2);
}

.clear-all-btn:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3); /* Reduced shadow */
}

.clear-all-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.2); /* Reduced shadow */
}

/* Modern Active Filters - Modal Theme Consistent */
.active-filters-section {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  backdrop-filter: blur(10px);
}

.active-filters-list {
  display: flex;
  flex-direction: column;
  gap: 10px; /* Increased gap to prevent overlap */
  margin-top: 8px; /* Add space after header */
}

.active-filter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px 16px;
  transition: all 0.3s ease;
  gap: 12px; /* Add gap between elements */
}

.active-filter-item:hover {
  border-color: #1e40af;
  box-shadow: 0 2px 8px rgba(30, 64, 175, 0.15);
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 1);
}

/* Modern Filter Color Indicator */
.filter-color-indicator {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 2px solid white;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.filter-details {
  flex: 1;
  display: flex;
  flex-direction: row; /* Changed from column to row for side-by-side layout */
  align-items: center; /* Center align items vertically */
  gap: 8px; /* Add spacing between elements */
  margin-left: 8px; /* Add space after color indicator */
  overflow: hidden; /* Prevent overflow from parent container */
  min-width: 0; /* Allow flexbox to shrink this container */
}

.filter-property {
  font-size: 12px;
  font-weight: 600;
  color: #1e40af;
  background: rgba(30, 64, 175, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}

.filter-operator {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  background: rgba(100, 116, 139, 0.1);
  padding: 2px 4px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0; /* Don't shrink operator text */
}

.filter-value {
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  background: rgba(55, 65, 81, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  max-width: 150px; /* Increased from 120px */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1; /* Allow this to shrink if needed */
}

.filter-description {
  font-size: 11px;
  color: #6b7280;
}

/* Filter Actions Container */
.filter-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.filter-toggle-btn, .filter-remove-btn {
  background: none;
  border: 1px solid transparent;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
}

.filter-toggle-btn {
  color: #64748b;
}

.filter-toggle-btn.active {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.2);
}

.filter-toggle-btn:hover {
  color: #059669;
  background: rgba(5, 150, 105, 0.1);
}

.filter-remove-btn {
  color: #ef4444;
}

.filter-remove-btn:hover {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.2);
}

/* Responsive adjustments for filter details */
@media (max-width: 768px) {
  .filter-details {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .filter-value {
    max-width: 200px;
  }
  
  .active-filter-item {
    padding: 10px 12px;
    gap: 8px;
  }
}

/* Modern Remove Filter Button */
.remove-filter-btn {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-filter-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  transform: scale(1.1);
}

.filter-property {
  font-weight: 600;
  color: #1e293b;
  font-size: 9px;
}

.filter-operator {
  font-size: 8px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-value {
  font-size: 8px;
  color: #475569;
  font-family: monospace;
  background: #f1f5f9;
  padding: 1px 2px;
  border-radius: 2px;
  display: inline-block;
}

.filter-actions {
  display: flex;
  gap: 2px;
}

.filter-toggle-btn,
.filter-remove-btn {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  transition: all 0.2s ease;
}

.filter-toggle-btn {
  background: #f1f5f9;
  color: #64748b;
}

.filter-toggle-btn.active {
  background: #22c55e;
  color: white;
}

.filter-toggle-btn:hover {
  transform: scale(1.1);
}

.filter-remove-btn {
  background: #fef2f2;
  color: #ef4444;
}

.filter-remove-btn:hover {
  background: #ef4444;
  color: white;
  transform: scale(1.1);
}

/* Filter Creation Area */
.filter-creation-area {
  background: white;
  border-radius: 4px;
  padding: 6px;
  border: 1px solid #e2e8f0;
}

.filter-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 6px;
  margin-bottom: 8px;
  max-width: 100%;
  overflow: hidden;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0; /* Allow flex shrinking */
}

.filter-field label {
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  margin-bottom: 2px;
}

.filter-select,
.filter-input {
  padding: 6px 8px;
  border: 1px solid #f8b4b4;
  border-radius: 4px;
  font-size: 12px;
  background: white;
  transition: all 0.3s ease;
  color: #771d1d;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.filter-select:focus,
.filter-input:focus {
  outline: none;
  border-color: #f87171;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.1);
  background: #fdf2f2;
}

/* Accessibility Focus States */
.filter-action-btn:focus-visible,
.add-filter-btn:focus-visible,
.clear-all-btn:focus-visible,
.geometry-filter-btn:focus-visible,
.analysis-tool-btn:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.filter-action-btn:focus,
.add-filter-btn:focus,
.clear-all-btn:focus {
  outline: none;
}

/* High Contrast Support */
@media (prefers-contrast: high) {
  .advanced-filters-panel {
    border: 2px solid #000;
    background: #fff;
  }
  
  .filter-section {
    border: 1px solid #000;
  }
  
  .section-header {
    border-bottom: 2px solid #000;
  }
}

.color-picker-container {
  position: relative;
  width: 100%; /* Match filter input width */
}

.color-picker-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px; /* Match filter input padding */
  border: 1px solid #f8b4b4; /* Match filter input border */
  border-radius: 4px; /* Match filter input border radius */
  background: white;
  cursor: pointer;
  transition: all 0.3s ease; /* Match filter input transition */
  width: 100%; /* Full width like other inputs */
  box-sizing: border-box; /* Match filter input box sizing */
  font-size: 12px; /* Match filter input font size */
}

.color-picker-trigger:hover {
  border-color: #f87171; /* Match filter input focus color */
}

.color-preview {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid white;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.add-filter-btn {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.2);
  width: 100%;
  justify-content: center;
}

.add-filter-btn:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
}

.add-filter-btn i {
  font-size: 12px;
}

/* Geometry Filters Grid */
.geometry-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
  gap: 3px;
}

.geometry-filter-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  background: linear-gradient(135deg, #fdf2f2 0%, white 100%);
  border: 1px solid #fbd5d5;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.geometry-filter-btn:hover {
  background: linear-gradient(135deg, #fde8e8 0%, #fdf2f2 100%);
  border-color: #f8b4b4;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.geometry-filter-btn.active {
  background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
  color: white;
  border-color: #dc2626;
  box-shadow: 0 1px 3px rgba(248, 113, 113, 0.3);
}

.geometry-filter-btn i {
  font-size: 12px;
  color: inherit;
}

.geometry-filter-btn span {
  font-size: 9px;
  font-weight: 500;
  text-align: center;
}

.filter-count {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  width: 12px;
  height: 12px;
  font-size: 7px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid white;
}

/* Analysis Tools Grid */
.analysis-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(55px, 1fr));
  gap: 3px;
}

.analysis-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 6px;
  background: linear-gradient(135deg, #fdf2f2 0%, white 100%);
  border: 1px solid #fbd5d5;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.analysis-tool-btn:hover {
  background: linear-gradient(135deg, #fde8e8 0%, #fdf2f2 100%);
  border-color: #f8b4b4;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.analysis-tool-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

.analysis-tool-btn.loading i {
  animation: spin 1s linear infinite;
}

.analysis-tool-btn i {
  font-size: 12px;
  color: #dc2626;
}

.analysis-tool-btn span {
  font-size: 9px;
  font-weight: 500;
  color: #9b1c1c;
}

/* Filter Results */
.filter-results-content {
  background: white;
  border-radius: 8px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  
  /* Aggressive overflow prevention */
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
  overflow-wrap: break-word !important;
  word-wrap: break-word !important;
  hyphens: auto !important;
}

.filter-results-content * {
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-wrap: break-word !important;
  word-wrap: break-word !important;
}

.results-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
}

.result-stat {
  text-align: center;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.stat-label {
  display: block;
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stat-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
}

/* Analysis Results */
.analysis-results-content {
  background: white;
  border-radius: 8px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  line-height: 1.5;
  max-width: 100%;
  overflow-x: hidden; /* Changed from auto to hidden to prevent scrolling */
  word-wrap: break-word;
  box-sizing: border-box;
}

/* Specific styling for analysis results within the advanced filters panel */
.advanced-filters-panel .analysis-results-content {
  padding: 6px !important;
  margin: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
  overflow: hidden !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  font-size: 11px !important;
  box-sizing: border-box !important;
  /* Ensure nothing can escape the container */
}

.advanced-filters-panel .analysis-results-content * {
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-wrap: break-word !important;
  word-wrap: break-word !important;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  /* Always single column in analysis results to prevent overflow */
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

/* Specific styling for stats within the advanced filters panel */
.advanced-filters-panel .analysis-results-content .stats-grid {
  grid-template-columns: 1fr !important;
  gap: 8px !important;
  max-width: 100% !important;
  width: 100% !important;
  overflow: hidden !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}

/* For wider containers outside of panels, allow multiple columns */
@media (min-width: 500px) {
  .stats-grid:not(.advanced-filters-panel .stats-grid) {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
  }
}

.stat-card {
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  min-width: 0; /* Allow flex items to shrink below content size */
  width: 100%;
  box-sizing: border-box;
  overflow: hidden; /* Prevent any content overflow */
}

/* Specific styling for stat cards within the advanced filters panel */
.advanced-filters-panel .analysis-results-content .stat-card {
  padding: 6px !important;
  margin: 0 !important;
  max-width: 228px !important;
  width: 228px !important; /* Force specific fixed width */
  min-width: 0 !important;
  overflow: hidden !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  /* Force specific width to prevent any expansion beyond panel bounds */
}

.stat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 600;
  color: #1e293b;
  font-size: 13px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* Specific styling for stat headers within the advanced filters panel */
.advanced-filters-panel .stat-header {
  font-size: 11px;
  gap: 4px;
  margin-bottom: 6px;
  max-width: 100%;
  overflow: hidden;
  flex-wrap: wrap;
}

.advanced-filters-panel .stat-header i {
  font-size: 10px;
  flex-shrink: 0;
  width: 12px;
}

.advanced-filters-panel .stat-header span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

/* Specific styling for stat content within the advanced filters panel */
.advanced-filters-panel .stat-content {
  gap: 4px;
  max-width: 100%;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  overflow-x: hidden;
  box-sizing: border-box;
  /* Ensure flex container doesn't exceed bounds */
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 4px 0;
  border-bottom: 1px solid #e2e8f0;
  position: relative;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  overflow: hidden;
  word-break: break-word;
}

/* Enhanced responsive handling for narrow containers */
.advanced-filters-panel .stat-item {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 3px 0;
}

/* Responsive stat-item for narrow containers */
@media (max-width: 300px) {
  .stat-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}

.stat-item .stat-label {
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-size: 12px;
  color: #64748b;
  max-width: 120px; /* Limit label width in narrow panels */
}

/* Enhanced label styling for panel */
.advanced-filters-panel .stat-item .stat-label {
  max-width: 100%;
  font-size: 11px;
  line-height: 1.3;
}

.stat-item .stat-value {
  flex-shrink: 0;
  font-weight: 500;
  font-size: 12px;
  color: #1e293b;
  text-align: right;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100px; /* Limit value width in narrow panels */
}

/* Enhanced value styling for panel */
.advanced-filters-panel .stat-item .stat-value {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  max-width: 100%;
}

.stat-item:last-child {
  border-bottom: none;
}

.filter-color-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 1px;
  opacity: 0.7;
}

/* Fullscreen Adjustments */
.fullscreen-container .advanced-filters-panel {
  top: 80px;
  right: 20px;
  max-height: calc(100vh - 140px);
}

.fullscreen-container .map-control-btn {
  padding: 10px 16px;
  font-size: 14px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .advanced-filters-panel {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
    max-width: calc(100% - 20px);
    max-height: calc(100% - 20px);
    border-radius: 12px;
    transform: translateY(100%) scale(0.9);
  }
  
  .advanced-filters-panel.show {
    transform: translateY(0) scale(1);
  }
  
  .filters-panel-content {
    padding: 16px;
    max-height: calc(100vh - 120px);
  }
  
  .section-header {
    font-size: 14px;
  }
  
  .filters-title {
    font-size: 16px;
  }

  .filter-row {
    grid-template-columns: 1fr;
    gap: 6px;
    grid-template-areas:
      "property"
      "operator"
      "value"
      "color"
      "actions";
  }

  .results-summary {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .geometry-filters-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .analysis-tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Even more compact for very small panels */
@media (max-width: 400px) {
  .advanced-filters-panel {
    width: 260px;
  }

  .geometry-filters-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
  }

  .analysis-tools-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
  }
}

/* Animation Keyframes */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

/* Enhanced Layer Control Panel */
.layer-control-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  z-index: 40;
  width: 200px;
  max-width: 200px;
  max-height: calc(100% - 80px);
  overflow-y: auto;
  border: 1px solid rgba(0, 0, 0, 0.1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.layer-control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(248, 250, 252, 0.8);
  border-radius: 12px 12px 0 0;
}

.layer-control-title {
  font-weight: 600;
  color: #1e293b;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.layer-control-title i {
  color: #3b82f6;
  font-size: 13px;
}

.layer-control-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
  font-size: 14px;
  padding: 3px;
  border-radius: 4px;
  transition: all 0.2s ease;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.layer-control-toggle:hover {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.layer-control-body {
  padding: 10px;
}

.layer-section {
  margin-bottom: 12px;
}

.layer-section:last-child {
  margin-bottom: 0;
}

.layer-section-title {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.layer-item {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  margin-bottom: 3px;
  border-radius: 6px;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.layer-item:hover {
  background: rgba(59, 130, 246, 0.05);
  border-color: rgba(59, 130, 246, 0.2);
}

.layer-item.active {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
}

.layer-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  margin-right: 6px;
  cursor: pointer;
}

.layer-item-label {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
}

.layer-item-icon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  margin-left: 6px;
}

.layer-item-icon.osm {
  background: #22c55e;
  color: white;
}

.layer-item-icon.satellite {
  background: #f59e0b;
  color: white;
}

.layer-item-icon.data {
  background: #ef4444;
  color: white;
}

/* Color Scheme Selector Styles */
.color-scheme-selector {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.color-scheme-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 11px;
  font-weight: 500;
  color: #334155;
}

.color-scheme-btn:hover {
  background: rgba(59, 130, 246, 0.05);
  border-color: rgba(59, 130, 246, 0.2);
}

.color-scheme-btn.active {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #1e40af;
}

.color-scheme-preview {
  display: flex;
  gap: 2px;
}

.color-scheme-preview span {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

/* Style Type Selector Styles */
.style-type-selector {
  display: flex;
  gap: 3px;
}

.style-type-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 10px;
  font-weight: 500;
  color: #334155;
}

.style-type-btn:hover {
  background: rgba(59, 130, 246, 0.05);
  border-color: rgba(59, 130, 246, 0.2);
}

.style-type-btn.active {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #1e40af;
}

.style-type-btn i {
  font-size: 12px;
}

/* Enhanced Measurement Results Overlay */
.measurement-overlay {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(30, 41, 59, 0.9) 100%);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  font-weight: 600;
  pointer-events: all;
  z-index: 1001;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  min-width: 120px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.measurement-overlay .area-display {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.measurement-overlay .area-value {
  font-size: 16px;
  font-weight: 700;
  color: #60a5fa;
  line-height: 1;
}

.measurement-overlay .area-unit {
  font-size: 11px;
  font-weight: 500;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}

.measurement-overlay .area-secondary {
  font-size: 9px;
  color: #94a3b8;
  margin-top: 2px;
  font-weight: 400;
  line-height: 1;
}

.measurement-controls {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.measurement-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.measurement-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

.measurement-btn:first-child:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.5);
}

.measurement-overlay::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(0, 0, 0, 0.9);
}

/* Fullscreen styles for entire tab container */
.fullscreen-container {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 9999 !important;
  background: white !important;
  padding: 20px !important;
}

.fullscreen-container #map {
  height: calc(100vh - 200px) !important;
}

.fullscreen-container .layer-control-panel {
  top: 20px !important;
  left: 20px !important;
}

/* OpenLayers Control Overrides */
div#map .ol-zoom,
div#map .ol-zoom .ol-zoom-in,
div#map .ol-zoom .ol-zoom-out {
  display: none !important;
  visibility: hidden !important;
}

div#map .ol-attribution,
div#map .ol-attribution button,
div#map .ol-attribution ul {
  display: none !important;
  visibility: hidden !important;
}

div#map .ol-control {
  position: absolute !important;
  z-index: 1000 !important;
  pointer-events: auto !important;
}

div#map .ol-zoom[style*="display"] {
  display: none !important;
}

div#map .ol-attribution[style*="display"] {
  display: none !important;
}

/* Table styles */
.data-table {
  border-collapse: collapse;
  width: 100%;
}

.data-table th {
  background-color: #f9fafb;
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 500;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.data-table tr:hover {
  background-color: #f9fafb;
}

#map {
  height: 500px;
  width: 100%;
  border-radius: 0.5rem;
  position: relative;
}

/* JSON tree styles */
.json-tree {
  font-family: monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  padding: 1rem;
  background-color: #f9fafb;
  border-radius: 0.5rem;
  overflow: auto;
  max-height: 500px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .filter-row {
    grid-template-columns: 1fr;
  }
}

/* Even more compact for very small panels */
@media (max-width: 400px) {
  .geometry-filters-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .analysis-tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile Download Options Styles */
@media (max-width: 768px) {
  /* Force single column layout for ALL grid containers */
  .grid.grid-cols-1.sm\\:grid-cols-2,
  .grid[class*="grid-cols"],
  div[class*="grid-cols"] {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }
  
  /* Download section improvements for mobile */
  .grid.grid-cols-1.sm\\:grid-cols-2 {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
  }
  
  /* Download button optimizations */
  .download-btn {
    min-height: 44px; /* Touch-friendly size */
    padding: 0.75rem 1rem !important;
    font-size: 0.875rem;
    justify-content: center;
    text-align: center;
  }
  
  .download-btn i {
    margin-right: 0.5rem;
    font-size: 1rem;
  }
  
  /* Mobile-specific download card layout */
  .p-4.bg-primary-50 {
    padding: 1rem !important;
  }
  
  .p-4.bg-primary-50 .flex.items-center.justify-between {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.75rem;
  }
  
  /* Original format download mobile styling */
  .col-span-2 .download-btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Format cards mobile adjustments */
  .p-4.border.border-gray-200 {
    padding: 0.875rem !important;
  }
  
  .p-4.border.border-gray-200 h3 {
    font-size: 0.9rem;
  }
  
  .p-4.border.border-gray-200 p {
    font-size: 0.8rem;
    margin-bottom: 0.75rem !important;
  }
  
  /* Force all download cards to full width */
  .border.border-gray-200.rounded-lg {
    width: 100% !important;
    grid-column: 1 / -1 !important;
  }
}

@media (max-width: 480px) {
  /* Extra small mobile adjustments */
  .download-btn {
    padding: 0.625rem 0.875rem !important;
    font-size: 0.8rem;
    min-height: 40px;
  }
  
  .download-btn .btn-text {
    font-size: 0.8rem;
  }
  
  /* Compact layout for very small screens */
  .p-4.border.border-gray-200 {
    padding: 0.75rem !important;
  }
  
  .w-8.h-8 {
    width: 1.75rem !important;
    height: 1.75rem !important;
  }
  
  .w-8.h-8 i {
    font-size: 0.75rem;
  }
}

/* Modal Filter Results - Compact Section */
.modal-filter-results {
  margin-top: 8px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 6px;
  overflow: hidden;
}

.filter-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.filter-results-header:hover {
  background: #e2e8f0;
}

.results-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.results-title i {
  font-size: 12px;
}

.results-toggle {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 2px;
  border-radius: 3px;
  transition: background-color 0.2s ease;
}

.results-toggle:hover {
  background: rgba(100, 116, 139, 0.1);
}

.results-toggle i {
  font-size: 10px;
  transition: transform 0.3s ease;
}

.modal-filter-results.collapsed .results-toggle i {
  transform: rotate(180deg);
}

/* Compact Horizontal Summary Layout */
.results-summary-vertical {
  padding: 8px 12px;
  display: flex;
  flex-direction: row;
  gap: 12px;
  background: white;
  flex-wrap: wrap;
}

.summary-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 11px;
  flex-shrink: 0;
}

.summary-label {
  display: flex;
  align-items: center;
  gap: 3px;
  font-weight: 500;
  color: #64748b;
}

.summary-label i {
  font-size: 10px;
}

.summary-label span {
  font-size: 10px;
}

.summary-value {
  display: flex;
  align-items: center;
}

.count-value {
  font-size: 11px;
  font-weight: 600;
  color: #1e293b;
  min-width: 20px;
  text-align: right;
}

/* Filter Performance Info */
.filter-performance {
  padding: 12px 16px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.performance-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.performance-label {
  color: #6b7280;
  font-weight: 500;
}

.performance-value {
  color: #374151;
  font-weight: 600;
}

/* Collapsible Animation */
.modal-filter-results .filter-results-content {
  max-height: 300px;
  overflow: hidden;
  transition: max-height 0.3s ease-in-out;
}

.modal-filter-results.collapsed .filter-results-content {
  max-height: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .modal-filter-results {
    margin-top: 12px;
  }
  
  .filter-results-header {
    padding: 10px 12px;
  }
  
  .results-title {
    font-size: 13px;
  }
  
  .results-summary-vertical {
    padding: 12px;
    gap: 10px;
  }
  
  .summary-item {
    padding: 10px 12px;
  }
  
  .summary-label {
    font-size: 13px;
  }
  
  .count-value {
    font-size: 16px;
  }
}

/* Spatial Filtering Styles */
.spatial-filter-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.spatial-draw-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
}

.spatial-draw-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.spatial-section-title {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.clear-spatial-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #dc2626;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 10px;
}

.clear-spatial-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
}

.spatial-draw-tools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
}

.spatial-draw-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 10px;
  text-align: center;
}

.spatial-draw-btn:hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.05);
}

.spatial-draw-btn.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.spatial-draw-btn i {
  font-size: 14px;
}

.spatial-relationship-section {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
}

.spatial-relationships {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.spatial-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.spatial-option:hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.05);
}

.spatial-option input[type="radio"] {
  margin: 0;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.spatial-option input[type="radio"]:checked + .spatial-label {
  color: #3b82f6;
  font-weight: 600;
}

.spatial-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  min-width: 80px;
}

.spatial-label i {
  font-size: 12px;
}

.spatial-description {
  font-size: 11px;
  color: #6b7280;
  line-height: 1.3;
}

.spatial-apply-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.apply-spatial-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
  font-weight: 600;
  width: 100%;
  justify-content: center;
}

.apply-spatial-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-1px);
}

.apply-spatial-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
}

.spatial-results {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #059669;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  text-align: center;
}

@media (max-width: 768px) {
  .spatial-draw-tools {
    grid-template-columns: 1fr;
  }
  
  .spatial-option {
    flex-direction: column;
    gap: 4px;
  }
  
  .spatial-label {
    min-width: auto;
  }
}

/* Custom Modal Alert System */
.custom-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.custom-modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.custom-modal {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  transform: scale(0.8) translateY(30px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.custom-modal-backdrop.show .custom-modal {
  transform: scale(1) translateY(0);
}

.custom-modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #e2e8f0;
  position: relative;
}

.custom-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 10px;
}

.custom-modal-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
}

.custom-modal-icon.success {
  background: linear-gradient(135deg, #10b981, #059669);
}

.custom-modal-icon.error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.custom-modal-icon.warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.custom-modal-icon.info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.custom-modal-icon.confirm {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.custom-modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 20px;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.custom-modal-close:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.custom-modal-body {
  padding: 20px 24px;
}

.custom-modal-message {
  color: #475569;
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

.custom-modal-footer {
  padding: 16px 24px 20px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  border-top: 1px solid #f1f5f9;
}

.custom-modal-btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  min-width: 80px;
  text-align: center;
}

.custom-modal-btn.primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}

.custom-modal-btn.primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
}

.custom-modal-btn.success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.custom-modal-btn.success:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
}

.custom-modal-btn.danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.custom-modal-btn.danger:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-1px);
}

.custom-modal-btn.secondary {
  background: #f8fafc;
  color: #64748b;
  border-color: #e2e8f0;
}

.custom-modal-btn.secondary:hover {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

/* Pickr button width fix for form consistency */
.pickr .pcr-button,
.color-picker-container .pcr-button {
  width: 100% !important;
  box-sizing: border-box;
  border: 1px solid #f8b4b4;
  border-radius: 4px;
  padding: 6px 8px;
  background: white;
  transition: all 0.3s ease;
}

.pickr .pcr-button:hover,
.color-picker-container .pcr-button:hover {
  border-color: #f87171;
}

/* Auto-close progress bar for alerts */
.custom-modal-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border-radius: 0 0 12px 12px;
  transform-origin: left;
  animation: progressBar linear;
}

@keyframes progressBar {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* Animation improvements */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(30px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes modalFadeOut {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.8) translateY(30px);
  }
}

.custom-modal.entering {
  animation: modalFadeIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.custom-modal.leaving {
  animation: modalFadeOut 0.2s ease-in;
}

/* Color Picker Edit Container Styles */
.color-picker-edit-container {
  pointer-events: all !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3) !important;
  border-radius: 8px !important;
  overflow: hidden !important;
}

.color-picker-backdrop {
  pointer-events: all !important;
  backdrop-filter: blur(2px);
}

/* Override Pickr styles for better modal integration */
.pickr-temp-container .pickr {
  position: relative !important;
}

.pickr-temp-container .pcr-app {
  position: relative !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  z-index: inherit !important;
}

/* Ensure color picker elements are visible */
.color-picker-edit-container * {
  pointer-events: all !important;
}

/* Fix for Pickr positioning issues */
.pickr-temp-container .pcr-selection .pcr-color-chooser,
.pickr-temp-container .pcr-selection .pcr-color-preview {
  position: relative !important;
}

/* Filter Logic Selection Styles - Compact Version */
.filter-logic-section {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}

.filter-logic-section .section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-weight: 500;
  color: #374151;
  font-size: 13px;
}

.filter-logic-section .section-header i {
  color: var(--primary-600, #dc2626) !important;
  font-size: 13px;
}

.logic-help {
  margin-left: auto;
  font-size: 11px;
  color: var(--primary-500, #ef4444);
  cursor: help;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.logic-help:hover {
  opacity: 1;
}

.filter-logic-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.logic-option {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.logic-option:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.logic-option input[type="radio"] {
  margin-right: 10px;
  width: 16px;
  height: 16px;
  accent-color: var(--primary-600, #dc2626);
}

.logic-option input[type="radio"]:checked + .logic-label {
  color: var(--primary-700, #b91c1c);
  font-weight: 600;
}

.logic-option:has(input:checked) {
  background: linear-gradient(135deg, var(--primary-50, #fef2f2) 0%, var(--primary-100, #fee2e2) 100%);
  border-color: var(--primary-600, #dc2626);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
}

.logic-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #475569;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.logic-label i {
  font-size: 14px;
  width: 18px;
  text-align: center;
}

.logic-label strong {
  font-size: 13px;
  font-weight: 500;
  color: inherit;
}

.logic-label small {
  display: none; /* Keep descriptions hidden for clean look */
}

/* Logic Indicator Styles - Compact */
.filter-logic-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin: 0 6px;
  min-width: 32px;
  height: 20px;
}

.filter-logic-indicator.and {
  background: var(--primary-600, #dc2626);
  color: white;
}

.filter-logic-indicator.or {
  background: #10b981;
  color: white;
}

/* Responsive Design */
@media (max-width: 640px) {
  .filter-logic-options {
    gap: 8px;
  }
  
  .logic-option {
    padding: 10px 14px;
  }
  
  .logic-label {
    font-size: 13px;
  }
}

/* Feature Popup Styles - Consistent with map-explorer */
.feature-popup-container {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(229, 231, 235, 0.8);
    backdrop-filter: blur(10px);
    max-width: 100%;
    min-width: 250px;
    overflow: hidden;
    animation: popupFadeIn 0.2s ease-out;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.feature-popup-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    position: relative;
}

.feature-popup-title {
    font-weight: 600;
    font-size: 14px;
    margin: 0;
    letter-spacing: 0.025em;
}

.feature-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 12px;
}

.feature-popup-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.feature-popup-content {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.feature-popup-property {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    gap: 12px;
}

.feature-popup-property:last-child {
    border-bottom: none;
}

.feature-popup-key {
    font-weight: 500;
    color: #374151;
    font-size: 13px;
    min-width: 80px;
    flex-shrink: 0;
}

.feature-popup-value {
    color: #6b7280;
    font-size: 13px;
    text-align: right;
    word-break: break-word;
    line-height: 1.4;
}

/* Scrollbar styling for popup content */
.feature-popup-content::-webkit-scrollbar {
    width: 4px;
}

.feature-popup-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 2px;
}

.feature-popup-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.feature-popup-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Enhanced Table Styling */
#data-table {
  font-size: 0.875rem;
  line-height: 1.25rem;
}

#data-table thead th {
  position: sticky;
  top: 0;
  background: #f9fafb;
  padding: 0.75rem 0.5rem;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  min-width: 100px;
  vertical-align: top;
}

#data-table tbody td {
  padding: 0.75rem 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}

#data-table tbody tr:hover {
  background-color: #f9fafb;
}

/* Table container responsive scrolling */
.table-container {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
}

/* Better column width management */
#data-table th:first-child,
#data-table td:first-child {
  min-width: 80px;
  max-width: 120px;
}

#data-table th:not(:first-child),
#data-table td:not(:first-child) {
  min-width: 120px;
  max-width: 200px;
}

/* Column header responsiveness */
@media (max-width: 768px) {
  #data-table thead th {
    padding: 0.5rem 0.25rem;
    font-size: 0.75rem;
    max-width: 120px;
    min-width: 80px;
  }
  
  #data-table tbody td {
    padding: 0.5rem 0.25rem;
    font-size: 0.75rem;
    max-width: 120px;
  }
}

/* Table search and filter styling */
#table-controls {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border: 1px solid #e2e8f0;
}

#table-search, #column-filter {
  transition: all 0.2s ease;
  border: 1px solid #d1d5db;
}

#table-search:focus, #column-filter:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
  outline: none;
}

/* Table loading state */
.table-loading {
  opacity: 0.6;
  pointer-events: none;
}
