/* ── Interactive Around Map Section ── */

.around-map-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: var(--space-4);
  background: #fdfcfb; /* matches light beige */
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

@media (min-width: 900px) {
  .around-map-container {
    grid-template-columns: 1fr 300px;
    min-height: 480px; 
    gap: 0; /* Remove gap on desktop so sidebar sits flush with map border */
  }
}

@media (min-width: 1040px) {
  /* Ensure the last section doesn't push the grid row taller on desktop */
  .around-section {
    margin-bottom: 0 !important;
  }
}

/* Map Shell */
.around-map-shell {
  position: relative;
  width: 100%;
  height: 220px; /* Cut map height for mobile */
  background: #f4f7fa;
}

@media (min-width: 900px) {
  .around-map-shell {
    height: 100%;
    border-right: 1px solid var(--color-border);
  }
}

.around-map-inner {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
}

/* Right Side List */
.around-map-sidebar {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  max-height: 320px; /* Cut list height for mobile so it doesn't take up the whole screen */
  overflow: hidden;
  background: #fcfbfa; /* slight beige to match screenshot */
}

@media (min-width: 900px) {
  .around-map-sidebar {
    max-height: 480px;
    padding: 20px 12px;
  }
}

/* Tabs */
.around-map-sidebar-controls {
  display: flex;
  gap: 6px; 
  flex-wrap: nowrap; /* Always force single line */
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px; /* Space for box-shadows/scroll */
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.around-map-sidebar-controls::-webkit-scrollbar {
  display: none;
}

.around-segment {
  flex: 0 0 auto; /* Prevent stretching or squishing */
  padding: 6px 12px; 
  border-radius: 20px;
  background: #f9f9f9;
  border: 1px solid #e2e2e2;
  font-size: 12px; 
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

@media (min-width: 900px) {
  .around-map-sidebar-controls {
    gap: 4px;
  }
  .around-segment {
    padding: 4px 8px;
    font-size: 11px;
  }
}

.around-segment:hover {
  background: #f0f0f0;
  color: var(--color-text);
}

.around-segment.is-active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  box-shadow: 0 2px 6px rgba(31, 77, 59, 0.2); /* assuming primary is a green hue */
  font-weight: 600;
}

.around-map-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain; /* Prevent scroll chaining! */
  display: flex;
  flex-direction: column;
  gap: 10px; /* Middle ground gap */
  padding-right: 8px;
}

/* Scrollbar */
.around-map-list::-webkit-scrollbar { width: 4px; }
.around-map-list::-webkit-scrollbar-track { background: transparent; }
.around-map-list::-webkit-scrollbar-thumb { background-color: var(--color-border); border-radius: 4px; }

/* List Item Card */
.around-map-row {
  display: flex;
  align-items: center;
  padding: 10px 12px; /* Middle ground padding */
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-text);
  transition: all 0.2s ease-out;
  cursor: pointer;
  position: relative;
}

.around-map-row:hover, .around-map-row.is-active {
  background: white;
  border-color: var(--color-border-hover, #d0d0d0);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.around-map-row-icon-wrap {
  width: 24px; /* Tightly hug the icon */
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px; /* Tight gap! */
  flex-shrink: 0;
}

.around-map-row-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.around-map-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.around-map-row-title {
  font-weight: 600;
  font-size: 14px; /* Middle ground text */
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text);
}

.around-map-row-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px; /* Middle ground text */
  color: var(--color-text-secondary);
  font-weight: 500;
}

.around-travel-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto; /* Push to the right edge */
  flex-shrink: 0;
}

.around-travel-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f0f4f8; /* Soft badge background */
  color: #5c6b7a;
  padding: 3px 6px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
}

.around-travel-pill svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.5;
}

/* Subcategory Pill */
.around-map-meta-pill {
  background: #f0f4f8;
  color: #5c6b7a;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}

/* External Link Button */
.around-map-link-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #f0ede9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: all 0.2s;
  flex-shrink: 0;
  margin-left: 12px;
}

/* Target the SVG specifically since lucide replaces the i tag */
.around-map-link-btn svg {
  width: 14px !important;
  height: 14px !important;
}

.around-map-link-btn:hover {
  background: #e4e0db;
  color: var(--color-text);
}

/* Map Markers */
.around-map-marker {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  border: 1.5px solid var(--color-primary);
  transition: background-color 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  z-index: 1;
}

.around-map-marker img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  transition: filter 0.2s ease;
}

/* Hover State - Green Background, No Scale */
.around-map-marker:hover, .around-map-marker.is-active {
  background: var(--color-primary); /* Green background */
  border-color: white; /* White border to pop */
  z-index: 10;
}

/* Invert the icon to white when background is green */
.around-map-marker:hover img, .around-map-marker.is-active img {
  filter: brightness(0) invert(1);
}

/* Home Pin */
.around-map-home-pin {
  position: relative;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 3px solid white;
  z-index: 5;
}

.around-map-home-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

/* Tooltip Popup */
.maplibregl-popup {
  z-index: 50 !important;
}

.maplibregl-popup-content {
  border-radius: var(--radius-md) !important;
  padding: 12px 16px !important;
  box-shadow: var(--shadow-lg) !important;
  border: 1px solid var(--color-border);
  font-family: inherit !important;
}

.around-map-popup h4 {
  margin: 0 0 4px 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  word-wrap: break-word;
}

.around-map-popup p {
  margin: 0;
  font-size: 12px;
  color: var(--color-text-secondary);
}
