/* Search Results Styles */
.search-results { 
  max-height: 300px; 
  overflow-y: auto; 
  margin-top: 8px; 
}

.search-result-item { 
  padding: 8px; 
  border: 1px solid #374151; 
  border-radius: 4px; 
  margin-bottom: 4px; 
  cursor: pointer; 
  transition: background-color 0.2s;
  background: #1f2937;
}

.search-result-item:hover { 
  background: #374151; 
}

.search-result-item.selected { 
  background: #3b82f6; 
  border-color: #60a5fa; 
}

.search-result-name { 
  font-weight: 600; 
  color: #f3f4f6; 
  margin-bottom: 2px; 
}

.search-result-meta { 
  font-size: 12px; 
  color: #9ca3af; 
}

.search-result-extra { 
  font-size: 11px; 
  color: #6b7280; 
  margin-top: 2px; 
}

/* Search result tags (inspired by OpenSanctions) */
.search-result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0;
}

.search-tag {
  display: inline-block;
  background: #374151;
  color: #e5e7eb;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
  border: 1px solid #4b5563;
  transition: all 0.2s ease;
}

.search-tag:hover {
  background: #4b5563;
  border-color: #6b7280;
}

/* Specific tag colors for different types */
.search-tag[data-tag-type="sanctioned"] {
  background: #dc2626;
  border-color: #ef4444;
  color: white;
}

.search-tag[data-tag-type="export-controlled"] {
  background: #ea580c;
  border-color: #f97316;
  color: white;
}

.search-tag[data-tag-type="debarred"] {
  background: #b91c1c;
  border-color: #dc2626;
  color: white;
}

.search-tag[data-tag-type="sanction-linked"] {
  background: #7c2d12;
  border-color: #ea580c;
  color: white;
}

.search-tag[data-tag-type="asset-frozen"] {
  background: #1e40af;
  border-color: #3b82f6;
  color: white;
}

.search-tag[data-tag-type="criminal"] {
  background: #7c2d12;
  border-color: #ea580c;
  color: white;
}

.search-tag[data-tag-type="terrorism"] {
  background: #991b1b;
  border-color: #dc2626;
  color: white;
}

.query-type-badge { 
  display: inline-block; 
  background: #3b82f6; 
  color: white; 
  padding: 2px 6px; 
  border-radius: 3px; 
  font-size: 10px; 
  margin-bottom: 4px;
}

/* Search Suggestions Styles */
.search-suggestions {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 8px;
  border: 1px solid #374151;
  border-radius: 4px;
  background: #1f2937;
}

.suggestion-item {
  padding: 8px 12px;
  cursor: pointer;
  transition: background-color 0.2s;
  border-bottom: 1px solid #374151;
  color: #e5e7eb;
  font-size: 14px;
}

.suggestion-item:hover {
  background: #374151;
}

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

/* Map Search Container Styles */
.map-search-container {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: 400px;
  max-width: 90vw;
}

.map-search-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #374151;
  border-radius: 8px;
  background: rgba(31, 41, 55, 0.95);
  color: #e5e7eb;
  font-size: 14px;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.map-search-input:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.map-search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 4px;
  border: 1px solid #374151;
  border-radius: 8px;
  background: rgba(31, 41, 55, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.map-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 4px;
  border: 1px solid #374151;
  border-radius: 8px;
  background: rgba(31, 41, 55, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Checkbox Filter Styles - Grid Layout */
.checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 3px;
  padding: 6px;
  border: 1px solid #374151;
  border-radius: 4px;
  background: #1f2937;
  max-height: none;
  overflow: visible;
}

.checkboxes label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px 2px;
  border-radius: 3px;
  transition: all 0.2s;
  font-size: 9px;
  color: #e5e7eb;
  text-align: center;
  min-height: 32px;
  border: 1px solid transparent;
}

.checkboxes label:hover {
  background: #374151;
  border-color: #60a5fa;
}

.checkboxes label:has(input:checked) {
  background: #3b82f6;
  border-color: #60a5fa;
  color: white;
}

.checkboxes input[type="checkbox"] {
  margin-bottom: 2px;
  accent-color: #60a5fa;
  transform: scale(0.7);
}

/* Country code styling */
.country-code {
  font-weight: 600;
  font-size: 8px;
  margin-bottom: 1px;
}

