/* ===== Global Styles ===== */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: #0f1116;
  color: #fff;
  font-family: 'Inter', sans-serif;
  overflow: hidden;
}

html {
  scroll-behavior: smooth;
}

/* ===== Map & Swipe Containers (Fixed Flex Width) ===== */
/* #map,
#map-compare {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: 100%;
  height: 100%;
  position: relative;
  display: block;
  background-color: #e0e0e0 !important;
} */
/* #map-compare {
  display: none;
} */

/* --- MAP & SWIPE LAYOUT FIX ---
#map,
#map-compare {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  position: relative;
}
#map-compare {
  display: none;
} */

/* --- STATS PANEL FIX --- */
.stats-panel {
  width: 400px; /* increase for wider right panel*/
  /* flex: 0 0 360px; */
  background: #111418;
  color: #f5f5f5;
  border-left: 1px solid rgba(255,255,255,0.1);
  padding: 16px 20px;
  box-sizing: border-box;
  overflow-y: auto;

  position: absolute;
  top: 0px;          /* below header */
  right: 0;
  height: calc(100% - 40px);
  z-index: 30;  
}

/* Table styling to match your screenshot */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.stats-table td {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.stats-table td:first-child {
  color: #bbb;
  /* text-transform: uppercase; */
  font-size: 14px;
  letter-spacing: 0.5px;
}

.stats-table td:last-child {
  text-align: right;
  color: #fff;
  font-weight: 600;
}

.stats-table td:last-child::first-line {
  font-variant-numeric: tabular-nums;
}

/* ==== Dark Mode Dropdowns (Country / Region Selects) ==== */
.dropdowns select {
  background-color: #1a1c22;       /* dark background */
  color: #f5f5f5;                  /* light text */
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: "Inter", sans-serif;
  outline: none;
  cursor: pointer;
  margin-right: 8px;
  appearance: none;                /* remove native arrows */
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: all 0.2s ease;
  background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='12' viewBox='0 0 24 24' width='12' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  padding-right: 28px; /* space for arrow */  
}

/* add subtle hover / focus effects */
.dropdowns select:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background-color: #22242a;
}

.dropdowns select:focus {
  border-color: #0078ff;
  box-shadow: 0 0 0 2px rgba(0,120,255,0.3);
}

/* make sure dropdown caret is visible and consistent */
.dropdowns {
  display: flex;
  gap: 8px;
  margin: 10px 0 15px 0;
}

.dropdowns select option {
  background-color: #1a1c22;
  color: #fff;
}

/* Responsive tweak: stack on small screens */
@media (max-width: 600px) {
  .dropdowns {
    flex-direction: column;
    align-items: flex-start;
  }

  .dropdowns select {
    width: 100%;
  }
}

/* ===== Header ===== */
header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgb(5, 5, 5);
  padding: 8px 20px;
  height: 40px;
  z-index: 1000;
  border-bottom: 1px solid #222;
  backdrop-filter: blur(6px);
  overflow: visible !important;
}

/* .logo-area {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: inherit;
}

.logo-area h1 {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
  color: #fff;
}

.logo-area:hover {
  text-decoration: none;
} */

/* ✅ Brighter, visible Scion logo */
.logo-scion {
  height: 32px;                     /* slightly larger */
  display: inline-block;
  vertical-align: middle;
  opacity: 1;                       /* full opacity */
  filter: brightness(100%) contrast(110%) invert(100%);  
  transition: filter 0.2s ease, transform 0.2s ease;
}
.logo-scion:hover {
  filter: brightness(120%) contrast(120%) invert(100%);
  transform: scale(1.03);
}

/* === Header Navigation Fix === */
nav {
  display: flex;
  align-items: center;
  gap: 22px; /* consistent spacing between links */
  flex-wrap: nowrap; /* prevent wrapping */
  overflow: visible !important;
}

/* Style for all links */
nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ccc;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

nav a:hover {
  color: #fff;
}

/* === Header Monitoring Dropdown (custom) === */
.nav-dropdown {
  overflow: visible !important;
  position: relative;
  display: inline-block;
}

.nav-dropbtn {
  background: transparent;
  color: #ccc;
  border: none;
  font-family: "Inter", sans-serif;
  font-weight: 500;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.5s ease;
}

.nav-dropbtn:hover {
  color: #fff;
}

.nav-dropdown .arrow {
  font-size: 16px;
  transition: transform 0.5s ease;
}

