/* Mining Map - Palantir Style v3 */
/* Polished with animations, better typography, and 3D effects */

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { 
    box-shadow: 0 0 0 0 currentColor;
    filter: brightness(1);
  }
  50% { 
    box-shadow: 0 0 15px 3px currentColor;
    filter: brightness(1.2);
  }
}

@keyframes ring-pulse {
  0%, 100% { 
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.5;
  }
  50% { 
    transform: translate(-50%, -50%) scale(1.3);
    opacity: 0.1;
  }
}

@keyframes glow {
  0%, 100% { filter: brightness(1) saturate(1); }
  50% { filter: brightness(1.2) saturate(1.1); }
}

.custom-marker {
  background: transparent !important;
  border: none !important;
}

.asset-marker-container {
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

.asset-marker-container:hover {
  transform: scale(1.3) !important;
  z-index: 10000 !important;
}

.asset-marker {
  transition: all 0.2s ease;
}

.asset-marker.operating,
.asset-marker.commissioning {
  animation: glow 3s ease-in-out infinite;
}

.metal-indicator {
  transition: all 0.2s ease;
  pointer-events: none;
  opacity: 0.9;
}

.asset-marker-container:hover .metal-indicator {
  opacity: 1;
  transform: translate(calc(-50% + var(--x, 0)), calc(-50% + var(--y, 0))) scale(1.15);
}

/* Dark Popup - Refined */
.dark-popup .leaflet-popup-content-wrapper {
  background: rgba(8, 8, 12, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: #fff;
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.02),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(24px);
}

.dark-popup .leaflet-popup-content {
  margin: 14px 16px;
}

.dark-popup .leaflet-popup-tip {
  background: rgba(8, 8, 12, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.dark-popup .leaflet-popup-close-button {
  color: #444 !important;
  font-size: 20px;
  padding: 8px 10px;
  transition: color 0.2s;
}

.dark-popup .leaflet-popup-close-button:hover {
  color: #fff !important;
}

/* Dark Tooltip - Refined */
.dark-tooltip {
  background: rgba(8, 8, 12, 0.94) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 4px !important;
  padding: 10px 14px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
  backdrop-filter: blur(16px) !important;
}

.dark-tooltip .tooltip-content {
  line-height: 1.4;
}

.dark-tooltip .tooltip-name {
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 2px;
}

.dark-tooltip .tooltip-meta {
  font-size: 10px;
  color: #666;
}

.dark-tooltip .tooltip-prod {
  font-size: 10px;
  color: #888;
  margin-top: 4px;
  font-family: 'SF Mono', Monaco, monospace;
}

.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
  border-color: transparent !important;
}

/* Popup Content - Refined */
.asset-popup {
  min-width: 240px;
  max-width: 300px;
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.popup-header .ticker {
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 10px;
  font-weight: 600;
  color: #555;
  letter-spacing: 1.5px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 8px;
  border-radius: 3px;
}

.stage-badge {
  font-size: 8px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(0, 0, 0, 0.8);
}

.popup-name {
  font-size: 16px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 4px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.popup-location {
  font-size: 11px;
  color: #4a4a4a;
  margin-bottom: 14px;
}

.popup-metals {
  display: flex;
  gap: 5px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.metal-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 4px 7px;
  border-radius: 3px;
  font-family: 'SF Mono', Monaco, monospace;
  color: rgba(0, 0, 0, 0.8);
}

.popup-section {
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.popup-section:first-of-type {
  margin-top: 4px;
}

.section-title {
  font-size: 9px;
  color: #3a3a3a;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  font-weight: 500;
}

.section-content {
  font-size: 12px;
  color: #999;
  font-family: 'SF Mono', Monaco, monospace;
  line-height: 1.6;
}

.popup-notes {
  font-size: 11px;
  color: #444;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  line-height: 1.5;
  font-style: italic;
}

.popup-source {
  font-size: 9px;
  color: #333;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* Map Stats Overlay - Refined */
.map-stats {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 1000;
  display: flex;
  gap: 1px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  overflow: hidden;
}

.stat-item {
  background: rgba(8, 8, 12, 0.88);
  padding: 16px 20px;
  backdrop-filter: blur(24px);
  min-width: 90px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-right: none;
}

.stat-item:last-child {
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.stat-value {
  font-size: 32px;
  font-weight: 300;
  color: #fff;
  font-family: 'SF Mono', Monaco, monospace;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 8px;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 6px;
  font-weight: 500;
}

/* Map Legend - Refined */
.map-legend {
  position: absolute;
  bottom: 100px;
  left: 20px;
  z-index: 1000;
  background: rgba(8, 8, 12, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 16px 20px;
  backdrop-filter: blur(24px);
  border-radius: 6px;
  min-width: 140px;
}

.legend-title {
  font-size: 8px;
  color: #3a3a3a;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 14px;
  font-weight: 600;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 11px;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
  padding: 4px 0;
}

.legend-item:hover {
  color: #fff;
}

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

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.legend-item:hover .legend-dot {
  transform: scale(1.3);
}

.legend-dot.producing {
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

/* Filters - Refined */
.map-filters {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.filter-group {
  background: rgba(8, 8, 12, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 14px 16px;
  backdrop-filter: blur(24px);
  border-radius: 6px;
  margin-bottom: 10px;
}

.filter-title {
  font-size: 8px;
  color: #3a3a3a;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
  font-weight: 600;
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #555;
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'SF Mono', Monaco, monospace;
  border-radius: 4px;
}

.filter-btn:hover {
  border-color: rgba(255, 255, 255, 0.15);
  color: #888;
  background: rgba(255, 255, 255, 0.04);
}

.filter-btn.active {
  border-color: #fff;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

/* Company Select */
.company-select {
  width: 100%;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #888;
  padding: 8px 12px;
  font-size: 11px;
  font-family: 'SF Mono', Monaco, monospace;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23555' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.company-select:hover {
  border-color: rgba(255, 255, 255, 0.15);
  color: #aaa;
}

.company-select:focus {
  outline: none;
  border-color: #fff;
  color: #fff;
}

.company-select option {
  background: #0a0a0a;
  color: #888;
  padding: 8px;
}

/* Size Legend - Refined */
.size-legend {
  position: absolute;
  bottom: 100px;
  right: 20px;
  z-index: 1000;
  background: rgba(8, 8, 12, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 14px 18px;
  backdrop-filter: blur(24px);
  border-radius: 6px;
}

.size-legend-title {
  font-size: 8px;
  color: #3a3a3a;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 14px;
  font-weight: 600;
  text-align: center;
}

.size-scale {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  justify-content: center;
  padding: 0 5px;
}

.size-dot {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}

.size-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 8px;
  color: #3a3a3a;
  letter-spacing: 1px;
}

/* Leaflet overrides */
.leaflet-control-zoom a {
  background: rgba(8, 8, 12, 0.88) !important;
  border: 1px solid rgba(255, 255, 255, 0.04) !important;
  color: #444 !important;
  backdrop-filter: blur(24px);
  width: 34px !important;
  height: 34px !important;
  line-height: 32px !important;
  font-size: 16px !important;
}

.leaflet-control-zoom a:hover {
  background: rgba(20, 20, 25, 0.95) !important;
  color: #fff !important;
}

.leaflet-control-zoom {
  border: none !important;
  border-radius: 6px !important;
  overflow: hidden;
}

.leaflet-control-attribution {
  background: rgba(8, 8, 12, 0.6) !important;
  color: #2a2a2a !important;
  font-size: 9px !important;
  backdrop-filter: blur(10px);
  padding: 4px 8px !important;
}

.leaflet-control-attribution a {
  color: #3a3a3a !important;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .map-stats {
    top: 10px;
    left: 10px;
    right: 10px;
    flex-wrap: wrap;
    gap: 1px;
  }
  
  .stat-item {
    flex: 1;
    min-width: calc(50% - 1px);
    padding: 12px 14px;
  }
  
  .stat-value {
    font-size: 24px;
  }
  
  .stat-label {
    font-size: 7px;
  }
  
  .map-legend,
  .map-filters,
  .size-legend {
    display: none;
  }
}
