/* Crime city & country page polish.
   Everything is scoped under .crime-page so it cannot leak onto the other
   extended-indicator pages (pollution, health-care) that share the same
   helper markup: table_indices, the gauge, the jQuery-UI progress-bar table
   (.table_builder_with_value_explanation), and the green_standard/red_standard
   value labels. */

.crime-page {
  --numbeo-blue: #1B3B6F;
  --numbeo-blue-light: #2E5090;
  --numbeo-blue-dark: #0F2444;
  --crime-text: #2a3340;
  --crime-muted: #50545e; /* #6c7689; */
  --crime-divider: #e7ecf3;
  --crime-row-hover: #f5f8fc;
  --crime-track: #eceff4;
  max-width: 820px;
  margin: 10px 0 6px;
}

/* ---------- Hero: gauge + Crime / Safety index ---------- */
.crime-hero {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 34px;
  margin: 6px 0 2px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
  border: 1px solid var(--crime-divider);
  border-radius: 5px;
  /*box-shadow: 0 1px 2px rgba(15, 36, 68, 0.04),
              0 14px 34px -16px rgba(15, 36, 68, 0.20); */
  overflow: hidden;
}

/*
.crime-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--numbeo-blue) 0%, var(--numbeo-blue-light) 100%);
}*/

.crime-hero #gauge_div {
  order: -1;
  float: none !important;
  margin: 0 !important;
  flex: none;
}

.crime-hero aside {
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: 1 1 240px;
}

/* The shared index table becomes a clean two-stat list */
.crime-hero .table_indices {
  width: 100%;
  border-collapse: collapse;
  border: 0;
  background: none;
}

/* hide the "Index | (i)" header row */
.crime-hero .table_indices tr:first-child {
  display: none;
}

.crime-hero .table_indices td {
  border: 0 !important;
  background: none !important;
  padding: 6px 0 !important;
  vertical-align: baseline;
}

.crime-hero .table_indices tr + tr td {
  border-top: 1px solid var(--crime-divider) !important;
}

.crime-hero .table_indices td:first-child {
  text-align: left !important;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--crime-muted);
}

.crime-hero .table_indices td:last-child {
  text-align: right !important;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--numbeo-blue);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  white-space: nowrap;
  padding-left: 18px !important;
}

/* ---------- Section headings ---------- */
.crime-page h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px 0 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--numbeo-blue-dark);
  letter-spacing: -0.01em;
}

.crime-page h2::before {
  content: "";
  width: 5px;
  height: 20px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--numbeo-blue-light), var(--numbeo-blue));
}

/* ---------- Breakdown scorecard (bars) ---------- */
.crime-page .table_builder_with_value_explanation {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0 8px;
  background: #ffffff;
  border: 1px solid var(--crime-divider);
  border-radius: 5px;
  overflow: hidden;
  /*box-shadow: 0 1px 2px rgba(15, 36, 68, 0.04),
              0 12px 30px -16px rgba(15, 36, 68, 0.18); */
}

.crime-page .table_builder_with_value_explanation td {
  padding: 12px;
  border-bottom: 1px solid var(--crime-divider);
  vertical-align: middle;
}

.crime-page .table_builder_with_value_explanation tr:last-child td {
  border-bottom: none;
}

.crime-page .table_builder_with_value_explanation tr:hover td {
  background: var(--crime-row-hover);
}

/* statement / row name */
.crime-page .table_builder_with_value_explanation td.columnWithName {
  font-size: 15px;
  font-weight: 600;
  color: var(--crime-text);
  line-height: 1.35;
}

/* the cell holding the bar takes the slack */
.crime-page .table_builder_with_value_explanation td:nth-child(2) {
  width: 38%;
}

/* numeric value */
.crime-page .table_builder_with_value_explanation td.indexValueTd {
  text-align: right !important;
  width: 1%;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 700;
  color: var(--numbeo-blue-dark);
  font-variant-numeric: tabular-nums;
}

/* category label cell */
.crime-page .table_builder_with_value_explanation td.hidden_on_small_mobile {
  text-align: right !important;
  width: 1%;
  white-space: nowrap;
}

