/* Simple Black & White Search Control Styles */
.leaflet-control-search {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  overflow: visible;
  position: relative;
  z-index: 1000;
  transition: all 0.3s ease;
}

.search-container {
  display: flex;
  align-items: center;
  position: relative;
  min-width: 44px;
  transition: all 0.3s ease;
  border-radius: 8px;
  overflow: hidden;
}

.search-container.expanded {
  min-width: 300px;
  background: white;
}

.search-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: black;
  color: white;
  border-radius: 8px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.search-icon:hover {
  background: #333;
}

.search-icon:active {
  transform: scale(0.95);
}

.search-icon i {
  font-size: 16px;
  transition: transform 0.3s ease;
}

.search-icon.active {
  border-radius: 8px 0 0 8px;
}

.search-input {
  border: none;
  outline: none;
  padding: 12px 50px 12px 16px;
  font-size: 14px;
  width: 0;
  opacity: 0;
  transition: all 0.3s ease;
  background: white;
  color: black;
  position: absolute;
  left: 44px;
  top: 0;
  height: 44px;
  border-radius: 0 8px 8px 0;
  z-index: 1;
  border-left: 1px solid #e5e7eb;
}

.search-input.show {
  width: 256px;
  opacity: 1;
  position: relative;
  left: 0;
}

.search-input::placeholder {
  color: #666;
}

.search-input:focus {
  box-shadow: inset 0 0 0 2px black;
}

/* Clear button */
.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f5f5f5;
  border: 1px solid #ddd;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 3;
}

.search-clear:hover {
  background: #e5e5e5;
}

.search-clear i {
  font-size: 10px;
  color: #666;
}

/* Loading indicator */
.search-loading {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid black;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: none;
  z-index: 3;
}

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

/* Suggestions Container */
.suggestions-container {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  margin-top: 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1001;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  border: 1px solid #e5e7eb;
  display: none;
}

.suggestions-container.show {
  opacity: 1;
  transform: translateY(0);
  display: block;
}

.suggestion-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

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

.suggestion-item:hover,
.suggestion-item.active {
  background: #f8f8f8;
}

.suggestion-item:active {
  background: #f0f0f0;
}

.suggestion-icon {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: black;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  flex-shrink: 0;
}

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

.suggestion-name {
  font-weight: 500;
  color: black;
  font-size: 14px;
  line-height: 1.3;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  line-clamp: 1;
}

.suggestion-type {
  font-size: 11px;
  color: #666;
  text-transform: capitalize;
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}

/* No results */
.no-results {
  padding: 24px 16px;
  text-align: center;
  color: #666;
  font-size: 13px;
}

.no-results i {
  font-size: 24px;
  margin-bottom: 8px;
  display: block;
  color: #ccc;
}

/* Custom scrollbar */
.suggestions-container::-webkit-scrollbar {
  width: 4px;
}

.suggestions-container::-webkit-scrollbar-track {
  background: #f5f5f5;
}

.suggestions-container::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 2px;
}

.suggestions-container::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Responsive Design */
@media (max-width: 768px) {
  .leaflet-control-search {
    margin: 10px !important;
  }

  .search-container.expanded {
    min-width: 280px;
  }

  .search-input.show {
    width: 236px;
  }

  .suggestions-container {
    left: -10px;
    right: -10px;
    max-height: 250px;
  }

  .suggestion-item {
    padding: 10px 14px;
    min-height: 44px;
  }

  .suggestion-icon {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }

  .suggestion-name {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .leaflet-control-search {
    margin: 8px !important;
  }

  .search-container.expanded {
    min-width: 260px;
  }

  .search-input.show {
    width: 216px;
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .suggestions-container {
    left: -15px;
    right: -15px;
    max-height: 200px;
  }

  .suggestion-item {
    padding: 8px 12px;
    min-height: 40px;
  }

  .suggestion-name {
    font-size: 12px;
  }

  .suggestion-type {
    font-size: 10px;
  }
}

/* Focus styles for accessibility */
.search-icon:focus,
.search-clear:focus {
  outline: 2px solid black;
  outline-offset: 2px;
}

.search-input:focus {
  outline: none;
}

.suggestion-item:focus {
  outline: 2px solid black;
  outline-offset: -2px;
}

/* Dark mode support (still black and white) */
@media (prefers-color-scheme: dark) {
  .leaflet-control-search {
    background: #ffffff;
    border-color: #333;
  }

  .search-input {
    background: #ffffff;
    color: rgb(0, 0, 0);
    border-left-color: #333;
  }

  .search-input::placeholder {
    color: #000000;
  }

  .suggestions-container {
    background: #ffffff;
    border-color: #333;
  }

  .suggestion-item {
    border-bottom-color: #333;
  }

  .suggestion-item:hover,
  .suggestion-item.active {
    background: #e6e5e5;
  }

  .suggestion-name {
    color: rgb(0, 0, 0);
  }

  .suggestion-type {
    background: #333;
    color: #ffffff;
  }

  .search-clear {
    background: #333;
    border-color: #555;
  }

  .search-clear i {
    color: #ccc;
  }

  .no-results {
    color: #999;
  }

  .search-icon {
    background: white;
    color: black;
  }

  .search-icon:hover {
    background: #f0f0f0;
  }

  .suggestion-icon {
    background: white;
    color: black;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .search-container,
  .search-input,
  .suggestions-container,
  .suggestion-item,
  .search-icon {
    transition: none;
    animation: none;
  }
}

/* Print styles */
@media print {
  .leaflet-control-search {
    display: none;
  }
}
