/* ============================================
   COMPLETE CSS - REPLACE YOUR ENTIRE STYLE.CSS
   ============================================ */

/* Full width and height html and body */
html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  /* font-family: Arial, Helvetica, sans-serif; */
}

body {
  margin: 0;
  padding: 0;
  height: 100%;
  /* width: 1750px; */
  overflow: hidden;
  /* transform-origin: top left; */
}
#app-wrapper {
  width: 1750px;
  height: 100vh;
  transform-origin: top left;
  overflow: hidden;
  position: relative;
}

/* ============================================
   LAYOUT CONTAINERS
   ============================================ */

.layoutcontainer {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.layoutcontent {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: row;
}

.layoutcontent > div:first-child {
  flex: 2;
}

.layoutcontent > div:last-child {
  flex: 1;
}

/* ============================================
   CHART ICONS - TOP RIGHT
   ============================================ */

.chart-icons {
  position: absolute;
  top: 10px;
  left: 970px;
  width: auto;
  max-width: calc(100% - 800px); /* ✅ Leave space for counters on right */
  z-index: 100;
  display: flex;
  gap: 10px;
  align-items: center;
}

.chart-button {
  background: white;
  font-size: 20px;
  box-shadow: 1px 1px 1px grey;
  padding: 10px;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.3s ease;
  text-align: center;
  border: 1px solid gray;
}

.chart-button.active {
  background: #4141c9;
  color: white;
  box-shadow: 1px 1px 1px grey;
}

.chart-button:hover {
  color: #007bff;
  transform: scale(1.1);
  transition: 0.2s ease-in-out;
}

/* ============================================
   COUNTER TILES - BELOW ICONS
   ============================================ */

.layoutcounters-floating {
  position: absolute;
  top: 60px;
  right: 30px;
  width: 750px;
  z-index: 99;
}

.layoutcounters {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-around;
  height: auto;
  margin-bottom: 10px;
}

.counter-container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-around;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 15px;
  box-shadow: 1px 1px 6px grey;
  width: 100%;
}

.counter {
  flex: 1;
  cursor: pointer;
  padding: 5px;
  background: white;
  border-radius: 10px;
  margin: 5px;
  box-shadow: 1px 1px 6px;
  min-width: 80px;
}

.counter > div:first-child {
  font-size: 22px;
  font-weight: bold;
  text-align: center;
  -webkit-text-fill-color: #ffffff;
  letter-spacing: 2px;
  font-family: Arial, Helvetica, sans-serif;
  color: white;
  text-shadow:
    rgb(0 0 0) 1px 0px 1px,
    rgb(0 0 0) 0.540302px 0.841471px 1px,
    rgb(0 0 0) -0.416147px 0.909297px 1px,
    rgb(0 0 0) -0.989992px 0.14112px 1px,
    rgb(0 0 0) -0.653644px -0.756802px 1px,
    rgb(0 0 0) 1.283662px -0.958924px 1px,
    rgb(0 0 0) 0.96017px -0.279415px 1px;
}

.counter > div:last-child {
  font-size: 14px;
  text-align: center;
  font-weight: bold;
  color: black;
  font-family: Arial, Helvetica, sans-serif;
  text-shadow:
    rgb(255 255 255) 1px 0px 1px,
    rgb(255 255 255) 0.540302px 0.841471px 1px,
    rgb(255 255 255) -0.416147px 0.909297px 1px,
    rgb(255 255 255) -0.989992px 0.14112px 1px,
    rgb(255 255 255) -0.653644px -0.756802px 1px,
    rgb(255 255 255) 1.283662px -0.958924px 1px,
    rgb(255 255 255) 0.96017px -0.279415px 1px;
}

.separator-div {
  border-bottom: 0.5px solid #000000;
  padding: 0.25px;
  margin-bottom: 3px;
  background: white;
  opacity: 0.5;
}

.table-counter-container {
  display: flex;
  flex-direction: row;
}

/* ============================================
   CHART CONTAINERS - BELOW COUNTERS
   ============================================ */

.layoutfloating {
  position: absolute;
  top: 247px;
  right: 9px;
  width: 771px;
  z-index: 10;
  overflow: hidden;
  border-radius: 15px;
  box-shadow: 1px 1px 6px grey;
  background: white;
}

.layoutcharts {
  height: auto;
  width: 100%;
  position: relative;
  padding: 3px;
  background-color: transparent;
  border-radius: 15px;
  display: flex;
  align-items: baseline;
}

