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

/* LAYOUT */
#app {
  display: flex;
  height: 100vh;
}

/* LEFT PANEL */
#panel {
  width: 360px;

  background:
    linear-gradient(
      180deg,
      rgba(18,18,18,0.92),
      rgba(10,10,10,0.88)
    );

  backdrop-filter: blur(18px);

  color: white;

  padding: 28px 24px;

  box-sizing: border-box;

  overflow-y: auto;

  border-right: 1px solid rgba(255,255,255,0.06);

  box-shadow: 6px 0 30px rgba(0,0,0,0.35);
}

/* IMPROVED FILTER SCROLL AREA */
#filterContainer {
  margin-top: 20px;

  max-height: calc(100vh - 260px);

  overflow-y: auto;

  padding-right: 6px;
}

/* TYPOGRAPHY */
h1 {
  font-size: 34px;
  line-height: 1;
  margin: 0;
  font-weight: 700;
  letter-spacing: -1.2px;
}

h1::after {
  content: "";
  display: block;
  width: 72px;
  height: 4px;
  margin-top: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #4cc9f0, #4361ee);
}

.subtitle {
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.78;
  margin-top: 18px;
  max-width: 280px;
}

.description {
  font-size: 13px;
  line-height: 1.7;
  opacity: 0.72;
  margin-top: 24px;
  color: rgba(255,255,255,0.82);
}

/* SECTION BLOCKS */
.section {
  margin-top: 26px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.05);
}

.section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  opacity: 0.6;
  margin-top: 0;
  margin-bottom: 14px;
}

/* FILTER ACCORDION (NEW) */
.filter-group {
  margin-bottom: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  overflow: hidden;
}

.filter-header {
  padding: 12px 12px;
  cursor: pointer;

  display: flex;
  justify-content: space-between;
  align-items: center;

  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;

  opacity: 0.85;
}

.filter-options {
  display: none;
  padding: 8px 12px 14px 12px;
}

.filter-group.open .filter-options {
  display: block;
}

/* CHECKBOX LABELS */
label {
  display: flex;
  align-items: center;
  gap: 10px;

  font-size: 13px;
  margin-top: 8px;
  cursor: pointer;
  opacity: 0.92;
}

/* MAP */
#map {
  flex: 1;
}

/* DETAIL PANEL */
#detailPanel {
  position: absolute;

  top: 20px;
  right: 20px;
  bottom: 20px;

  width: 380px;

  background: rgba(25, 25, 25, 0.58);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  border: 1px solid rgba(255,255,255,0.08);

  border-radius: 22px;

  box-shadow:
    0 8px 32px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.05);

  color: white;

  padding: 20px;
  box-sizing: border-box;

  overflow-y: auto;

  z-index: 2000;

  transition: transform 0.35s ease, opacity 0.35s ease;

  opacity: 1;
}

/* CLOSE BUTTON */
.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;

  width: 30px;
  height: 30px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);

  color: #fff;
  font-size: 18px;
  font-weight: 300;

  cursor: pointer;

  border: 1px solid rgba(255, 255, 255, 0.2);

  transition: all 0.2s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.08);
}

/* HIDDEN STATE (FIXED - more reliable) */
.hidden {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

/* DETAIL HEADER */
.detailHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#closeBtn {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
}

/* IMAGE */
#detailImage {
  width: 100%;
  margin-top: 12px;
  border-radius: 8px;
}

/* DETAIL GRID */
.detailGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.detailGrid div {
  background: rgba(255,255,255,0.05);
  padding: 10px;
  border-radius: 8px;
}

input[type="checkbox"] {
  accent-color: #4cc9f0;
}

/* LEGEND */

#legend {
  position: absolute;

  bottom: 50px;
  left: 24px;   /* ✅ moved from right to left */

  z-index: 1500;

  padding: 16px 18px;

  width: 190px;

  border-radius: 18px;

  background: rgba(18,18,18,0.72);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  border: 1px solid rgba(255,255,255,0.08);

  box-shadow: 0 8px 24px rgba(0,0,0,0.18);

  color: white;
}

.legend-title {
  font-size: 11px;

  text-transform: uppercase;

  letter-spacing: 1.5px;

  opacity: 0.65;

  margin-bottom: 14px;
}

.legend-item {
  display: flex;
  align-items: center;

  gap: 10px;

  font-size: 13px;

  margin-bottom: 10px;

  opacity: 0.92;
}

.legend-dot {
  width: 12px;
  height: 12px;

  border-radius: 50%;

  display: inline-block;

  box-shadow:
    0 0 10px rgba(255,255,255,0.12);
}

/* STATUS COLOURS */

.legend-dot.operational {
  background: #4cc9f0;
}