/* Dropdown content */
/* .nav-dropdown-content {
  display: none;
  position: absolute;
  background-color: #1a1c22;
  min-width: 300px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  font-size: 14px;
  z-index: 1001;
  top: 28px;
  left: 0;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  pointer-events: none;           
} */

.nav-dropdown-content {
  position: absolute;
  background-color: #1a1c22;
  min-width: 300px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  font-size: 14px;
  z-index: 1001;
  top: 28px;
  right: 0;
  left: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.45s ease, transform 0.45s ease, visibility 0.45s;
  pointer-events: none;
}

.nav-dropdown-content a {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 14px;
  color: #f0f0f0;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-dropdown-content a:active {
  background-color: #2a2c32;
  transform: scale(0.99);
  transition: transform 0.5s ease;
}

.nav-dropdown-content a:hover {
  background-color: #22242a;
}

.nav-dropdown-content .title {
  font-weight: 600;
  font-size: 13px;
  color: #fff;
  margin-bottom: 2px;
}

.nav-dropdown-content .desc {
  font-size: 11.5px;
  color: #aaa;
  line-height: 1.3;
}

/* Hover open + arrow rotation */
/* .nav-dropdown:hover .nav-dropdown-content {
  display: block;
} */
.nav-dropdown:hover .nav-dropdown-content {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* === Keep dropdown visible briefly after hover === */
.nav-dropdown-content.show {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
  pointer-events: auto !important;
}

/* Arrow rotates smoothly */
.nav-dropdown .arrow {
  transition: transform 0.25s ease;
}
.nav-dropdown:hover .arrow {
  transform: rotate(180deg); /* ▲ open */
}
.dropdown-section {
  font-size: 0.75rem;
  color: #888;
  padding: 6px 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Sign out */
.nav-signout {
  background: transparent;
  border: none;
  color: #ccc;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.nav-signout:hover {
  color: #fff;
}

/* === Indufor Logo Block (side by side, not below) === */
.indufor-block {
  display: flex;
  flex-direction: row;   /* horizontal layout */
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #fff;
  opacity: 0.9;
  font-size: 12px;
  font-weight: 600;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.indufor-block:hover {
  opacity: 1;
  transform: translateY(-1px);
}

/* Logo styling */
.logo-indufor {
  height: 50px;
  width: auto;
  filter: none; /*show original black/white logo*/
  margin-bottom: 0; /* fix vertical alignment */
}

.logo-dwell {
  height: 30px;
  width: auto;
  display: block;
}

.logo-divider {
  width: 1px;
  height: 28px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(255,255,255,0.5),
    transparent
  );
  opacity: 0.7;
}

.brand-area {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  flex-shrink: 0;
}

.logo-area {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  line-height: 0;
}

.logo-divider {
  width: 1px;
  height: 30px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(255,255,255,0.5),
    transparent
  );
  opacity: 0.7;
}

.logo-bsi-link {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  flex-shrink: 0;
}

.logo-bsi {
  height: 50px;
  width: auto;
  max-width: 210px;
  object-fit: contain;
  display: block;
  opacity: 0.94;
  transition: opacity 180ms ease, transform 180ms ease, filter 180ms ease;
}

.logo-bsi-link:hover .logo-bsi {
  opacity: 1;
  transform: translateY(-1px) scale(1.02);
  filter: brightness(1.05);
}


.dwell-loader {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 50%, rgba(120,217,139,0.18), transparent 22rem),
    linear-gradient(145deg, #020d0b, #031c17);
  animation: loaderExit 900ms ease forwards;
  animation-delay: 1700ms;
}

.loader-glow {
  position: absolute;
  width: 22rem;
  height: 22rem;
  border-radius: 999px;
  background: rgba(120,217,139,0.18);
  filter: blur(70px);
  animation: loaderPulse 1200ms ease-in-out infinite alternate;
}

.dwell-loader-logo {
  position: relative;
  width: min(520px, 78vw);
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  animation: logoReveal 900ms cubic-bezier(.2,.8,.2,1) forwards;
}

@keyframes logoReveal {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes loaderPulse {
  to {
    transform: scale(1.12);
    opacity: 0.75;
  }
}

@keyframes loaderExit {
  to {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

/* ===== Main Layout ===== */
#container {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: stretch;
  height: calc(100% - 40px);
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* ===== Sidebar ===== */
#sidebar {
  top: 0px; /* header height */
  left: 0;
  width: 350px !important;
  min-width: 350px !important;
  /* height: calc(100% - 40px); */
  height: 100%;
  background: rgba(20, 22, 27, 0.97);
  color: #eee;
  padding: 18px 20px;
  border-right: 1px solid #222;
  /* overflow-y: auto; */
  z-index: 30;
  position: relative;
  transition: width 0.25s ease, padding 0.25s ease;  
  pointer-events: none;
  display: flex;
  flex-direction: column;  
}

#sidebar * {
  pointer-events: auto;
}

#sidebar h2 {
  margin-top: 0;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

#sidebar h4 {
  font-size: 14px;
  color: #bbb;
  margin-top: 17px;
  margin-bottom: 1px;
}

/* ===== Layer Rows Inline ===== */
.layer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0;
}

