@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap");
:root {
  --primary: #004494;
  --primary-light: #e6f1ff;
  --text-main: #333;
  --text-muted: #666;
  --bg-page: #ffffff;
  --bg-section: #f8f8f8;
  --border-color: #f8f8f8;
  --font-family: "Inter", sans-serif;
  --color-eu: #004494;
  --color-ae: #D96B27;
  --color-other: #98C500;
}

.dashboard,
.dashboard * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
}
.ecl-page-header-harmonised__title span {
  color: #004494;
  font-family: var(--font-family);
  font-weight: 700;
  font-style: bold;
  font-size: 24px;
}
.field__field-text p {
  font-weight: 400;
  color: #000000;
  font-size: 14px;
  font-family: var(--font-family);
  text-align: justify;
}
.dashboard {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Layout Utilities */
.grid-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.country_group_heading {
  font-weight: 700;
  font-style: bold;
  font-size: 24px;
  line-height: 100%;
  color: #004494;
  margin-bottom: 10px;
}
.card_heading_title {
  font-weight: 700;
  font-style: bold;
  font-size: 16px;
  line-height: 100%;
}
.charts_heading_title {
  font-weight: 600;
  font-size: 14px;
  line-height: 100%;
}
.private_entities_table_heading {
  font-weight: 700;
  font-size: 14px;
  line-height: 100%;
  font-style: bold;
  padding-bottom: 15px;
  padding-top: 20px;
  padding-left: 20px;
}

.section1-card-value {
  font-weight: 700;
  font-style: bold;
  font-size: 28px;
  color: #004494;
  margin-bottom: 8px;
  line-height: 1.1;
}
.section1-card-heading {
  font-weight: 500;
  font-size: 15px;
  color: #222222;
  margin-bottom: 4px;
  line-height: 1.3;
}
.section1-card-description {
  font-weight: 400;
  font-size: 13px;
  color: #004494;
  opacity: 0.8;
}

/* Components */
.card {
  background: #F8F8F8;
  padding: 24px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease-in-out;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
.card-title {
  color: var(--primary);
}
.card-description {
  color: var(--primary);
}
/* Tabs - Responsive */
.tabs {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background-color: #fbfbfb;
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}
.dropdown-tabs {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  align-items: start;
  padding: 10px 20px;
  background-color: #fbfbfb;
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}
.tab-btn {
  padding: 10px 20px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: white;
  color: #8e8e93;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
.tab-btn-1 {
  padding: 10px 20px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: white;
  color: #8e8e93;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
.tab-section-1 {
  display: flex;
}
.tab-section-2 {
  display: flex;
  justify-items: center;
  justify-content: center;
  gap: 2px;
  > small {
    color: var(--primary);
    margin-top: 2px;
  }
}
.tab-content {
  display: none;
}
.tab-content.active-tab {
  display: block;
}
.tab-section {
  display: none;
}
.tab-section.active-section-tab {
  display: block;
}
/* .tab-btn.active { background: var(--primary-light); color: var(--primary); border-color: var(--primary-light); } */
.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-light);
  font-weight: 580;
  font-size: 16px;
  color: #004494;
}
.tab-btn:first-child {
  border-radius: 4px 0 0 4px;
}
.tab-btn:last-child {
  border-radius: 0 4px 4px 0;
  border-left: none;
}
.refres-btn {
  border: none;
  background: none;
}
.refres-btn:hover {
  border: none;
  background: none;
  cursor: pointer;
}
.tab-btn img, .tab-btn svg {
  width: 24px;
  height: 24px;
  font-size: 8px;
  font-weight: 400;
  padding-bottom: 2px;
}

/* Section 3 Cards */
.card--grouped {
  border-bottom: 4px solid var(--primary);
}
.head-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 10px;
}
.head-section__title {
  display: flex;
  align-items: center;
  gap: 10px;
  > h1 {
    font-size: 16px;
  }
}
.color-indicator {
  width: 14px;
  height: 14px;
  background: var(--primary);
  border-radius: 3px;
}
.body-section__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  font-size: 0.9rem;
  border-radius: 4px;
}
.body-section__row span:first-child {
  text-align: left;
  flex: 1;
  padding-right: 12px;
}
.body-section__row span:last-child {
  text-align: right;
  white-space: nowrap;
}
.body-section__row:nth-child(odd) {
  background-color: #ffffff;
}

