/* ==========================================================================
   Kustomisasi Leaflet: Balon Marker Kustom, Animasi Radar, dan Popup Modern
   ========================================================================== */

/* Hilangkan background default div icon Leaflet */
.leaflet-custom-div-icon {
  background: transparent !important;
  border: none !important;
}

/* Container Pin / Balon Kustom */
.custom-map-pin {
  position: relative;
  width: 48px;
  height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  transform-origin: bottom center;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-map-pin:hover {
  transform: scale(1.18) translateY(-6px);
  z-index: 9999 !important;
}

.custom-map-pin.is-active {
  transform: scale(1.22) translateY(-8px);
  z-index: 10000 !important;
}

/* Balon / Bubble Marker */
.pin-bubble {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--marker-color, #10B981);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), 0 0 16px var(--marker-color, #10B981);
  border: 2.5px solid #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.3s ease;
  z-index: 5;
}

.custom-map-pin.is-hq .pin-bubble {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #F59E0B, #D97706);
  border: 3px solid #FFFBEB;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 24px rgba(245, 158, 11, 0.85);
}

.pin-bubble-inner {
  transform: rotate(45deg);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Label Pill di bawah Balon (Selalu Horizontal & Presisi di Tengah) */
.pin-label-pill {
  position: absolute;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 3px 10px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  transition: transform 0.2s ease, border-color 0.2s ease;
  z-index: 10;
}

.custom-map-pin:hover .pin-label-pill {
  transform: translateX(-50%) translateY(3px) scale(1.08);
  border-color: #FFFFFF;
}

.pin-code {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-muted);
}

.pin-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: #FFFFFF;
}

.custom-map-pin.is-hq .pin-label-pill {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(15, 23, 42, 0.95);
}

.custom-map-pin.is-hq .pin-name {
  color: #FBBF24;
}

/* Bayangan di bawah Pin */
.pin-shadow {
  position: absolute;
  bottom: 0;
  width: 22px;
  height: 8px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  filter: blur(2px);
  z-index: 1;
}

/* Animasi Gelombang Radar / Pulsa */
.pin-radar-ring {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--pulse-color, #10B981);
  pointer-events: none;
  animation: radarWave 2.4s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
  z-index: 2;
}

.pin-radar-ring.delay-1 {
  animation-delay: 1.2s;
}

.custom-map-pin.is-hq .pin-radar-ring {
  width: 50px;
  height: 50px;
  border-color: #F59E0B;
  border-width: 2.5px;
  animation-duration: 2s;
}

@keyframes radarWave {
  0% {
    transform: translate(-50%, -50%) scale(0.6);
    opacity: 0.9;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.6);
    opacity: 0;
  }
}

/* ==========================================================================
   Leaflet Popup Customization
   ========================================================================== */
.custom-leaflet-popup .leaflet-popup-content-wrapper {
  background: rgba(15, 23, 42, 0.95) !important;
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 20px 35px -5px rgba(0, 0, 0, 0.7);
  padding: 0;
  overflow: hidden;
  color: #F8FAFC;
}

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

.custom-leaflet-popup .leaflet-popup-tip {
  background: rgba(15, 23, 42, 0.95) !important;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.custom-leaflet-popup a.leaflet-popup-close-button {
  top: 10px;
  right: 10px;
  color: #FFFFFF !important;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.2s;
  z-index: 10;
}

.custom-leaflet-popup a.leaflet-popup-close-button:hover {
  background: #EF4444;
}

/* Isi Popup Card */
.location-popup-card {
  display: flex;
  flex-direction: column;
}

.popup-thumb-wrapper {
  position: relative;
  height: 150px;
  overflow: hidden;
}

.popup-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.popup-badge {
  z-index: 2;
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #FFFFFF;
  padding: 3px 8px;
  border-radius: 9999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.popup-hq-pill {
  z-index: 2;
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid #F59E0B;
  color: #F59E0B;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 9999px;
}

.popup-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.popup-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #F8FAFC;
  line-height: 1.3;
}

.popup-category {
  font-size: 0.72rem;
  color: #94A3B8;
}

.popup-address {
  font-size: 0.72rem;
  color: #64748B;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.popup-distance-pill {
  background: rgba(16, 185, 129, 0.12);
  color: #10B981;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
  margin: 4px 0;
}

.popup-snippet {
  font-size: 0.75rem;
  color: #94A3B8;
  line-height: 1.4;
  margin-bottom: 6px;
}

.popup-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.popup-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.popup-btn.primary-btn {
  background: linear-gradient(135deg, #059669, #10B981);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.popup-btn.primary-btn:hover {
  background: linear-gradient(135deg, #047857, #059669);
  transform: translateY(-1px);
}

.popup-btn.secondary-btn {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #FBBF24;
}

.popup-btn.secondary-btn:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: #F59E0B;
}

/* ==========================================================================
   Garis Rute Penghubung Beranimasi (Animated Dash Lines)
   ========================================================================== */
.animated-route-line {
  stroke-dasharray: 8, 8;
  animation: dashAnimation 20s linear infinite;
}

@keyframes dashAnimation {
  to {
    stroke-dashoffset: -1000;
  }
}

.route-tooltip {
  background: rgba(15, 23, 42, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #F8FAFC !important;
  font-size: 0.72rem !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

.diy-boundary-tooltip {
  background: rgba(15, 23, 42, 0.94) !important;
  border: 1.5px solid #10B981 !important;
  color: #10B981 !important;
  font-weight: 700 !important;
  font-size: 0.78rem !important;
  border-radius: 8px !important;
  padding: 5px 12px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6) !important;
}