#leftchart,
#rightchart,
#trendChart,
#barChart {
  overflow: hidden;
  flex: 1;
  width: 100%;
  min-height: 400px;
}

/* Remove old conflicting rules */
#app > div.layoutcontent > div.layoutfloating {
  position: absolute;
  top: 248px;
  right: 9px;
  width: 771px;
  z-index: 10;
}

#app > div.layoutcontent > div.layoutfloating_trend {
  position: absolute;
  top: 261px;
  right: 9px;
  width: 771px;
  z-index: 10;
}

/* ============================================
   LOADING INDICATOR
   ============================================ */

.layoutloader {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: absolute;
  background: white;
  box-shadow: 1px 1px 6px grey;
  border-radius: 15px;
  width: 750px;
  height: 420px;
  padding: 20px;
  right: 30px;
  top: 165px;
  z-index: 10;
}

.dataloading {
  display: flex;
  white-space: nowrap;
  height: 48px;
  margin-top: 10px;
  justify-content: center;
  align-items: center;
}

.loader {
  width: 48px;
  height: 48px;
  border: 6px solid #d2e593;
  border-bottom-color: transparent;
  border-radius: 50%;
  display: inline-block;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;
}

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

@-webkit-keyframes spin {
  0% {
    -webkit-transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
  }
}

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

/* ============================================
   HEADER AND CONTROLS
   ============================================ */

.layoutcontrols {
  display: flex;
  flex-direction: row;
  padding: 8px;
  font-family: Arial;
  background-color: #efcc35;
  border-bottom: 2px solid #b3ade6;
  align-items: center;
}

#app > div.layoutcontrols select {
  border-radius: 10px;
  padding: 5px;
  margin-right: 15px;
}

#portal-links {
  display: flex;
  justify-content: center;
  align-content: center;
  align-items: center;
}

.header {
  display: flex;
  justify-content: center;
  padding: 10px;
  z-index: 2;
  border-bottom: 2px solid #b3ade6;
  align-items: center;
  background: linear-gradient(
    180deg,
    rgb(227, 226, 24) 0%,
    rgb(67, 187, 0) 100%
  );
  font-family: arial, sans-serif;
}

.header img {
  max-height: 70px;
}

.center-text {
  display: flex;
  align-items: center;
}

.header-select-label {
  /* margin: 5px 5px 5px 0px; */
  font-weight: bold;
  color: black;
}

.header-presentations {
  display: flex;
  align-items: center;
  justify-content: center;
}

.download-pdf {
  height: 40px;
  margin-left: 40%;
}

.download-button {
  padding: 5px 10px;
  border-radius: 10px;
  background-color: #6d74f7;
  color: white;
  border: 1px solid #313ae9;
  letter-spacing: 1.1;
}

.presentations-label {
  margin: 5px 5px 5px 0px;
  font-weight: bold;
  color: black;
  font-size: 18px;
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
  background-color: #d2e593;
  display: flex;
  justify-content: center;
  padding: 8px;
  font-family: arial, sans-serif;
}

.footer-mobile {
  background-color: #d2e593;
  display: flex;
  justify-content: center;
  padding: 8px;
  font-family: arial, sans-serif;
}

/* ============================================
   POPUPS AND MODALS
   ============================================ */

.about-us-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 20px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  z-index: 1000;
  width: 700px;
}

.about-us-popup .popup-content {
  text-align: center;
}

.about-us-popup .close-icon {
  width: 20px;
  height: 20px;
}

button.active {
  background-color: #007bff;
  color: white;
}

button:not(.active) {
  background-color: #f1f1f1;
  color: #333;
}

.backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  z-index: 999;
}

/* .modal {
  position: fixed;
  z-index: 999;
  padding-top: 50px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
} */

/* .modal-content {
  font-family: Arial, Helvetica, sans-serif;
  background-color: #fefefe;
  margin: 0;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-height: 85%;
  overflow: scroll;
  border-radius: 15px;
} */

.modal-content-presentations {
  font-family: Arial, Helvetica, sans-serif;
  background-color: #fefefe;
  margin: auto;
  padding: 20px;
  border: 1px solid #888;
  width: 50%;
  max-width: 900px;
  max-height: 85%;
  overflow: auto;
  border-radius: 15px;
}