.layer-row label {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ccc;
  cursor: pointer;
}

.layer-row input[type="checkbox"] {
  accent-color: #0078ff;
  cursor: pointer;
}

.layer-row .info-icon {
  flex-shrink: 0;
  margin-left: 10px;
  font-size: 14px;
  color: #888;
  cursor: pointer;
  transition: color 0.2s ease;
}
.layer-row .info-icon:hover {
  color: #fff;
}

/* ===== Basemap Buttons ===== */
.basemap-buttons button {
  background: #1e1f25;
  color: #ccc;
  border: 1px solid #333;
  border-radius: 5px;
  margin: 3px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
}
.basemap-buttons button:hover {
  background: #333;
  color: #fff;
}

/* ===== Basemap Thumbnails ===== */
.basemap-thumbnails {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 10px;
  margin-top: 8px;
  padding-bottom: 5px;
}

.basemap-thumb {
  flex: 0 0 auto;
  width: 64px;
  aspect-ratio: 1 / 1;         /* ✅ ensures perfect square */
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.basemap-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid transparent;
  transition: transform 0.3s ease, border-color 0.2s ease;
}

.basemap-thumb:hover img {
  transform: scale(1.8);
}

.basemap-thumb.active img {
  border-color: #0078ff;
  box-shadow: 0 0 10px rgba(0,120,255,0.5);
}

.basemap-thumb span {
  display: block;
  font-size: 12px;
  color: #ccc;
  margin-top: 4px;
}

.basemap-thumb.active span {
  color: #fff;
  font-weight: 600;
}

/* ===== Legend Section ===== */
.legend-title {
  margin-top: 1px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  border-top: 1px solid #333;
  padding-top: 14px;
  padding-bottom: 1px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

#legend {
  margin-top: 1px;
  background: rgba(15, 17, 22, 0.95);
  color: #f0f0f0;
  padding: 5px;
  border-radius: 10px;
  font-family: "Inter", sans-serif;
  font-size: 13px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.legend-group {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #444;
}

.legend-group-header {
  font-weight: 600;
  font-size: 13.5px;
  color: #fff;
  margin-top: 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid #333;
}

.legend-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  grid-column-gap: 18px;
  grid-row-gap: 6px;
  align-items: center;
  margin-top: 8px;
}

.legend-items.single-column {
  grid-template-columns: 1fr;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.legend-color, .legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
}

.legend-label {
  font-size: 13px;
  color: #f0f0f0;
  line-height: 1.3;
  letter-spacing: 0.2px;
  text-transform: capitalize;
}

/* Sentinel-2 legend entry */
#legend-s2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 4px 2px;
}

/* Remove button */
.legend-remove-btn {
  background: none;
  border: none;
  color: #bbb;
  cursor: pointer;
  font-size: 14px;
  margin-left: auto;
  padding: 0 4px;
  transition: color 0.2s ease;
}

.legend-remove-btn:hover {
  color: #ff6666;
}


/* ===== Modal ===== */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.modal.hidden { display: none; }
.modal-content {
  background-color: #111;
  color: #eee;
  padding: 25px 30px;
  border-radius: 10px;
  width: 420px;
  max-width: 90%;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
.modal-content h3 {
  margin-top: 0;
  font-size: 18px;
  color: #fff;
}
.modal-content p {
  font-size: 14px;
  line-height: 1.4em;
  color: #ccc;
}
.close-btn {
  float: right;
  font-size: 22px;
  color: #aaa;
  cursor: pointer;
}
.close-btn:hover {
  color: #fff;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-thumb {
  background-color: #333;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background-color: #444;
}

/* ===== Swipe Tool Toggle ===== */
.swipe-toggle-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}
#swipe-status {
  font-size: 13px;
  color: #ccc;
}
/* iOS-style switch */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #333;
  transition: .3s;
  border-radius: 22px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background-color: #fff;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: #0078ff;
}
input:checked + .slider:before {
  transform: translateX(20px);
}

