/* YOLO Street View Viewer — inspect per-image YOLO detections with bbox
   overlays, side-of-street analysis, and derived parking signals. */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: #1a1a1a;
  background: #f1f5f9;
  min-height: 100vh;
}

#loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  font-size: 18px;
  color: #64748b;
  z-index: 9999;
}

#loading.hidden { display: none; }

/* Top bar */
#topbar {
  background: #0f172a;
  color: #f8fafc;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

#topbar h1 {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.controls button {
  background: #334155;
  color: #f8fafc;
  border: none;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.controls button:hover { background: #475569; }

#counter {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  min-width: 80px;
  text-align: center;
}

.controls select {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #475569;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.controls label {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.filter-count {
  font-size: 11px;
  color: #94a3b8;
}

/* Main layout */
#main {
  display: flex;
  gap: 16px;
  padding: 16px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Image section */
#image-section {
  flex-shrink: 0;
}

#image-container {
  position: relative;
  width: 500px;
  height: 500px;
  background: #0f172a;
  border-radius: 8px;
  overflow: hidden;
}

#street-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#center-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 2px dashed rgba(255, 50, 50, 0.5);
  pointer-events: none;
  z-index: 2;
}

#bbox-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.det-box {
  position: absolute;
  border-width: 2px;
  border-style: solid;
  pointer-events: auto;
  cursor: pointer;
}

.det-box.side-left {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.12);
}

.det-box.side-right {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.12);
}

.det-box.side-center {
  border-color: #94a3b8;
  background: rgba(148, 163, 184, 0.08);
}

.det-box:hover {
  border-width: 3px;
}

.det-box-label {
  position: absolute;
  top: -16px;
  left: 0;
  font-size: 10px;
  font-weight: 600;
  color: white;
  padding: 1px 4px;
  border-radius: 2px;
  white-space: nowrap;
}

.side-left .det-box-label { background: #16a34a; }
.side-right .det-box-label { background: #2563eb; }
.side-center .det-box-label { background: #64748b; }

#side-labels {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 12px;
  pointer-events: none;
  z-index: 4;
}

.side-label {
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
}

.side-left { color: #4ade80; }
.side-right { color: #60a5fa; }

.meta-line {
  margin-top: 8px;
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
}

/* Analysis section */
#analysis-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 280px;
}

.analysis-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
}

.analysis-card h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
  margin-bottom: 10px;
}

.badge {
  font-size: 11px;
  background: #e2e8f0;
  color: #475569;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
}

.stat-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value.score-high { color: #16a34a; }
.stat-value.score-mid { color: #d97706; }
.stat-value.score-low { color: #94a3b8; }

/* Assessment card */
.assessment-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.assessment-tag.likely { background: #dcfce7; color: #166534; }
.assessment-tag.possible { background: #fef3c7; color: #92400e; }
.assessment-tag.none { background: #f1f5f9; color: #64748b; }

.assessment-detail-row {
  font-size: 12px;
  margin-bottom: 4px;
}

.assessment-detail-row strong {
  display: inline-block;
  width: 110px;
  color: #475569;
}

/* Detection table */
.det-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}

.det-table th {
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 600;
  color: #64748b;
  font-size: 11px;
}

.det-table td {
  padding: 4px 6px;
  border-bottom: 1px solid #f1f5f9;
  font-variant-numeric: tabular-nums;
}

.det-table tr:hover { background: #f8fafc; }

.det-table .side-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 3px;
  color: white;
}

.side-tag.left { background: #22c55e; }
.side-tag.right { background: #3b82f6; }
.side-tag.center { background: #94a3b8; }

#card-detections {
  max-height: 300px;
  overflow-y: auto;
}

/* Keyboard hint */
.keyboard-hint {
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 12px;
}

@media (max-width: 900px) {
  #main { flex-direction: column; }
  #image-container { width: 100%; height: auto; aspect-ratio: 1; }
}