.modal-header h2 {
  font-size: 18px;
}

.close {
  color: #aaaaaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.close:hover,
.close:focus {
  color: #000;
  text-decoration: none;
  cursor: pointer;
}

.custom-popup-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.custom-popup {
  background: white;
  padding: 20px;
  border-radius: 10px;
  max-width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* ============================================
   TABLES
   ============================================ */

table {
  font-family: arial, sans-serif;
  border-collapse: collapse;
  width: 100%;
}

td,
th {
  border: 1px solid #dddddd;
  text-align: left;
  padding: 8px;
  cursor: pointer;
}

tr:nth-child(even) {
  background-color: #dddddd;
}

.table thead th {
  background-color: #f0f8ff;
  cursor: pointer;
  user-select: none;
  position: relative;
}

.table thead th.sortable:hover {
  background-color: #dceefb;
}

.table thead th.asc::after {
  content: " ▲";
  color: #007bff;
}

.table thead th.desc::after {
  content: " ▼";
  color: #007bff;
}

.table tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

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

.district-table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 20px;
}

.district-table th,
.district-table td {
  border: 1px solid #ccc;
  padding: 6px;
  text-align: center;
}

.district-table th {
  background-color: #f0f0f0;
}

/* ============================================
   SEARCH AND EXPORT
   ============================================ */

.modal-search {
  padding-left: 0px;
  font-size: 18px;
  width: 100%;
}

.modal-search input {
  width: 100%;
  padding: 5px;
  font-size: 18px;
}

.modal-export {
  display: flex;
  justify-content: end;
  align-items: stretch;
  margin-top: 10px;
}

.select-source {
  padding: 10px;
  border-radius: 15px;
  font-size: 18px;
  margin-right: 10px;
}

.li-source {
  padding: 10px;
  font-size: 18px;
}

.no-data {
  text-align: center;
  font-size: 20px;
  font-weight: bold;
  color: #ff0000;
  margin-top: 10px;
}

/* ============================================
   TEAM AND PROJECT CONTENT
   ============================================ */

.team-content {
  text-align: left;
  word-wrap: break-word;
  line-height: 1.2;
}

.team-content h1 {
  font-size: 18px;
  color: darkblue;
}

.team-content h2 {
  font-size: 16px;
}

.team-content li {
  font-size: 14px;
}

.horizontal-list {
  list-style: disc inside;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 0;
  margin: 5px 0;
}

.horizontal-list li {
  display: inline;
  white-space: nowrap;
  font-size: 20px;
}

.project-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.tab-container {
  flex-grow: 1;
  overflow-y: auto;
}

.param-description {
  max-height: 90px;
  cursor: pointer;
  padding: 5px;
  background: white;
  border-radius: 10px;
  margin: 5px;
  box-shadow: 1px 1px 6px;
  text-align: justify;
  overflow-y: auto;
}

.param-description-container {
  padding: 10px;
  padding-top: 5px;
  font-family: Arial, Helvetica, sans-serif;
  color: rgb(51, 51, 51);
}

.param-description-header-text {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 3px;
}

/* ============================================
   WARNINGS AND NOTIFICATIONS
   ============================================ */

.selection-warning {
  position: fixed;
  top: 300px;
  right: 200px;
  overflow: hidden;
  border-radius: 15px;
  box-shadow: 1px 1px 6px grey;
  flex: 1;
  margin: 5px;
  background: white;
  color: #d32f2f;
  font-weight: 600;
  padding: 12px 18px;
  font-size: 16px;
  z-index: 100;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ============================================
   MISC STYLES
   ============================================ */

.material-symbols-outlined {
  font-variation-settings:
    "FILL" 0,
    "wght" 400,
    "GRAD" 0,
    "opsz" 24;
}

.highcharts-credits {
  display: none;
}

#dsslink,
#madplink,
#flalink {
  display: flex;
  margin-right: 10px;
  justify-content: center;
  align-content: center;
  align-items: center;
  background-color: #ff5722;
  border-radius: 10px;
  padding: 8px;
  font-size: 14px;
}

#dsslink {
  border: 1px solid grey;
  width: 150px;
  margin: 4px;
}

.mobile-toggle-buttons {
  display: none;
}

.ol-zoom-out,
.ol-zoom-in {
  background-color: #ffc107 !important;
  color: #685a5a !important;
}

