/* ════════════════════════════════════════════════════════════════════════
   World Comparison + Sensitivity Matrix — visual layer (Clal)
   ════════════════════════════════════════════════════════════════════════ */

/* ──────────────────────── World comparison filters ─────────────────── */
.comp-filters {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px 16px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--sh-sm);
}

.comp-filters .group-tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
}
.comp-filters .group-tabs button {
  padding: 6px 18px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--r-pill);
  font-family: inherit;
  font-weight: 700;
  font-size: 11.5px;
  cursor: pointer;
  transition: all .2s;
}
.comp-filters .group-tabs button.active { background: var(--grad-brand); color: #fff; box-shadow: var(--sh-brand); }
.comp-filters .group-tabs button:hover:not(.active) { color: var(--primary-dark); }

.comp-filters .filter-block { display: flex; align-items: center; gap: 8px; }
.comp-filters .filter-block label {
  font-size: 10.5px;
  color: var(--faint);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
}

/* Small note spelling out which ratings are active. A direct child of
   .comp-filters (not the rating filter-block) so it drops to its own full-width
   line below the controls row instead of pushing the rating dropdown out of
   alignment with its neighbours. */
.rating-active-note {
  flex-basis: 100%;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.4;
}

.comp-filters select {
  background: var(--panel);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 6px 11px;
  border-radius: var(--r-ctrl);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  min-width: 70px;
  box-shadow: var(--sh-sm);
  transition: border-color .2s, box-shadow .2s;
}
.comp-filters select:hover { border-color: var(--primary); }
.comp-filters select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.comp-country-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 92px;
  overflow-y: auto;
  padding: 9px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-ctrl);
  flex: 1;
  min-width: 320px;
}

.comp-country-list .chip {
  padding: 3px 9px;
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--primary-dark);
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: all .16s;
}
.comp-country-list .chip.selected {
  background: var(--grad-brand);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px -3px rgba(22,87,208,.5);
}
.comp-country-list .chip:hover { border-color: var(--primary); transform: translateY(-1px); }

.comp-actions { display: flex; gap: 6px; }
.comp-actions button {
  padding: 6px 13px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--primary);
  border-radius: var(--r-ctrl);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--sh-sm);
  transition: all .18s;
}
.comp-actions button:hover { background: var(--primary); color: #fff; border-color: var(--primary); transform: translateY(-1px); }

.comp-search-wrap {
  position: relative;
  flex: 1;
  min-width: 120px;
  max-width: 200px;
}
.comp-search-wrap::before {
  content: "🔍";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  pointer-events: none;
  opacity: 0.45;
}
#country-search {
  width: 100%;
  padding: 7px 32px 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-ctrl);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  direction: rtl;
  box-shadow: var(--sh-sm);
  transition: border-color .18s, box-shadow .18s;
  outline: none;
}
#country-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,87,208,.12);
}
#country-search::placeholder { color: var(--faint); }
html[data-theme="dark"] #country-search {
  background: rgba(14,27,49,.7);
  border-color: rgba(100,150,255,.2);
  color: var(--text);
}
html[data-theme="dark"] #country-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47,123,240,.18);
}

.comp-chart-wrap { height: 460px; position: relative; margin-top: 8px; }
.comp-chart-wrap:hover .expand-btn { opacity: 1; }

.comp-max-line {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
}
.comp-max-line input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; }

/* ───────────────────────── Sensitivity matrix ──────────────────────── */
/* Full-bleed, generous layout — fills the screen when active. */
.view-sensitivity { padding: 30px 46px 34px; }

.sens-title {
  font-size: 27px;
  font-weight: 800;
  color: var(--ink);
  margin: 4px 0 10px;
  text-align: center;
  letter-spacing: -.4px;
}
.sens-subtitle {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 26px;
  max-width: 940px;
  margin-inline: auto;
  line-height: 1.6;
}
.sens-subtitle #sens-scenario-label { color: var(--primary); font-weight: 800; }

.sens-wrap {
  display: grid;
  /* Table column caps at the table's own max-width (1240px) so it always
     fills the column exactly — no leftover room for the table's internal
     `margin:0 auto` to drift it away from the axis label. justify-content
     then centers the (now content-sized) axis+table pair as a unit, so on
     wide screens the axis label stays snug against the table instead of
     pinning to the wrap's edge while the table centers off on its own. */
  grid-template-columns: 46px minmax(0, 1240px);
  justify-content: center;
  gap: 0;
  padding: 6px clamp(8px, 4vw, 70px) 6px;
  align-items: stretch;
}

.sens-axis-y {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .3px;
  padding: 40px 0;
  text-align: center;
}
.sens-axis-x {
  text-align: center;
  font-weight: 700;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: .3px;
  margin-bottom: 18px;
}

.sens-table-host { display: flex; flex-direction: column; }

.sens-table {
  border-collapse: separate;
  border-spacing: clamp(8px, 1vw, 16px);
  width: 100%;
  max-width: 1240px;
  min-width: 0;
  table-layout: fixed;
  margin: 0 auto;
  font-size: 15px;
}
.sens-table th,
.sens-table td {
  padding: 14px 8px;
  text-align: center;
  border: none;
}
.sens-table thead th {
  color: var(--ink);
  font-weight: 800;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  background: transparent;
}
.sens-table tbody th {
  color: var(--ink);
  font-weight: 800;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  background: transparent;
  white-space: nowrap;
}
.sens-table tbody td {
  height: clamp(70px, 9vh, 104px);
  font-weight: 800;
  font-size: clamp(20px, 2vw, 28px);
  color: #0c2c22;
  font-variant-numeric: tabular-nums;
  border-radius: 18px;
  box-shadow: 0 4px 14px -6px rgba(12,27,52,.20), inset 0 1px 0 rgba(255,255,255,.5);
  transition: transform .16s cubic-bezier(.2,.7,.3,1), box-shadow .22s;
  cursor: default;
}
.sens-table tbody td:hover {
  transform: scale(1.06) translateY(-2px);
  position: relative;
  z-index: 2;
  box-shadow: var(--sh-lg);
}
.sens-table tbody td.current {
  outline: 3px solid var(--primary-dark);
  outline-offset: -1px;
  box-shadow: 0 0 0 6px var(--primary-soft), var(--sh-md);
}

.sens-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  margin-top: 30px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.sens-legend .swatch {
  display: inline-block;
  width: 24px; height: 15px;
  border-radius: 5px;
  border: 1px solid rgba(0,0,0,.06);
  margin-left: 10px;
  vertical-align: middle;
}

.sens-source {
  font-size: 11px;
  color: var(--faint);
  font-style: normal;
  line-height: 1.55;
  margin-top: 22px;
  text-align: center;
  white-space: nowrap;
}