/* Hide the swipe toggle row completely */
/* .swipe-row {
  display: none !important;
} */


/* === Combined Header: ForestInsights + Swipe === */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 1px;
  margin-bottom: 6px;
}

.section-header h4 {
  font-size: 14px;
  font-weight: 600;
  color: #e0e0e0;
  margin: 0;
}

.swipe-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

.swipe-inline .swipe-label {
  font-size: 12.5px;
  color: #ccc;
}

.swipe-inline #swipe-status {
  font-size: 12px;
  color: #888;
}

.swipe-inline .switch {
  transform: scale(0.85);
  margin-left: 2px;
}

.swipe-ui-hidden {
  display: none !important;
}

/* === Layer Actions Row: Info + Side Buttons === */
.layer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 6px;
}

.layer-actions .info-icon {
  font-size: 14px;
  color: #999;
  cursor: pointer;
  transition: color 0.2s ease;
}
.layer-actions .info-icon:hover {
  color: #fff;
}

.layer-actions .side-toggle {
  display: inline-flex;
  align-items: center;
  background: #1c1d22;
  border: 1px solid #333;
  border-radius: 999px;
  overflow: hidden;
}

.layer-actions .side-toggle .side-btn {
  background: transparent;
  border: none;
  color: #aaa;
  font-size: 10.5px;
  padding: 3px 7px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.layer-actions .side-toggle .side-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.layer-actions .side-toggle .side-btn.active {
  background: #fff;
  color: #000;
  font-weight: 600;
  border-radius: 999px;
}


/* ===== Left / Both / Right toggle ===== */
.side-toggle {
  display: inline-flex;
  align-items: center;
  background: #1e1f25;
  border: 1px solid #333;
  border-radius: 999px;
  overflow: hidden;
  margin-left: 8px;
}
.side-toggle .side-btn {
  background: transparent;
  border: none;
  color: #aaa;
  font-size: 10.5px;
  padding: 3px 7px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.side-toggle .side-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}
.side-toggle .side-btn.active {
  background: #fff;
  color: #000;
  font-weight: 600;
  border-radius: 999px;
}
.side-toggle.disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ===== Swipe Side Controls ===== */
.side-toggle {
  display: flex;
  gap: 4px;
  transition: all 0.25s ease;
}

.side-toggle.collapsed {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.side-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  font-size: 11px;
  padding: 2px 6px;
  color: #ddd;
  cursor: pointer;
  transition: all 0.15s ease;
}

.side-btn.active {
  background: rgba(0,120,255,0.25);
  border-color: rgba(0,120,255,0.7);
  color: #fff;
}

.side-btn:hover {
  background: rgba(255,255,255,0.2);
}

/* ===== Mapbox Compare Divider Styling ===== */
.compare-swiper-vertical {
  background-color: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 0 8px rgba(0,0,0,0.4);
  backdrop-filter: blur(6px);
}
.compare-swiper-vertical:before,
.compare-swiper-vertical:after {
  background: #fff !important;
  border-radius: 2px;
}

/* ==== Swipe / Flex Layout Fix ==== */

/* Prevent sidebar from shrinking when swipe adds extra map divs */
/* #sidebar { */
  /* flex-shrink: 0; */
  /* min-width: 320px; */
/* } */


/* Ensure the map container flexes but doesn't overflow */
/* #map, #map-compare {
  flex-grow: 1;
  width: 100%;
  height: 100%;
  position: relative;
} */

#map,
#map-compare {
  position: absolute;
  top: 0;
  left: 350px;   /* sidebar width */
  right: 400px;  /* stats panel width */
  bottom: 0;
  overflow: hidden;
}

body.sidebar-collapsed #map,
body.sidebar-collapsed #map-compare {
  left: 60px;
}

#map {
  z-index: 1;
}

#map-compare {
  display: none;
  z-index: 2;
}

/* Guarantee maps fill container and remain above background */
#left-map, #right-map, .mapboxgl-canvas {
  background-color: #e0e0e0 !important;
}

