/* ===================================================================
   Property Wharf - Map View Styles (Leaflet & Nautical Radar Markers)
   =================================================================== */

.map-view-container {
  position: relative;
  width: 100%;
  height: calc(100vh - 144px);
  min-height: 500px;
  background-color: var(--bg-main);
  overflow: hidden;
}

#portfolio-map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Nautical Theme Filter on Leaflet Map */
[data-theme="dark"] .leaflet-layer {
  filter: brightness(0.92) contrast(1.08);
}

/* ===================================================================
   Custom Nautical Radar Dot Marker
   =================================================================== */
.custom-beacon-icon {
  background: transparent;
  border: none;
}

.nautical-marker-dot {
  position: relative;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.beacon-core {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.45);
  position: relative;
  z-index: 2;
  transition: transform var(--transition-fast);
}

.nautical-marker-dot:hover .beacon-core {
  transform: scale(1.35);
  box-shadow: 0 0 14px var(--accent-teal);
}

/* Pulsing radar wave */
.beacon-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 26px;
  margin-top: -13px;
  margin-left: -13px;
  border-radius: 50%;
  border: 2px solid var(--pulse-color, var(--accent-teal));
  opacity: 0.8;
  animation: beacon-wave 2.2s infinite ease-out;
  pointer-events: none;
}

@keyframes beacon-wave {
  0% {
    transform: scale(0.4);
    opacity: 0.9;
  }
  70% {
    transform: scale(1.6);
    opacity: 0.15;
  }
  100% {
    transform: scale(2.1);
    opacity: 0;
  }
}

/* ===================================================================
   Nautical Leaflet Popup Styling
   =================================================================== */
.leaflet-popup-content-wrapper {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0 !important;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0 !important;
  line-height: 1.4 !important;
}

.leaflet-popup-tip {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-light) !important;
}

.harbor-popup {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.harbor-popup-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.harbor-popup-badge .type-pill {
  font-size: 10px;
  padding: 2px 8px;
}

.harbor-popup-badge .value-pill {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-teal);
}

.harbor-popup-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.harbor-popup-address {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.harbor-popup-address .pin-icon {
  color: var(--accent-gold);
  flex-shrink: 0;
}

.harbor-popup-actions {
  margin-top: 4px;
}

.btn-popup-inspect {
  width: 100%;
  padding: 8px 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.btn-popup-inspect:hover {
  background-color: var(--accent-teal);
  color: #060d17;
  border-color: var(--accent-teal);
}

/* ===================================================================
   Floating Map Controls & Chart Legend
   =================================================================== */
.map-floating-panel {
  position: absolute;
  top: 18px;
  left: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.map-control-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(8px);
  flex-wrap: wrap;
}

.map-tool-dropdown-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 2px 8px;
}

.map-tool-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.map-select-tool {
  background: transparent;
  border: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px 2px;
  outline: none;
}

.map-select-tool option {
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

.btn-map-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-display);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.btn-map-tool:hover {
  border-color: var(--accent-teal);
  background-color: var(--bg-card-hover);
}

.btn-new-category-shortcut {
  border-color: rgba(0, 229, 176, 0.35);
  color: var(--accent-teal);
}

.btn-new-category-shortcut:hover {
  background-color: rgba(0, 229, 176, 0.12);
  border-color: var(--accent-teal);
}

/* Map Sequence Bottom Tray */
.map-sorted-tray {
  position: absolute;
  bottom: 24px;
  right: 24px;
  max-width: 580px;
  width: calc(100% - 340px);
  z-index: 500;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all var(--transition-normal);
}

.map-sorted-tray.collapsed .tray-cards-container {
  display: none;
}

.tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tray-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.tray-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tray-nav-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-tray-nav {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-tray-nav:hover {
  border-color: var(--accent-teal);
  color: var(--accent-teal);
}

.tray-counter {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-gold);
  padding: 0 4px;
}

.btn-tray-toggle {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-tray-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-light);
}

.tray-cards-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.map-tray-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  min-width: 170px;
  max-width: 220px;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.map-tray-card:hover {
  border-color: var(--accent-teal);
  background-color: var(--bg-card-hover);
}

.map-tray-card.active {
  border-color: var(--accent-teal);
  background-color: rgba(0, 229, 176, 0.1);
  box-shadow: 0 0 10px rgba(0, 229, 176, 0.25);
}

.tray-card-type-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tray-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.tray-card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tray-card-pills {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tray-card-category {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-gold);
  font-family: var(--font-mono);
}

.tray-card-type {
  font-size: 10px;
  color: var(--text-muted);
}

.tray-empty-hint {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 0;
}

.harbor-popup-badge .category-pill {
  display: inline-block;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
  border-radius: var(--radius-xs);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Map Bottom Legend */
.map-legend-card {
  position: absolute;
  bottom: 24px;
  left: 24px;
  z-index: 500;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 16px;
}

.legend-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.legend-items {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

@media (max-width: 900px) {
  .map-sorted-tray {
    width: calc(100% - 48px);
    max-width: none;
    bottom: 80px;
  }
}

@media (max-width: 768px) {
  .map-legend-card {
    display: none;
  }
}
