/* =============================================================
   TRAIL ISSUE REPORTING — DESIGN SYSTEM
   Clean / modern utility aesthetic
   ============================================================= */

/* ---------- FONTS ---------- */
@import url('assets/fonts/fonts.css');
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ---------- CSS VARIABLES ---------- */
:root {
  --brand-green:      #65932f;
  --brand-green-dark: #395239;
  --brand-lime:       #c5d446;
  --brand-lime-dark:  #a8b800;
  --accent-blue:      #224952;
  --accent-blue-light:#1a73e8;

  --severity-high:    #c0392b;
  --severity-medium:  #d97706;
  --severity-low:     #16a34a;

  --surface:          #ffffff;
  --surface-alt:      #f7f8f6;
  --surface-raised:   #ffffff;
  --border:           #dde1d8;
  --border-strong:    #a8b09e;

  --text-primary:     #1a1f18;
  --text-secondary:   #4a5544;
  --text-muted:       #7a8a73;
  --text-inverse:     #ffffff;

  --shadow-sm:   0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06);
  --shadow-lg:   0 12px 32px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);

  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-pill: 999px;

  --font-din: 'd-dinregular', Arial, sans-serif;
  --font-din-bold: 'd-dindin-bold', Arial, sans-serif;
  --font-crimson-pro-light: 'crimson-pro-light', Times, serif;
  --font-crimson-pro-regular: 'crimson-pro-regular', Times, serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --nav-height: 60px;
  --content-max: 1200px;
  --form-max:    620px;
}

/* ---------- RESET & BASE ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-din);
  background: var(--surface);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =============================================================
   NAVIGATION
   ============================================================= */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--nav-height);
  background: var(--brand-green);
  border-bottom: 3px solid var(--brand-lime);
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-md);
}

.nav-inner {
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 0;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-right: auto;
}

.nav-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--brand-lime);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.nav-logo-text {
  font-family: 'd-dindin-bold', 'IBM Plex Sans', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

.nav-logo-sub {
  font-size: 10px;
  font-weight: 400;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.nav-link:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.nav-link.active {
  background: var(--brand-lime);
  color: var(--brand-green-dark);
  font-weight: 700;
}

.nav-link .nav-icon {
  font-size: 15px;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  margin-left: 8px;
}

/* =============================================================
   PAGE SHELL
   ============================================================= */
.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 24px 20px 20px;
}

.page-header-inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

.page-title {
  font-family: 'd-dindin-bold', 'IBM Plex Sans', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title-icon {
  font-size: 20px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.5;
}

.page-content {
  flex: 1;
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px;
}

/* =============================================================
   FORM PAGE
   ============================================================= */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  max-width: var(--form-max);
  margin: 0 auto;
}

.form-card-header {
  background: var(--accent-blue);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-sm);
  gap: 12px;
}

.form-card-header-icon {
  width: 40px;
  height: 40px;
  background: rgba(196, 214, 0, 0.2);
  background-image: url("/assets/images/Trustees_Logo.jpg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  border: 1px solid rgba(196, 214, 0, 0.4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.form-card-header h3 {
  font-size: 36px;
  font-weight: bold;
  color: #fff;
  letter-spacing: 0.02em;
  font-family: var(--font-din-bold);
}

.form-card-header p {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: .16px;
  color: #fff;
  margin-top: 2px;
  font-family: var(--font-din);
}

.form-body {
  padding: 28px 24px 32px;
}

/* ---------- SECTION DIVIDERS ---------- */
.form-section {
  margin-bottom: 28px;
}

.form-section-label {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.15em;  
  text-transform: uppercase;
  font-family: var(--font-din);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.form-section-label::before {
  content: "";
  width: 3px;
  height: 15px;
  background: var(--brand-lime);
  border-radius: 2px;
  display: inline-block;
}

/* ---------- INPUT WRAPPER (floating label) ---------- */
.input-wrapper {
  position: relative;
  margin-top: 20px;
}

/* focus underline bar */
.input-wrapper::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: var(--brand-green);
  transition: height 0.25s ease;
  border-radius: 0 0 2px 2px;
}

.input-wrapper.focussed::after {
  height: 2px;
}

.input-wrapper input,
.input-wrapper select,
.input-wrapper textarea {
  width: 100%;
  padding: 20px 12px 6px;
  font-family: var(--font-din);
  font-size: 15px;
  line-height: 1.4;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  color: var(--text-primary);
  caret-color: var(--brand-green);
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s ease, background 0.2s ease;
  box-sizing: border-box;
}

.input-wrapper input:focus,
.input-wrapper select:focus,
.input-wrapper textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--border-strong);
}