.legend-dot.construction {
  background: #8b7cf6;
}

.legend-dot.planned {
  background: #94a3b8;
}

.leaflet-popup-content-wrapper {
  background: transparent !important;
  box-shadow: none !important;
}

.leaflet-popup-tip {
  background: rgba(18,18,18,0.85) !important;
}
/* REMOVE DEFAULT LEAFLET STYLING */
.leaflet-popup-content-wrapper {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

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

/* MAIN CARD */
.popupCard {
  position: relative;

  width: 240px;

  background: rgba(18, 18, 18, 0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;

  overflow: hidden;

  color: white;
  font-family: Arial, sans-serif;
}

/* LEFT ACCENT STRIP */
.popupAccent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;

  width: 4px;
}

/* STATUS COLOURS */
.status-operational {
  background: #4cc9f0;
}

.status-under-construction {
  background: #8b7cf6;
}

.status-planned {
  background: #94a3b8;
}

/* CONTENT WRAPPER */
.popupContent {
  padding: 12px 12px 10px 14px;
}

/* TITLE */
.popupHeader {
  font-size: 13px;
  font-weight: 600;

  margin-bottom: 10px;

  padding-left: 6px;
}

/* META GRID */
.popupMeta {
  display: grid;
  gap: 6px;

  font-size: 11px;

  margin-bottom: 10px;

  opacity: 0.9;
}

.popupMeta div {
  display: flex;
  justify-content: space-between;

  gap: 10px;
}

.popupMeta span:first-child {
  opacity: 0.6;
}

/* BUTTON */
.popupButton {
  width: 100%;

  padding: 8px 10px;

  border-radius: 10px;

  border: 1px solid rgba(255,255,255,0.12);

  background: rgba(255,255,255,0.06);

  color: white;

  font-size: 12px;

  cursor: pointer;

  transition: all 0.2s ease;
}

.popupButton:hover {
  background: rgba(255,255,255,0.14);
  transform: translateY(-1px);
}

#footerDisclaimer {
  margin-top: 20px;
  font-size: 11px;
  line-height: 1.4;

  color: #475569; /* darker, readable slate tone */

  padding-top: 12px;
  border-top: 1px solid rgba(100, 116, 139, 0.25);

  opacity: 0.9;
}

.terms-link {
  font-size: 12px;
  color: #94a3b8;
  text-decoration: none;
  margin-top: 12px;
  display: inline-block;
}


.terms-button {
  display: inline-block;
  font-size: 12px;
  color: #cbd5e1;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  transition: all 0.2s ease;
}

.terms-button:hover {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.terms-title {
  font-size: 20px; /* adjust as needed */
  font-weight: 400;
}

/* Hidden state */
.modal.hidden {
  display: none;
}

/* Overlay */
.modal {
  position: fixed;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(0, 0, 0, 0.6);

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  z-index: 1000;
}

/* Hidden state */
.modal.hidden {
  display: none;
}

/* Glass modal box */
.modal-content {
  position: relative;

  width: 420px;
  max-width: 90%;

  padding: 22px 20px;

  border-radius: 18px;

  background: rgba(25, 25, 25, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  border: 1px solid rgba(255, 255, 255, 0.08);

  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);

  color: #e5e7eb;

  font-size: 14px;
  line-height: 1.6;
}

/* Title */
.modal-content h2 {
  margin: 0 0 12px 0;

  font-size: 18px;
  font-weight: 600;

  letter-spacing: -0.3px;

  color: #ffffff;
}

/* Close button (FIXED VISIBILITY) */
.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;

  width: 32px;
  height: 32px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 8px;

  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);

  color: #ffffff;

  font-size: 18px;
  font-weight: 300;

  cursor: pointer;

  transition: all 0.2s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.05);
}

/* Modal text */
.modal-content p {
  margin: 10px 0;
  color: rgba(229, 231, 235, 0.85);
}

/* Email link */
.modal-content a {
  color: #4cc9f0;
  text-decoration: none;
}

.modal-content a:hover {
  text-decoration: underline;
}

.panel-footer {
  display: flex;
  gap: 10px;

  margin-top: 20px;
  padding-top: 12px;

  border-top: 1px solid rgba(255,255,255,0.08);

  justify-content: flex-start;
  align-items: center;
}

#panel {
  display: flex;
  flex-direction: column;
}

#app.blurred {
  filter: blur(3px) brightness(0.8);
  transition: 0.2s ease;
}

.back-button {
  display: inline-block;

  margin: 20px 0;

  padding: 8px 12px;

  font-size: 13px;

  color: #cbd5e1;
  text-decoration: none;

  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);

  border-radius: 8px;

  backdrop-filter: blur(10px);

  transition: all 0.2s ease;
}

.back-button:hover {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}