html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

#map {
  position: relative;
  width: 100%;
  height: 100%;
}

#mangrove-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.7);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  /* display: flex; will be toggled by JS */
}
#mangrove-modal[style*="display: flex"] {
  display: flex !important;
}
#mangrove-modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
  padding: 0;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  position: relative;
}
#mangrove-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: white;
  border: none;
  font-size: 2em;
  cursor: pointer;
  z-index: 2;
  margin: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  color: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  line-height: 1;
  padding: 0;
  font-size: 1.8em;
  font-family: monospace;
}
#mangrove-modal-close:hover {
  background: #f0f0f0;
  color: #d32f2f;
}
#mangrove-modal-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: block;
}

#navbar {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 0 18px;
  height: 56px;
  background: #263238;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  z-index: 11000;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  min-width: 0;
  overflow: visible;
}

.navbar-left {
  display: flex;
  align-items: center;
  margin-right: 18px;
  flex: 1 1 0;
  min-width: 0;
}
.navbar-logo {
  font-size: 2em;
  margin-right: 8px;
  user-select: none;
  filter: drop-shadow(0 2px 4px #00b8d455);
}

.navbar-logo i {
  width: 32px;
  height: 32px;
  color: #4caf50;
}
.navbar-title {
  font-size: 1.6em;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #f5f5f5;
  text-shadow: 0 2px 8px #0008;
  margin-left: 8px;
  margin-right: 0;
  text-align: left;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex: 0 0 auto;
  padding-right: 40px;
}
.navbar-btn {
  background: #009688;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 7px 18px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px #00968822;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.1s;
  outline: none;
}
.navbar-btn:hover, .navbar-btn:focus {
  background: #26a69a;
  color: #fff;
  box-shadow: 0 4px 16px #00968833, 0 2px 8px #00968822;
  transform: translateY(-1px) scale(1.04);
}

body, #navbar, .navbar-title, #mangrove-modal, #mangrove-modal-content {
  font-family: 'Inter', Arial, Helvetica, sans-serif;
}

#map-loader {
  position: fixed;
  top: 56px;
  left: 0;
  width: 100vw;
  height: 4px;
  background: linear-gradient(90deg, #FFD600 0%, #00B8D4 40%, #FFD600 80%, #FFD600 100%);
  background-size: 200% 100%;
  background-repeat: no-repeat;
  z-index: 12000;
  border-radius: 0 0 2px 2px;
  box-shadow: none;
  padding: 0;
  display: none;
  animation: map-loader-bar 1.2s linear infinite;
}
@keyframes map-loader-bar {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

#stats-container {
  position: absolute;
  top: 72px;
  right: 24px;
  background: rgba(20, 30, 20, 0.92);
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
  border-radius: 10px;
  padding: 18px 24px;
  max-width: 36vw;
  max-height: 80vh;
  overflow-x: auto;
  overflow-y: auto;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 320px;
}
#chart-container, #cards-container, #table-container {
  width: 100%;
}

#roi-table-container {
  position: absolute;
  top: 72px;
  right: 24px;
  background: rgba(20, 30, 20, 0.92);
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
  border-radius: 10px;
  padding: 18px 24px;
  max-width: 90vw;
  max-height: 60vh;
  overflow-x: auto;
  overflow-y: auto;
  z-index: 5000;
}
#roi-table-toggle-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  background: #00B8D4;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 1em;
}

.summary-cards {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.summary-cards .card {
  /* background: rgba(0, 0, 0, 0.65); */
  color: #e0f2f1;
  /* border: 1px solid rgba(255,255,255,0.1); */
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  /* add more space between cards */
  margin: 0 12px;
}

.summary-cards .icon {
  font-size: 1.5em;
  margin-bottom: 10px;
  display: block;
}

.summary-cards .icon i {
  width: 24px;
  height: 24px;
  color: #00b8d4;
}

.summary-cards .label {
  font-size: 1.05em;
  color: #b2dfdb;
}

.summary-cards .value {
  font-size: 1.3em;
  font-weight: 700;
  color: #e0f3f5;
}

/* Total Benefit */
/* .summary-cards .card:nth-child(3) .value {
  color: #66ff66;
} */

/* CO2 Offset */
/* .summary-cards .card:nth-child(4) .value {
  color: #76ff03;
} */

/* Break-even year */
/* .summary-cards .card:nth-child(5) .value {
  color: #ffcc80;
} */

.summary-cards .card strong {
  color: #009688;
  font-weight: 700;
}

.summary-cards .card:hover {
  transform: translateY(-2px) scale(1.30);
}

@media (max-width: 900px) {
  .summary-cards {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  .summary-cards .card {
    min-width: 80px;
    width: 95%;
    font-size: 0.97em;
    padding: 8px 10px;
  }
}

@media (max-width: 700px) {
  #navbar {
    padding: 0 4px;
  }
  .navbar-title {
    font-size: 1.05em;
  }
  .navbar-btn {
    padding: 6px 10px;
    font-size: 0.97em;
  }
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(20, 30, 20, 0.92);
  z-index: 12000;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}
.modal[style*="display: flex"] {
  display: flex !important;
}
.modal-content {
  background: #232b2b;
  color: #f5f5f5;
  border-radius: 14px;
  box-shadow: 0 6px 32px #000a;
  padding: 0;
  max-width: 800px;
  width: 92vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: #232b2b;
  border: none;
  font-size: 2em;
  cursor: pointer;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-shadow: 0 2px 8px #0005;
  color: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  line-height: 1;
  padding: 0;
  font-family: monospace;
}
.modal-close:hover {
  background: #333b3b;
  color: #d32f2f;
}
.modal-body {
  padding: 32px 28px 24px 28px;
  overflow-y: auto;
  font-size: 1.08em;
  line-height: 1.7;
}
.modal-body h2, .modal-body h3 {
  color: #b2dfdb;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}
.modal-body h2 {
  font-size: 1.5em;
  color: #80cbc4;
}
.modal-body a {
  color: #4dd0e1;
  text-decoration: underline;
}
.modal-body pre {
  background: #1a2323;
  color: #e0f2f1;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 1em;
  overflow-x: auto;
}
.modal-body ul {
  margin-bottom: 1em;
}
@media (max-width: 600px) {
  .modal-content {
    padding: 0;
    max-width: 98vw;
  }
  .modal-body {
    padding: 18px 6vw 18px 6vw;
    font-size: 0.98em;
  }
}

.about-geobase-logo {
  max-height: 18px;
  width: auto;
  border-radius: 4px;
  /* on hover, scale up */
  transition: transform 0.2s ease-in-out;
  /* link on hover */
  cursor: pointer;
}
.about-geobase-logo:hover {
  transform: scale(1.25);
}

/* Fade animation for chart updates */
.fade-out {
  opacity: 0;
  transition: opacity 0.4s ease;
}
.fade-in {
  opacity: 1;
  transition: opacity 0.4s ease;
}