.input-wrapper textarea {
  resize: vertical;
  min-height: 80px;
  max-width: 100%;
}

/* custom select arrow */
.input-wrapper select {
  appearance: none;
  -webkit-appearance: auto;
  -moz-appearance: auto;
  padding-right: 32px;
  background: none;
}

.input-wrapper label {
  position: absolute;
  left: 12px;
  top: 14px;
  font-size: 15px;
  color: var(--text-muted);
  pointer-events: none;
  transition: all 0.2s ease;
  font-family: var(--font-din);
}

.input-wrapper.focussed label,
.input-wrapper.filled label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  top: 5px;
  color: var(--brand-green);
}

/* ---------- HINT ROW ---------- */
.hintRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 5px;
  min-height: 18px;
}

.fieldHint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.2s ease;
  font-weight: 500;
}

.fieldHint.required {
  color: var(--severity-high);
  font-weight: 600;
}

.fieldHint.optional {
  color: var(--text-muted);
}

.hintHidden {
  visibility: hidden;
}

.formHelpText {
  color: var(--text-muted);
  font-size: 12px;
  margin: 0;
  text-align: right;
  font-style: italic;
}

/* ---------- MAP (Form Page) ---------- */
#map {
  height: 320px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-top: 8px;
  overflow: hidden;
  transition: border-color 0.2s ease;
  background: #e8ece4;
}

#map:focus-within,
#map.map-active {
  border-color: var(--brand-green);
  box-shadow: 0 0 0 3px rgba(75, 111, 68, 0.15);
}

.map-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(75, 111, 68, 0.06);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
  transition: opacity 0.3s ease;
}

.map-hint.hidden {
  display: none;
}

/* =============================================================
   LEAFLET OVERRIDES
   ============================================================= */
.leaflet-touch .leaflet-control-layers, .leaflet-touch .leaflet-bar {
  border: none !important;
  background-clip: padding-box;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-sm) !important;
  border-radius: var(--radius-sm) !important;
}

.leaflet-control-zoom {
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-sm) !important;
  border-radius: var(--radius-sm) !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text-secondary) !important;
  border-bottom-color: var(--border) !important;
  font-size: 16px !important;
  line-height: 28px !important;
  width: 28px !important;
  height: 28px !important;
  transition: background 0.15s ease !important;
}

.leaflet-control-zoom a:hover {
  background: var(--surface-alt) !important;
  color: var(--text-primary) !important;
}

/* Leaflet layers control toggle styles */
.leaflet-control-layers-toggle {
  background-color: red !important;
}

#button-layer-toggle {
  padding: 0;
  background-clip: padding-box;
  transition: background 0.15s ease !important;
}

#button-layer-toggle .layer-toggle-bg {
  width: 30px;
  height: 30px;
  background-image: url('https://unpkg.com/leaflet@1.9.4/dist/images/layers.png');
  background-size: 20px 20px; /* Adjust based on your image size */
  background-repeat: no-repeat;
  background-position: center;
}

#button-layer-toggle:hover {
  background-color: #f4f4f4;
}

/* ---------- LOCATE ME BUTTON ---------- */
.map-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 6px;
  background-color: #fff;
  font-family: var(--font-din);
  font-size: 14px;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-sm) !important;
  border-radius: var(--radius-sm) !important;
  transition: background 0.15s ease !important;
  text-transform: uppercase;
  letter-spacing: .36px;
}

.map-btn:hover {
  background-color: #f4f4f4;
}

