/* ============================================
   BAUSITE Geo — Search & Geocoding Module
   Styles for address search, parcel info,
   reverse geocoding, coordinates, bookmarks
   ============================================ */

/* ── Search Container (top-center of map) ── */
.search-container {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 420px;
  max-width: calc(100vw - 24px);
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* ── Search Input ── */
.search-box {
  display: flex;
  align-items: center;
  background: rgba(27, 42, 74, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(232, 131, 58, 0.3);
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
  border-color: rgba(232, 131, 58, 0.7);
  box-shadow: 0 4px 24px rgba(232, 131, 58, 0.15), 0 4px 20px rgba(0, 0, 0, 0.3);
}

.search-icon {
  padding: 0 0 0 14px;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
  line-height: 1;
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  padding: 12px 10px;
  min-width: 0;
}

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

.search-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: #E8833A;
  border-radius: 50%;
  animation: search-spin 0.6s linear infinite;
  margin-right: 12px;
  flex-shrink: 0;
  display: none;
}

.search-spinner.active {
  display: block;
}

.search-clear {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 18px;
  cursor: pointer;
  padding: 0 12px;
  line-height: 1;
  display: none;
  flex-shrink: 0;
}

.search-clear:hover {
  color: #fff;
}

.search-clear.visible {
  display: block;
}

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

/* ── Search Dropdown ── */
.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: rgba(27, 42, 74, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(232, 131, 58, 0.25);
  border-radius: 10px;
  max-height: 360px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.search-dropdown.open {
  display: block;
}

.search-result {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.15s;
}

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

.search-result:hover,
.search-result.active {
  background: rgba(232, 131, 58, 0.15);
}

.search-result-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

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

.search-result-title {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-subtitle {
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-type {
  font-size: 10px;
  color: #E8833A;
  background: rgba(232, 131, 58, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ── Coordinate Input (below search) ── */
.coord-input-toggle {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
  cursor: pointer;
  padding: 0 12px;
  flex-shrink: 0;
  line-height: 1;
  transition: color 0.15s;
}

.coord-input-toggle:hover {
  color: #E8833A;
}

.coord-input-toggle.active {
  color: #E8833A;
}

.coord-input-panel {
  margin-top: 4px;
  background: rgba(27, 42, 74, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(232, 131, 58, 0.25);
  border-radius: 10px;
  padding: 12px 14px;
  display: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.coord-input-panel.open {
  display: block;
}

.coord-input-label {
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.coord-input-row {
  display: flex;
  gap: 6px;
}

.coord-input-field {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 8px 10px;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.coord-input-field:focus {
  border-color: rgba(232, 131, 58, 0.5);
}

.coord-input-field::placeholder {
  color: rgba(255, 255, 255, 0.25);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
}

.coord-go-btn {
  background: #E8833A;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.coord-go-btn:hover {
  background: #d6732e;
}

.coord-hint {
  color: rgba(255, 255, 255, 0.35);
  font-size: 10px;
  margin-top: 6px;
}

/* ── Context Menu (right-click) ── */
.search-context-menu {
  position: absolute;
  z-index: 20;
  background: rgba(27, 42, 74, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(232, 131, 58, 0.3);
  border-radius: 8px;
  padding: 4px 0;
  min-width: 200px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  display: none;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.search-context-menu.open {
  display: block;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.context-menu-item:hover {
  background: rgba(232, 131, 58, 0.15);
}

.context-menu-item .cm-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
}

.context-menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

/* ── Info Popup (reverse geocoding result) ── */
.search-info-popup {
  font-family: 'Plus Jakarta Sans', sans-serif;
  max-width: 300px;
}

.search-info-popup h4 {
  margin: 0 0 8px;
  color: #1B2A4A;
  font-size: 14px;
  font-weight: 700;
}

.search-info-popup .info-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 12px;
  color: #555;
  border-bottom: 1px solid #eee;
}

.search-info-popup .info-row:last-child {
  border-bottom: none;
}

.search-info-popup .info-label {
  font-weight: 600;
  color: #1B2A4A;
  margin-right: 12px;
}

.search-info-popup .info-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-align: right;
}

.search-info-popup .info-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 2px solid #E8833A;
}

.search-info-popup .info-section-title {
  font-size: 11px;
  font-weight: 700;
  color: #E8833A;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

/* ── Bookmarks Panel (in sidebar) ── */
.bookmarks-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bookmark-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.bookmark-item:hover {
  background: rgba(232, 131, 58, 0.12);
}

.bookmark-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.bookmark-name {
  flex: 1;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bookmark-delete {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.25);
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

.bookmark-item:hover .bookmark-delete {
  opacity: 1;
}

.bookmark-delete:hover {
  color: #ff6b6b;
}

.bookmark-add-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.bookmark-add-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 6px 10px;
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  outline: none;
}

.bookmark-add-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.bookmark-add-btn {
  background: #E8833A;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.bookmark-add-btn:hover {
  background: #d6732e;
}

/* ── Mobile ── */
@media (max-width: 600px) {
  .search-container {
    width: calc(100vw - 16px);
    top: 8px;
  }

  .search-input {
    font-size: 15px;
    padding: 10px 8px;
  }

  .coord-input-panel {
    padding: 10px 12px;
  }
}

/* ── Scrollbar for dropdown ── */
.search-dropdown::-webkit-scrollbar {
  width: 6px;
}

.search-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.search-dropdown::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.search-dropdown::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}
