/* Remove default container padding for map page */
body:has(.world-map-container) {
  overflow: hidden !important;
}

body:has(.world-map-container) .container {
  padding: 0 !important;
  max-width: 100% !important;
  margin: 0 !important;
}

/* World Map Container */
.world-map-container {
  width: 100vw;
  height: calc(100vh - 60px);
  position: fixed;
  top: 60px;
  left: 0;
  background-color: #f0f9ff;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* Map Canvas */
.map-canvas {
  width: 100%;
  height: 100%;
  background-color: #f8f9fa;
  z-index: 1;
}

/* Map Legend */
.map-legend {
  position: absolute;
  top: 140px;
  right: 20px;
  background-color: rgba(15, 23, 42, 0.95);
  border: 2px solid #334155;
  border-radius: 8px;
  padding: 1rem;
  z-index: 1000;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  color: #e2e8f0;
  font-size: 0.875rem;
}

.legend-item:last-child {
  margin-bottom: 0;
}

.legend-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.legend-icon.historical {
  background-color: #f59e0b;
}

.legend-icon.fictional {
  background-color: #8b5cf6;
}

.legend-icon.living {
  background-color: #10b981;
}

.legend-icon.user {
  background-color: #ec4899;
}

/* Custom Avatar Markers */
.custom-avatar-marker {
  background: transparent;
  border: none;
}

/* Custom Avatar Marker with Pin */
.custom-avatar-marker {
  position: relative;
}

/* Pear-shaped pin container */
.marker-pin {
  position: relative;
  width: 50px;
  height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s ease;
}

/* Circular avatar at top */
.marker-pin::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  background-color: currentColor;
  background-image: var(--avatar-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 50%;
  border: 2px solid #ff6600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 1;
}

/* Triangular pin at bottom - pear shape */
.marker-pin::after {
  content: '';
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 32px solid currentColor;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  z-index: 0;
}

.marker-pin:hover {
  transform: scale(1.1);
}


/* Custom Popup Styles */
.leaflet-popup-content-wrapper {
  background-color: #ffffff;
  color: #1f2937;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-tip {
  background-color: #ffffff;
  border: 2px solid #e5e7eb;
  border-top: none;
  border-right: none;
}

.leaflet-popup-close-button {
  color: #6b7280 !important;
  font-size: 20px !important;
  font-weight: 700 !important;
  padding: 4px 8px !important;
  right: 8px !important;
  top: 8px !important;
}

.leaflet-popup-close-button:hover {
  color: #1f2937 !important;
}

.avatar-popup {
  padding: 0.5rem;
  min-width: 180px;
}

.popup-info {
  text-align: left;
  margin-bottom: 0.5rem;
}

.avatar-name {
  margin: 0 0 0.25rem 0;
  color: #111827;
  font-size: 0.875rem;
  font-weight: 600;
}

.avatar-username {
  margin: 0 0 0.25rem 0;
  color: #6b7280;
  font-size: 0.75rem;
  font-weight: 500;
}

.avatar-type {
  color: #6b7280;
  font-size: 0.875rem;
  text-transform: capitalize;
  margin: 0 0 0.75rem 0;
}

.avatar-about {
  color: #374151;
  font-size: 0.75rem;
  line-height: 1.4;
  margin: 0 0 0.5rem 0;
  max-height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff !important;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.75rem;
  transition: all 0.2s ease;
  width: 100%;
  margin: 0 auto;
}

.chat-link:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.chat-link svg {
  width: 12px;
  height: 12px;
}

/* Leaflet Controls Customization */
.leaflet-control-zoom {
  border: 2px solid #e0e7ff !important;
  border-radius: 8px !important;
  overflow: hidden;
  display: flex !important;
  flex-direction: row !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
  margin-top: 30px !important;
}

.leaflet-control-zoom a {
  background-color: #ffffff !important;
  color: #4f46e5 !important;
  border: none !important;
  border-right: 1px solid #e0e7ff !important;
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  font-size: 20px !important;
  font-weight: 700 !important;
  float: none !important;
  display: inline-block !important;
}

.leaflet-control-zoom a:last-child {
  border-right: none !important;
}

.leaflet-control-zoom a:hover {
  background-color: #eef2ff !important;
  color: #6366f1 !important;
}

.leaflet-bar {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5) !important;
}

/* Attribution */
.leaflet-control-attribution {
  background-color: rgba(255, 255, 255, 0.9) !important;
  color: #6b7280 !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 4px !important;
  font-size: 0.75rem !important;
  padding: 2px 6px !important;
}

.leaflet-control-attribution a {
  color: #4f46e5 !important;
}

/* Geocoder Control Customization */
.leaflet-control-geocoder {
  background-color: #ffffff !important;
  border: 2px solid #e5e7eb !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  min-width: 300px !important;
  padding: 0 !important;
  margin-top: 30px !important;
}

.leaflet-control-geocoder-form {
  background-color: #ffffff !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  display: block !important;
  box-sizing: border-box !important;
}

.leaflet-control-geocoder-form input {
  background-color: #ffffff !important;
  color: #1f2937 !important;
  border: none !important;
  border-radius: 6px !important;
  padding: 10px 14px !important;
  font-size: 0.875rem !important;
  width: 100% !important;
  box-sizing: border-box !important;
  display: block !important;
  margin: 0 !important;
}

.leaflet-control-geocoder-form input::placeholder {
  color: #9ca3af !important;
}

.leaflet-control-geocoder-form input:focus {
  outline: none !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

.leaflet-control-geocoder-alternatives {
  background-color: #ffffff !important;
  border: none !important;
  border-top: 1px solid #e5e7eb !important;
  border-radius: 0 0 6px 6px !important;
  margin-top: 4px !important;
  max-height: 200px !important;
  overflow-y: auto !important;
}

.leaflet-control-geocoder-alternatives-minimized {
  display: none !important;
}

.leaflet-control-geocoder-alternative {
  color: #1f2937 !important;
  border-top: 1px solid #f3f4f6 !important;
  padding: 10px 14px !important;
  cursor: pointer !important;
}

.leaflet-control-geocoder-alternative:hover {
  background-color: #f3f4f6 !important;
}

.leaflet-control-geocoder-alternative-first {
  border-top: none !important;
}

.leaflet-control-geocoder-icon {
  display: none !important;
}

.leaflet-control-geocoder.leaflet-control-geocoder-expanded {
  background-color: #ffffff !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  .map-header {
    padding: 1.5rem 1rem;
  }
  
  .map-header h1 {
    font-size: 1.5rem;
  }
  
  .map-legend {
    top: 120px;
    right: 10px;
    padding: 0.75rem;
    font-size: 0.75rem;
  }
  
  .legend-icon {
    width: 12px;
    height: 12px;
  }
  
  .marker-pin {
    width: 40px;
    height: 50px;
  }
  
  .marker-pin::before {
    width: 32px;
    height: 32px;
    border-width: 2px;
  }
  
  .marker-pin::after {
    top: 22px;
    border-left-width: 12px;
    border-right-width: 12px;
    border-top-width: 28px;
  }
  
  .avatar-popup {
    min-width: 160px;
  }
}
