/* NVI DataViz - NORDCAN-inspired responsive design */
.nvidv {
  max-width: 1400px;
  margin: 1rem auto 2rem;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.nvidv__controls {
  background: linear-gradient(135deg, #f7f9fb 0%, #e9eff5 100%);
  border-bottom: 1px solid #d7dee5;
  padding: 22px;
}

.nvidv__menuRow {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #dee2e6;
}

.nvidv__rowLabel {
  width: 100%;
  font-size: 13px;
  font-weight: 600;
  color: #2c3e57;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nvidv__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}

.nvidv__tab {
  min-width: 140px;
  padding: 8px 14px;
  background: #e2ebf3;
  border: 1px solid #c7d2df;
  border-radius: 8px;
  color: #334558;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.nvidv__tab:hover {
  background-color: #d9e4ee;
}

.nvidv__tab.active {
  background-color: #1F3A5F;
  border-color: #1F3A5F;
  color: #ffffff;
}

.nvidv__hidden {
  display: none;
}

.nvidv__menuRow select {
  padding: 10px 12px;
  border: 1px solid #c0c8d2;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.06);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.nvidv__menuRow select:focus {
  outline: 0;
  border-color: #1F3A5F;
  box-shadow: 0 0 0 0.25rem rgba(31, 58, 95, 0.2);
}

.nvidv__filterRow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  align-items: end;
}

.nvidv__filterRow label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #303f57;
}

.nvidv__filterRow select {
  border: 1px solid #c7d2df;
  border-radius: 6px;
  background: #ffffff;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.nvidv__filterRow select:focus {
  border-color: #1F3A5F;
  box-shadow: 0 0 0 0.2rem rgba(31, 58, 95, 0.15);
}

.nvidv__filterRow select {
  padding: 8px 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
  transition: border-color 0.15s ease-in-out;
}

.nvidv__filterRow select:focus {
  outline: 0;
  border-color: #80bdff;
}

.nvidv__filterRow select:disabled {
  background-color: #e9ecef;
  opacity: 0.65;
  cursor: not-allowed;
}

.nvidv__actionRow {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: flex-end;
}

.nvidv__controls button:not(.nvidv__tab) {
  background-color: var(--e-global-color-primary, #1F3A5F);
  font-family: "Inter", Sans-serif;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  line-height: 16px;
  color: var(--e-global-color-10dfedf, #fff);
  border-radius: 5px;
  padding: 17px 35px;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out;
}

.nvidv__controls .nvidv__tab {
  background-color: #e2ebf3;
  border-color: #c7d2df;
  color: #1F3A5F;
  min-width: 140px;
  padding: 8px 14px;
}

.nvidv__controls .nvidv__tab:hover {
  background-color: #1F3A5F;
  color: #ffffff;
}

.nvidv__controls .nvidv__tab.active {
  background-color: #1F3A5F;
  border-color: #1F3A5F;
  color: #ffffff;
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.15);
}

.nvidv__controls button:hover:not(:disabled) {
  background-color: #455469;
}

.nvidv__controls button:disabled {
  background: #6c757d;
  cursor: not-allowed;
  opacity: 0.65;
}

.nvidv__controls button[data-nvidv="download"] {
  background-color: var(--e-global-color-primary, #1F3A5F);
}

.nvidv__controls button[data-nvidv="download"]:hover:not(:disabled) {
  background-color: #455469;
}

.nvidv__chartWrap {
  position: relative;
  height: 500px;
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  padding: 20px;
  transition: height 0.2s ease;
}

.nvidv__chartWrap--map {
  height: auto;
  min-height: 500px;
}

.nvidv__chart {
  width: 100% !important;
  height: 100% !important;
}

.nvidv__map {
  display: none;
  width: 100%;
  height: auto;
}

.nvidv__mapLayout {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  align-items: start;
  width: 100%;
  height: auto;
}

.nvidv__mapLegend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: #24384f;
}

.nvidv__mapLegendTitle {
  font-weight: 600;
  text-align: center;
}

.nvidv__mapLegendScale {
  width: 22px;
  height: 220px;
  border-radius: 6px;
  background: linear-gradient(180deg, #0f3a6d 0%, #2f6fad 25%, #68a3d7 50%, #9dc3e3 75%, #d7e8f4 100%);
  border: 1px solid #b7c9da;
}

.nvidv__mapSvg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 700px;
}

.nvidv__mapRegion {
  stroke: #ffffff;
  stroke-width: 2;
  transition: fill 0.2s ease;
  cursor: pointer;
}

.nvidv__mapRegion:hover {
  stroke: #1F3A5F;
  stroke-width: 2.5;
  filter: brightness(0.88);
}

.nvidv__mapTooltip {
  position: fixed;
  background: rgba(15, 30, 55, 0.92);
  color: #fff;
  padding: 6px 11px;
  border-radius: 6px;
  font-size: 13px;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.1s ease;
  z-index: 9999;
}

.nvidv__mapRegionLabel {
  font-size: 11px;
  font-weight: 600;
  fill: #17304a;
  text-anchor: middle;
  pointer-events: none;
}

.nvidv__mapCaption {
  margin-top: 6px;
  font-size: 12px;
  color: #425b74;
  text-align: center;
}

.nvidv__nodata {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #6c757d;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
}

.nvidv__tableWrap {
  padding: 20px;
  overflow-x: auto;
}

.nvidv__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.nvidv__table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #495057;
  border-bottom: 2px solid #dee2e6;
  padding: 12px 16px;
  text-align: left;
}

.nvidv__table td {
  border-bottom: 1px solid #dee2e6;
  padding: 12px 16px;
  color: #495057;
}

.nvidv__table tbody tr:hover {
  background: #f8f9fa;
}

.nvidv__note {
  padding: 12px 20px;
  font-size: 14px;
  color: #6c757d;
  min-height: 24px;
  border-top: 1px solid #e9ecef;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .nvidv__menuRow {
    flex-direction: column;
    gap: 16px;
  }

  .nvidv__menuRow label {
    min-width: auto;
  }

  .nvidv__mapLayout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .nvidv__mapLegend {
    flex-direction: row;
    justify-content: center;
    gap: 12px;
  }

  .nvidv__mapLegendScale {
    width: 180px;
    height: 16px;
    background: linear-gradient(90deg, #d7e8f4 0%, #9dc3e3 25%, #68a3d7 50%, #2f6fad 75%, #0f3a6d 100%);
  }

  .nvidv__filterRow {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
  }
}

@media (max-width: 768px) {
  .nvidv__controls {
    padding: 16px;
  }

  .nvidv__menuRow {
    gap: 12px;
  }

  .nvidv__filterRow {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .nvidv__actionRow {
    flex-direction: column;
  }

  .nvidv__actionRow button {
    width: 100%;
  }

  .nvidv__chartWrap {
    height: 400px;
    padding: 16px;
  }

  .nvidv__tableWrap {
    padding: 16px;
  }

  .nvidv__table th,
  .nvidv__table td {
    padding: 8px 12px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .nvidv__filterRow {
    grid-template-columns: 1fr;
  }

  .nvidv__chartWrap {
    height: 300px;
  }

  .nvidv__tableWrap {
    padding: 12px;
  }

  .nvidv__table {
    font-size: 12px;
  }

  .nvidv__table th,
  .nvidv__table td {
    padding: 6px 8px;
  }
}

/* Loading and Error States */
.nvidv__note.loading {
  color: #007bff;
  font-style: italic;
}

.nvidv__note.error {
  color: #dc3545;
  font-weight: 500;
}

.nvidv__note.warning {
  color: #ffc107;
  font-weight: 500;
}

/* Focus and Accessibility */
.nvidv__controls select:focus,
.nvidv__controls button:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .nvidv__controls {
    display: none;
  }

  .nvidv__chartWrap {
    page-break-inside: avoid;
  }

  .nvidv__tableWrap {
    page-break-inside: avoid;
  }
}