option.highlighted {
  background: #ffc107;
  color: black;
  font-weight: bold;
  padding-top: 5px;
  padding-bottom: 5px;
}

select option {
  color: black;
}

select option:disabled {
  color: #aaa;
}

.ol-overlay-container {
  background-color: white;
  padding: 10px;
  color: black;
  font-size: 14px;
  border-radius: 15px;
  border: 2px solid #b3ade6;
}

#chart-modal {
  overflow: hidden;
  position: absolute;
  width: 100%;
  margin: 0px auto;
  bottom: 0;
  z-index: 999;
  background-color: white;
  border: 1px solid black;
}

.chart-close {
  color: #3687d3;
  float: right;
  font-size: 28px;
  font-weight: bold;
  padding-right: 2px;
}

.chart-close:hover,
.chart-close:focus {
  color: #031255;
  text-decoration: none;
  cursor: pointer;
}

#loading-chart {
  width: 50%;
  margin: 0 auto;
  padding: 10px;
  text-align: center;
}

/* ============================================
   LEGEND AND BAR CHARTS
   ============================================ */

.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.swatch {
  width: 20px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.bar-wrap {
  background: #f7f7f7;
  border-radius: 6px;
  padding: 4px;
}

.bar {
  height: 28px;
  border-radius: 4px;
  display: flex;
  overflow: hidden;
  font-size: 12px;
}

.seg {
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 6px;
}

/* ============================================
   MAP STYLES
   ============================================ */

.map-overlay-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 50px auto;
  width: 100%;
}

.map-overlay {
  background: rgba(0, 0, 0, 0.849);
  padding: 20px 30px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  width: auto;
  color: white;
}

.overlay-title {
  margin-bottom: 15px;
  font-size: 18px;
  font-weight: bold;
}

.selection-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 15px;
  text-align: left;
}

.selection-steps li {
  padding: 6px 0;
  font-size: 14px;
  color: #555;
}

.selection-steps li.completed {
  color: green;
  font-weight: bold;
}

.progress-bar {
  background: #eee;
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
}

.progress {
  background: #4caf50;
  height: 100%;
  width: 0;
  transition: width 0.4s ease;
}

/* ============================================
   MEDIA QUERIES
   ============================================ */

@media (max-width: 1150px) {
  .modal-content-presentations {
    width: 90%;
  }
}

/* END OF CSS */

/* ============================================
   SIMPLE MODAL - EXACT BASE COLORS
   ============================================ */

