/* country-ui.css */

/* ---------- Modal backdrop ---------- */
.kpi-modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;

  opacity: 0;
  transition: opacity 120ms ease-out;
}

.kpi-modal-backdrop.open{
  opacity: 1;
}

/* ---------- Modal ---------- */
.kpi-modal{
  width: min(980px, calc(100vw - 32px));
  max-height: min(80vh, 820px);

  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 60px rgba(0,0,0,.25);
  overflow: hidden;

  display: flex;
  flex-direction: column;

  transform: scale(.96);
  opacity: 0;
  transition: transform 140ms ease-out, opacity 140ms ease-out;
}

.kpi-modal.open{
  transform: scale(1);
  opacity: 1;
}

/* ---------- Header ---------- */
.kpi-modal-header{
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 12px 14px;
  border-bottom: 1px solid #CDE4FE;
  background: #f8faff;
}

.kpi-modal-title{
  font-weight: 700;
  font-size: 14px;
  color: #011832;
}

.kpi-modal-close{
  border: 1.5px solid #5E2390;
  background: transparent;
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  color: #5E2390;
  font-family: "IBM Plex Sans", Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  transition: background 150ms ease, color 150ms ease;
}

.kpi-modal-close:hover{
  background: #5E2390;
  color: #fff;
}

/* ---------- Body ---------- */
.kpi-modal-body{
  padding: 12px 14px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

/* ---------- KPI cards ---------- */
.kpi-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.kpi-card{
  border: 1px solid #CDE4FE;
  border-radius: 10px;
  padding: 10px;
  background: #f8faff;
}

.kpi-label{
  font-size: 11px;
  color: #034EA2;
  margin-bottom: 4px;
}

.kpi-value{
  font-size: 18px;
  font-weight: 700;
  color: #011832;
}

/* ---------- Segmented control ---------- */
.kpi-segments{
  display: inline-flex;
  background: #CDE4FE;
  border-radius: 20px;
  padding: 3px;
  margin-bottom: 12px;
  gap: 2px;
}

.kpi-seg-btn{
  border: none;
  background: transparent;
  border-radius: 18px;
  padding: 6px 14px;
  font-size: 12px;
  font-family: "IBM Plex Sans", Arial, sans-serif;
  color: #034EA2;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.kpi-seg-btn:hover{
  color: #011832;
}

.kpi-seg-btn.active{
  background: #034EA2;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(3,78,162,.2);
}

/* ---------- Chart containers ---------- */
.kpi-chart-wrap{
  width: 100%;
  height: 360px;
}

/* ---------- Detail table ---------- */
.kpi-table{
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.kpi-table th,
.kpi-table td{
  border-bottom: 1px solid #eee;
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
}

.kpi-table th{
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  border-bottom: 1px solid #CDE4FE;
  color: #034EA2;
  font-weight: 600;
}

/* sortable headers */
.kpi-table th[data-sort]{
  cursor: pointer;
  user-select: none;
}

.kpi-table th .sort-ind{
  font-size: 10px;
  color: #3793FB;
  margin-left: 6px;
}

/* totals row */
.kpi-table tr.kpi-totals-row td{
  font-weight: 700;
  border-top: 2px solid #034EA2;
  color: #011832;
}

/* year stepper in modal title */
.kpi-year-nav{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.kpi-year-btn{
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid #034EA2;
  background: #fff;
  cursor: pointer;
  line-height: 24px;
  text-align: center;
  font-weight: 700;
  color: #034EA2;
  transition: background 150ms ease, color 150ms ease;
}

.kpi-year-btn:hover:not(:disabled){
  background: #034EA2;
  color: #fff;
}

.kpi-year-btn:disabled{
  opacity: 0.45;
  cursor: default;
}