/* === Map Page Layout === */
.map-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

@media (max-width: 1023px) {
  .map-layout {
    flex-direction: column;
  }
}

/* === Map Container === */
.map-main {
  flex: 1;
  min-width: 0;
}

.map-viewport {
  position: relative;
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-80);
  cursor: grab;
  overflow: hidden;
  aspect-ratio: 1 / 1;
}

.map-viewport:active { cursor: grabbing; }

.map-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  transition: transform 0.15s ease;
}

.map-inner img.map-bg {
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  pointer-events: none;
}

/* === Markers === */
.map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 2;
  transition: transform 0.15s, filter 0.15s;
}

.map-marker:hover {
  transform: translate(-50%, -50%) scale(1.3);
  z-index: 10;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.map-marker.collected {
  opacity: 0.4;
}

.map-marker.collected .marker-check {
  display: block;
}

.marker-check {
  display: none;
  position: absolute;
  top: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #10b981;
  border: 1.5px solid white;
  z-index: 3;
}

.marker-check svg {
  width: 8px;
  height: 8px;
}

/* === Zoom Controls === */
.map-zoom {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 5;
}

.map-zoom button {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-95);
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: background 0.15s;
}

.map-zoom button:hover {
  background: var(--bg-80);
}

/* === Region Selector === */
.map-regions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.region-btn {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.region-btn:hover { border-color: var(--primary); color: var(--primary); }

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

/* === Sidebar Panel === */
.map-sidebar {
  width: 320px;
  flex-shrink: 0;
}

@media (max-width: 1023px) {
  .map-sidebar { width: 100%; }
}

.map-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow);
}

/* === Filter Chips === */
.map-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  color: var(--text);
}

.filter-chip:hover { border-color: var(--primary); }

.filter-chip.active {
  border-color: var(--primary);
  background: var(--primary-10);
  color: var(--primary);
}

.filter-chip .chip-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.filter-chip .chip-count {
  font-size: 0.7rem;
  opacity: 0.7;
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
}

.filter-actions button {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
}

.filter-actions button:hover { text-decoration: underline; }

.filter-actions label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  cursor: pointer;
}

.filter-actions input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #10b981;
}

/* === Marker List === */
.map-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.map-list-header .list-count {
  font-size: 0.75rem;
  font-weight: 600;
}

.marker-list {
  max-height: 500px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.marker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
  font-size: 0.82rem;
  color: var(--text);
}

.marker-item:hover { background: var(--primary-10); }

.marker-item.active { background: var(--primary-10); }

.marker-item.collected-item { opacity: 0.5; }

.marker-item .item-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.marker-item .item-id {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.marker-item .item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marker-item .item-collect-btn {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.marker-item .item-collect-btn.collected {
  color: #10b981;
}

.map-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 1.5rem 0;
}

/* === Tooltip === */
.map-tooltip {
  position: absolute;
  z-index: 20;
  background: var(--bg-95);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  box-shadow: var(--shadow-md);
  font-size: 0.8rem;
  pointer-events: none;
  white-space: nowrap;
  max-width: 240px;
  backdrop-filter: blur(8px);
}

.map-tooltip .tooltip-id {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* === Mobile === */
@media (max-width: 767px) {
  .marker-list { max-height: 300px; }
  .map-regions { gap: 0.35rem; }
  .region-btn { padding: 0.3rem 0.6rem; font-size: 0.78rem; }
}
