/* ============================================================
   Proxima Nova — primary body font on geogli.com
   Loaded from geogli.com; falls back to Montserrat if unavailable
   ============================================================ */
@font-face {
  font-family: 'Proxima Nova';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('https://www.geogli.com/themes/ugridt/assets/css/files/proxima-nova-latin-400-normal.woff2') format('woff2'),
       url('https://www.geogli.com/themes/ugridt/assets/css/files/proxima-nova-all-400-normal.woff') format('woff');
}

/* ============================================================
   CSS design tokens — mirrored from tailwind.config.js & pcss sources
   ============================================================ */
:root {
  /* brand */
  --black:       #000000;
  --black1:      #0a0c0d;
  --black2:      #1E1E1E;
  --white:       #ffffff;
  --white1:      #F0F0F0;
  --white2:      #F7F8FA;
  --white3:      #ebf2fa;   /* border-secondary  */
  --white4:      #fafbfc;

  /* grays */
  --gray:        #D1D2D3;
  --gray1:       #e1e1e1;   /* border-gray1      */
  --gray2:       #656565;
  --gray3:       #BFBFBF;
  --gray7:       #bfbebe;   /* bg-gray-7 (active ctrl btn) */

  /* brand greens */
  --green:       green;
  --green1:      #006937;   /* UNCCD brand green – active toggle/pin */
  --green2:      #daf043;   /* bg active Explore tab (lime)          */
  --green3:      rgba(25,157,60,0.08);

  /* terracotta / workspace */
  --orange2:     #cc7c4b;   /* bg active Pinned/Workspace tab */
  --soil:        #644117;
  --terracotta:  #cc7c4b;

  /* misc */
  --form-bg:     #f2f0ec;   /* bg-form – search field, etc. */
  --blue:        #0B397F;
  --orange:      #E7B056;
  --red:         #C92730;

  /* layout — sidebar is md:w-1/3 in the React source; we use a fixed 380px
     so the 200px filter column always has room for the list column beside it */
  --sidebar-w:   480px;
  --filters-w:   200px;
  --app-h:       calc(100vh - 5px);
  --tab-h:       44px;               /* h-11 */
}

/* ============================================================
   Reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: auto;
  font-family: 'Proxima Nova', 'Montserrat', sans-serif;
  font-size: 14px;
  color: var(--black1);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-y: auto;
}

button { cursor: pointer; font-family: 'Proxima Nova', 'Montserrat', sans-serif !important; }
input  { font-family: 'Proxima Nova', 'Montserrat', sans-serif; }
a      { color: inherit; text-decoration: none; }
ul     { list-style: none; }

/* ============================================================
   Material Symbols — mirrors app.pcss .symbol class
   ============================================================ */
.symbol {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 1.5em; /* 24px relative */
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  color: gray;
  vertical-align: middle;
  user-select: none;
}
/* filled variant */
.symbol.fill {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
/* green fill for active toggle & pin — from app.pcss */
.symbol.fill.toggle_on,
.symbol.fill.push_pin {
  color: var(--green1);
}
.symbol.fill.toggle_off { color: gray; }
/* normal size variant used in small controls */
.symbol-sm {
  font-size: 1.25em;
}

/* ============================================================
   Loading overlay
   ============================================================ */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray2);
  gap: 10px;
}
#loading-overlay.hidden { display: none; }
.spinner {
  width: 20px; height: 20px;
  border: 3px solid var(--gray1);
  border-top-color: var(--green1);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   App layout  – mirrors App.jsx: md:flex md:items-center
   ============================================================ */
#app {
  display: flex;
  height: var(--app-h);
  overflow: hidden;
  align-items: stretch;
}

/* ── Sidebar (md:w-1/3) ────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  flex-shrink: 0;          /* prevent flexbox from squishing it */
  display: flex;
  flex-direction: column;
  height: var(--app-h);
  overflow: hidden;
  position: relative;
  z-index: 10;
  transition: width 0.2s, min-width 0.2s;
  background: var(--white);
}
#sidebar.collapsed { width: 0; min-width: 0; }

/* ── Tab nav – h-11, sticky, bg-white ─────────────────────── */
#tab-nav {
  display: flex;
  height: var(--tab-h);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 5;
}
.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
  border-bottom: 2px solid var(--white3);
  color: var(--gray2);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
/* Explore active → bg-green2 text-black (lime yellow)
   JS sets class="tab-btn active" on the explore button */