/* Optional: visually reinforce divider handle */
/* .compare-swiper-vertical {
  background-color: rgba(255, 255, 255, 0.12) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
} */

/* ==== Responsive Sidebar Behavior ==== */

/* Desktop (≥900px): keep sidebar visible and fixed width */
@media (min-width: 900px) {
  #sidebar {
    /* flex-shrink: 0; */
    /* min-width: 320px; */
    /* max-width: 400px; */
    transition: width 0.3s ease;
  }
}

/* Tablet & mobile (<900px): auto-collapse sidebar */
@media (max-width: 899px) {
  #sidebar {
    position: absolute;
    z-index: 10;
    width: 260px;
    left: 0;
    top: 0;
    bottom: 0;
    background-color: rgba(20, 20, 20, 0.95);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.4);
  }

  /* Add an open state when toggled (you can toggle with a button) */
  #sidebar.open {
    transform: translateX(0);
  }

  /* Add a simple sidebar toggle button */
  #sidebar-toggle {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 11;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    backdrop-filter: blur(6px);
  }

  #sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
  }
}

/* ============================================================
   🧭 Swipe Tool (custom Mapbox GL divider — no plugin)
   ============================================================ */

/* Host container for the swipe maps */
/* #map-compare {
  position: relative;
  width: 100%;
  height: 100%;
  display: none;
  overflow: hidden;
} */

/* Left and right map containers created dynamically */
#left-map,
#right-map {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
}

#right-map { will-change: clip-path; }

/* Divider styling */
#swipe-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: rgba(255, 255, 255, 0.9);
  border-left: 1px solid rgba(0, 0, 0, 0.15);
  border-right: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
  cursor: ew-resize;
  z-index: 20;
  transition: background 0.2s ease;
}

#swipe-divider:hover {
  background: #fff;
  width: 4px;
}

/* Disabled state for side-toggle buttons
.side-toggle.disabled {
  opacity: 0.4;
  pointer-events: none;
} */

/* Optional: subtle fade-in when enabling swipe */
#map-compare.active #swipe-divider {
  animation: fadeInDivider 0.3s ease-in-out;
}


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

/* === Swipe Divider Arrows === */
#swipe-divider .swipe-arrow {
  position: absolute;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  pointer-events: none;
  text-shadow: 0 0 4px rgba(0,0,0,0.6);
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

#swipe-divider .swipe-arrow.left {
  left: -18px;
  top: 50%;
  transform: translateY(-50%);
}

#swipe-divider .swipe-arrow.right {
  right: -18px;
  top: 50%;
  transform: translateY(-50%);
}

#swipe-divider:hover .swipe-arrow {
  opacity: 1;
}


/* =========================================================
   LOGIN PAGE BACKGROUND 
   ========================================================= */
body.login-page {
  background:
    linear-gradient(rgba(5,5,5,0.3), rgba(5,5,5,0.5)),
    url("/static/about_images/indufor_background.png") center no-repeat;
  background-size: 100% 100%;
}

