/* ── SVG Map Generator — project-specific styles ──
   Shared styles loaded from /shared/style.css
── */

.section { flex-shrink: 0; }

/* ── Small buttons ── */
.small-btn {
  padding: 3px 8px;
  font-size: 10px;
  font-family: 'Space Grotesk', sans-serif;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
}
.small-btn:hover { background: var(--border); color: var(--text); }
.small-btn.active { border-color: var(--accent-cyan); color: var(--accent-cyan); }

/* ── Icon buttons ── */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--border); color: var(--text); }
.icon-btn.active { border-color: var(--accent-cyan); color: var(--accent-cyan); }

/* ── Sort buttons ── */
.sort-btn {
  padding: 3px 6px;
  font-size: 10px;
  font-family: 'Space Grotesk', sans-serif;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.sort-btn:hover { color: var(--text); }
.sort-btn.active { color: var(--accent-cyan); }
/* Lucide chevron-down / chevron-up on the active sort (no unicode arrows) */
.sort-btn.active .sort-arrow::after {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center/contain no-repeat;
}
.sort-btn.active[data-dir="asc"] .sort-arrow::after {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m18 15-6-6-6 6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m18 15-6-6-6 6'/%3E%3C/svg%3E");
}

.row-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Polygon list ── */
.section:last-child {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* Room for the list when open: otherwise the rows above squash it to nothing
   without the sidebar ever overflowing, so auto-collapse never kicks in */
.section:last-child:not(.collapsed):not(.auto-collapsed) { min-height: 170px; }
.section:last-child.collapsed,
.section:last-child.auto-collapsed {
  flex: none;
  min-height: auto;
  overflow: visible;
}
.section:last-child.collapsed .section-body,
.section:last-child.auto-collapsed .section-body {
  display: none;
}
.section:last-child .section-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.section:last-child .section-body > .row {
  flex-shrink: 0;
}
.section:last-child .polygon-filter {
  flex: none;
}
#polygonList {
  flex: 1;
  overflow-y: auto;
  margin-left: -14px;
  padding-left: 14px;
}

#polygonList::-webkit-scrollbar { width: 4px; }
#polygonList::-webkit-scrollbar-track { background: transparent; }
#polygonList::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.polygon-item {
  font-size: 11px;
  color: var(--text-dim);
  padding: 2px 4px;
  margin-left: -10px;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.polygon-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }

.polygon-item.hidden {
  color: var(--text-muted);
  text-decoration: line-through;
  opacity: 0.5;
}

.polygon-item .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.2;
}

.polygon-item.hidden .dot { opacity: 0.3; }

.polygon-filter {
  width: 100%;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 8px;
  outline: none;
  margin-bottom: 6px;
}

.polygon-filter:focus { border-color: var(--accent-cyan); }
.polygon-filter::placeholder { color: var(--text-muted); }


/* ── Painted list ── */
.painted-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-dim);
  padding: 1px 0;
}

.painted-item .swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.painted-item .remove {
  margin-left: auto;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
}

.painted-item .remove:hover { color: #ef4444; }

/* ── Download + Share ── */
.download-row {
  display: flex;
  gap: 6px;
}

.download-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 4px;
  background: var(--accent-cyan);
  color: #fff;
  border: 1px solid var(--accent-cyan);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}

.download-btn:hover {
  box-shadow: var(--glow-cyan);
  filter: brightness(1.15);
}

/* ── Reset button — outlined red, fills on hover (matches pixel-map) ── */
.btn-reset {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 4px;
  background: transparent;
  color: #ef4444;
  border: 1px solid #ef4444;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}

.btn-reset:hover {
  background: #ef4444;
  color: #fff;
}


/* ── Chart area ── */
#chartdiv {
  flex: 1;
  min-width: 0;
  background: #f0f0f0;
}

/* Narrow screens: keep Points and the copyright on one line */
.status-bar .status-item { white-space: nowrap; }
@media (max-width: 560px) {
  #statusMap,
  #statusProj { display: none; }
}

/* -- About panel (crawlable text about the tool), as in the Pixel Map Generator -- */
.status-about {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  color: var(--text-dim);
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}
.status-about:hover { color: var(--text); }
@media (max-width: 560px) { .status-about-more { display: none; } }

.about-popup {
  width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.about-body {
  padding: 4px 20px 18px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
.about-body h2 { font-size: 17px; color: var(--text); margin: 14px 0 6px; }
.about-body h3 { font-size: 13px; color: var(--text); margin: 16px 0 4px; }
.about-body p { margin: 6px 0; }
.about-body ol { margin: 6px 0; padding-left: 20px; }
.about-body li { margin: 3px 0; }
.about-body strong { color: var(--text); font-weight: 600; }
