:root { 
  --bg:#f9fafb; 
  --ink:#1f2937; 
  --ink2:#374151; 
  --brand:#3b82f6; 
}

* { 
  box-sizing: border-box; 
  font-family: 'Heebo', sans-serif; 
}

html, body { 
  height: 100%; 
  margin: 0; 
  background: var(--bg); 
}

.page { 
  min-height: 100%; 
  display: flex; 
  flex-direction: column; 
}

header {
  background: #000; 
  color: #fff; 
  padding: 20px 20px; 
  height: 72px;
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  gap: 10px;
}

header h1 { 
  font-size: 20px; 
  margin: 0; 
}

header img { 
  height: 32px; 
  transition: opacity .2s; 
}

header img:hover { 
  opacity: .8; 
}

.map-wrap { 
  flex: 1; 
  position: relative; 
}

#map { 
  position: absolute; 
  inset: 0; 
}

/* Keep Leaflet UI LTR but the rest RTL */
#map .leaflet-container { 
  direction: ltr; 
}

/* Custom pin */
.map-pin-container { 
  position: relative; 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
}

.map-pin-circle {
  background: #fff; 
  border: 3px solid var(--ink);
  border-radius: 50%; 
  width: 60px; 
  height: 60px;
  display: flex; 
  align-items: center; 
  justify-content: center;
  font-size: 11px; 
  font-weight: 700; 
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  transition: all .3s ease; 
  cursor: pointer;
  text-align: center; 
  line-height: 1.2; 
  padding: 2px; 
  position: relative; 
  z-index: 1000;
}

.map-pin-text {
  max-width: 100%; 
  overflow: hidden; 
  display: -webkit-box;
  -webkit-line-clamp: 2; 
  line-clamp: 2; 
  -webkit-box-orient: vertical; 
  word-break: break-word;
}

.map-pin-pointer {
  width: 0; 
  height: 0; 
  border-left: 8px solid transparent; 
  border-right: 8px solid transparent;
  border-top: 15px solid var(--ink); 
  margin-top: -3px; 
  transition: all .3s ease; 
  position: relative; 
  z-index: 1000;
}

.map-pin-container:hover .map-pin-circle {
  transform: scale(1.1); 
  box-shadow: 0 8px 25px rgba(0,0,0,.35);
  border-color: var(--brand); 
  color: var(--brand);
}

.map-pin-container:hover .map-pin-pointer { 
  border-top-color: var(--brand); 
}

/* Popup */
.leaflet-popup-content-wrapper {
  border-radius: 16px; 
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  border: none; 
  overflow: hidden; 
  background: #fff;
}

.leaflet-popup { 
  filter: none !important; 
}

.leaflet-popup-content { 
  margin: 0; 
  padding: 0; 
  line-height: 1.5; 
  direction: rtl; 
  width: 250px !important; 
}

.popup-content { 
  padding: 24px; 
  text-align: center; 
  background: #fff; 
}

.popup-title { 
  font-size: 16px; 
  font-weight: 700; 
  color: var(--ink); 
  margin: 0 0 20px 0; 
  line-height: 1.3; 
}

.popup-button {
  display: inline-block; 
  background: var(--ink); 
  color: #fff !important; 
  padding: 12px 24px;
  border-radius: 8px; 
  text-decoration: none; 
  font-weight: 600; 
  font-size: 14px;
  transition: all .3s ease; 
  border: none; 
  cursor: pointer;
}

.popup-button:hover {
  background: var(--ink2); 
  color: #fff !important; 
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(31,41,55,.3);
}

.leaflet-popup-tip { 
  background: #fff; 
  border: none; 
  box-shadow: 0 3px 8px rgba(0,0,0,.1); 
}

.leaflet-popup-close-button { 
  display: none !important; 
}

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

.leaflet-control-zoom {
  border: none !important; 
  box-shadow: 0 4px 12px rgba(0,0,0,.1) !important;
}

.leaflet-control-zoom a {
  background: rgba(255,255,255,.9) !important; 
  border: 1px solid #e5e7eb !important;
  color: #374151 !important; 
  font-weight: 600 !important; 
  backdrop-filter: blur(10px);
}

.leaflet-control-zoom a:hover { 
  background: #fff !important; 
  border-color: #d1d5db !important; 
}

/* Legend */
.legend {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.95);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  backdrop-filter: blur(10px);
  z-index: 1000;
  min-width: 200px;
  direction: rtl;
}

.legend h3 {
  margin: 0 0 15px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
}

.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 500;
  gap: 8px;
}

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

.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin-left: 5px;
  flex-shrink: 0;
}

/* Mobile responsive legend */
@media (max-width: 768px) {
  .legend {
    top: 10px;
    right: 10px;
    padding: 12px;
    min-width: 140px;
    max-width: 180px;
  }
  
  .legend h3 {
    font-size: 14px;
    margin: 0 0 10px 0;
  }
  
  .legend-item {
    margin-bottom: 8px;
    font-size: 12px;
  }
  
  .legend-color {
    width: 16px;
    height: 16px;
    margin-left: 4px;
  }
}

.legend-red { 
  background-color: #dc2626; 
}

.legend-green { 
  background-color: #16a34a; 
}

.legend-purple { 
  background-color: #9333ea; 
}

/* Light rail station markers */
.light-rail-marker {
  background: #dc2626;
  border: 3px solid #fff;
  border-radius: 50%;
  width: 12px;
  height: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  transition: all .3s ease;
}

.light-rail-marker:hover {
  transform: scale(1.5);
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
}

/* Light rail tooltip styling */
.leaflet-tooltip.light-rail-tooltip {
  background: rgba(0, 0, 0, 0.9);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 8px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
  direction: rtl;
  white-space: nowrap;
  z-index: 1000;
  opacity: 1;
  pointer-events: none;
  text-align: center;
  margin-top: 0;
  margin-left: 0;
  max-width: 200px;
}

.leaflet-tooltip.light-rail-tooltip::before {
  border-left-color: rgba(0, 0, 0, 0) !important;
  border-right: none !important;
  border-top: 6px solid transparent !important;
  border-bottom: 6px solid transparent !important;
  border-left: 8px solid rgba(0, 0, 0, 0) !important;
  right: -8px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
}

/* Disable text selection and copying */
* {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

/* Disable image dragging */
img, svg, canvas {
  -webkit-user-drag: none !important;
  -khtml-user-drag: none !important;
  -moz-user-drag: none !important;
  -o-user-drag: none !important;
  user-drag: none !important;
  pointer-events: none !important;
}

/* Map container protection */
#map {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

/* Disable context menu on map */
#map * {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

/* Disable right-click context menu */
body {
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  -khtml-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}

/* Info icon styling */
.info-icon {
  background: none;
  border: none;
  font-size: 12px;
  cursor: pointer;
  padding: 2px;
  border-radius: 3px;
  transition: all 0.2s ease;
  opacity: 0.6;
  margin-right: 0px;
  margin-top: 1px;
  text-decoration: none;
  color: #666;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.info-icon:hover {
  opacity: 1;
  background-color: rgba(0, 0, 0, 0);
  transform: scale(1.1);
  color: #333;
  border-radius: 100px;
}

.info-icon i {
  font-size: 12px;
}

/* Mobile responsive info icon */
@media (max-width: 768px) {
  .info-icon {
    font-size: 10px;
    width: 16px;
    height: 16px;
  }
  
  .info-icon i {
    font-size: 10px;
  }
}