/* === CENTERING === */
.login-wrapper {
  height: calc(100vh - 40px); /* subtract header */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === CARD === */
.login-card {
  width: 320px;
  padding: 24px;
  border-radius: 12px;

  background: rgba(20,22,27,0.85);
  border: 1px solid rgba(255,255,255,0.1);

  backdrop-filter: blur(8px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

/* inputs */
.login-card input {
  width: 100%;
  margin-bottom: 12px;
  padding: 10px;

  background: #1a1c22;
  border: 1px solid rgba(255,255,255,0.15);
  color: white;
  border-radius: 6px;
  box-sizing: border-box;
}

/* buttons */
.login-card button {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 6px;

  background: #f2f4f7;
  color: black;
  font-weight: 600;
  cursor: pointer;
}

.login-card button:active {
  transform: scale(0.97);
}

.login-card button.loading,
.login-card button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: scale(0.98);
}

/* =========================================================
/* === Tight tab buttons === */
.tab-header {
  display: flex;
  justify-content: flex-start;
  align-items: stretch;
  background-color: #1a1a1a; /* optional for contrast */
  margin: 0;
  padding: 0;
  border-bottom: 1px solid #333;
}

.tab-btn {
  flex: 1; /* equal width if you want them even */
  background: #0f0f0f;
  color: #fff;
  border: none;
  padding: 0.6rem 1rem;   /* reduce padding = tighter look */
  margin: 0;              /* remove gaps between buttons */
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 0;       /* remove rounded corners for seamless connection */
  transition: background 0.2s ease;
}

.tab-btn:not(:last-child) {
  border-right: 1px solid #333; /* small divider between tabs */
}

.tab-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.tab-btn.active { 
  background: rgba(255,255,255,0.15); 
  color: #fff; 
  font-weight: 600; 
}

.tab-content { 
  display: none; 
  margin-top: 0;
  padding-top: 0rem;  
  background: #121212;
  color: #ddd;
  border-top: none;  
  /* padding: 12px 16px;  */
}
.tab-content.active { display: block; }

/* === Purchase Tab Styling === */
.subtext {
  color: #999;
  font-size: 13px;
  margin-bottom: 10px;
}

.selection-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 15px;
}

.mode-btn {
  flex: 1 1 calc(50% - 8px);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: #ddd;
  font-size: 13px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.mode-btn:hover { background: rgba(255,255,255,0.1); }
.mode-btn.active {
  background: rgba(0,120,255,0.25);
  border-color: rgba(0,120,255,0.7);
  color: #fff;
}

.area-summary {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 15px;
}
.area-summary h4 { font-size: 13px; margin-bottom: 6px; color: #eee; }
.area-stats { display: flex; justify-content: space-between; }
.area-stats span { color: #999; font-size: 12px; }
.area-stats strong { color: #fff; font-size: 13px; }

.currency-section {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.currency-dropdown select {
  background: #0f1116;
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
}

.analysis-section {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 10px;
}
.analysis-section h4 { font-size: 13px; color: #eee; margin-bottom: 6px; }

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ddd;
  font-size: 13px;
  margin-bottom: 8px;
}

.total-section {
  display: flex;
  justify-content: space-between;
  margin: 10px 0;
  font-size: 13px;
  color: #ddd;
}

#purchase-btn {
  width: 100%;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 6px;
  padding: 8px;
  color: #999;
  font-size: 13px;
  cursor: not-allowed;
}
#purchase-btn.enabled {
  background: #0078ff;
  color: #fff;
  cursor: pointer;
}
.hint { color: #777; font-size: 12px; margin-top: 6px; text-align: center; }


/* === Collapsible sections (Download / Next Steps) ===   */
.info-section {
  background: #111418;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  margin-top: 16px;
  overflow: hidden;
}

.collapsible-header {
  width: 100%;
  background: none;
  border: none;
  color: #fff;
  font-size: 14px;
  padding: 12px 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.collapse-arrow {
  font-size: 16px;
  opacity: 0.7;
  transition: transform 0.3s ease;
}

.collapsible.active .collapse-arrow {
  transform: rotate(180deg);
}

.collapsible-content {
  display: none;
  padding: 0 12px 12px;
  color: #ccc;
  font-size: 13px;
  line-height: 1.5;
}

.inline-link {
  color: #66aaff;
  text-decoration: underline;
  cursor: pointer;
}

.download-btn {
  margin-top: 8px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.download-btn:hover {
  background: rgba(255,255,255,0.15);
}

/* ======================================================
   COLLAPSED SIDEBAR WITH TOP CHEVRON + HORIZONTAL LABEL
====================================================== */
#sidebar.collapsed {
  width: 60px !important; 
  min-width: 60px !important;
  padding: 8px 0 !important;
  overflow: hidden;
  position: relative;
  pointer-events: none !important;
}

#sidebar.collapsed * {
  pointer-events: none !important;
}


/* Hide all sidebar content EXCEPT the top toggle */
#sidebar.collapsed .section,
#sidebar.collapsed .section-header,
#sidebar.collapsed h4,
#sidebar.collapsed .layer-row,
#sidebar.collapsed .legend-title,
#sidebar.collapsed #legend,
#sidebar.collapsed .basemap-thumbnails {
  display: none !important;
}

/* === TOGGLE BUTTON === */
#global-sidebar-toggle {
  /* width: 100%; */
  border: none;
  background: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  z-index: 9999;
  position: absolute;
  top: -1px;            /* move higher */
  right: 8px;         /* move further right */
}


/* Chevron */
#global-sidebar-toggle .chevron {
  font-size: 20px;
  transition: transform 0.25s ease;
}

/* Horizontal label */
#global-sidebar-toggle .collapsed-label {
  font-size: 12px;
  opacity: 0.85;
  white-space: nowrap;
}

/* Expanded sidebar: hide the label */
#sidebar:not(.collapsed) #global-sidebar-toggle .collapsed-label {
  display: none;
}

