/* ==========================================================================
   dashboard.css — styles for dashboard.html only
   ========================================================================== */

.dash-hero {
  background: var(--navy);
  color: #e8eef4;
  padding: clamp(2.2rem, 5vw, 3.6rem) 0 0;
}

.dash-hero h1,
.dash-hero h2 {
  color: #fff;
}

.dash-hero .lede {
  color: #aebcc9;
}

.dash-hero__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.dash-hero .data-banner {
  margin: 1.2rem 0 0;
  flex: none;
}

/* ---------- KPI cards ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 2.4rem;
}

.kpi {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}

.kpi__label {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8fa5b8;
  display: block;
  margin-bottom: 0.35rem;
}

.kpi__value {
  font-family: var(--serif);
  font-size: 1.7rem;
  color: var(--gold-2);
  line-height: 1.1;
}

@media (max-width: 880px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- Globe panel ---------- */
.globe-panel {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 0;
  background: var(--navy-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: -3.2rem; /* overlap the hero edge */
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 5;
}

.globe-stage {
  position: relative;
  min-height: 440px;
  background:
    radial-gradient(120% 90% at 30% 20%, #0e2c42 0%, #071522 70%);
}

#globe-canvas {
  width: 100%;
  height: 100%;
  min-height: 440px;
  touch-action: none;
}

.globe-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(10, 22, 34, 0.94);
  border: 1px solid var(--gold);
  color: #fff;
  font-size: 0.8rem;
  line-height: 1.4;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}

.globe-tooltip.is-visible {
  opacity: 1;
}

.globe-side {
  padding: 1.8rem;
  color: #c8d4de;
}

.globe-side h3 {
  color: #fff;
}

.globe-side ul {
  padding-left: 1.1rem;
  margin: 0.6rem 0 1.4rem;
}

.globe-side li {
  margin-bottom: 0.45rem;
  font-size: 0.92rem;
}

.globe-hint {
  font-size: 0.78rem;
  color: #7e93a6;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 0.9rem;
}

@media (max-width: 960px) {
  .globe-panel {
    grid-template-columns: 1fr;
    margin-top: -1.6rem;
  }
}

/* ---------- Controls row ---------- */
.dash-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}

.dash-controls h2 {
  margin: 0;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: var(--gold);
  color: var(--ink);
}

.chip.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.search-input {
  font: inherit;
  font-size: 0.92rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  min-width: 240px;
  color: var(--ink);
}

.search-input:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

/* ---------- Table ---------- */
.table-wrap {
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

#priority-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 860px;
}

#priority-table th {
  text-align: left;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0.85rem 0.75rem;
  border-bottom: 2px solid var(--line);
  background: var(--paper-2);
  white-space: nowrap;
}

#priority-table th[data-key] {
  cursor: pointer;
  user-select: none;
}

#priority-table th[data-key]:hover {
  color: var(--ink);
}

#priority-table th.is-sorted::after {
  content: " ▲";
  color: var(--gold);
}

#priority-table th.is-sorted.desc::after {
  content: " ▼";
}

#priority-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

#priority-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

#priority-table tbody tr:hover {
  background: var(--paper-2);
}

#priority-table tbody tr.is-selected {
  background: #fdf3dd;
  box-shadow: inset 3px 0 0 var(--gold);
}

.cell-country {
  font-weight: 600;
  white-space: nowrap;
}

.iso {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0.06em;
}

.cell-score {
  white-space: nowrap;
}

.score-bar {
  display: inline-block;
  width: 64px;
  height: 6px;
  border-radius: 3px;
  background: var(--paper-2);
  overflow: hidden;
  vertical-align: middle;
  margin-right: 0.5rem;
}

.score-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
}

.col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-empty {
  text-align: center;
  color: var(--ink-3);
  padding: 2rem !important;
}

.table-foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--ink-3);
  margin-top: 0.7rem;
}

/* ---------- Top-10 bars ---------- */
.bars-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow);
}

.bar-row {
  display: grid;
  grid-template-columns: 150px 1fr 44px;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  font: inherit;
  font-size: 0.85rem;
  background: none;
  border: none;
  padding: 0.28rem 0;
  cursor: pointer;
  text-align: left;
  color: var(--ink-2);
}

.bar-row:hover {
  color: var(--ink);
}

.bar-row__label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-row__track {
  height: 10px;
  background: var(--paper-2);
  border-radius: 5px;
  overflow: hidden;
}

.bar-row__fill {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--teal), #2c8a7e);
  transition: width 0.4s ease;
}

.bar-row:hover .bar-row__fill {
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
}

.bar-row__value {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 600;
}

.dash-lower {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 960px) {
  .dash-lower {
    grid-template-columns: 1fr;
  }
}
