/* ─── Layout ──────────────────────────────────────────────────────────────── */

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: sans-serif;
}

#map {
  height: 100vh;
  width: 100%;
}

/* ─── Loading / error overlays ────────────────────────────────────────────── */

/* Shown over the basemap while lake data downloads; removed by populate(). */
#tt-loading {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: rgba(255, 255, 255, 0.92);
  padding: 8px 14px;
  border-radius: 20px;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
}

.tt-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid #cbd5e1;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: tt-spin 0.8s linear infinite;
}

@keyframes tt-spin {
  to { transform: rotate(360deg); }
}

#tt-error {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: white;
  color: #c00;
  padding: 8px 18px;
  border-radius: 6px;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.25);
}

/* ─── Control panel ───────────────────────────────────────────────────────── */

#tt-controls {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 9999;
  background: white;
  padding: 10px 14px;
  border: 2px solid #666;
  border-radius: 6px;
  font-size: 13px;
  min-width: 190px;
  max-width: 250px;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.25);
}

#tt-controls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

#tt-controls-header b {
  font-size: 14px;
}

#tt-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}

#tt-body label {
  display: block;
  margin-bottom: 2px;
}

#tt-body input[type="range"] {
  width: 100%;
  margin: 3px 0 8px;
}

.tt-section {
  margin-bottom: 6px;
}

.tt-spacer {
  height: 6px;
}

/* ─── Dimension cards ─────────────────────────────────────────────────────── */

.tt-dim-card {
  background: #f5f7fa;
  border: 1px solid #d0d0d0;
  border-radius: 5px;
  padding: 6px 8px;
  margin-bottom: 6px;
}

.tt-dim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#tt-body .tt-dim-header label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: bold;
  margin-bottom: 0;
  cursor: pointer;
}

.tt-dim-body {
  margin-top: 5px;
}

/* ─── Fish dropdown ──────────────────────────────────────────────────────── */

.tt-fish-dropdown {
  position: relative;
}

.tt-fish-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 3px 7px;
  background: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  color: inherit;
}

.tt-fish-btn:hover {
  background: #e8e8e8;
}

.tt-fish-arrow {
  font-size: 10px;
  color: #888;
  margin-left: 4px;
  transition: transform 0.15s;
}

.tt-fish-dropdown.open .tt-fish-arrow {
  transform: rotate(180deg);
}

.tt-fish-panel {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  padding: 2px;
  z-index: 1000;
}

.tt-fish-panel[hidden] {
  display: none;
}

.tt-fish-toggle-all {
  display: block;
  width: 100%;
  text-align: left;
  padding: 3px 6px;
  background: none;
  border: none;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  font-size: 11px;
  color: #666;
  font-family: inherit;
  margin-bottom: 2px;
}

.tt-fish-toggle-all:hover {
  background: #f0f0f0;
}

.tt-fish-panel label {
  display: block;
  padding: 2px 6px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 2px;
  line-height: 1.4;
}

.tt-fish-panel label:hover {
  background: #f5f5f5;
}

/* ─── Access-mode segmented toggle (road vs public transport) ────────────── */

.tt-mode-toggle {
  display: flex;
  gap: 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  overflow: hidden;
}

.tt-mode-btn {
  flex: 1;
  padding: 3px 7px;
  background: #f5f5f5;
  border: none;
  border-left: 1px solid #ccc;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  color: inherit;
}

.tt-mode-btn:first-child {
  border-left: none;
}

.tt-mode-btn:hover {
  background: #e8e8e8;
}

.tt-mode-btn.active {
  background: #4a90d9;
  color: #fff;
}

/* ─── noUiSlider ─────────────────────────────────────────────────────────── */

/* Low/High range labels flanking slider */
.tt-slider-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75em;
  color: #888;
  margin-bottom: 2px;
}

/* noUiSlider track + handle style */
.noUi-target {
  background: #ddd;
  border: none;
  box-shadow: none;
  border-radius: 4px;
  height: 4px;
  margin: 8px 4px 12px;
}

.noUi-horizontal {
  height: 4px;
}

.noUi-base,
.noUi-connects {
  border-radius: 4px;
}

.noUi-connect {
  background: #888;
}

.noUi-horizontal .noUi-handle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #555;
  border: none;
  box-shadow: none;
  top: -5px;
  right: -7px;
  cursor: pointer;
}

.noUi-handle::before,
.noUi-handle::after {
  display: none;
}

.noUi-handle:focus {
  outline: none;
}

/* noUiSlider range label */
#tt-ar-range-label,
#tt-ls-range-label,
#tt-ms-range-label {
  font-size: 13px;
  color: #555;
}

