/* ══════════════════════════════════════
   Overlay & Layers CSS
   ══════════════════════════════════════ */

/* ── Overlay Add as Layer Button ── */
#overlay-add-btn {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: var(--space-md);
  align-items: center;
  animation: slideUp 0.3s ease;
  transition: opacity 0.3s;
}

#overlay-add-btn.hidden {
  display: none !important;
}

.overlay-add-layer-btn {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px 20px;
  background: rgba(18, 18, 26, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: var(--fs-lg);
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 0 20px var(--accent-primary-glow), var(--shadow-lg);
  transition: all var(--transition-default);
}

.overlay-add-layer-btn:hover {
  background: var(--accent-primary);
  color: white;
  transform: scale(1.03);
  box-shadow: 0 0 30px var(--accent-primary-glow);
}

.overlay-add-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-primary);
  color: white;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.overlay-add-text {
  white-space: nowrap;
}

.overlay-dismiss-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 18, 26, 0.8);
  border: 1px solid var(--border-default);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.overlay-dismiss-btn:hover {
  background: var(--accent-danger);
  border-color: var(--accent-danger);
  color: white;
}

/* ── Search Result Badge ── */
.search-result-badge {
  font-size: 9px;
  color: var(--accent-primary);
  padding: 2px 6px;
  background: var(--accent-primary-glow);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(124, 106, 246, 0.3);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── Layer List Items (updated) ── */
.layer-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px var(--space-md);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  border-left: 3px solid transparent;
}

.layer-item:hover {
  background: var(--bg-hover);
}

.layer-item.selected {
  background: var(--accent-primary-glow);
  border-left-color: var(--accent-primary);
}

.layer-vis-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  flex-shrink: 0;
  cursor: pointer;
}

.layer-vis-btn:hover {
  background: var(--bg-active);
}

.layer-color-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.layer-icon {
  font-size: 12px;
  flex-shrink: 0;
}

.layer-name {
  flex: 1;
  font-size: var(--fs-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.layer-delete-btn {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  cursor: pointer;
}

.layer-item:hover .layer-delete-btn {
  opacity: 1;
}

.layer-delete-btn:hover {
  background: rgba(231, 76, 60, 0.2);
  color: var(--accent-danger);
}

.layer-rename-input {
  flex: 1;
  min-width: 0;
  padding: 2px 4px;
  font-size: var(--fs-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
}

/* ── Route Builder Hint ── */
#route-builder-hint {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  padding: 8px 16px;
  background: rgba(18, 18, 26, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid var(--accent-secondary);
  border-radius: var(--radius-lg);
  color: var(--accent-secondary);
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 0 12px rgba(78, 205, 196, 0.2), var(--shadow-md);
  animation: fadeIn 0.3s ease;
  pointer-events: none;
}

#route-builder-hint.hidden {
  display: none !important;
}

/* ── Toggle Switch (for route properties) ── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 18px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: 9px;
  transition: all var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  left: 2px;
  top: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-primary-glow);
  border-color: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  background: var(--accent-primary);
  transform: translateX(18px);
}

/* ── Property Select (for route marker icon) ── */
.prop-select {
  flex: 1;
  font-size: var(--fs-sm);
  padding: 3px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
}

.prop-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary-glow);
}

/* ── Route Moving Marker ── */
.route-moving-marker {
  pointer-events: none;
  z-index: 10;
}

/* ── Property Panel Extras ── */
.prop-readonly {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  text-transform: capitalize;
}

.prop-color {
  width: 50px;
  height: 24px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 1px;
  background: var(--bg-tertiary);
}

.prop-range {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-tertiary);
  border-radius: 2px;
  border: none;
  cursor: pointer;
}

.prop-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
}

.prop-range-val {
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
  width: 35px;
  text-align: right;
  flex-shrink: 0;
}

.prop-num {
  width: 65px;
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
}

/* ── Route Waypoint List ── */
.route-wp-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 4px 0;
}

.route-wp-num {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-primary);
  background: var(--accent-secondary);
  border-radius: 50%;
  flex-shrink: 0;
}

.route-wp-address {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  font-size: var(--fs-xs);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast);
}

.route-wp-address:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary-glow);
}

.route-wp-del {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.route-wp-del:hover {
  background: rgba(231, 76, 60, 0.2);
  border-color: var(--accent-danger);
  color: var(--accent-danger);
}

.action-btn--danger {
  background: rgba(231, 76, 60, 0.1);
  border-color: var(--accent-danger);
  color: var(--accent-danger);
}

.action-btn--danger:hover {
  background: var(--accent-danger);
  color: white;
}

.action-btn--path {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(78, 205, 196, 0.1);
  border-color: #4ecdc4;
  color: #4ecdc4;
}

.action-btn--path:hover {
  background: #4ecdc4;
  color: #0f0f16;
}

.action-btn--ok {
  background: rgba(46, 204, 113, 0.15);
  border-color: #2ecc71;
  color: #2ecc71;
}

.action-btn--ok:hover {
  background: #2ecc71;
  color: #0f0f16;
}

/* ── Mask Overlay ── */
.mask-overlay-container {
  pointer-events: none;
  overflow: visible;
}

.mask-overlay-container img {
  pointer-events: none;
  user-select: none;
}
