/* ── D10 Crime Trends ─────────────────────────────────────────────────────── */
/* Scoped under .d10ct to avoid collisions with the crime-map styles. */

.d10ct {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color: #374151;
  display: flex;
  flex-direction: column;
}

/* ── Chart section ───────────────────────────────────────────────────────── */

.d10ct-chart-wrap {
  position: relative;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.d10ct-header {
  padding: 16px 20px 4px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.d10ct-header-text {
  flex: 1;
}

.d10ct-title {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 2px;
}

.d10ct-subtitle {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

.d10ct-canvas-wrap {
  position: relative;
  height: 400px;
  padding: 8px 12px 12px;
}

.d10ct-loading {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.8);
  font-size: 14px;
  color: #6b7280;
  z-index: 5;
}

/* ── Filter strip ────────────────────────────────────────────────────────── */

.d10ct-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 16px 20px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.d10ct-filter-group {
  min-width: 0;
}

.d10ct-filter-timeframe {
  flex: 0 0 auto;
}

.d10ct-filter-neighborhoods,
.d10ct-filter-categories {
  flex: 1 1 0;
  min-width: 200px;
}

.d10ct-filter-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin: 0 0 8px;
}

.d10ct-count {
  font-weight: 400;
  color: #9ca3af;
}

.d10ct-filter-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.d10ct-link-btn {
  background: none;
  border: none;
  font-size: 12px;
  color: #2563eb;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.d10ct-link-btn:hover {
  text-decoration: underline;
}

/* ── Timeframe buttons ───────────────────────────────────────────────────── */

.d10ct-timeframe-btns {
  display: flex;
  gap: 6px;
}

.d10ct-tf-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #4b5563;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.d10ct-tf-btn:hover {
  background: #f3f4f6;
}

.d10ct-tf-btn.active {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

/* ── Checkbox lists ──────────────────────────────────────────────────────── */

.d10ct-checkbox-list {
  max-height: 140px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 2px 16px;
}

.d10ct-cb-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
}

.d10ct-cb-label:hover {
  background: #f9fafb;
}

.d10ct-cb-label input[type="checkbox"] {
  accent-color: #dc2626;
  flex-shrink: 0;
}

.d10ct-cb-label span {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── View toggle ─────────────────────────────────────────────────────────── */

.d10ct-view-toggle {
  display: flex;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  margin-top: 2px;
}

.d10ct-view-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: #fff;
  color: #4b5563;
  transition: background 0.15s, color 0.15s;
}

.d10ct-view-btn + .d10ct-view-btn {
  border-left: 1px solid #d1d5db;
}

.d10ct-view-btn:hover {
  background: #f3f4f6;
}

.d10ct-view-btn.active {
  background: #dc2626;
  color: #fff;
}

/* ── Data table ──────────────────────────────────────────────────────────── */

.d10ct-table-wrap {
  padding: 12px;
}

.d10ct-table-scroll {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.d10ct-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.d10ct-table th,
.d10ct-table td {
  padding: 6px 12px;
  text-align: right;
  white-space: nowrap;
}

.d10ct-table thead th {
  background: #f3f4f6;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #d1d5db;
  position: sticky;
  top: 0;
  z-index: 2;
}

.d10ct-table tbody th,
.d10ct-table tfoot th {
  text-align: left;
  font-weight: 500;
  color: #1f2937;
}

.d10ct-th-sticky,
.d10ct-td-sticky {
  position: sticky;
  left: 0;
  z-index: 1;
}

.d10ct-tr-even { background: #fff; }
.d10ct-tr-odd  { background: #f9fafb; }

.d10ct-tr-total {
  background: #f3f4f6;
  font-weight: 600;
  border-top: 2px solid #d1d5db;
}

.d10ct-tr-total td {
  color: #1f2937;
}

.d10ct-pct-up   { font-size: 10px; color: #dc2626; margin-left: 4px; }
.d10ct-pct-down { font-size: 10px; color: #16a34a; margin-left: 4px; }
.d10ct-pct-flat { font-size: 10px; color: #9ca3af; margin-left: 4px; }

.d10ct-table-empty {
  text-align: center;
  color: #6b7280;
  padding: 32px 16px;
  font-size: 14px;
}

/* Screen-reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .d10ct-filters {
    flex-direction: column;
  }

  .d10ct-canvas-wrap {
    height: 300px;
  }

  .d10ct-checkbox-list {
    grid-template-columns: 1fr;
  }
}