.country-count {
  font-size: 7px;
  opacity: 0.8;
}

/* Responsive grid for mobile */
@media (max-width: 768px) {
  .checkboxes {
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 2px;
    padding: 4px;
  }
  
  .checkboxes label {
    min-height: 28px;
    font-size: 8px;
    padding: 3px 1px;
  }
  
  .country-code {
    font-size: 7px;
  }
  
  .country-count {
    font-size: 6px;
  }
}

@media (max-width: 480px) {
  .checkboxes {
    grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
    gap: 1px;
    padding: 3px;
  }
  
  .checkboxes label {
    min-height: 24px;
    font-size: 7px;
    padding: 2px 1px;
  }
}

.muted {
  color: #9ca3af;
  font-size: 12px;
  font-weight: 500;
}

/* Search Panel Styles */
.search-results-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 8px;
  background: #1f2937;
  border-radius: 4px;
  border: 1px solid #374151;
}

.select-all-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #e5e7eb;
  cursor: pointer;
}

.select-all-checkbox {
  margin: 0;
  accent-color: #60a5fa;
}

.selected-count {
  font-size: 11px;
  color: #9ca3af;
}

.search-results-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #374151;
}

.btn-primary {
  background: #3b82f6;
  color: white;
  border-color: #2563eb;
}

.btn-primary:hover {
  background: #2563eb;
  border-color: #1d4ed8;
}

.btn-primary:disabled {
  background: #6b7280;
  border-color: #4b5563;
  cursor: not-allowed;
}

.btn-secondary {
  background: #374151;
  color: #e5e7eb;
  border-color: #4b5563;
}

.btn-secondary:hover {
  background: #4b5563;
  border-color: #6b7280;
}

.result-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  width: 100%;
}

.result-checkbox {
  margin: 0;
  margin-top: 2px;
  accent-color: #60a5fa;
}

.result-content {
  flex: 1;
}

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

.result-name {
  font-weight: 600;
  color: #f3f4f6;
  font-size: 13px;
}

.result-type {
  background: #374151;
  color: #e5e7eb;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
}

.result-meta {
  font-size: 11px;
  color: #9ca3af;
}

.result-country {
  margin-right: 8px;
}

.result-summary {
  margin-top: 4px;
  line-height: 1.3;
}

.search-result-item.selected {
  background: #374151;
  border-color: #60a5fa;
}

.no-results {
  text-align: center;
  color: #9ca3af;
  font-style: italic;
  padding: 20px;
}

/* Map Search Container Styles */
.map-search-container {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: 600px; /* Increased from 400px */
  max-width: 90vw;
}

.map-search-input {
  width: 100%;
  padding: 16px 20px;
  font-size: 14px;
  background: linear-gradient(135deg, #0b1220 0%, #1e293b 100%);
  color: #e5e7eb;
  border: 1px solid #374151;
  border-radius: 16px;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.map-search-input:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2), 0 8px 32px rgba(0, 0, 0, 0.5);
  background: linear-gradient(135deg, #0b1220 0%, #1e293b 100%);
}

.map-search-input::placeholder {
  color: #9ca3af;
  font-style: italic;
}

.map-search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #0b1220 0%, #1e293b 100%);
  border: 1px solid #374151;
  border-radius: 16px;
  margin-top: 8px;
  backdrop-filter: blur(10px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  max-height: 200px;
  overflow-y: auto;
}

.suggestion-item {
  padding: 10px 16px;
  cursor: pointer;
  color: #e5e7eb;
  font-size: 13px;
  border-bottom: 1px solid rgba(55, 65, 81, 0.5);
  transition: background-color 0.2s;
}

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

.suggestion-item:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
}

/* Fuzzy Suggestions Styles */
.fuzzy-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(17, 24, 39, 0.98);
  border: 1px solid rgba(55, 65, 81, 0.8);
  border-radius: 12px;
  margin-top: 8px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1002;
}

