
/* =====================================================
   Piliscsaba Értékei – Interactive Map CSS
   Organized by: Layout, Map, Points, Tooltips, Sidebar, Detail Panel, Responsive
   ===================================================== */

/* ========== 1. Base & Layout ========== */
html, body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  height: auto;
  overflow: hidden;
  font-family: system-ui, sans-serif;
  background: #f6f7f9;
}

#layout {
  position: relative;
  display: flex;
  gap: 20px;
  align-items: stretch;
  justify-content: stretch;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  height: auto;
  padding: 20px;
  box-sizing: border-box;
}

/* ========== 2. Map & Map Container ========== */
#map-container {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 40px);
  min-height: calc(100dvh - 40px);
  box-sizing: border-box;
}

#map-viewport {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 300px;
  border: 1px solid #ccc;
  background: #fff;
  overflow: hidden;
  min-width: 0;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#map-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
}

#map-image {
  max-width: 100%;
  height: auto;
  display: block;
}

#map-points {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ========== 3. Sidebar Toggle Button ========== */
#toggle-list {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2000;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  color: #111;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}
#toggle-list:hover {
  background: #fafafa;
}

/* ========== 4. Map Points ========== */
.map-point,
.tooltip {
  pointer-events: auto;
}
.map-point {
  position: absolute;
  width: 16px;
  height: 16px;
  background: #c62828;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  box-shadow: 0 0 0 2px #fff;
  transition: transform 0.2s ease, background-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  line-height: 1;
  z-index: 20;
}
.map-point:hover {
  transform: translate3d(-50%, -50%) scale(1.4);
  font-size: 14px;
  background: #ff5252;
}
.map-point.highlight {
  background: #ffaa3b;
  transform: translate3d(-50%, -50%) scale(1.4);
  font-size: 14px;
}

/* ========== 5. Tooltips ========== */
.tooltip {
  position: absolute;
  background: #fff;
  padding: 12px 12px 10px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  width: 240px;
  display: none;
  z-index: 30;
  font-family: system-ui, sans-serif;
  font-size: 14px;
}
.tooltip-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #444;
  color: #fff;
  font-size: 16px;
  line-height: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tooltip-close-btn:hover {
  background: #000;
}
.tooltip.visible {
  display: block;
}
.tooltip .tooltip-title {
  font-size: 15px;
}
.tooltip .tooltip-thumb {
  width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 6px 0;
  object-fit: cover;
  max-height: 140px;
}
.tooltip .tooltip-address {
  font-style: italic;
  color: #555;
}
.tooltip .tooltip-link-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 10px;
  background: #0073aa;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-size: 13px;
}

/* ========== 6. Sidebar ========== */
#sidebar {
  position: absolute;
  top: 26px;
  right: 26px;
  width: 320px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  transform: translateX(110%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 1000;
}
.sidebar-open #sidebar {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
#sidebar .sidebar-title {
  margin: 0;
  font-size: 18px;
}

/* Sidebar list styles */
#value-list {
  margin: 0;
  padding: 10px;
  list-style: none;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 14px;
  overflow-y: auto;
  flex: 1 1 auto;
  max-height: calc(100% - 58px);
}
#value-list .value-item {
  padding: 10px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}
#value-list .value-item:last-child {
  border-bottom: none;
}
#value-list .value-item:hover {
  background: #f3f7ff;
}

#value-filter {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 14px;
}

/* ========== 7. Detail Panel (Mobile) ========== */
#detail-panel {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  #detail-panel {
    display: flex;
    position: absolute;
    left: 26px;
    top: 26px;
    width: min(360px, calc(100% - 52px));
    max-width: 420px;
    transform: translateY(0);
    opacity: 0;
    pointer-events: none;
    flex-direction: column;
    gap: 12px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.16);
    overflow: auto;
    max-height: calc(100vh - 52px);
    z-index: 9999;
  }
  .detail-open #detail-panel {
    opacity: 1;
    pointer-events: auto;
  }
  .detail-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #444;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  #detail-body {
    overflow-y: auto;
    max-height: calc(100% - 64px);
  }
}

/* ========== 8. Responsive ========== */
@media (max-width: 920px) {
  #layout {
    flex-direction: column;
    align-items: stretch;
  }
  #sidebar {
    width: calc(100% - 32px);
    max-width: 100%;
    right: 16px;
    left: 16px;
    bottom: 16px;
    top: auto;
    height: 50%;
    transform: translateY(110%);
  }
  .sidebar-open #sidebar {
    transform: translateY(0);
  }
}
