/* =================================================================
   NEARBY.CSS - Nearby Spaces Feature Styles
   Popover, Cursor Hint, Radius Slider
   ================================================================= */

/* =================================================================
   CURSOR HINT (Schwebendes Fadenkreuz)
   ================================================================= */

.nearby-cursor-hint {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: var(--space-hover);
  color: white;
  padding: 0 12px 0 0;
  border-radius: 20px;
  font-family: var(--font-family);
  font-size: 0.85em;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 8px var(--shadow-color);
  white-space: nowrap;
  overflow: hidden;
  height: 28px;
  min-width: 28px;
  max-width: 350px;
  transition:
    opacity 0.3s ease-in-out,
    max-width 0.3s ease-in-out,
    padding 0.3s ease-in-out;
}

.hint-icon-wrapper {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nearby-cursor-hint.icon-only {
  max-width: 28px;
  padding-right: 0 !important;
  transition:
    opacity 0.15s ease-in-out,
    max-width 0.15s ease-in-out,
    padding 0.15s ease-in-out;
}

.nearby-cursor-hint span {
  transition: opacity 0.3s ease-in-out;
  opacity: 1;
}

.nearby-cursor-hint.icon-only span {
  opacity: 0;
}

/* =================================================================
   DRAGGABLE CIRCLE
   ================================================================= */

.nearby-circle-draggable {
  cursor: move;
}

/* =================================================================
   POPOVER (Das Fenster)
   ================================================================= */

.nearby-popover {
  display: flex;
  flex-direction: column;
  position: absolute;
  /* z-index: 10000; */
  z-index: 1000;
  width: 380px;
  background-color: var(--dropdown-bg);
  border-radius: 16px;
  border: none;
  box-shadow: 0px 4px 12px 2px var(--shadow-color);
  overflow: visible;
  text-align: left;
}

/* Zweizeiliger Header */
.nearby-popover-header {
  flex-direction: column;
  align-items: stretch;
  display: flex;
  padding: 10px 7px;
  gap: 8px;
  height: auto;
  background: var(--nearby-title);
}

.nearby-header-row-top {
  font-size: 1.1em;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  cursor: grab;
}


.nearby-grip-wrapper {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 14px;
  cursor: grab;
}

.nearby-grip-wrapper i {
  font-size: 10px;
  color: var(--text-muted, #888);
  transform: scaleX(20);
  pointer-events: none;
  opacity: 0.5;
}

.nearby-header-row-address {
  font-size: 0.8em;
  color: var(--hover-text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.nearby-address-icon {
  color: var(--space-hover);
  font-size: 1.3em;
  vertical-align: middle;
  margin: 0 2px;
}

.nearby-header-row-bottom {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding-top: 5px;
}

.nearby-close-btn {
  font-size: 0.55em;
  color: black;
  background-color: transparent;
  border: none;
  width: 18px !important;
  height: 18px !important;
}

.nearby-close-btn:hover {
  color: white;
  background-color: var(--text-color) !important;
}

/* =================================================================
   LISTE & EINTRÄGE
   ================================================================= */

.nearby-popover-list {
  padding: 0;
  max-height: 210px;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: thin;
}

.nearby-popover-list .listing-item {
  scroll-snap-align: start;
}

/* Resize-Handle am unteren Rand */
.nearby-resize-handle {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 16px;
  cursor: ns-resize;
  color: var(--text-muted, #888);
  background: var(--nearby-title);
  border-top: 1px solid var(--dropdown-border);
  border-radius: 0 0 12px 12px;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

.nearby-resize-handle:hover {
  background: var(--dropdown-hover-bg, #f0f0f0);
  color: var(--text-color, #333);
}

.nearby-resize-handle i {
  font-size: 10px;
  pointer-events: none;
  transform: scaleX(5);
}

/* Flicker-Animation wenn Liste nicht weiter erweiterbar */
@keyframes nearby-limit-flicker {
  0%, 100% { background-color: var(--dropdown-bg); }
  25%, 75% { background-color: var(--space-closed); }
  50% { background-color: var(--dropdown-bg); }
}

.nearby-resize-handle.limit-reached {
  animation: nearby-limit-flicker 0.3s ease-out;
}

/* =================================================================
   RADIUS SLIDER (Draggable Pill)
   ================================================================= */

.nearby-radius-slider-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 8px;
  width: 100%;
  margin: -1px 0;
}

.nearby-radius-slider-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  font-size: 1.1em;
}

.nearby-radius-label-prefix {
  font-size: 0.85em;
  font-weight: normal;
  color: var(--text-color);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Track (die Schiene) */
.nearby-radius-track {
  position: relative;
  height: 26px;
  background: white;
  border: 1px solid rgba(88, 160, 122, 1);
  border-radius: 16px;
  margin: 0;
  padding: 0 3px;
  box-shadow: 1px 3px 9px rgba(0, 0, 0, 0.4) inset;
  width: 260px;
}

@media (prefers-color-scheme: dark) {
  .nearby-radius-track {
    background: var(--dropdown-alt-border);
  }
}

/* Die Pill (draggable) */
.nearby-radius-pill {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--space-hover);
  color: var(--search-bg);
  border-radius: 30px;
  font-size: 0.7em;
  font-weight: bold;
  cursor: grab;
  user-select: none;
  transition: left 0.3s ease-out, transform 0.3s ease-out, box-shadow 0.3s ease-out;
  z-index: 15;
  min-width: 50px;
  width: 50px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.nearby-radius-pill.dragging {
  cursor: grabbing;
  transition: none !important;
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  background: var(--space-hover);
}

.nearby-radius-pill:hover {
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%) scale(1.05);
  transition: all 0.1s ease-in;
}

/* Transparente Klick-Bereiche über den Labels */
.nearby-radius-clickarea {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 26px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 11;
  padding: 0;
  margin: 0;
  pointer-events: all;
}

/* Labels IM Track */
.nearby-radius-labels {
  position: absolute;
  top: 50%;
  left: 3px;
  right: 3px;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0;
  font-size: 0.8em;
  font-weight: 600;
  color: var(--hover-text-color);
  user-select: none;
  pointer-events: auto;
  z-index: 2;
}

.nearby-radius-label {
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 3px 8px;
  border-radius: 4px;
  pointer-events: auto;
  color: #666;
  font-size: 0.85em;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nearby-radius-label:hover {
  color: var(--text-color);
  font-weight: 600;
}

.nearby-radius-label.active {
  color: #666;
  font-weight: 600;
  z-index: 5;
}

@media (prefers-color-scheme: dark) {
  .nearby-radius-label {
    color: #999;
  }

  .nearby-radius-label:hover {
    color: var(--text-color);
  }

  .nearby-radius-label.active {
    color: #999;
  }
}

/* =================================================================
   MOBILE RESPONSIVE
   ================================================================= */

@media (max-width: 768px) {
  .nearby-popover {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 70vh !important;
    animation: nearbySlideUp 0.3s ease-out;
  }

  @keyframes nearbySlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .nearby-cursor-hint {
    display: none !important;
  }

  .nearby-popover-list {
    max-height: 50vh !important;
  }

  .nearby-resize-handle {
    display: none !important;
  }
}