.tab-btn.active:not(.pinned) {
  background: var(--green2);
  color: var(--black1);
  border-bottom-color: transparent;
}
/* Pinned active → bg-orange-2 text-white
   JS sets class="tab-btn active pinned" on the pinned button */
.tab-btn.active.pinned {
  background: var(--orange2);
  color: var(--white);
  border-bottom-color: transparent;
}

/* ── Sidebar body: filters col + list col ──────────────────── */
#sidebar-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Category filters column – w-60, hidden on pinned tab ──── */
/* mirrors: hidden md:flex flex-col bg-white w-60 sticky top-0 overflow-y-auto h-screen border-r border-gray1 */
#filters-col {
  width: var(--filters-w);
  min-width: var(--filters-w);
  overflow-y: auto;
  border-right: 1px solid var(--gray1);
  background: var(--white);
  display: flex;
  flex-direction: column;
}
#filters-col.hidden { display: none; }

/* "Filters" label */
#filters-col .filters-label {
  font-size: 13px;
  font-weight: 700;
  padding: 12px 12px 4px;
  display: block;
  color: var(--black1);
}

/* Active filter tags (soil bg, white text) */
.active-filters { padding: 0 8px 4px; }
.active-filter-tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--soil);  /* bg-soil */
  color: var(--white);
  border-radius: 4px;
  padding: 4px 8px;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 500;
}
.active-filter-tag button {
  background: none;
  border: none;
  color: var(--white);
  font-size: 16px;
  line-height: 1;
  padding: 0 0 0 6px;
  cursor: pointer;
}

/* Clear all */
.clear-all-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px 8px;
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  color: var(--gray2);
  cursor: pointer;
}
.clear-all-btn .symbol { font-size: 1.1em; }

/* ── Category checkboxes — mirrors Filters.jsx / app.pcss ──── */
/* .category: border-top, padding-top:10px, margin-bottom:10px */
.category {
  border-top: 1px solid var(--gray1);
  padding-top: 10px;
  margin-bottom: 10px;
}

/* .parent-category: pl-10px pb-10px; input hidden; svg green */
.parent-category {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 10px;
  padding-bottom: 10px;
  cursor: pointer;
}
.parent-category input[type="checkbox"] {
  display: none;          /* hidden per app.pcss */
}
.parent-category .cat-icon {
  color: var(--green1);   /* svg { color:#006937 } */
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.parent-category .cat-icon .symbol {
  font-size: 1.2em;
  color: var(--green1);
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
.parent-category label {
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: var(--black1);
}

/* checked state: icon fills green */
.parent-category.checked .cat-icon .symbol {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

/* sub-categories list: border-bottom */
.sub-categories {
  border-bottom: 1px solid var(--gray1);
  padding-bottom: 15px;
}

/* .sub-category: pl-30px pt-2px */
.sub-category {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 30px;
  padding-top: 2px;
}
.sub-category input[type="checkbox"] {
  width: 13px;
  height: 13px;
  border: 1px solid black;
  accent-color: var(--soil);
  cursor: pointer;
  flex-shrink: 0;
}
.sub-category label {
  font-size: 12px;
  cursor: pointer;
  text-transform: capitalize;
  color: var(--black1);
}

/* ── Layer list column ─────────────────────────────────────── */
#list-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Toolbar (search + active-only checkbox) */
#list-toolbar {
  padding: 6px 8px 4px;
  border-bottom: 1px solid var(--white3);
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 4;
  flex-shrink: 0;
}

/* Search input — mirrors Mantine Input with icon, bg-form */
.search-box {
  display: flex;
  align-items: center;
  background: var(--form-bg);   /* bg-form = #f2f0ec */
  border: none;
  border-radius: 6px;
  padding: 0 10px;
  /* mirrors mantine-Input-withIcon pl-10 */
}
.search-box .symbol { color: var(--gray2); font-size: 1.2em; }
.search-box input {
  border: none;
  outline: none;
  flex: 1;
  padding: 7px 8px;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  color: var(--black1);
}
.search-box input::placeholder { color: var(--gray3); }
/* override Drupal normalize for search inputs */
.search-box input[type="search"] { -webkit-appearance: none; box-sizing: border-box; }

/* "Show only active layers" checkbox row */
.show-active-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px 2px;
  font-size: 13px;
  font-weight: 600;
  border-top: 1px solid var(--white3);
  margin-top: 4px;
}
.show-active-row input[type="checkbox"] {
  width: 14px; height: 14px;
  accent-color: var(--soil);
  cursor: pointer;
}

/* "Remove all active layers" row */
.remove-all-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 4px 4px;
  border-bottom: 1px solid var(--gray1);
  font-size: 13px;
  font-weight: 600;
}
.remove-all-row button {
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--black1);
  cursor: pointer;
}
.remove-all-row .symbol { font-size: 1.1em; }