/* ---------- jQuery-UI progress bars ---------- */
.crime-page .jquery_bar,
.crime-page .jquery_bar.ui-progressbar {
  width: 100%;
  height: 9px;
  border: none;
  background: var(--crime-track);
  border-radius: 999px;
  overflow: hidden;
}

.crime-page .jquery_bar .ui-progressbar-value {
  height: 100%;
  margin: 0;
  border: none;
  border-radius: 999px;
  background: var(--numbeo-blue);
}

/* severity-tinted bars, driven by the existing category label in the row */
.crime-page tr:has(.green_standard) .ui-progressbar-value        { background: linear-gradient(90deg, #34b36b, #2e9e5b); }
.crime-page tr:has(.green_light_standard) .ui-progressbar-value  { background: linear-gradient(90deg, #74c98f, #5cbf85); }
.crime-page tr:has(.yellow_neutral_standard) .ui-progressbar-value { background: linear-gradient(90deg, #f0c64b, #e6b400); }
.crime-page tr:has(.red_light_standard) .ui-progressbar-value    { background: linear-gradient(90deg, #ef9a55, #e8833f); }
.crime-page tr:has(.red_standard) .ui-progressbar-value          { background: linear-gradient(90deg, #e25c54, #d6453d); }

/* ---------- Category labels rendered as pills ---------- */
.crime-page .green_standard,
.crime-page .green_light_standard,
.crime-page .yellow_neutral_standard,
.crime-page .red_light_standard,
.crime-page .red_standard {
  display: inline-block;
  min-width: 70px;
  padding: 4px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
}

.crime-page .green_standard        { background: #e3f6ea; color: #1c7a42; border-color: #c4e9d0; }
.crime-page .green_light_standard  { background: #eef8f1; color: #2f8a4e; border-color: #d6ecdb; }
.crime-page .yellow_neutral_standard { background: #fdf3da; color: #946800; border-color: #f3e2ad; }
.crime-page .red_light_standard    { background: #fdeedd; color: #c15a25; border-color: #f6dcc2; }
.crime-page .red_standard          { background: #fce9e7; color: #c0392b; border-color: #f5cec9; }

/* ---------- Data freshness meta ---------- */
.crime-page > p {
  margin: 4px 0;
}

.crime-page .reportees {
  font-size: 15px;
  color: var(--crime-muted);
}

/* ---------- Orchestrated entrance ---------- */
/*
@media (prefers-reduced-motion: no-preference) {
  .crime-hero,
  .crime-page .table_builder_with_value_explanation {
    opacity: 0;
    transform: translateY(10px);
    animation: crimeRise 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }
  .crime-hero { animation-delay: 0.04s; }
  .crime-page .table_builder_with_value_explanation { animation-delay: 0.12s; }
}

@keyframes crimeRise {
  to { opacity: 1; transform: translateY(0); }
}
*/

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .crime-hero {
    padding: 18px 18px;
    gap: 8px 20px;
    justify-content: center;
    text-align: center;
  }
  .crime-hero aside { flex-basis: 100%; }
  .crime-page .table_builder_with_value_explanation td { padding: 10px 10px; }
  .crime-page .table_builder_with_value_explanation td.columnWithName { font-size: 13.5px; }
  .crime-page .green_standard,
  .crime-page .green_light_standard,
  .crime-page .yellow_neutral_standard,
  .crime-page .red_light_standard,
  .crime-page .red_standard {
    min-width: 0;
    padding: 3px 9px;
    font-size: 11.5px;
  }
}

/* ===========================================================
   Crime comparison page (compare_cities / compare_countries)
   Scoped under .crime-compare. The comparison tables use the
   JqueryComparisonTableBuilder markup: <table class="visualizeComparison">
   with two cities per row (5 cells: name, bar1, value1, bar2, value2),
   jquery_bar_small bars and *_small value labels.
   =========================================================== */
.crime-compare {
  --numbeo-blue: #1B3B6F;
  --numbeo-blue-light: #2E5090;
  --numbeo-blue-dark: #0F2444;
  --crime-text: #2a3340;
  --crime-muted: #50545e; /* #6c7689; */
  --crime-divider: #e7ecf3;
  --crime-row-hover: #f5f8fc;
  --crime-track: #eceff4;
  max-width: 820px;
  margin: 10px 0 6px;
}

/* section heading ("Safety comparisons ...") */
.crime-compare h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px 0 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--numbeo-blue-dark);
  letter-spacing: -0.01em;
}

.crime-compare h2::before {
  content: "";
  width: 5px;
  height: 20px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--numbeo-blue-light), var(--numbeo-blue));
}

/* ---------- Headline scoreboard (index header) ---------- */
.crime-compare .table_indices {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0;
  background: #ffffff;
  border: 1px solid var(--crime-divider);
  border-radius: 5px;
  overflow: hidden;
}



.crime-compare .table_indices th {
  padding: 10px 14px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--numbeo-blue-dark);
  background: var(--crime-row-hover);
  border-bottom: 1px solid var(--crime-divider);
}

.crime-compare .table_indices th:first-child {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--crime-muted);
  background: #ffffff;
}

.crime-compare .table_indices td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--crime-divider);
}

.crime-compare .table_indices tr:last-child td {
  border-bottom: none;
}

.crime-compare .table_indices td:first-child {
  text-align: left !important;
  font-size: 15px;
  font-weight: 600;
  color: var(--crime-text);
}

.crime-compare .table_indices td:nth-child(n+2) {
  text-align: center !important;
  font-size: 22px;
  font-weight: 800;
  color: var(--numbeo-blue);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* divider between the two cities */
.crime-compare .table_indices th:nth-child(3),
.crime-compare .table_indices td:nth-child(3) {
  border-left: 1px solid var(--crime-divider);
}

/* ---------- Comparison scorecard ---------- */
.crime-compare .visualizeComparison {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0 8px;
  background: #ffffff;
  border: 1px solid var(--crime-divider);
  border-radius: 5px;
  overflow: hidden;
}

/* city-name header row */
.crime-compare .visualizeComparison th {
  padding: 11px;
  text-align: center !important;
  font-size: 15px;
  font-weight: 700;
  color: var(--numbeo-blue-dark);
  background: var(--crime-row-hover);
  border-bottom: 1px solid var(--crime-divider);
}

.crime-compare .visualizeComparison th:first-child {
  background: #ffffff;
}

.crime-compare .visualizeComparison td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--crime-divider);
  vertical-align: middle;
}

.crime-compare .visualizeComparison tr:last-child td {
  border-bottom: none;
}

.crime-compare .visualizeComparison tr:hover td {
  background: var(--crime-row-hover);
}

/* statement / row name */
.crime-compare .visualizeComparison td:first-child {
  text-align: left !important;
  font-size: 15px;
  font-weight: 600;
  color: var(--crime-text);
  line-height: 1.35;
}

/* bar cells (city1 = 2nd, city2 = 4th) */
.crime-compare .visualizeComparison td:nth-child(2),
.crime-compare .visualizeComparison td:nth-child(4) {
  width: 24%;
}

/* value cells (city1 = 3rd, city2 = 5th) — drop the redundant text label
   (it stays in the DOM so the per-city bar colouring below still works) */
.crime-compare .visualizeComparison td:nth-child(3),
.crime-compare .visualizeComparison td:nth-child(5) {
  /* entry value cells already carry inline `text-align: right`; no !important
     here so it doesn't override the inline `text-align: center` on the
     "Improve Data" / meta rows whose 3rd cell is a colspan-2 city cell */
  text-align: right;
  white-space: nowrap;
  width: 1%;
  font-size: 15px;
  font-weight: 700;
  color: var(--numbeo-blue-dark);
  font-variant-numeric: tabular-nums;
}

.crime-compare .visualizeComparison td:nth-child(3) .hidden_on_small_mobile,
.crime-compare .visualizeComparison td:nth-child(5) .hidden_on_small_mobile {
  display: none;
}

.crime-compare .visualizeComparison td:nth-child(3) .small_font,
.crime-compare .visualizeComparison td:nth-child(5) .small_font {
  font-size: 15px;
}

/* divider before the city2 group */
.crime-compare .visualizeComparison th:nth-child(3),
.crime-compare .visualizeComparison td:nth-child(4) {
  border-left: 1px solid var(--crime-divider);
}

/* "Improve Data" links + contributor/last-update meta rows — de-emphasized */
.crime-compare .visualizeComparison tr:has(i) td,
.crime-compare .visualizeComparison tr:nth-child(2) td {
  border-bottom: 1px solid var(--crime-divider);
  padding-top: 6px;
  padding-bottom: 6px;
  font-weight: 400;
}

.crime-compare .visualizeComparison tr:has(i) td {
  border-bottom: none;
  font-size: 12px;
  color: var(--crime-muted);
  text-align: center !important;
}

.crime-compare .visualizeComparison tr:has(i) td:first-child {
  text-align: left !important;
}

.crime-compare .visualizeComparison tr:has(i) .small_font {
  font-size: 15px !important;
  font-weight: 400 !important;
  color: var(--crime-muted) !important;
}

.crime-compare .visualizeComparison tr:has(i) i {
  font-style: normal;
}

.crime-compare .visualizeComparison tr:nth-child(2) .small_font a {
  font-size: 15px;
  /* color: var(--crime-muted); */
}

/* ---------- jQuery-UI progress bars ---------- */
.crime-compare .jquery_bar_small,
.crime-compare .jquery_bar_small.ui-progressbar {
  width: 100%;
  height: 8px;
  border: none;
  background: var(--crime-track);
  border-radius: 999px;
  overflow: hidden;
}

.crime-compare .jquery_bar_small .ui-progressbar-value {
  height: 100%;
  margin: 0;
  border: none;
  border-radius: 999px;
  background: var(--numbeo-blue);
}

/* severity-tinted bars, coloured per city from that city's own label
   (city1 bar = col2 keyed off col3's label; city2 bar = col4 keyed off col5) */
.crime-compare tr:has(td:nth-child(3) .green_small) td:nth-child(2) .ui-progressbar-value,
.crime-compare tr:has(td:nth-child(5) .green_small) td:nth-child(4) .ui-progressbar-value          { background: linear-gradient(90deg, #34b36b, #2e9e5b); }
.crime-compare tr:has(td:nth-child(3) .green_light_small) td:nth-child(2) .ui-progressbar-value,
.crime-compare tr:has(td:nth-child(5) .green_light_small) td:nth-child(4) .ui-progressbar-value    { background: linear-gradient(90deg, #74c98f, #5cbf85); }
.crime-compare tr:has(td:nth-child(3) .yellow_neutral_small) td:nth-child(2) .ui-progressbar-value,
.crime-compare tr:has(td:nth-child(5) .yellow_neutral_small) td:nth-child(4) .ui-progressbar-value { background: linear-gradient(90deg, #f0c64b, #e6b400); }
.crime-compare tr:has(td:nth-child(3) .red_light_small) td:nth-child(2) .ui-progressbar-value,
.crime-compare tr:has(td:nth-child(5) .red_light_small) td:nth-child(4) .ui-progressbar-value      { background: linear-gradient(90deg, #ef9a55, #e8833f); }
.crime-compare tr:has(td:nth-child(3) .red_small) td:nth-child(2) .ui-progressbar-value,
.crime-compare tr:has(td:nth-child(5) .red_small) td:nth-child(4) .ui-progressbar-value            { background: linear-gradient(90deg, #e25c54, #d6453d); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .crime-compare .visualizeComparison td,
  .crime-compare .visualizeComparison th { padding: 9px 8px; }
  .crime-compare .visualizeComparison td:first-child { font-size: 13px; }
  .crime-compare .table_indices td:nth-child(n+2) { font-size: 18px; }
}

@media (min-width: 768px) {
.crime-compare .table_indices {
  border: 1px solid #dde3ec;
  background-color: #fbfbf8;
  border-collapse: initial;
  margin-top: 8px;
  margin-bottom: 16px;
}
}