/* ============================================
   PinDrop Map Styles
   ============================================ */

/* ---- Map Container ---- */
.map-wrapper {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-base);
}

#map {
  width: 100%;
  height: 100%;
}


/* ---- Map Controls Overlay ---- */
.map-controls {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  z-index: var(--z-dropdown);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.map-control-btn {
  width: 40px;
  height: 40px;
  background: var(--surface-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.map-control-btn:hover {
  background: var(--color-gray-50);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
}

.map-control-btn.active {
  background: var(--color-primary-600);
  color: white;
  border-color: var(--color-primary-600);
}

.map-control-btn svg {
  width: 20px;
  height: 20px;
}


/* ---- Category Filter Bar (Bottom) ---- */
.map-category-bar {
  position: absolute;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-dropdown);
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  max-width: calc(100vw - var(--space-8));
  overflow-x: auto;
  scrollbar-width: none;
}

.map-category-bar::-webkit-scrollbar {
  display: none;
}

.map-category-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.map-category-btn:hover {
  background: var(--color-gray-100);
  color: var(--text-primary);
}

.map-category-btn.active {
  background: var(--color-primary-600);
  color: var(--text-inverse);
  border-color: var(--color-primary-600);
}


/* ---- Add Place Button ---- */
.add-place-fab {
  position: absolute;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-dropdown);
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--color-primary-600);
  color: white;
  border: none;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.add-place-fab:hover {
  background: var(--color-primary-700);
  box-shadow: var(--shadow-xl);
  transform: scale(1.08);
}

.add-place-fab svg {
  width: 24px;
  height: 24px;
}

.add-place-fab-tooltip {
  position: absolute;
  right: calc(100% + 12px);
  white-space: nowrap;
  background: var(--color-gray-800);
  color: white;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.add-place-fab:hover .add-place-fab-tooltip {
  opacity: 1;
}


/* ---- Custom Leaflet Popup ---- */
.leaflet-popup-content-wrapper {
  background: var(--surface-primary) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-xl) !important;
  padding: 0 !important;
  border: 1px solid var(--border-light) !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  min-width: 260px;
  max-width: 320px;
}

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

.leaflet-popup-close-button {
  color: var(--text-tertiary) !important;
  font-size: 18px !important;
  width: 28px !important;
  height: 28px !important;
  top: 8px !important;
  right: 8px !important;
}

.leaflet-popup-close-button:hover {
  color: var(--text-primary) !important;
}

.popup-content {
  padding: 0;
}

.popup-image {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.popup-body {
  padding: var(--space-3) var(--space-4) var(--space-4);
}

.popup-category {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-primary-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-1);
}

.popup-title {
  font-size: var(--text-base);
  font-weight: 600;
  font-family: var(--font-heading);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.popup-rating {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.popup-description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.popup-actions {
  display: flex;
  gap: var(--space-2);
}

.popup-actions .btn {
  flex: 1;
  font-size: var(--text-xs);
  padding: var(--space-2) var(--space-3);
}


/* ---- Custom Marker Styles ---- */
.custom-marker {
  background: var(--color-primary-600);
  border: 3px solid var(--surface-primary);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  width: 38px !important;
  height: 38px !important;
  margin-left: -19px !important;
  margin-top: -19px !important;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.custom-marker:hover {
  transform: scale(1.15);
  box-shadow: var(--shadow-lg);
  z-index: 1000 !important;
}

.custom-marker.house { background: #6366f1; }
.custom-marker.shop { background: #ec4899; }
.custom-marker.restaurant { background: #f97316; }
.custom-marker.hospital { background: #ef4444; }
.custom-marker.park { background: #22c55e; }
.custom-marker.school { background: #8b5cf6; }
.custom-marker.temple { background: #d97706; }
.custom-marker.office { background: #0ea5e9; }
.custom-marker.gym { background: #14b8a6; }
.custom-marker.other { background: #64748b; }


/* ---- Side Panel (Place Details) ---- */
.side-panel {
  position: fixed;
  top: var(--nav-height);
  right: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--nav-height));
  background: var(--surface-primary);
  border-left: 1px solid var(--border-light);
  box-shadow: var(--shadow-2xl);
  z-index: var(--z-overlay);
  transform: translateX(100%);
  transition: transform var(--transition-slow) cubic-bezier(0.33, 1, 0.68, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.side-panel.open {
  transform: translateX(0);
}

.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.side-panel-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.side-panel-hero {
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: var(--color-gray-100);
}

.side-panel-info {
  padding: var(--space-5);
}

.side-panel-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: var(--space-1);
}

.side-panel-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.side-panel-section {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-gray-100);
}

.side-panel-section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}


/* ---- Detail List ---- */
.detail-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.detail-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.detail-icon {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  margin-top: 2px;
}

.detail-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}


/* ---- Map Instruction Overlay ---- */
.map-instruction {
  position: absolute;
  top: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-dropdown);
  background: var(--color-primary-600);
  color: white;
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: fadeInDown 300ms ease, pulse 2s ease-in-out infinite;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.map-instruction .close-instruction {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  margin-left: var(--space-2);
  padding: 2px;
}

.map-instruction .close-instruction:hover {
  color: white;
}


/* ---- Leaflet Override ---- */
.leaflet-control-zoom {
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-md) !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-light) !important;
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  font-size: 16px !important;
}

.leaflet-control-zoom a:hover {
  background: var(--color-gray-50) !important;
}

.leaflet-control-attribution {
  font-size: 10px !important;
  background: rgba(255, 255, 255, 0.85) !important;
  padding: 2px 6px !important;
}


/* ---- Marker Cluster Override ---- */
.marker-cluster-small {
  background-color: rgba(59, 130, 246, 0.2) !important;
}
.marker-cluster-small div {
  background-color: var(--color-primary-500) !important;
  color: white !important;
  font-family: var(--font-heading) !important;
  font-weight: 600 !important;
}

.marker-cluster-medium {
  background-color: rgba(245, 158, 11, 0.2) !important;
}
.marker-cluster-medium div {
  background-color: var(--color-warning-500) !important;
  color: white !important;
  font-family: var(--font-heading) !important;
  font-weight: 600 !important;
}

.marker-cluster-large {
  background-color: rgba(239, 68, 68, 0.2) !important;
}
.marker-cluster-large div {
  background-color: var(--color-danger-500) !important;
  color: white !important;
  font-family: var(--font-heading) !important;
  font-weight: 600 !important;
}
