/* ── Reset / Global ──────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: #f4f6fb;
  color: #1a2840;
  font-size: 14px;
  line-height: 1.55;
}

.app-wrapper {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.header {
  padding: 26px 0 16px;
  border-bottom: 2px solid #d8e0ea;
}

.main-title {
  margin: 0 0 5px;
  font-size: 22px;
  font-weight: 700;
  color: #0d1b2a;
  letter-spacing: -0.3px;
}

.main-subtitle {
  margin: 0;
  font-size: 13px;
  color: #5a6a80;
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.main-tabs { margin-top: 0; border-bottom: none !important; }

.tab {
  padding: 11px 20px;
  font-size: 13px;
  font-weight: 600;
  color: #5a6a80;
  background-color: #edf0f7;
  border: 1px solid #d8e0ea;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  margin-right: 4px;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.tab:hover { color: #1a5fb4; background-color: #e4eaf5; }

.tab--selected {
  background-color: #f4f6fb !important;
  color: #1a5fb4 !important;
  border-bottom: 2px solid #f4f6fb !important;
}

.outer-tab-content {
  background-color: #f4f6fb;
  border: 1px solid #d8e0ea;
  border-radius: 0 6px 6px 6px;
  padding: 24px 24px 20px;
  min-height: 640px;
}

/* ── Sidebar layout ──────────────────────────────────────────────────────── */
.tab-with-sidebar {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.sidebar {
  width: 210px;
  flex-shrink: 0;
  padding-top: 4px;
}

.main-content {
  flex: 1;
  min-width: 0;
}

/* ── Controls ────────────────────────────────────────────────────────────── */
.tab-content {}

.tab-subtitle {
  margin: 0 0 16px;
  font-size: 12px;
  color: #5a6a80;
  line-height: 1.55;
  border-left: 3px solid #1a5fb4;
  padding-left: 9px;
}

.ctrl-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #7a90b0;
  margin-bottom: 5px;
  margin-top: 0;
}

.ctrl-dropdown { font-size: 13px; }

/* Vertical slider (Tab 1 and Tab 3 left panel) */
.tab1-slider { margin-left: 8px; }

/* Horizontal year slider — blue handle + track */
.year-slider .rc-slider-handle {
  border-color: #1a5fb4;
  background-color: #1a5fb4;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  opacity: 1;
}
.year-slider .rc-slider-handle:hover,
.year-slider .rc-slider-handle:active {
  border-color: #1145a0;
  background-color: #1145a0;
  box-shadow: 0 0 0 4px rgba(26,95,180,0.18);
}
.year-slider .rc-slider-track {
  background-color: #b8cde8;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #1a5fb4;
  background-color: #e8edf8;
  border: 1px solid #b0c4e0;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.12s;
}

