* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

#app {
  display: flex;
  height: 100vh;
}

#sidebar {
  width: 300px;
  padding: 16px;
  background: #ffffff;
  border-right: 1px solid #ddd;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#sidebar h1 {
  font-size: 18px;
  margin: 0 0 6px 0;
}

#sidebar label {
  display: block;
  font-size: 14px;
}

#sidebar select, #sidebar input {
  width: 100%;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid #ddd;
  margin-top: 6px;
  font-size: 14px;
  outline: none;
}

#sidebar input:focus, #sidebar select:focus {
  border-color: #bdbdbd;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

#map {
  flex: 1;
}

/* Objekti */
#list-title {
  font-size: 13px;
  color: #555;
  margin-top: 2px;
}

#objects-list {
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  overflow: auto;
  padding: 6px;
  flex: 1;
  min-height: 140px;
  background: #fafafa;
}

.obj-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
  border: 1px solid #eee;
  margin-bottom: 6px;
}

.obj-item:hover {
  background: #f7f7f7;
}

.obj-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 4px;
  flex: 0 0 10px;
  border: 1px solid rgba(0,0,0,0.12);
}

.obj-dot.ok {
  background: #1d3557;
}

.obj-dot.missing {
  background: #e63946;
}

.obj-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.obj-title {
  font-size: 13px;
  font-weight: 700;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.obj-sub {
  font-size: 12px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.obj-empty {
  font-size: 13px;
  color: #666;
  padding: 10px;
}

/* Mobile */
@media (max-width: 768px) {
  #app {
    flex-direction: column;
  }

  #sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #ddd;
    height: 300px;
  }

  #map {
    height: calc(100vh - 300px);
  }
}

/* Mapbox popup fix */
.mapboxgl-popup-content {
  padding: 12px;
  max-width: 280px;
  overflow: hidden;
}

/* Popup */
.popup-wrap { width: 100%; max-width: 260px; }

.popup-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.badge-missing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  background: #ffe8ea;
  color: #b4232c;
  border: 1px solid #f3b2b7;
}

.badge-ok {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  background: #eaf7ee;
  color: #18794e;
  border: 1px solid #bfe9cf;
}

.popup-meta {
  font-size: 12px;
  color: #555;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.popup-desc {
  font-size: 13px;
  margin-bottom: 10px;
  color: #222;
}

.popup-chip {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f5f5f5;
  border: 1px solid #e6e6e6;
  color: #333;
}

/* Slideshow */
.slideshow {
  position: relative;
  width: 100%;
  height: 160px;
  max-width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #f2f2f2;
  border: 1px solid #e7e7e7;
  margin-bottom: 8px;
}

.slideshow img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f5f5f5;
  display: block;
}

.slide-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.15);
  background: rgba(255,255,255,0.92);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.slide-btn:hover { background: rgba(255,255,255,1); }

.slide-prev { left: 8px; }
.slide-next { right: 8px; }

.slide-btn svg { width: 18px; height: 18px; }

.slide-counter {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  color: #fff;
}

.slide-hidden { display: none; }

/* Footer */
#footer {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 5;
}

#footer a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #ddd;
  font-size: 13px;
  text-decoration: none;
  color: #1d3557;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

#footer a:hover {
  background: #f7f7f7;
}