.fuzzy-suggestion-item {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(55, 65, 81, 0.3);
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fuzzy-suggestion-item:last-child {
  border-bottom: none;
}

.fuzzy-suggestion-item:hover {
  background: rgba(59, 130, 246, 0.1);
}

.suggestion-text {
  color: #f3f4f6;
  font-size: 13px;
  font-weight: 500;
}

.similarity-badge {
  background: #374151;
  color: #9ca3af;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}

.exact-match .similarity-badge {
  background: #10b981;
  color: white;
}

.fuzzy-match .similarity-badge {
  background: #f59e0b;
  color: white;
}

.prefix-match .similarity-badge {
  background: #3b82f6;
  color: white;
}

/* Highlighted text and similarity indicators */
.highlighted-text {
  background: #fef3c7;
  color: #92400e;
  padding: 1px 2px;
  border-radius: 2px;
  font-weight: 600;
}

.similarity-indicator {
  color: #9ca3af;
  font-size: 10px;
  margin-top: 2px;
  font-style: italic;
}

/* Map Search Results Styles */
.map-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(17, 24, 39, 0.98);
  border: 1px solid rgba(55, 65, 81, 0.8);
  border-radius: 12px;
  margin-top: 8px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1001;
}

.map-search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(55, 65, 81, 0.5);
  background: rgba(31, 41, 55, 0.8);
}

.map-search-results-title {
  color: #e5e7eb;
  font-size: 13px;
  font-weight: 600;
}

.map-search-clear-btn {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}

.map-search-clear-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.map-search-results-content {
  padding: 8px 0 20px 0;
}

.map-search-results-header {
  padding: 12px 16px;
  border-bottom: 2px solid rgba(55, 65, 81, 0.5);
  background: rgba(17, 24, 39, 0.8);
}

.map-search-results-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.map-search-bulk-actions {
  display: flex;
  gap: 8px;
}

.map-search-result-item {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(55, 65, 81, 0.3);
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.map-search-result-item:hover {
  background: rgba(59, 130, 246, 0.1);
}

.map-search-result-item.selected {
  background: rgba(59, 130, 246, 0.2);
  border-left: 3px solid #3b82f6;
}

.map-search-result-checkbox {
  flex-shrink: 0;
}

.map-search-result-info {
  flex: 1;
  min-width: 0;
}

.map-search-result-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.map-search-checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  color: #d1d5db;
  user-select: none;
}

.map-search-checkbox-label input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid #6b7280;
  border-radius: 4px;
  background: transparent;
  position: relative;
  transition: all 0.2s;
  margin-right: 8px;
}

.map-search-checkbox-label input[type="checkbox"]:checked + .checkmark {
  background: #3b82f6;
  border-color: #3b82f6;
}

.map-search-checkbox-label input[type="checkbox"]:checked + .checkmark::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.btn-add-selected, .btn-add-all {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.btn-add-selected {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
}

.btn-add-selected:disabled {
  background: #6b7280;
  cursor: not-allowed;
  opacity: 0.6;
}

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

.btn-add-selected:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  transform: translateY(-1px);
}

.btn-add-all:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
}

.map-search-result-name {
  color: #f3f4f6;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}

.map-search-result-meta {
  color: #9ca3af;
  font-size: 11px;
}

.map-search-result-extra {
  color: #6b7280;
  font-size: 10px;
  margin-top: 2px;
}

.map-search-result-sanctions {
  background: #3b82f6;
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.map-search-result-node-count {
  background: #10b981;
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.map-search-result-add-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 50%, #7c3aed 100%);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
  white-space: nowrap;
}

.map-search-result-add-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 50%, #6d28d9 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Pagination and Lazy Loading Styles */
.search-results-info {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 4px;
  text-align: center;
}

.load-more-container {
  padding: 16px;
  text-align: center;
  border-top: 1px solid rgba(55, 65, 81, 0.5);
  background: rgba(17, 24, 39, 0.5);
}

.btn-load-more {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-load-more:hover {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-load-more:disabled {
  background: #6b7280;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.loading-indicator {
  color: #9ca3af;
  font-size: 12px;
  font-style: italic;
  margin-top: 8px;
}

.loading-indicator::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid #374151;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
}

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

/* Scrollbar styling for search results */
.map-search-results::-webkit-scrollbar {
  width: 6px;
}

.map-search-results::-webkit-scrollbar-track {
  background: rgba(55, 65, 81, 0.3);
  border-radius: 3px;
}

.map-search-results::-webkit-scrollbar-thumb {
  background: rgba(96, 165, 250, 0.5);
  border-radius: 3px;
}

.map-search-results::-webkit-scrollbar-thumb:hover {
  background: rgba(96, 165, 250, 0.7);
}