.map-btn-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  background-image: url("assets/images/locate_pin.svg");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}




/* ---------- PHOTO UPLOAD ---------- */
.file-wrapper input[type="file"] {
  display: none;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface-alt);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease, background 0.2s ease;
  cursor: pointer;
  margin-top: 8px;
}

.file-row:hover {
  border-color: var(--brand-green);
  background: rgba(75, 111, 68, 0.04);
}

.file-row button {
  padding: 8px 10px;
  background-color: #569602;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: .15em;
  font-weight: 600;
  font-family: var(--font-din);
  white-space: nowrap;
  flex-shrink: 0;
  align-items: center;
  text-transform: uppercase;
  transition: all .3s cubic-bezier(.25,.46,.45,.94);
  justify-content: center;
  border-radius: 40px;
  display: inline-flex;
}

.file-row button:hover {
  background: var(--brand-green-dark);
  box-shadow: var(--shadow-md);
}

.file-row button:focus {
  outline: 2px solid var(--brand-lime);
  outline-offset: 2px;
}

.file-row span {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-btn-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  background-image: url("assets/images/add_photo.svg");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  margin-right: 5px;
}

/* ---------- PHOTO PREVIEW ---------- */
#photoPreview {
  max-width: 100%;
  max-height: 200px;
  margin-top: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  object-fit: contain;
}

/* ---------- SUBMIT BUTTON ---------- */
.submit-btn-wrapper {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

button#submitBtn {
  width: 100%;
  font-size: 12px;
  line-height: 38px;
  letter-spacing: .15em;
  border: none;
  color: #fff;
  font-family: var(--font-din);
  font-weight: 600;
  margin-top: 32px;
  align-items: center;
  background-color: #569602;
  border-radius: 40px;
  display: inline-flex;
  height: 50px;
  justify-content: center;
  min-width: 100%;
  padding: 0 28px;
  text-transform: uppercase;
  transition: all .3s cubic-bezier(.25,.46,.45,.94);
}

button#submitBtn:hover:not(:disabled) {
  background: var(--brand-green-dark);
  box-shadow: var(--shadow-md);
}

button#submitBtn:active:not(:disabled) {
  transform: translateY(0);
}

button#submitBtn:disabled {
  background: #c5ccc1;
  color: #8a9488;
  cursor: not-allowed;
}

/* ---------- STATUS ---------- */
.status {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.status.success {
  background: #f0faf0;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.status.error {
  background: #fff5f5;
  color: #9b1c1c;
  border: 1px solid #fecaca;
}

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 340px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 0;
  overflow: hidden;
  transform: translateY(120px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(.22,.68,0,1.2), opacity 0.3s ease;
  z-index: 9999;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-progress {
  height: 3px;
  background: var(--brand-lime);
  width: 100%;
  transform-origin: left;
  animation: none;
}

.toast.show .toast-progress {
  animation: toast-timer 6s linear forwards;
}

@keyframes toast-timer {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

.toast-inner {
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.toast-icon {
  width: 32px;
  height: 32px;
  background: #dcfce7;
  color: #16a34a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-body {
  flex: 1;
}

.toast-body strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.toast-body p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.toast-btn {
  background: var(--brand-green);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  margin-top: 10px;
  transition: background 0.2s ease;
  font-family: var(--font-din);
}

.toast-btn:hover {
  background: var(--brand-green-dark);
}

/* =============================================================
   ISSUES MAP PAGE
   ============================================================= */

/* -- Two-column layout: map left, panel right on desktop -- */
.issues-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  grid-template-rows: auto 1fr;
  gap: 0;
  height: calc(100vh - var(--nav-height) - 1px);
  overflow: hidden;
}

.issues-map-col {
  position: relative;
  overflow: hidden;
  grid-row: 1 / 3;
}

.issues-panel-col {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow: hidden;
}

/* ---------- PANEL HEADER ---------- */
.panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.panel-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ---------- SUMMARY STATS ---------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.stat-chip {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  text-align: center;
}

.stat-chip .stat-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1;
  color: var(--text-primary);
}

.stat-chip .stat-label {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 600;
}

.stat-chip.high   .stat-value { color: var(--severity-high); }
.stat-chip.medium .stat-value { color: var(--severity-medium); }
.stat-chip.low    .stat-value { color: var(--severity-low); }

/* ---------- CONTROLS ---------- */
.controls-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* Site filter select in panel */
.panel-select {
  flex: 1;
  min-width: 120px;
  padding: 7px 28px 7px 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-din);
  font-size: 13px;
  color: var(--text-primary);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234a5544' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.panel-select:focus {
  outline: none;
  border-color: var(--brand-green);
  box-shadow: 0 0 0 3px rgba(75,111,68,0.12);
}

/* Search input */
.search-input {
  width: 100%;
  padding: 8px 10px 8px 32px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-din);
  font-size: 13px;
  color: var(--text-primary);
  margin-top: 8px;
  transition: border-color 0.15s ease;
  position: relative;
}

