/* map.css — map page layout, info bar, legend, popups */
body { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }

.toggle-info {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3);
  color: #ccc; font-size: 13px; font-weight: 500; padding: 5px 14px; border-radius: 4px; cursor: pointer;
  white-space: nowrap;
}
.toggle-info:hover { background: rgba(255,255,255,0.25); color: #fff; }

#info-bar {
  background: #f0f1f5; border-bottom: 1px solid #d8dae0; overflow: clip; flex-shrink: 0;
  position: relative; z-index: 1;
  min-height: 120px; max-height: 600px; padding: 13px 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
#info-bar.collapsed { min-height: 0; max-height: 0; padding-top: 0; padding-bottom: 0; }

.info-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.info-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; color: #1a1a2e; }
.info-card p { font-size: 13px; color: #444; line-height: 1.5; margin: 0; }
.info-card a { color: #2563eb; text-decoration: none; }
.info-card a:hover { text-decoration: underline; }
#generated { font-size: 12px; color: #999; margin-top: 4px; }
.info-title { display: none; font-size: 16px; font-weight: 600; color: #1a1a2e; margin-bottom: 12px; }

/* Layer toggle — now lives inside the legend */
.legend-layer-toggle {
  display: flex; gap: 4px; margin-bottom: 6px; width: 100%;
}
.layer-btn {
  flex: 1; padding: 3px 0; border-radius: 4px; border: 1px solid #d1d5db;
  background: #f9fafb; color: #374151; font-size: 11px; font-weight: 500;
  cursor: pointer; text-align: center; white-space: nowrap; overflow: hidden;
}
.layer-btn.active { background: #1a1a2e; color: #fff; border-color: #1a1a2e; }
.layer-btn:hover:not(.active) { background: #e5e7eb; }

/* Legend */
.legend-toggle {
  display: none; background: none; border: none; font-size: 13px;
  font-weight: 600; cursor: pointer; padding: 0; color: #333;
}
.legend {
  background: white; padding: 10px 14px; border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2); font-size: 13px; line-height: 1.8;
  width: 210px; box-sizing: border-box;
}
.legend i {
  width: 14px; height: 14px; display: inline-block; margin-right: 6px;
  border-radius: 3px; vertical-align: middle;
}
.legend-title {
  font-size: 12px; font-weight: 700; color: #1a1a2e;
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
}
.legend-count { font-size: 11px; color: #9ca3af; }

#map { flex: 1; position: relative; width: 100%; will-change: transform; }

/* Popups */
.info-popup { font-size: 13px; line-height: 1.6; min-width: 200px; }
.popup-title-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 1px;
}
.popup-title-row strong { font-size: 14px; }
.popup-domain { display: block; font-size: 12px; color: #888; margin-bottom: 2px; }
.popup-meta { display: block; font-size: 12px; color: #555; margin-bottom: 2px; }
.popup-section { margin-top: 8px; border-top: 1px solid #e5e7eb; padding-top: 6px; }
.popup-empty { color: #999; font-size: 12px; }

/* Score mode toggle (inside legend) */
.score-mode-toggle {
  display: flex; gap: 4px; margin-bottom: 8px; width: 100%;
}
.mode-btn {
  flex: 1; padding: 3px 0; border-radius: 4px;
  border: 1px solid #d1d5db; background: #f9fafb;
  color: #374151; font-size: 11px; font-weight: 500; cursor: pointer;
  text-align: center; white-space: nowrap; overflow: hidden;
}
.mode-btn.active { background: #1a1a2e; color: #fff; border-color: #1a1a2e; }
.mode-btn:hover:not(.active) { background: #e5e7eb; }

.band-desc { font-style: normal; color: #9ca3af; font-size: 11px; }

/* Score badge */
.score-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; padding: 2px 6px; border-radius: 10px;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.score-badge.no-data { background: #9ca3af; }
.score-badge.score-sm { min-width: 28px; padding: 1px 5px; font-size: 11px; }

/* Dual scores row in popup */
.popup-scores {
  display: flex; gap: 12px; align-items: center;
  margin: 4px 0 2px; font-size: 12px;
}
.popup-score-item { display: flex; align-items: center; gap: 5px; }
.popup-score-label { font-size: 11px; color: #9ca3af; font-weight: 500; }

/* Validation type counts (DV / OV / EV) */
.vt-badge {
  display: inline-block; padding: 0 5px; border-radius: 3px;
  font-size: 10px; font-weight: 600; line-height: 1.7;
}
.vt-badge.dv { background: #fee2e2; color: #991b1b; }
.vt-badge.ov { background: #dcfce7; color: #15803d; }
.vt-badge.ev { background: #d1fae5; color: #065f46; }

/* Zone badges */
.zone-badge {
  display: inline-block; padding: 0 5px; border-radius: 3px;
  font-size: 10px; font-weight: 700; line-height: 1.7;
}
.zone-1 { background: #d1fae5; color: #065f46; }
.zone-2 { background: #fef3c7; color: #92400e; }
.zone-3 { background: #fee2e2; color: #991b1b; }

/* Issuer table */
.issuer-table {
  border-collapse: collapse; width: 100%; margin-top: 2px; font-size: 12px;
}
.issuer-table th {
  text-align: left; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px; color: #9ca3af;
  padding: 0 8px 4px 0; border-bottom: 1px solid #e5e7eb;
}
.issuer-table td {
  padding: 3px 8px 3px 0; vertical-align: middle;
  border-bottom: 1px solid #f3f4f6;
}
.issuer-table tr:last-child td { border-bottom: none; }
.iss-name { font-weight: 500; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iss-count { color: #374151; text-align: right; }
.iss-cc { color: #6b7280; font-family: ui-monospace, monospace; }

@media (max-width: 600px) {
  .info-title { display: block; }
  .info-grid { grid-template-columns: 1fr; }
  .legend-toggle { display: block; }
  .legend.legend-collapsed .legend-content { display: none; }
  .legend.legend-collapsed { padding: 8px 12px; }
}