/* Blurred Backdrop */
.modal {
  position: fixed;
  z-index: 999;
  padding: 0;
  left: 0;
  top: 0;
  width: 100%;
  height: 97%;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Modal Container */
.modal-content {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #ffffff;
  margin: 0; /* ← not auto, flex parent centers it */
  padding: 0;
  border: none;
  width: 90%;
  max-width: 1200px;
  height: 85vh; /* ← fixed viewport height */
  max-height: 85vh;
  overflow: hidden; /* ← modal-content itself never scrolls */
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: grid;
  grid-template-rows: auto 1fr; /* header = auto, body = remaining space */
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Header with Base Gradient */
.modal-header {
  background: linear-gradient(
    180deg,
    rgb(227, 226, 24) 0%,
    rgb(67, 187, 0) 100%
  );
  color: white;
  padding: 20px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.modal-header h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Close Button */
.close {
  position: absolute;
  top: 15px;
  right: 20px;
  color: white;
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  z-index: 101;
  background: rgba(255, 255, 255, 0.2);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Main Content Area */
.modal-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 0;
  overflow: hidden; /* ← body container itself does NOT scroll */
  min-height: 0; /* ← CRITICAL: allows grid children to shrink */
}

/* Left Side - Table */
.modal-body > div:first-child {
  padding: 25px;
  overflow-y: auto; /* ← scrolls table content */
  overflow-x: hidden;
  min-height: 0; /* ← CRITICAL: without this, height grows infinitely */
  background: #ffffff;
}

/* Right Side - Controls */
.modal-body > div:last-child {
  background: linear-gradient(
    180deg,
    rgb(227, 226, 24) 0%,
    rgb(67, 187, 0) 100%
  );
  padding: 25px 20px;
  overflow-y: auto; /* ← scrolls controls if they overflow */
  overflow-x: hidden;
  min-height: 0; /* ← CRITICAL */
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  color: white;
}

/* Custom Scrollbar for Table */
.modal-body > div:first-child::-webkit-scrollbar {
  width: 8px;
}

.modal-body > div:first-child::-webkit-scrollbar-track {
  background: #f0f0f0;
}

.modal-body > div:first-child::-webkit-scrollbar-thumb {
  background: #bdbdbd;
  border-radius: 4px;
}

.modal-body > div:first-child::-webkit-scrollbar-thumb:hover {
  background: #9e9e9e;
}

/* Custom Scrollbar for Controls */
.modal-body > div:last-child::-webkit-scrollbar {
  width: 8px;
}

.modal-body > div:last-child::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

.modal-body > div:last-child::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

/* Simple Table */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #e0e0e0;
}

.table thead {
  background: linear-gradient(
    180deg,
    rgb(227, 226, 24) 0%,
    rgb(67, 187, 0) 100%
  );
  position: sticky;
  top: 0;
  z-index: 10;
}

.table thead th {
  background: transparent;
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
  padding: 14px 12px;
  text-align: left;
  border: none;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.table thead th:hover {
  background: rgba(255, 255, 255, 0.15);
}

.table thead th.sortable::after {
  content: " ⇅";
  opacity: 0.6;
  margin-left: 5px;
}

.table thead th.asc::after {
  content: " ▲";
  opacity: 1;
}

.table thead th.desc::after {
  content: " ▼";
  opacity: 1;
}

.table tbody tr {
  transition: background 0.2s ease;
  border-bottom: 1px solid #e0e0e0;
}

.table tbody tr:nth-child(even) {
  background: #fafafa;
}

.table tbody tr:hover {
  background: #f5f5f5;
}

.table tbody td {
  padding: 12px;
  color: #424242;
  font-size: 14px;
  border: none;
}

.table tbody td:first-child {
  font-weight: 600;
  color: rgb(67, 187, 0);
}

/* Right Panel Heading */
.modal-body > div:last-child h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 20px 0;
  color: white;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

/* Right Panel Labels */
.modal-body > div:last-child label {
  display: block;
  font-weight: 600;
  color: white;
  font-size: 12px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Right Panel Selects */
.modal-body > div:last-child select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 18px;
  font-weight: 500;
}

.modal-body > div:last-child select:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.25);
}

.modal-body > div:last-child select:focus {
  outline: none;
  border-color: white;
  background: rgba(255, 255, 255, 0.3);
}

.modal-body > div:last-child select option {
  background: rgb(67, 187, 0);
  color: white;
}

/* Info Cards */
.info-card {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: all 0.2s ease;
}

.info-card:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
}

