/* ============================================================
   ViewPoint Dashboard – global styles
   ============================================================ */

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  margin: 0;
  background: #0f172a;
  color: #e2e8f0;
}

/* ── Top nav bar ───────────────────────────────────────────── */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 52px;
  background: #111827;
  border-bottom: 1px solid #1f2937;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 32px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.topnav-logo {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #e2e8f0;
  white-space: nowrap;
}
.topnav-links {
  display: flex;
  gap: 4px;
}
.topnav-link {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.topnav-link:hover { background: #1e293b; color: #e2e8f0; }
.topnav-link.active { background: #1e40af; color: #fff; }

/* ── Page layout ────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

.page-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 72px 24px 48px;
}

.card {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.5);
}

h1 { margin-bottom: 8px; }

p {
  color: #94a3b8;
  margin: 0 0 24px 0;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  font-weight: 600;
}

code {
  background: #1f2937;
  color: #93c5fd;
  padding: 2px 6px;
  border-radius: 6px;
}

.actions { margin-top: 16px; }

.section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #1f2937;
}

button {
  background: #2563eb;
  color: #ffffff;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

button:disabled {
  opacity: 0.7;
  cursor: wait;
}

pre {
  margin-top: 16px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #1f2937;
  background: #0b1220;
  color: #cbd5e1;
  overflow-x: auto;
}

input {
  width: 100%;
  max-width: 420px;
  margin-top: 12px;
  margin-right: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0b1220;
  color: #e2e8f0;
}

ul {
  margin-top: 12px;
  padding-left: 20px;
}

li {
  margin-bottom: 8px;
  color: #cbd5e1;
}

/* ---- Links ---- */
.address-link {
  color: #93c5fd;
  text-decoration: underline;
  cursor: pointer;
}

/* ---- Address detail cards ---- */
.details-container {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.detail-card {
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 14px;
  background: #0b1220;
}

.detail-title {
  margin: 0 0 8px 0;
  font-size: 15px;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toggle-raw-btn {
  margin-left: auto;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #93c5fd;
  cursor: pointer;
  white-space: nowrap;
}
.toggle-raw-btn:hover { background: #334155; }

.delete-vp-btn {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #7f1d1d;
  background: #450a0a;
  color: #fca5a5;
  cursor: pointer;
  white-space: nowrap;
}
.delete-vp-btn:hover:not(:disabled) { background: #7f1d1d; }
.delete-vp-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Priority fields shown by default; raw fields hidden */
.raw-fields-grid      { display: none; }
.priority-fields-grid { display: grid; }
/* Flipped when .show-raw-fields is toggled onto the card */
.show-raw-fields .raw-fields-grid      { display: grid; }
.show-raw-fields .priority-fields-grid { display: none; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px 12px;
}

.field {
  margin: 0;
  color: #cbd5e1;
  font-size: 14px;
}

.field-label {
  color: #93c5fd;
  font-weight: 600;
  margin-right: 4px;
}

.source-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.badge {
  font-size: 12px;
  border-radius: 999px;
  padding: 4px 10px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
}

/* ---- Infinite scroll ---- */
#resultsSentinel { height: 1px; }

.loading-indicator {
  margin-top: 10px;
  color: #93c5fd;
  font-size: 13px;
}

.hidden { display: none; }

/* ---- POI grid ---- */
.poi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.poi-card {
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px;
  background: #0f172a;
}

.poi-title {
  margin: 0 0 6px 0;
  color: #e2e8f0;
  font-size: 14px;
}

.poi-meta {
  margin: 0;
  color: #94a3b8;
  font-size: 12px;
}

/* ---- Leaflet map ---- */
.poi-map {
  margin-top: 10px;
  width: 100%;
  height: 360px;
  border-radius: 10px;
  border: 1px solid #334155;
}

.map-note {
  margin-top: 8px;
  color: #94a3b8;
  font-size: 12px;
}

.poi-marker {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #1f2937;
  background: #111827;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.poi-marker-wrap {
  background: transparent;
  border: 0;
}

.map-legend {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #cbd5e1;
  font-size: 12px;
  background: #111827;
  border: 1px solid #334155;
  border-radius: 999px;
  padding: 4px 10px;
}

/* ---- POI flag controls ---- */
.flag-controls {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.flag-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #cbd5e1;
  font-size: 12px;
}

.flag-results {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
}

.flag-card {
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px;
  background: #111827;
}

.flag-card.distance-under-500  { border-color: #16a34a; background: rgba(22, 163, 74, 0.25); }
.flag-card.distance-under-2000 { border-color: #84cc16; background: rgba(132, 204, 22, 0.25); }
.flag-card.distance-under-5000 { border-color: #eab308; background: rgba(234, 179, 8, 0.22); }
.flag-card.distance-under-7000 { border-color: #f97316; background: rgba(249, 115, 22, 0.22); }
.flag-card.distance-over-7000  { border-color: #ef4444; background: rgba(239, 68, 68, 0.2); }
.flag-card.distance-none       { border-color: #7f1d1d; background: rgba(127, 29, 29, 0.45); }
.flag-card.clickable           { cursor: pointer; }

.flag-title {
  margin: 0;
  color: #e2e8f0;
  font-size: 13px;
}

.flag-distance {
  margin: 4px 0 0 0;
  color: #93c5fd;
  font-size: 13px;
}

/* ---- ViewPoint listings table ---- */
.viewpoint-table-wrap {
  margin-top: 10px;
  border: 1px solid #334155;
  border-radius: 10px;
  overflow: auto;
  background: #0b1220;
}

.viewpoint-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.viewpoint-table th,
.viewpoint-table td {
  text-align: left;
  border-bottom: 1px solid #1f2937;
  padding: 10px;
  font-size: 13px;
  color: #cbd5e1;
  vertical-align: top;
}

.viewpoint-table th {
  color: #93c5fd;
  font-weight: 700;
  position: sticky;
  top: 0;
  background: #111827;
  z-index: 1;
}

.viewpoint-meta {
  margin-top: 8px;
  color: #94a3b8;
  font-size: 13px;
}

.thumb-small {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #334155;
}

/* ── VP photo strip ──────────────────────────────────────────── */

.photo-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 4px 10px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.photo-strip::-webkit-scrollbar { height: 5px; }
.photo-strip::-webkit-scrollbar-track { background: #0f172a; }
.photo-strip::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }

.photo-thumb-link {
  flex: 0 0 auto;
  scroll-snap-align: start;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #1e293b;
  transition: border-color 0.15s;
}
.photo-thumb-link:hover { border-color: #3b82f6; }

.photo-thumb {
  display: block;
  height: 160px;
  width: auto;
  max-width: 260px;
  object-fit: cover;
}

/* ── Value Assessment panel ──────────────────────────────────── */

.assessment-panel { padding: 0; overflow: hidden; }

.assessment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e293b;
  padding: 10px 16px;
  border-bottom: 1px solid #334155;
}
.assessment-title {
  font-size: 14px;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: 0.02em;
}
.assessment-total {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.assessment-total.positive { color: #4ade80; }
.assessment-total.neutral  { color: #94a3b8; }
.assessment-asking { font-size: 0.75em; font-weight: 400; color: #94a3b8; margin-left: 0.4rem; }
.assessment-refresh-btn {
  font-size: 11px;
  padding: 3px 9px;
  border: 1px solid #475569;
  border-radius: 4px;
  background: #0f172a;
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin: 0 auto 0 12px;
}
.assessment-refresh-btn:hover:not(:disabled) { background: #1e3a5f; color: #60a5fa; border-color: #60a5fa; }
.assessment-refresh-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Transit Grid */
.transit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.transit-item {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.transit-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  font-weight: 600;
}
.transit-value-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.transit-value {
  font-size: 18px;
  font-weight: 700;
  color: #f1f5f9;
}

.assessment-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.assessment-table thead th {
  background: #0f172a;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 12px;
  text-align: left;
  border-bottom: 1px solid #1e293b;
}
.assessment-row { border-bottom: 1px solid #1e293b; }
.assessment-row:last-child { border-bottom: none; }
.assessment-row:hover { background: #1e293b44; }

.assessment-name {
  padding: 8px 12px;
  color: #cbd5e1;
  font-weight: 500;
  line-height: 1.4;
}
.assessment-control { padding: 8px 12px; }
.assessment-dollar-cell {
  padding: 8px 12px;
  text-align: right;
  white-space: nowrap;
}

.assessment-dollar { font-weight: 700; font-size: 14px; }
.assessment-dollar.positive { color: #4ade80; }
.assessment-dollar.neutral  { color: #94a3b8; }
.assessment-dollar.unknown  { color: #475569; }

.assessment-source-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.assessment-source-tag.manual     { background: #1e3a5f; color: #93c5fd; }
.assessment-source-tag.auto       { background: #14532d; color: #86efac; }
.assessment-source-tag.unset      { background: #1e293b; color: #64748b; }

/* Bool control */
.bool-control { display: flex; gap: 4px; }
.bool-btn {
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.bool-btn:hover:not(:disabled) { background: #334155; color: #e2e8f0; }
.bool-btn.active { background: #3b82f6; border-color: #3b82f6; color: #fff; }
.bool-btn.auto-hint { border-color: #86efac; color: #86efac; background: transparent; }
.bool-btn.clr.active { background: #475569; border-color: #475569; color: #94a3b8; }
.bool-btn.clr:not(.active):hover { background: #450a0a; border-color: #7f1d1d; color: #fca5a5; }

/* Scale control */
.scale-control { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.scale-input {
  flex: 1;
  max-width: 140px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
}
.scale-input.auto-hint { border-color: #16a34a; }
.scale-input:focus { outline: none; border-color: #3b82f6; }
.scale-auto-hint {
  flex-basis: 100%;
  font-size: 11px;
  color: #4ade80;
  margin-top: 1px;
}

.assessment-footnote {
  font-size: 11px;
  color: #475569;
  padding: 6px 12px 10px;
}

.assessment-loading {
  padding: 12px 16px;
  color: #64748b;
  font-size: 13px;
}

/* ── Settings section ────────────────────────────────────────── */

.settings-feature-card { margin-bottom: 12px; }

.settings-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.settings-text-input {
  width: 100%;
  padding: 5px 8px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  box-sizing: border-box;
}
.rules-editor {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  font-family: monospace;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  resize: vertical;
  box-sizing: border-box;
}
.rules-editor:focus, .settings-text-input:focus { outline: none; border-color: #3b82f6; }

.settings-save-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #93c5fd;
  cursor: pointer;
}
.settings-save-btn:hover { background: #334155; }

.settings-status { font-size: 12px; font-weight: 600; }

/* ── Process cutsheet button ─────────────────────────────────── */

.process-cutsheet-btn {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 5px;
  border: 1px solid #0ea5e9;
  background: #0c4a6e;
  color: #bae6fd;
  cursor: pointer;
  transition: background 0.15s;
}
.process-cutsheet-btn:hover:not(:disabled) { background: #075985; }
.process-cutsheet-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.cutsheet-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  margin-left: 8px;
  vertical-align: middle;
}
.cutsheet-status--running { color: #fbbf24; }
.cutsheet-status--done    { color: #4ade80; }
.cutsheet-status--error   { color: #f87171; }

/* ── Cutsheet details card ───────────────────────────────────── */

.cutsheet-details-card { border-left: 3px solid #0ea5e9; }

.cutsheet-section { margin-bottom: 14px; }
.cutsheet-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: #7dd3fc;
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