.search-wrapper {
  position: relative;
  margin-top: 8px;
}

.search-wrapper::before {
  content: "🔍";
  font-size: 12px;
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.5;
}

.search-wrapper input {
  width: 100%;
  padding: 8px 10px 8px 30px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-din);
  font-size: 13px;
  color: var(--text-primary);
  transition: border-color 0.15s ease;
}

.search-wrapper input:focus {
  outline: none;
  border-color: var(--brand-green);
  box-shadow: 0 0 0 3px rgba(75,111,68,0.12);
  background: #fff;
}

/* Filter buttons */
.filter-btns {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.filter-btn {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-din);
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.filter-btn:hover {
  background: var(--border);
  border-color: var(--border-strong);
}

.filter-btn.active {
  background: var(--brand-green);
  color: #fff;
  border-color: var(--brand-green);
}

.filter-btn[data-severity="high"].active   { background: var(--severity-high);   border-color: var(--severity-high); }
.filter-btn[data-severity="medium"].active { background: var(--severity-medium); border-color: var(--severity-medium); }
.filter-btn[data-severity="low"].active    { background: var(--severity-low);    border-color: var(--severity-low); }

/* ---------- ISSUES LIST ---------- */
.issues-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.issues-list-scroll::-webkit-scrollbar {
  width: 4px;
}

.issues-list-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.issues-list-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* Issue cards */
.issue-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.issue-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--border-strong);
  transition: background 0.15s ease;
}

.issue-card.severity-high::before   { background: var(--severity-high); }
.issue-card.severity-medium::before { background: var(--severity-medium); }
.issue-card.severity-low::before    { background: var(--severity-low); }

.issue-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  background: var(--surface-alt);
}

.issue-card.active-card {
  border-color: var(--brand-green);
  background: rgba(75, 111, 68, 0.04);
  box-shadow: 0 0 0 2px rgba(75,111,68,0.15);
}

.issue-card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.issue-card-body {
  flex: 1;
  min-width: 0;
}

