/* ============================================================
   Tax Assessor Review Interface — CAMA Project
   ============================================================ */

html, body { height: 100%; overflow: hidden; display: flex; flex-direction: column; }

/* ---- App shell ---- */
.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  overflow: hidden;
}

.content-area {
  display: grid;
  grid-template-columns: 272px 1fr 330px;
  overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
  background: white;
  border-right: 1px solid var(--phila-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-head {
  background: var(--phila-blue);
  color: white;
  padding: 0.6rem 1rem;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  flex-shrink: 0;
}

.sidebar-body {
  padding: 0.9rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ---- Map area ---- */
.map-area {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.map-toolbar {
  background: var(--phila-dark-blue);
  color: white;
  padding: 0.38rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem 1rem;
  font-size: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.toolbar-sep { opacity: 0.4; }

.map-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.map-toolbar-btn {
  padding: 0.18rem 0.5rem;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 3px;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.map-toolbar-btn:hover { background: rgba(255,255,255,0.22); color: white; }

.basemap-select {
  padding: 0.18rem 0.5rem;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 3px;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background 0.15s;
}

.basemap-select:hover { background: rgba(255,255,255,0.22); }
.basemap-select option { background: #1a3a5c; color: white; }

#map { flex: 1; }

/* ---- Boundary toggle ---- */
.boundary-toggle {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: nowrap;
}

.boundary-label {
  font-size: 10px;
  opacity: 0.7;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.boundary-btn {
  padding: 0.18rem 0.5rem;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 3px;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.boundary-btn:hover {
  background: rgba(255,255,255,0.22);
  color: white;
}

.boundary-btn.active {
  background: rgba(255,255,255,0.92);
  color: var(--phila-dark-blue);
  border-color: white;
}

/* ---- Boundary tooltip (Leaflet) ---- */
.boundary-tooltip {
  background: var(--phila-dark-blue) !important;
  color: white !important;
  border: none !important;
  border-radius: 3px !important;
  font-size: 11px !important;
  padding: 0.2rem 0.5rem !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
}

.boundary-tooltip::before { display: none !important; }


/* ---- Property tile legend (rendered as a Leaflet control) ---- */
.map-legend {
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid var(--phila-border);
  border-radius: 4px;
  padding: 0.45rem 0.6rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  min-width: 130px;
}

.map-legend-title {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--phila-text-muted);
  margin-bottom: 0.35rem;
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  margin-bottom: 0.18rem;
  font-size: 10px;
  color: var(--phila-text);
}

.map-legend-item:last-child { margin-bottom: 0; }

.map-legend-swatch {
  display: inline-block;
  width: 14px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}


/* ---- Results panel ---- */
.results-panel {
  background: white;
  border-left: 1px solid var(--phila-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stats-bar {
  background: var(--phila-dark-blue);
  color: white;
  display: flex;
  gap: 0;
  flex-shrink: 0;
}

.stat-cell {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border-right: 1px solid rgba(255,255,255,0.1);
}

.stat-cell:last-child { border-right: none; }

.stat-cell .stat-label { font-size: 10px; opacity: 0.65; text-transform: uppercase; letter-spacing: 0.4px; }
.stat-cell .stat-value { font-size: 18px; font-weight: 700; color: white; line-height: 1.2; }
.stat-cell .stat-value.warn { color: var(--phila-gold); }

/* ---- Overview pane fills the panel ---- */
#pane-overview { display: flex; flex: 1; overflow-y: auto; flex-direction: column; }

/* ---- Property list ---- */
.prop-list { list-style: none; }

.prop-item {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--phila-border);
  cursor: pointer;
  transition: background 0.1s;
}

.prop-item:hover { background: var(--phila-sky); }

.prop-item.selected {
  background: var(--phila-hover);
  border-left: 3px solid var(--phila-blue);
  padding-left: calc(0.9rem - 3px);
}

.prop-addr {
  font-weight: 700;
  font-size: 13px;
  color: var(--phila-blue);
}

.prop-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--phila-text-muted);
  margin-top: 2px;
}

.prop-tags {
  display: flex;
  gap: 0.25rem;
  margin-top: 3px;
  flex-wrap: wrap;
}

/* ---- Detail view ---- */
.detail-section {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--phila-border);
}

.detail-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--phila-text-muted);
  margin-bottom: 0.5rem;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.2rem 0;
  font-size: 13px;
}

.detail-row .dl { color: var(--phila-text-muted); }
.detail-row .dv { font-weight: 600; }

/* ---- Empty state ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 0.5rem;
  color: var(--phila-text-muted);
  padding: 2rem;
  text-align: center;
}

.empty-state svg { opacity: 0.25; }

/* ---- City Overview panel (right panel, pane-overview) ---- */
.overview-panel {
  padding: 0.9rem;
  overflow-y: auto;
  flex: 1;
}

.overview-panel-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--phila-text-muted);
  margin-bottom: 0.75rem;
}

.overview-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.overview-kpi {
  background: var(--phila-bg);
  border-radius: 4px;
  padding: 0.5rem 0.6rem;
  min-width: 0;
}

.overview-kpi-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--phila-text-muted);
  line-height: 1.3;
  margin-bottom: 0.25rem;
}

.overview-kpi-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--phila-blue);
  line-height: 1;
}