/* Scrollable layer list — mirrors ScrollArea */
#layer-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px;    /* px-5 */
}
#layer-list::-webkit-scrollbar { width: 4px; }
#layer-list::-webkit-scrollbar-thumb { background: var(--gray1); border-radius: 4px; }

.empty-msg {
  padding: 24px 8px;
  text-align: center;
  color: var(--gray2);
  font-style: italic;
  font-size: 13px;
}

/* ── Layer item — mirrors View.jsx ─────────────────────────── */
/* border-b border-secondary py-3 */
.layer-item {
  border-bottom: 1px solid var(--white3);
  padding: 12px 0;
}

.layer-top {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* UnstyledButton toggle — no bg, no border */
.layer-toggle-btn {
  background: none;
  border: none;
  padding: 0 4px 0 0;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
}
.layer-toggle-btn .symbol { font-size: 1.6em; }
/* active toggle: FILL=1, green — mirrors .symbol.fill.toggle_on from app.pcss */
.layer-toggle-btn.active .symbol {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  color: var(--green1);  /* #006937 */
}
/* inactive toggle: explicit gray so it's consistent */
.layer-toggle-btn:not(.active) .symbol {
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  color: gray;
}

.layer-title {
  flex: 1;
  font-size: 13px;
  cursor: pointer;
  line-height: 1.4;
  color: var(--black1);
}
.layer-title:hover { text-decoration: underline; }

/* Action row (pin + info) */
.layer-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 0 0 28px;
}

/* UnstyledButton pin & info */
.layer-pin-btn,
.layer-info-btn {
  background: none;
  border: none;
  padding: 2px 4px;
  display: flex;
  align-items: center;
  cursor: pointer;
}
.layer-pin-btn .symbol,
.layer-info-btn .symbol { font-size: 1.2em; }
/* pinned: fill green */
.layer-pin-btn.pinned .symbol {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  color: var(--green1);
}
.layer-info-btn.open .symbol {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  color: gray;
}

/* Expanded panel */
.layer-expand { display: none; padding: 6px 0 2px 28px; }
.layer-expand.open { display: block; }

.opacity-row { margin: 6px 0 8px; }
.opacity-row label {
  font-size: 11px;
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
  color: var(--gray2);
}
.opacity-row input[type="range"] {
  width: 100%;
  accent-color: var(--green1);
}

.layer-share-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 0;
  color: var(--gray2);
  cursor: pointer;
}
.layer-share-btn:hover { color: var(--black1); }
.layer-share-btn .symbol { font-size: 1.1em; }

/* Pinned tab remove-all row */
.remove-pinned-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--gray1);
  font-size: 13px;
  font-weight: 600;
}
.remove-pinned-row button {
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--black1);
}

/* Drag handle */
.drag-handle {
  cursor: grab;
  display: flex;
  align-items: center;
  padding: 0 2px;
}
.drag-handle:active { cursor: grabbing; }
.drag-handle .symbol { color: var(--gray3); }

/* ============================================================
   Map area – md:w-2/3, presentation-map, relative
   ============================================================ */
#map-area {
  flex: 1;
  position: relative;
  height: var(--app-h);
  overflow: hidden;
}
#mx-container { width: 100%; height: 100%; }

/* "Show the list" button — bottom-left — lime yellow, square, same style as ctrl-btn */
#show-list-btn {
  position: absolute;
  bottom: 40px;
  left: 12px;
  z-index: 20;
  background: var(--green2);
  border: none;
  border-radius: 4px;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -2px rgba(0,0,0,.05);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: filter 0.1s;
}
#show-list-btn:hover { filter: brightness(0.92); }
#show-list-btn .symbol { color: var(--green1); font-size: 1.25em; }

/* ============================================================
   Map controls overlay – top-3 right-3
   mirrors: absolute flex flex-col space-y-2 items-center top-3 right-3 z-10
   ============================================================ */