.btn-sm:hover { background-color: #d0ddf4; }

/* ── Dimension legend in sidebar ─────────────────────────────────────────── */
.dim-legend-sidebar {
  margin-top: 4px;
  padding: 8px 10px;
  background-color: #edf0f7;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.8;
  color: #1a2840;
}

/* ── Country legend (parallel coords) ───────────────────────────────────── */
.country-legend {
  margin-top: 12px;
  padding: 10px 14px;
  background-color: #edf0f7;
  border-radius: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

/* ── Plotly chart ────────────────────────────────────────────────────────── */
.js-plotly-plot { border-radius: 8px; overflow: hidden; }

/* ── Landing Page ────────────────────────────────────────────────────────── */
.landing-page {
  max-width: 780px;
  padding: 4px 0 20px;
}

.lp-section { margin-bottom: 4px; }

.lp-h2 {
  font-size: 17px;
  font-weight: 700;
  color: #0d1b2a;
  margin: 0 0 12px;
  padding-bottom: 5px;
  border-bottom: 2px solid #d8e0ea;
}

.lp-p {
  margin: 0 0 12px;
  font-size: 14px;
  color: #2a3a50;
  line-height: 1.65;
}

.lp-hr {
  border: none;
  border-top: 1px solid #d8e0ea;
  margin: 24px 0;
}

.lp-dim-block {
  margin: 10px 0 14px 10px;
}

.lp-dim-row {
  margin-bottom: 7px;
  font-size: 14px;
  line-height: 1.5;
}

.lp-ul {
  padding-left: 20px;
  margin: 6px 0 0;
}

.lp-li {
  margin-bottom: 11px;
  font-size: 14px;
  color: #2a3a50;
  line-height: 1.6;
}

/* ── Structural indicator rows with hover tooltip ────────────────────────── */
.indicator-row {
  position: relative;
}

.indicator-tooltip {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  z-index: 999;
  width: 300px;
  background: #1a2840;
  color: #e8edf5;
  border-radius: 8px;
  padding: 11px 14px;
  box-shadow: 0 6px 18px rgba(13,27,42,0.28);
  pointer-events: none;
}

.indicator-row:hover .indicator-tooltip {
  display: block;
}

.indicator-tooltip-desc {
  font-size: 11px;
  line-height: 1.5;
  color: #d0d8e8;
  margin: 0 0 7px;
}

.indicator-tooltip-source {
  font-size: 10px;
  color: #7a90b0;
  border-top: 1px solid #2e4060;
  padding-top: 6px;
  margin: 0;
  font-style: italic;
}

.lp-limitation {
  padding: 12px 14px;
  margin-bottom: 10px;
  background-color: #f7f9fc;
  border-left: 3px solid #c0cce0;
  border-radius: 0 6px 6px 0;
}

/* ── Scatter fullscreen overlay ───────────────────────────────────────────── */
.scatter-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 27, 42, 0.82);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  box-sizing: border-box;
  backdrop-filter: blur(3px);
}

.scatter-overlay-inner {
  background: #f4f6fb;
  border-radius: 10px;
  box-shadow: 0 12px 48px rgba(13,27,42,0.45);
  width: 96%;
  max-width: 1400px;
  height: 88vh;
  overflow-y: auto;
  padding: 16px 20px 12px;
  position: relative;
}

/* Close button sits in the dark overlay background, not inside the chart panel */
.scatter-overlay-close {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 10000;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 18px;
  color: #e8edf5;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
}

.scatter-overlay-close:hover {
  background: rgba(255,255,255,0.28);
  color: #fff;
}

.scatter-expand-btn {
  background: none;
  border: 1px solid #c0cce0;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 13px;
  color: #5a6a80;
  cursor: pointer;
  float: right;
  margin-bottom: 4px;
}

.scatter-expand-btn:hover { background: #edf0f7; color: #1a2840; }

/* Icon-only zoom button — top-right corner of any chart container */
.chart-expand-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  width: 26px;
  height: 26px;
  background: rgba(244, 246, 251, 0.88)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 13 13'%3E%3Ccircle cx='5' cy='5' r='3.5' fill='none' stroke='%237a90b0' stroke-width='1.4'/%3E%3Cline x1='7.5' y1='7.5' x2='11' y2='11' stroke='%237a90b0' stroke-width='1.4' stroke-linecap='round'/%3E%3Cline x1='5' y1='3' x2='5' y2='7' stroke='%237a90b0' stroke-width='1.4' stroke-linecap='round'/%3E%3Cline x1='3' y1='5' x2='7' y2='5' stroke='%237a90b0' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat center / 14px 14px;
  border: 1px solid #c0cce0;
  border-radius: 5px;
  padding: 0;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s;
  backdrop-filter: blur(2px);
}

.chart-expand-btn:hover {
  background-color: #e4eaf5;
  border-color: #a0b4d0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 13 13'%3E%3Ccircle cx='5' cy='5' r='3.5' fill='none' stroke='%231a5fb4' stroke-width='1.4'/%3E%3Cline x1='7.5' y1='7.5' x2='11' y2='11' stroke='%231a5fb4' stroke-width='1.4' stroke-linecap='round'/%3E%3Cline x1='5' y1='3' x2='5' y2='7' stroke='%231a5fb4' stroke-width='1.4' stroke-linecap='round'/%3E%3Cline x1='3' y1='5' x2='7' y2='5' stroke='%231a5fb4' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
}