/* Map Section */
.map-section {
  position: relative !important;
  overflow: visible;
  background: #ffffff;
  padding: 20px;
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
  height: 720px;
}
.stack-map-section {
  background: var(--bg-section);
  padding: 20px;
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
  min-height: 600px;
  display: flex;
  flex-direction: column;
}

.stack-map-section canvas {
  width: 100% !important;
  height: 100% !important;
  display: block; /* Removes any default inline-block spacing */
}
.stack-map-title {
  padding-bottom: 2px;
  font-weight: 700;
}
.stack-map-footer-title {
  padding-bottom: 5px;
  padding-top: 10px;
  margin-top: 15px;
  font-weight: 500;
  opacity: 0.6;
  text-align: center;
}
.stack-chart-wrapper {
  position: relative;
  flex: 1; /* This is the key: forces the wrapper to fill the container height */
  width: 100%;
}
/* #world-map {
  position: relative;
  width: 100% !important;
  background-color: none;
  height: 300px !important;
} */

/* Charts Section */
/* .charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 20px; margin-bottom: 20px; }
.chart-wrapper { background: var(--bg-section); height: auto; padding: 20px; border: 1px solid var(--border-color); }
canvas { width: 100% !important; height: auto !important; display: block; } */

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.chart-wrapper {
  background: var(--bg-section);
  padding: 20px;
  border: 1px solid var(--border-color);
  /* Increase this value to ensure all labels fit */
  min-height: 600px;
  overflow-y: auto; /* Adds a scrollbar if the chart is too tall */
}
.table-wrapper {
  background: var(--bg-section);
  border: 1px solid var(--border-color);
  /* Increase this value to ensure all labels fit */
  min-height: 600px;
  overflow-y: auto; /* Adds a scrollbar if the chart is too tall */
}

canvas {
  width: 100% !important;
  /* Remove 'height: auto !important' so it respects the wrapper */
  display: block;
}

/* Ensure sub-titles are consistent across all cards */
.card .subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 15px;
}

/* dropdown div */
.dropdown-div {
  width: 300px;
  border: 1px solid var(--text-main);
  border-radius: 8px;
}
.custom-dropdown {
  position: relative;
  width: 100%;
  border: 2px solid #8e8e93;
  padding: 5px;
}
.dropdown-selected {
  display: flex;
  justify-items: center;
  justify-content: space-between;
}
.custom-dropdown:hover {
  cursor: pointer;
}
.dropdown-options {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100.4%;
  margin-left: -2px;
  margin-right: -6px;
  background: white;
  border: 2px solid #8e8e93;
  z-index: 1000;
}
.dropdown-search {
  width: 99%;
  margin: 5px;
  padding: 5px;
}
.dropdown-options ul {
  list-style: none;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
}
.dropdown-options li {
  padding: 8px;
  cursor: pointer;
}
.dropdown-options li:hover {
  background: #f0f0f0;
}

.kpi-table-container {
  overflow-x: auto;
  margin: 5px 0;
  /* Removed border from container */
}

.kpi-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-family);
  color: #333;
  /* Fixed layout is crucial for controlling column widths */
  table-layout: fixed;
}

.kpi-table th,
.kpi-table td {
  padding: 12px;
  /* Removed borders */
  border: none;
  /* Optional: keeps text from overflowing out of the fixed width */
  word-wrap: break-word;
}

/* Define specific column widths */
.kpi-table th:nth-child(1),
.kpi-table td:nth-child(1) {
  width: 55% !important; /* KPI column takes half the space */
}

.kpi-table th:nth-child(2),
.kpi-table td:nth-child(2) {
  width: 12%; /* Value */
}

.kpi-table th:nth-child(3),
.kpi-table td:nth-child(3) {
  width: 10%; /* Unit */
}

.kpi-table th:nth-child(4),
.kpi-table td:nth-child(4) {
  width: 23%; /* Source */
}
.dropdown-tab-title{
  font-size: 16px;
  font-weight: 850;
  color: #3C4243;
  font-family: var(--font-family);
}

/* Optional: Keep the header background and bottom line */
.kpi-table thead {
  background-color: #f9f9f9;
  text-align: left;
  border-bottom: 2px solid #e0e0e0; /* Subtle line for header */
}

.kpi-table-header-title th {
  font-weight: 700;
  color: #000000;
  font-size: 16px;
}

.kpi-table tbody tr:hover {
  background-color: #f1f1f1;
}

.kpi-table-header-row th {
  font-weight: 500;
  color: #000000;
  font-size: 16px;
}