/* ─── Lake size filter section ────────────────────────────────────────────── */

.tt-filter-section {
  background: #fff8e7;
  border: 1px solid #e0c97f;
  border-radius: 5px;
  padding: 6px 8px;
  margin-bottom: 6px;
}

.tt-filter-header {
  font-weight: bold;
  margin-bottom: 1px;
}

.tt-filter-hint {
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
}

/* ─── Info button & tooltip ───────────────────────────────────────────────── */

.tt-info-btn {
  position: relative;
  cursor: pointer;
  color: #4a78b5;
  font-size: 18px;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
  outline: none;
  transition: color 0.15s ease;
}

.tt-info-btn:hover,
.tt-info-btn:focus,
.tt-info-btn.tt-info-open {
  color: #2c5894;
}

.tt-info-tip {
  display: none;
  position: absolute;
  right: 0;
  top: 120%;
  background: #333;
  color: #fff;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 11px;
  width: 230px;
  z-index: 10000;
  line-height: 1.4;
  white-space: normal;
  font-weight: normal;
}

.tt-info-btn:hover .tt-info-tip,
.tt-info-btn.tt-info-open .tt-info-tip {
  display: block;
}

/* ─── Legend ──────────────────────────────────────────────────────────────── */

#tt-legend {
  position: fixed;
  bottom: 30px;
  right: 10px;
  z-index: 9999;
  background: white;
  padding: 8px 10px;
  border: 2px solid #666;
  border-radius: 6px;
  font-size: 12px;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.25);
}

.tt-legend-header {
  font-weight: bold;
  margin-bottom: 3px;
}

.tt-legend-row {
  display: flex;
  align-items: center;
  margin-bottom: 2px;
}

.tt-legend-swatch {
  width: 12px;
  height: 12px;
  display: inline-block;
  margin-right: 6px;
  opacity: 0.75;
  flex-shrink: 0;
}

/* ─── Popups ──────────────────────────────────────────────────────────────── */

.tt-popup-name {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 4px;
}

.tt-popup-divider {
  margin: 4px 0 6px;
  border: none;
  border-top: 1px solid #ccc;
}

.tt-popup th.tt-popup-overall-label {
  font-weight: bold;
}

.tt-popup table {
  font-size: 12px;
  border-collapse: collapse;
  width: 100%;
}

.tt-popup th {
  text-align: left;
  padding: 2px 6px 2px 0;
  white-space: nowrap;
}

.tt-popup td {
  padding: 2px 0;
}

.tt-popup hr {
  margin: 3px 0;
  border: none;
  border-top: 1px solid #ccc;
}

/* Score badge colours — TentabilityLevel 1–5 */
.tt-b1, .tt-b2, .tt-b3, .tt-b4, .tt-b5 { padding: 1px 5px; border-radius: 3px; }
.tt-b1 { background: #d73027; color: white; }
.tt-b2 { background: #fc8d59; color: white; }
.tt-b3 { background: #fee08b; color: #333; }
.tt-b4 { background: #91cf60; color: #333; }
.tt-b5 { background: #1a9850; color: white; }

/* ─── Footer bar ──────────────────────────────────────────────────────────── */

#tt-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid #ccc;
  padding: 3px 12px;
  font-size: 11px;
  text-align: center;
}

#tt-footer a {
  color: #0066cc;
  text-decoration: none;
}

#tt-footer a:hover {
  text-decoration: underline;
}

.tt-footer-sep {
  margin: 0 6px;
  color: #aaa;
}

#tt-credits-btn {
  background: none;
  border: none;
  color: #0066cc;
  cursor: pointer;
  font-size: 11px;
  padding: 0;
}

.leaflet-bottom.leaflet-left {
  bottom: 28px;
}

#tt-credits-btn:hover {
  text-decoration: underline;
}

/* ─── Credits dialog ──────────────────────────────────────────────────────── */

#tt-credits-dialog {
  border: none;
  border-radius: 8px;
  padding: 20px 24px;
  max-width: 380px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  font-size: 13px;
}

#tt-credits-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.tt-credits-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #666;
  line-height: 1;
}

.tt-credits-close:hover {
  color: #000;
}

.tt-credits-body b {
  display: block;
  margin: 8px 0 2px;
  font-size: 12px;
}

.tt-credits-body b:first-child {
  margin-top: 0;
}

.tt-credits-body ul {
  margin: 0;
  padding-left: 18px;
}

.tt-credits-body li {
  margin-bottom: 2px;
}

.tt-credits-body a {
  color: #0066cc;
}