.issue-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.issue-card-type {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.issue-card-site {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.issue-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.issue-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.issue-card-age {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.badge.high   { background: #fee2e2; color: #9b1c1c; }
.badge.medium { background: #fef3c7; color: #92400e; }
.badge.low    { background: #dcfce7; color: #166534; }

.no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.no-results-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

/* ---------- ISSUES MAP ---------- */
#issuesMap {
  height: 100%;
  width: 100%;
  background: #e8ece4;
}

/* ---------- MAP OVERLAY CONTROLS ---------- */
.map-overlay-controls {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 500;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.map-badge-btn {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-din);
  color: var(--text-secondary);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.map-badge-btn:hover {
  background: var(--surface-alt);
  border-color: var(--border-strong);
}

/* Refresh indicator */
.refresh-indicator {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 500;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: var(--shadow-sm);
}

.refresh-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--severity-low);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.8); }
}

.refresh-indicator.loading .refresh-dot {
  background: var(--severity-medium);
  animation: spin-dot 0.8s linear infinite;
}

@keyframes spin-dot {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ---------- CUSTOM POPUP ---------- */
.leaflet-popup.custom-popup .leaflet-popup-content-wrapper {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 0;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  font-family: var(--font-din);
  min-width: 260px;
  border: 1px solid var(--border);
}

.leaflet-popup.custom-popup .leaflet-popup-content {
  margin: 0;
  width: auto !important;
}

.leaflet-popup.custom-popup .leaflet-popup-tip-container {
  margin-top: -1px;
}

.popup-header-band {
  padding: 12px 16px 10px;
  background: var(--brand-green);
  display: flex;
  align-items: center;
  gap: 8px;
}

.popup-header-band.severity-high   { background: var(--severity-high); }
.popup-header-band.severity-medium { background: #b45309; }
.popup-header-band.severity-low    { background: #166534; }

.popup-issue-icon {
  font-size: 20px;
}

.popup-issue-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.popup-issue-subtitle {
  font-size: 11px;
  color: rgba(255,255,255,0.75);
  margin-top: 1px;
}

.popup-body {
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.5;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 7px;
  gap: 10px;
}

.popup-label {
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-top: 1px;
}

.popup-value {
  text-align: right;
  color: var(--text-primary);
  font-size: 13px;
}

.popup-description {
  padding: 8px 10px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 8px 0;
  font-style: italic;
}

.popup-actions {
  display: flex;
  gap: 6px;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border);
}

.popup-btn {
  flex: 1;
  padding: 7px 10px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-din);
  font-weight: 700;
  font-size: 12px;
  transition: background 0.2s ease, opacity 0.2s ease;
  text-align: center;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.popup-btn.complete-btn {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.popup-btn.complete-btn:hover {
  background: #bbf7d0;
}

.popup-btn.view-btn {
  background: var(--accent-blue-light);
  color: var(--accent-blue);
  border: 1px solid #bfdbfe;
  text-decoration: none;
}

.popup-btn.view-btn:hover {
  background: #bfdbfe;
}

/* photo in popup */
.popup-photo {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.popup-photo-link {
  display: block;
  margin: 8px 0;
}

.popup-photo:hover {
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

/* ---------- ISSUE MARKER ICONS ---------- */
.issue-icon {
  display: block;
  pointer-events: auto;
}

.issue-icon svg {
  transition: transform 0.15s ease, filter 0.15s ease;
  transform-origin: center center;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.25));
}

.issue-icon:hover svg {
  transform: scale(1.2);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
}

/* =============================================================
   LOADING OVERLAY
   ============================================================= */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(247, 248, 246, 0.85);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
  transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--brand-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* =============================================================
   UTILITY
   ============================================================= */
.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* =============================================================
   RESPONSIVE — TABLET
   ============================================================= */
@media (max-width: 900px) {
  .issues-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 45vh 1fr;
    height: calc(100vh - var(--nav-height));
    overflow: auto;
  }

  .issues-map-col {
    grid-row: 1;
    height: 45vh;
    min-height: 280px;
  }

  .issues-panel-col {
    grid-row: 2;
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 55vh;
  }

  #issuesMap {
    height: 100%;
  }

  .stats-row {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* =============================================================
   RESPONSIVE — MOBILE
   ============================================================= */
@media (max-width: 600px) {
  :root {
    --nav-height: 54px;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--brand-green-dark);
    flex-direction: column;
    padding: 8px;
    gap: 2px;
    border-bottom: 2px solid var(--brand-lime);
    box-shadow: var(--shadow-md);
  }

  #issueType, #siteSelect, #severity {
    height: 50px;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-link {
    width: 100%;
    padding: 10px 14px;
  }

  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .page-content {
    padding: 16px 14px;
  }

  .form-body {
    padding: 20px 16px 24px;
  }

  .form-card-header {
    padding: 16px 18px;
  }

  .issues-layout {
    grid-template-rows: 50vw 1fr;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel-header {
    padding: 12px 14px;
  }

  .toast {
    left: 16px;
    right: 16px;
    width: auto;
    bottom: 16px;
  }

  .refresh-indicator {
    display: none;
  }
}