.overview-chart-block {
  margin-bottom: 0.8rem;
}

.overview-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.overview-chart-title {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--phila-text-muted);
  white-space: nowrap;
}

/* ---- Prediction chart inline legend ---- */
.overview-chart-legend-inline {
  font-size: 9px;
  color: var(--phila-text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.pred-legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.pred-chart-note {
  font-size: 9px;
  color: var(--phila-text-muted);
  font-style: italic;
  margin: 0.25rem 0 0;
  line-height: 1.4;
}

/* ---- Year selector ---- */
.year-selector {
  display: flex;
  gap: 0.2rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.year-btn {
  padding: 0.1rem 0.38rem;
  font-family: var(--font);
  font-size: 9px;
  font-weight: 700;
  border: 1px solid var(--phila-border);
  border-radius: 3px;
  background: white;
  color: var(--phila-text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  line-height: 1.6;
}

.year-btn:hover {
  background: var(--phila-bg);
  color: var(--phila-blue);
  border-color: var(--phila-blue);
}

.year-btn.active {
  background: var(--phila-blue);
  color: white;
  border-color: var(--phila-blue);
}

.overview-chart-area {
  background: var(--phila-bg);
  border-radius: 4px;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--phila-border);
  /* overflow must stay visible so ApexCharts tooltips aren't clipped */
  overflow: visible;
  position: relative;
}

/* Once ApexCharts renders, it fills the container — reset flex centering */
.overview-chart-area:has(> .apexcharts-canvas) {
  display: block;
  border-style: solid;
}

.overview-no-data {
  font-size: 11px;
  color: var(--phila-text-muted);
  font-style: italic;
}

/* ---- Property Card panel (replaces Overview on property selection) ---- */
.property-card-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
}

.prop-card-head {
  background: var(--phila-blue);
  color: white;
  padding: 0.6rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.prop-card-back {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 3px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.prop-card-back:hover { background: rgba(255,255,255,0.28); }

.prop-card-title {
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prop-card-body {
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.prop-card-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--phila-border);
  gap: 0.5rem;
  font-size: 13px;
}

.prop-card-row:last-child { border-bottom: none; }

.prop-card-divider {
  height: 0.6rem;
}

.pc-label {
  color: var(--phila-text-muted);
  flex-shrink: 0;
  font-size: 12px;
}

.pc-value {
  font-weight: 700;
  text-align: right;
  word-break: break-all;
}

.pc-positive { color: var(--phila-red); }
.pc-negative { color: var(--phila-green); }

/* ---- Mayor's quote ---- */
.mayor-quote {
  position: relative;
  margin: 0.6rem 0 0;
  padding: 0.75rem 0.75rem 0.65rem 0.9rem;
  background: var(--phila-sky);
  border-left: 3px solid var(--phila-blue);
  border-radius: 0 5px 5px 0;
  overflow: hidden;
}

.mayor-quote-mark {
  position: absolute;
  top: -6px;
  left: 6px;
  font-size: 52px;
  line-height: 1;
  color: var(--phila-blue);
  opacity: 0.12;
  font-family: Georgia, serif;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

.mayor-quote blockquote {
  font-size: 11px;
  font-style: italic;
  color: var(--phila-text);
  line-height: 1.6;
  position: relative;
}

.mayor-quote figcaption {
  margin-top: 0.45rem;
  font-size: 10px;
  font-weight: 700;
  color: var(--phila-blue);
  letter-spacing: 0.3px;
}

/* ---- Sidebar city illustration ---- */
.sidebar-city-wrap {
  margin-top: auto;
  padding-top: 1.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.sidebar-skyline {
  width: 100%;
  border-radius: 6px;
  animation: skylineFloat 7s ease-in-out infinite;
  filter: drop-shadow(0 4px 10px rgba(15,77,144,0.18));
}

@keyframes skylineFloat {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-5px); }
}

.sidebar-city-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: var(--phila-text-muted);
  opacity: 0.55;
}

/* ---- Location ping ---- */
.sidebar-ping {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ping-dot {
  width: 10px;
  height: 10px;
  background: var(--phila-blue);
  border-radius: 50%;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 0 3px rgba(15,77,144,0.15);
}

.ping-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--phila-blue);
  width: 42px;
  height: 42px;
  opacity: 0;
  transform: scale(0.24);
  animation: pingExpand 2.4s ease-out infinite;
}

.ping-ring-2 { animation-delay: 1s; }

@keyframes pingExpand {
  0%   { transform: scale(0.24); opacity: 0.7; }
  100% { transform: scale(1);    opacity: 0; }
}

/* ---- Property hover tooltip ---- */
.property-hover-popup .leaflet-popup-content-wrapper {
  background: rgba(15, 36, 68, 0.92);
  color: white;
  border-radius: 4px;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.property-hover-popup .leaflet-popup-content {
  margin: 8px 10px;
  font-size: 11px;
  font-family: var(--font);
  line-height: 1.6;
}
.property-hover-popup .leaflet-popup-tip-container { display: none; }
.phover-id {
  font-size: 10px;
  opacity: 0.6;
  margin-bottom: 3px;
}
.phover-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}
.phover-row span:first-child { opacity: 0.7; }
.phover-row span:last-child  { font-weight: 700; }