/* Collapsed sidebar: rotate chevron to point right */
#sidebar.collapsed #global-sidebar-toggle .chevron {
  transform: rotate(180deg);
}

#sidebar.collapsed #global-sidebar-toggle {
  pointer-events: auto !important;
  right: 10px;    /* inside 60px collapsed bar */
}

#swipe-divider {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 9999 !important;
  width: 8px !important;
  background: rgba(255,255,255,0.98) !important;
  box-shadow: 0 0 12px rgba(0,0,0,0.55) !important;
}


/* ======================================================
   Authenticated session timeout
====================================================== */
#session-warning-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
}

.session-warning-backdrop {
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
}

.session-warning-card {
  width: 360px;
  padding: 24px;
  border-radius: 12px;
  background: #14161b;
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  box-shadow: 0 16px 50px rgba(0,0,0,0.5);
}

.session-warning-card h3 {
  margin: 0 0 8px;
}

.session-warning-card p {
  color: #ccc;
  margin: 0 0 18px;
}

.session-warning-actions {
  display: flex;
  gap: 10px;
}

.session-warning-actions button {
  flex: 1;
  padding: 9px 10px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

/* =========================================================
   PROJECTS PAGE
   ========================================================= */

body.projects-page {
  overflow-y: auto;
  overflow-x: hidden;
  background: transparent;
}

.projects-wrapper {
  min-height: calc(100vh - 40px);
  padding: 40px 48px 70px;
  box-sizing: border-box;
}

.projects-hero {
  max-width: 1100px;
  margin: 0 auto 34px;
}

.projects-hero h1 {
  margin: 0 0 8px;
  font-size: 2.4rem;
  color: #fff;
  text-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

.projects-hero p {
  margin: 0;
  color: #aaa;
  font-size: 1rem;
}

.projects-section {
  max-width: 1100px;
  margin: 0 auto 38px;
}

.projects-section h2 {
  font-size: 1.15rem;
  color: #ddd;
  margin: 0 0 14px;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.project-card {
  display: block;
  min-height: 240px;
  overflow: hidden;
  border-radius: 16px;
  /* background: #171a21; */
  /* border: 1px solid rgba(255,255,255,0.09); */
  color: #fff;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.28);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;

  background: rgba(20, 24, 32, 0.65);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.12);  
}

.project-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(255,255,255,0.24);
  background: #1d2028;
}

.project-card img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
  background: #222;
}

.project-card-body {
  padding: 16px;
}

.project-card h3 {
  margin: 10px 0 6px;
  font-size: 1.05rem;
}

.project-card p {
  margin: 0;
  color: #aaa;
  font-size: 0.9rem;
  line-height: 1.45;
}

.project-badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.project-badge.private {
  background: rgba(96,165,250,0.18);
  color: #93c5fd;
}

.project-badge.public {
  background: rgba(45,212,191,0.16);
  color: #5eead4;
}

/* =========================================================
   PROJECTS BACKGROUND
   ========================================================= */

.projects-wrapper {
  position: relative;
  min-height: calc(100vh - 40px);
  padding: 40px 48px 70px;
  box-sizing: border-box;
  overflow: visible;
}

/* Background image layer */
.projects-bg {
  position: fixed;
  inset: 0;
  z-index: -1;

  background-image: url("/static/project_thumbnails/indufor_background.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  filter: brightness(0.6); /* darken */
}

/* Dark gradient overlay (improves readability) */
.projects-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(10, 12, 16, 0.9) 0%,
    rgba(10, 12, 16, 0.7) 40%,
    rgba(10, 12, 16, 0.4) 100%
  );
}

/* Ensure content sits above background */
.projects-wrapper > * {
  position: relative;
  z-index: 1;
}

body.projects-page {
  overflow-y: auto !important;
  overflow-x: hidden !important;

  background:
    linear-gradient(
      to right,
      rgba(10, 12, 16, 0.9) 0%,
      rgba(10, 12, 16, 0.72) 45%,
      rgba(10, 12, 16, 0.45) 100%
    ),
    url("/static/project_thumbnails/indufor_background.png") center center / cover no-repeat fixed !important;
}

.projects-bg {
  display: none !important;
}

.projects-wrapper {
  background: transparent !important;
  overflow: visible !important;
}