.kpi-table-row td {
  color: #475467;
  font-size: 14px;
  font-weight: 400;
}

/* Style the legend container */
.jvm-legend {
  background: #ffffff;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  position: absolute !important;
  bottom: 10px !important;
  right: 10px !important;
}

/* Each item in the legend */
.jvm-legend-tick {
  display: flex;
  align-items: center;
  margin-top: 5px;
}

/* The colored square */
.jvm-legend-tick-sample {
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border-radius: 2px;
  /* The library already provides the background-color via inline style */
}

/* The text label */
.jvm-legend-tick-text {
  font-size: 14px;
  line-height: 1;
}

/* Keep the tooltip clean and readable */
.jvm-tooltip {
  color: #333333 !important;
  padding: 10px !important;
  border-radius: 5px !important;
  font-size: 13px !important;

  /* FIX: Constrain width so it doesn't overflow */
  max-width: 500px !important;
  width: auto !important;
  white-space: pre-line;
  line-height: 1.5;
  z-index: 9999 !important;
  pointer-events: none !important;
  white-space: normal !important; /* Allows text wrapping */
  font-family: sans-serif;

  /* Ensure it doesn't get cut off by the parent card */
  position: absolute !important;
  top: 0 !important;
  left: -9999px !important;
  word-wrap: break-word !important;
}
.jvm-zoom-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 30px;
  height: 30px;
  background: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  cursor: pointer;
  color: #333;
  font-size: 20px;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease-in-out;
  margin-bottom: 5px;
}
.jvm-zoom-btn:hover {
  background-color: #f8f9fa;
  border-color: #007a33;
  color: #007a33;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}
.jvm-zoom-btn:active {
  transform: scale(0.95);
}
.jvm-zoomin {
  position: absolute !important;
  left: 10px !important;
  top: 10px !important;
}
.jvm-zoomout {
  position: absolute !important;
  left: 10px !important;
  top: 38px !important;
}

.table-container-input-section {
  width: 100%;
  margin: 20px 0;
  font-family: sans-serif;
  background: var(--bg-section);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed; /* Ensures column widths are respected */
}
.kpi-table tbody{
  font-size: 16px;
}

/* Set column widths for the 2-column table */
.data-table th:nth-child(1),
.data-table td:nth-child(1) {
  width: 85%; /* Topic column */
}

.data-table th:nth-child(2),
.data-table td:nth-child(2) {
  width: 15%; /* Number of entities */
}

.data-table th {
  font-size: 14px;
  color: #555;
  padding: 15px;
  border-bottom: 2px solid #eee;
  border-top: none; /* Explicitly ensure no top border */
}

.data-table td {
  padding: 15px;
  font-size: 14px;
  color: #333;
  border-bottom: 1px solid #f9f9f9;
}

/* Ensure no vertical borders are present */
.data-table th,
.data-table td {
  border-left: none;
  border-right: none;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.data-table tbody tr:hover {
  background-color: #fcfcfc;
}

/* Mobile responsive override */
@media (max-width: 600px) {
  .responsive-table {
    min-width: 100%;
  }

  /* Optional: Stack the rows */
  .responsive-table thead {
    display: none;
  }
  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }
}
/* Responsive Adjustments */
@media (max-width: 768px) {
  .tabs {
    flex-direction: column;
    align-items: flex-start;
  }
  .tab-section-1 {
    width: 100%;
  }
  .tab-btn {
    flex: 1;
    justify-content: center;
  }
  #world-map {
    height: 250px !important;
  }
}

/* D3 Chart & Tooltip Styles */
.d3-chart-container {
  width: 100%;
  min-height: 120px;
  position: relative;
}

.d3-chart-container svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.d3-tooltip {
  position: absolute;
  top: 0;
  left: -9999px;
  padding: 8px 12px;
  background: rgba(20, 20, 20, 0.9);
  color: #ffffff;
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font-family);
  pointer-events: none;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  line-height: 1.4;
  transition: opacity 0.15s ease-in-out;
}