.info-card h4 {
  font-size: 12px;
  margin: 0 0 6px 0;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.info-card p {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  color: white;
}

/* No Data Message */
.no-data {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #d32f2f;
  margin: 60px auto;
  padding: 30px;
  background: #fff5f5;
  border-radius: 8px;
  border: 2px dashed #d32f2f;
  max-width: 400px;
}

.no-data::before {
  content: "⚠️";
  display: block;
  font-size: 40px;
  margin-bottom: 10px;
}

/* Legend */
.legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 14px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.legend > span:first-child {
  font-weight: 700;
  font-size: 13px;
  color: rgb(67, 187, 0);
  margin-right: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #424242;
  padding: 6px 10px;
  background: #f5f5f5;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.legend-item:hover {
  background: #e0e0e0;
}

.swatch {
  width: 22px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

/* Bar Charts */
.bar-wrap {
  margin-bottom: 14px;
  background: white;
  padding: 12px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.bar-wrap > div:first-child {
  font-weight: 600;
  color: rgb(67, 187, 0);
  margin-bottom: 8px;
  font-size: 14px;
}

.bar {
  height: 30px;
  border-radius: 6px;
  display: flex;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.seg {
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 8px;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: filter 0.2s ease;
}

.seg:hover {
  filter: brightness(1.1);
}

/* Responsive */
@media (max-width: 1024px) {
  .modal-body {
    grid-template-columns: 1fr;
  }

  .modal-body > div:last-child {
    display: none;
  }
}

@media (max-width: 768px) {
  .modal-content {
    width: 100%;
    height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .modal-header {
    padding: 15px 20px;
  }

  .modal-header h2 {
    font-size: 18px;
  }

  .close {
    top: 12px;
    right: 15px;
    width: 36px;
    height: 36px;
    font-size: 28px;
  }
}

/* ============================================
   PLANTING DATE GRAPH STYLES
   ============================================ */

.planting-date-graph {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  padding: 30px;
  background: linear-gradient(to bottom, #f5f7fa 0%, #e8eef5 100%);
}

.graph-header {
  background: linear-gradient(
    180deg,
    rgb(227, 226, 24) 0%,
    rgb(67, 187, 0) 100%
  );
  color: white;
  padding: 25px 30px;
  border-radius: 12px;
  margin-bottom: 25px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.graph-header h2 {
  margin: 0 0 8px 0;
  font-size: 26px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.graph-header p {
  margin: 0;
  font-size: 16px;
  opacity: 0.95;
  font-weight: 500;
}

.year-selector {
  background: white;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 15px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.year-selector label {
  font-size: 15px;
  color: #333;
  font-weight: 600;
  margin: 0;
}

.year-selector select {
  padding: 10px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 15px;
  background: white;
  color: #333;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 150px;
  font-weight: 500;
}

.year-selector select:hover {
  border-color: rgb(67, 187, 0);
}

.year-selector select:focus {
  outline: none;
  border-color: rgb(67, 187, 0);
  box-shadow: 0 0 0 3px rgba(67, 187, 0, 0.1);
}

.graph-content {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  max-width: 1400px;
  margin: 0 auto;
}

.bar-wrap {
  margin-bottom: 18px;
  background: #fafafa;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  border: 1px solid #e8e8e8;
  transition: all 0.3s ease;
}

.bar-wrap:hover {
  box-shadow: 0 3px 10px rgba(67, 187, 0, 0.15);
  transform: translateY(-2px);
  border-color: rgba(67, 187, 0, 0.3);
  background: white;
}

.district-name {
  font-weight: 700;
  color: rgb(67, 187, 0);
  margin-bottom: 10px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.district-name::before {
  content: "📍";
  font-size: 18px;
}

.bar {
  height: 40px;
  border-radius: 10px;
  display: flex;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  border: 2px solid white;
}

.seg {
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 10px;
  color: white;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
  position: relative;
  cursor: pointer;
}

.seg:hover {
  filter: brightness(1.15);
  z-index: 2;
  transform: scaleY(1.1);
}

.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 25px;
  padding: 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.legend > span:first-child {
  font-weight: 700;
  font-size: 15px;
  color: rgb(67, 187, 0);
  margin-right: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #424242;
  padding: 8px 14px;
  background: #f8f8f8;
  border-radius: 8px;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.legend-item:hover {
  background: white;
  border-color: rgb(67, 187, 0);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(67, 187, 0, 0.2);
}

.swatch {
  width: 28px;
  height: 18px;
  border-radius: 6px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.no-data {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: #d32f2f;
  margin: 60px auto;
  padding: 40px;
  background: #fff5f5;
  border-radius: 12px;
  border: 3px dashed #d32f2f;
  max-width: 500px;
}

.no-data::before {
  content: "⚠️";
  display: block;
  font-size: 48px;
  margin-bottom: 15px;
}

/* Scrollbar for graph container */
.planting-date-graph::-webkit-scrollbar {
  width: 12px;
}

.planting-date-graph::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 10px;
}

.planting-date-graph::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    rgb(227, 226, 24) 0%,
    rgb(67, 187, 0) 100%
  );
  border-radius: 10px;
  border: 2px solid #f0f0f0;
}

.planting-date-graph::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    180deg,
    rgb(200, 199, 20) 0%,
    rgb(55, 155, 0) 100%
  );
}

/* ============================================
   DISTRICT TABLE MODAL — SCOPED FIX
   (body is 1750px scaled, so fixed position 
    must use 100vw/100vh not 100%)
   ============================================ */
/* ✅ ADD — counter scale for general modal too */
#modal.modal {
  transform: scale(var(--inverse-scale, 1));
  transform-origin: top left;
}
/* ✅ REPLACE entire #district-modal block */
#district-modal {
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  padding: 0;
  margin: 0;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
  /* ✅ Counter the scale applied to #app-wrapper by scalePage() */
  transform-origin: top left;
  transform: scale(var(--inverse-scale, 1));
}

#district-modal .modal-content {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #ffffff;
  margin: 0;
  padding: 0;
  border: none;
  /* ✅ vw/vh units — not % of scaled body */
  width: 88vw;
  max-width: 1200px;
  height: 85vh;
  max-height: 85vh;
  overflow: hidden; /* content itself never scrolls */
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: grid;
  grid-template-rows: auto 1fr; /* header fixed, body takes rest */
  animation: slideUp 0.4s ease;
}

#district-modal .modal-header {
  background: linear-gradient(
    180deg,
    rgb(227, 226, 24) 0%,
    rgb(67, 187, 0) 100%
  );
  color: white;
  padding: 20px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  /* ✅ Do NOT use position:sticky here — grid handles it */
}

#district-modal .modal-header h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#district-modal .close {
  position: static; /* ✅ not absolute — flex parent aligns it */
  color: white;
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.2);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

#district-modal .close:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: rotate(90deg);
}

/* ✅ Body: grid, overflow hidden, min-height:0 is THE key */
#district-modal .modal-body {
  display: grid;
  grid-template-columns: 1fr 300px;
  overflow: hidden;
  min-height: 0; /* ← CRITICAL for grid scroll to work */
}