#map-controls {
  position: absolute;
  top: 12px;    /* top-3 */
  right: 12px;  /* right-3 */
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;     /* space-y-2 */
  align-items: center;
}

/* Map control buttons — all lime yellow with dark green icons */
.ctrl-btn {
  width: 40px;
  height: 40px;
  background: var(--green2);   /* lime yellow */
  border: none;
  border-radius: 4px;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -2px rgba(0,0,0,.05); /* shadow-xl */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: filter 0.1s;
  position: relative;
}
.ctrl-btn:hover { filter: brightness(0.92); }
/* active state → slightly darker lime */
.ctrl-btn.active { filter: brightness(0.80); }
.ctrl-btn .symbol { font-size: 1.25em; color: var(--green1); }

/* Tooltip (right side label) */
.ctrl-btn::after {
  content: attr(title);
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.7);
  color: var(--white);
  font-size: 11px;
  font-family: 'Proxima Nova', 'Montserrat', sans-serif;
  padding: 3px 7px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.ctrl-btn:hover::after { opacity: 1; }


/* ============================================================
   Modal — mirrors Mantine Modal size="50%"
   ============================================================ */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
#modal-overlay.hidden { display: none; }

#modal-box {
  background: var(--white);
  border-radius: 8px;
  width: min(560px, 90vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
#modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--white3);
}
/* h1 class: text-h1 = 40px/47px */
#modal-header h2 {
  font-size: 28px;
  line-height: 33px;
  font-weight: 700;
  margin: 0;
}
#modal-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--gray2);
  cursor: pointer;
}
#modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 20px;
}
#modal-body h2 {
  font-size: 20px;
  line-height: 26px;
  font-weight: 700;
  margin-bottom: 8px;
}
#modal-body h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 12px 0 4px;
  color: var(--gray2);
}
#modal-body p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--black1);
}

/* Abstract spoiler — Mantine Spoiler maxHeight=120 */
.meta-abstract {
  font-size: 13px;
  line-height: 1.6;
  max-height: 120px;
  overflow: hidden;
}
.meta-abstract.expanded { max-height: none; }
.read-more-btn {
  background: none;
  border: none;
  color: var(--green1);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 0;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
}

/* ============================================================
   Responsive  – mobile (mirrors h-app-mobile, h-app)
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 100%;
    --app-h: calc(100vh - 10px);
  }

  #app { flex-direction: column; }

  #sidebar {
    width: 100%;
    min-width: 100%;
    height: calc(50vh - 30px);   /* h-app-mobile */
    border-bottom: 1px solid var(--gray1);
    transition: height 0.2s;
  }
  #sidebar.collapsed { height: 0; }

  #map-area { flex: 1; height: auto; }

  /* filters column hidden on mobile (mirrors hidden md:flex) */
  #filters-col { display: none !important; }

  /* show-list btn repositioned */
  #show-list-btn { bottom: auto; top: 12px; }
}

/* ============================================================
   Geocoder panel — appears at top of map area when btn-geocoder clicked
   Mirrors the Geocoder modal from the live site
   ============================================================ */
#geocoder-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 60px;   /* leave room for controls column */
  background: var(--white);
  z-index: 30;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  border-bottom: 1px solid var(--gray1);
}
#geocoder-panel.hidden { display: none; }

#geocoder-header {
  padding: 12px 20px 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--black1);
  border-bottom: 1px solid var(--gray1);
}

#geocoder-body {
  padding: 12px 20px;
}

#geocoder-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray1);
  border-radius: 4px;
  font-size: 14px;
  background: var(--form-bg);
  outline: none;
}
#geocoder-input:focus { border-color: var(--green1); }

#geocoder-results {
  margin-top: 8px;
  max-height: 200px;
  overflow-y: auto;
}
.geocoder-result-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 13px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--gray1);
  cursor: pointer;
  font-family: 'Proxima Nova', 'Montserrat', sans-serif;
  color: var(--black1);
}
.geocoder-result-btn:hover { background: var(--form-bg); }

#geocoder-footer {
  display: flex;
  gap: 8px;
  padding: 8px 20px 12px;
}
#geocoder-footer button {
  padding: 6px 14px;
  border: 1px solid var(--gray1);
  border-radius: 4px;
  background: var(--white);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: 'Proxima Nova', 'Montserrat', sans-serif;
}
#geocoder-footer button:hover { background: var(--form-bg); }
#geocoder-footer .symbol { font-size: 1em; }
