/* Migration Map — Leaflet map visualization styles
 * Used by: family-tree.html migration view mode (D1)
 */

/* Map container */
.migration-map-container {
  position: relative;
  width: 100%;
  min-height: 400px;
  height: 65vh;
  max-height: 800px;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #f8fafc;
}

@media (max-width: 640px) {
  .migration-map-container {
    min-height: 300px;
    height: 50vh;
  }
}

/* Leaflet container override inside our wrapper */
.migration-map-container .leaflet-container {
  width: 100%;
  height: 100%;
  border-radius: 0.75rem;
}

/* Custom marker styles */
.migration-marker-container {
  background: transparent !important;
  border: none !important;
}

.migration-marker {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
  cursor: pointer;
}

.migration-marker:hover {
  transform: scale(1.2);
  z-index: 1000 !important;
}

.migration-marker-text {
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  user-select: none;
}

/* Popup styles */
.migration-popup {
  min-width: 160px;
  max-width: 240px;
  padding: 4px 0;
}

.migration-popup-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  float: left;
  margin-right: 10px;
  margin-bottom: 4px;
  border: 2px solid #e5e7eb;
}

.migration-popup-name {
  font-weight: 600;
  font-size: 14px;
  color: #1f2937;
  margin-bottom: 2px;
}

.migration-popup-years {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.migration-popup-location {
  font-size: 12px;
  color: #374151;
  clear: both;
}

.migration-popup-label {
  font-weight: 500;
  color: #6b7280;
}

/* Migration path lines */
.migration-path {
  pointer-events: stroke;
}

.migration-path:hover {
  stroke-opacity: 1 !important;
  stroke-width: 3 !important;
}

/* Stats bar below the map */
.migration-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 0.75rem 0.75rem;
  font-size: 0.875rem;
  color: #6b7280;
}

.migration-stats-bar .stat-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.migration-stats-bar .stat-value {
  font-weight: 600;
  color: #374151;
}

/* Timeline slider */
.migration-timeline-slider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-top: none;
}

.migration-timeline-slider label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #6b7280;
  white-space: nowrap;
}

.migration-timeline-slider .range-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.migration-timeline-slider input[type="range"] {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #e5e7eb;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.migration-timeline-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0d9488;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

.migration-timeline-slider input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0d9488;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

.migration-timeline-slider .year-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
  min-width: 3rem;
  text-align: center;
}

/* Loading overlay */
.migration-map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(248, 250, 252, 0.9);
  z-index: 1000;
  border-radius: 0.75rem;
}

.migration-map-loading .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: #0d9488;
  border-radius: 50%;
  animation: migration-spin 0.8s linear infinite;
}

.migration-map-loading .loading-text {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: #6b7280;
}

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

/* Empty state */
.migration-map-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  background: #fff;
  border-radius: 0.75rem;
  border: 2px dashed #e5e7eb;
  min-height: 300px;
}

.migration-map-empty svg {
  width: 64px;
  height: 64px;
  color: #9ca3af;
  margin-bottom: 1rem;
}

.migration-map-empty .empty-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
}

.migration-map-empty .empty-description {
  font-size: 0.875rem;
  color: #6b7280;
  max-width: 320px;
}

/* Generation legend */
.migration-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 0.75rem 0.75rem;
}

.migration-legend-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.migration-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