/* ✅ Left panel — table scrolls here */
#district-modal .modal-body > div:first-child {
  padding: 20px 25px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0; /* ← CRITICAL */
  background: #ffffff;
}

/* ✅ Right panel — controls scroll here */
#district-modal .modal-body > div:last-child {
  background: linear-gradient(
    180deg,
    rgb(227, 226, 24) 0%,
    rgb(67, 187, 0) 100%
  );
  padding: 25px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0; /* ← CRITICAL */
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  color: white;
}

/* Scrollbars */
#district-modal .modal-body > div:first-child::-webkit-scrollbar {
  width: 7px;
}
#district-modal .modal-body > div:first-child::-webkit-scrollbar-track {
  background: #f0f0f0;
}
#district-modal .modal-body > div:first-child::-webkit-scrollbar-thumb {
  background: #bdbdbd;
  border-radius: 4px;
}
#district-modal .modal-body > div:first-child::-webkit-scrollbar-thumb:hover {
  background: #9e9e9e;
}

#district-modal .modal-body > div:last-child::-webkit-scrollbar {
  width: 7px;
}
#district-modal .modal-body > div:last-child::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}
#district-modal .modal-body > div:last-child::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 4px;
}

/* Table inside modal */
#district-modal .table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #e0e0e0;
}

#district-modal .table thead {
  background: linear-gradient(
    180deg,
    rgb(227, 226, 24) 0%,
    rgb(67, 187, 0) 100%
  );
  position: sticky;
  top: 0;
  z-index: 10;
}

#district-modal .table thead th {
  background: transparent;
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
  padding: 14px 12px;
  text-align: left;
  border: none;
}

#district-modal .table tbody tr:nth-child(even) {
  background: #fafafa;
}
#district-modal .table tbody tr:hover {
  background: #f0fdf0;
}
#district-modal .table tbody td {
  padding: 11px 12px;
  color: #424242;
  font-size: 14px;
  border: none;
  border-bottom: 1px solid #e0e0e0;
}
#district-modal .table tbody td:first-child {
  font-weight: 600;
  color: rgb(67, 187, 0);
}

/* Right panel elements */
#district-modal .modal-body > div:last-child label {
  display: block;
  font-weight: 600;
  color: white;
  font-size: 12px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#district-modal .modal-body > div:last-child select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  margin-bottom: 18px;
  font-weight: 500;
}

#district-modal .modal-body > div:last-child select:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.25);
}

#district-modal .modal-body > div:last-child select option {
  background: rgb(67, 187, 0);
  color: white;
}

#district-modal .info-card {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

#district-modal .info-card h4 {
  font-size: 12px;
  margin: 0 0 6px 0;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

#district-modal .info-card p {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  color: white;
}

#district-modal .no-data {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #d32f2f;
  margin: 60px auto;
  padding: 30px;
  background: #fff5f5;
  border-radius: 8px;
  border: 2px dashed #d32f2f;
  max-width: 400px;
}

/* Graph mode */
#district-modal .legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 14px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

#district-modal .bar-wrap {
  margin-bottom: 12px;
  background: white;
  padding: 12px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

#district-modal .bar {
  height: 30px;
  border-radius: 6px;
  display: flex;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
}

#district-modal .seg {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0 8px;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 1024px) {
  #district-modal .modal-body {
    grid-template-columns: 1fr;
  }
  #district-modal .modal-body > div:last-child {
    display: none;
  }
}