/* Map Container & Zoom Controls */
/* .map-section {
  position: relative;
  width: 100%;
  height: 820px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 20px;
  background: var(--bg-section);
  padding: 0;
}

#world-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  overflow: hidden;
  background: transparent;
  border: none;
}

#world-map > svg {
  display: block;
  width: 100%;
  height: 100%;
} */
/* start from here */
/* .map-legend-card {
  position: absolute;
  right: 10px;
  bottom: 20px;
  width: 220px;
  box-sizing: border-box;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #e2e2e2;
  border-radius: 6px;
  z-index: 10;
  pointer-events: none;
}

.map-legend-title {
  margin-bottom: 10px;
  color: #004494;
  font-family: Inter, sans-serif;
  font-size: 13px;
  font-weight: 700;
}

.map-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.map-legend-row:last-child {
  margin-bottom: 0;
}

.map-legend-color {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 3px;
}

.map-legend-label {
  color: #222222;
  font-family: Inter, sans-serif;
  font-size: 13px;
  font-weight: 500;
} */
/* end here */

/* .map-zoom-controls {
  position: absolute;
  top: 15px;
  left: 15px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  overflow: hidden;
  z-index: 10;
}

.zoom-btn {
  width: 30px;
  height: 30px;
  background: #ffffff;
  border: 1px solid #d0d5dd;
  font-size: 18px;
  font-weight: bold;
  color: #344054;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.zoom-btn:hover {
  background: #f2f4f7;
}

.zoom-btn + .zoom-btn {
  border-top: none;
} */


/* Map Container & Zoom Controls */
/* .map-section {
  position: relative;
  width: 100%;
  height: clamp(520px, 55vw, 820px);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 20px;
  background: var(--bg-section);
  padding: 0;
}

#world-map {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;

  border-radius: inherit;
  overflow: hidden;
  background: transparent;
  border: none;
}

#world-map > svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  pointer-events: all;
  border: none;
} */


.map-section {
  position: relative;
  width: 100%;
  height: clamp(480px, 55vw, 820px);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 20px;
  background: #ffffff;
  padding: 0;
}

#world-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
}

#world-map > svg {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: all;
}

#world-map .map-viewport,
#world-map .map-width-layer,
#world-map .map-path-layer,
#world-map .country-path {
  pointer-events: all;
}

@media (max-width: 1440px) {
  .map-section {
    height: clamp(520px, 58vw, 720px);
  }
}
@media (max-width: 2700px) {
  .map-section {
    height: clamp(520px, 58vw, 720px);
  }
}

@media (max-width: 1024px) {
  .map-section {
    height: clamp(480px, 65vw, 650px);
  }
}

@media (max-width: 600px) {
  .map-section {
    height: 460px;
  }

  .map-legend-card {
    right: 8px;
    bottom: 8px;
    width: 185px;
  }
}
/* Map paths */
#world-map .map-viewport,
#world-map .map-path-layer {
  pointer-events: all;
}

#world-map .country-path {
  vector-effect: non-scaling-stroke;
}

/* Legend */
.map-legend-card {
  position: absolute;
  right: 10px;
  bottom: 20px;
  width: 220px;
  max-width: calc(100% - 20px);
  box-sizing: border-box;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #e2e2e2;
  border-radius: 6px;
  z-index: 10;
  pointer-events: none;
}

.map-legend-title {
  margin-bottom: 10px;
  color: #004494;
  font-family: Inter, sans-serif;
  font-size: 13px;
  font-weight: 700;
}

.map-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.map-legend-row:last-child {
  margin-bottom: 0;
}

.map-legend-color {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border-radius: 3px;
  border: 1px solid #d0d0d0;
}

.map-legend-label {
  color: #222222;
  font-family: Inter, sans-serif;
  font-size: 13px;
  font-weight: 500;
}

/* Zoom controls */
.map-zoom-controls {
  position: absolute;
  top: 15px;
  left: 15px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  overflow: hidden;
  z-index: 10;
}

.zoom-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  background: #ffffff;
  border: 1px solid #d0d5dd;
  font-size: 18px;
  font-weight: bold;
  color: #344054;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.zoom-btn:hover {
  background: #f2f4f7;
}

.zoom-btn + .zoom-btn {
  border-top: none;
}

@media (max-width: 768px) {
  .map-section {
    height: 480px;
  }

  .map-legend-card {
    right: 8px;
    bottom: 8px;
    width: 190px;
    padding: 10px 12px;
  }

  .map-legend-label {
    font-size: 11px;
  }
}
@media (max-width: 480px) {
  body {
    padding: 10px;
  }
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
   World Map Icon Loader
   ========================================== */
.map-loader-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #ffffff;
  z-index: 500;
}

.map-loader-container svg.spinning-icon {
  animation: mapIconSpin 0.9s linear infinite;
  color: #004494;
}

@keyframes mapIconSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
