@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #080c12;
  --panel: #0c121a;
  --panel-soft: #111923;
  --panel-hover: #151f2b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text: #f5f7fa;
  --text-soft: #a9b4c2;
  --text-muted: #6f7c8d;
  --accent: #5f9cff;
  --accent-soft: rgba(95, 156, 255, 0.14);
  --accent-border: rgba(95, 156, 255, 0.35);
  --success: #61d395;
  --sidebar-width: 378px;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app {
  width: 100%;
  height: 100%;
  display: flex;
  background: var(--bg);
}

/* ---------------- Sidebar ---------------- */

.sidebar {
  position: relative;
  z-index: 1000;
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 18%),
    var(--panel);
  border-right: 1px solid var(--border);
  box-shadow: 16px 0 45px rgba(0, 0, 0, 0.18);
}

.brand {
  min-height: 92px;
  padding: 22px 22px 18px;
  display: flex;
  align-items: center;
  gap: 13px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 13px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.16), transparent),
    #387eea;
  color: white;
  font-size: 24px;
  font-weight: 800;
  box-shadow:
    0 10px 30px rgba(56, 126, 234, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}



.brand-mark.has-logo {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  padding: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.045);
}

.brand-mark.has-logo img {
  width: 38px;
  height: 38px;
  max-width: none;
  max-height: none;
  display: block;
  object-fit: contain;
  object-position: center center;
  margin: 0;
  transform: translate(1px, -3px);
  transform-origin: center center;
  border-radius: 8px;
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 750;
}

.sidebar-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 16px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.sidebar-content::-webkit-scrollbar {
  width: 6px;
}

.sidebar-content::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.intro {
  padding: 0 6px;
  margin-bottom: 15px;
}

.intro p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.65;
}

.search-box {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  transition: 150ms ease;
}

.search-box:focus-within {
  border-color: var(--accent-border);
  background: rgba(95, 156, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(95, 156, 255, 0.08);
}

.search-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.search-icon svg,
.map-button svg,
.mobile-menu-button svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
}

.search-box input::placeholder {
  color: #687585;
}

.search-box kbd {
  min-width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-bottom-color: rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 11px;
  font-family: inherit;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 14px 0 3px;
}

.filter-chip {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: 130ms ease;
}

.filter-chip:hover {
  background: var(--panel-hover);
  border-color: var(--border-strong);
  color: var(--text);
}

.filter-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: #cfe0ff;
}

.results-heading {
  margin: 18px 4px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.results-heading span {
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.results-heading button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}

.results-heading button:hover {
  color: var(--text);
}

.location-list {
  display: grid;
  gap: 7px;
}

.location-card {
  width: 100%;
  padding: 12px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    transform 120ms ease,
    background 120ms ease,
    border-color 120ms ease;
}

.location-card:hover {
  transform: translateX(2px);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.035);
}

.location-card.selected {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.location-icon,
.popup-icon {
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: white;
}

.location-icon {
  width: 38px;
  height: 38px;
}

.location-icon svg,
.popup-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.location-info {
  min-width: 0;
}

.location-info strong {
  display: block;
  overflow: hidden;
  color: #eef2f7;
  font-size: 12.5px;
  line-height: 1.25;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-info span {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.postal-pill {
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
  font-size: 9.5px;
  font-weight: 700;
}

.empty-state {
  margin-top: 20px;
  padding: 28px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}

.empty-state span {
  color: var(--text-muted);
  font-size: 11px;
}

.sidebar-footer {
  min-height: 48px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  color: #5f6b79;
  font-size: 10px;
  font-weight: 600;
}

.sidebar-footer .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #44505e;
}

/* ---------------- Map ---------------- */

.map-shell {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background: #0d1c26;
}

#map {
  width: 100%;
  height: 100%;
  background: #0c2735;
}

.leaflet-container {
  font-family: Inter, system-ui, sans-serif;
}

.leaflet-control-zoom {
  margin: 0 18px 78px 0 !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: 11px !important;
  overflow: hidden;
  box-shadow: var(--shadow) !important;
}

.leaflet-control-zoom a {
  width: 36px !important;
  height: 36px !important;
  display: grid !important;
  place-items: center !important;
  border: 0 !important;
  background: rgba(11, 16, 23, 0.94) !important;
  color: #dce3eb !important;
  line-height: 1 !important;
}

.leaflet-control-zoom a:first-child {
  border-bottom: 1px solid var(--border) !important;
}

.leaflet-control-zoom a:hover {
  background: #151e28 !important;
}

.leaflet-control-attribution {
  display: none;
}

.map-topbar {
  position: absolute;
  z-index: 750;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.map-topbar > * {
  pointer-events: auto;
}

.map-title {
  min-height: 40px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: rgba(8, 13, 19, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  color: #dce4ed;
  font-size: 11px;
  font-weight: 650;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(97, 211, 149, 0.1);
}

.map-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-button {
  height: 40px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: rgba(8, 13, 19, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  color: #d5dde7;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  transition: 120ms ease;
}

.map-button:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(18, 26, 36, 0.95);
}

.map-button svg {
  width: 16px;
  height: 16px;
}

.map-button.icon-only {
  width: 40px;
  padding: 0;
  justify-content: center;
}

.layer-picker {
  position: relative;
}

.layer-menu {
  position: absolute;
  top: 48px;
  right: 0;
  width: 235px;
  padding: 7px;
  display: none;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  background: rgba(9, 14, 21, 0.97);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.layer-menu.open {
  display: grid;
  gap: 3px;
}

.layer-menu button {
  width: 100%;
  padding: 8px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.layer-menu button:hover {
  background: rgba(255, 255, 255, 0.055);
}

.layer-menu button > span:nth-child(2) {
  display: grid;
  gap: 2px;
}

.layer-menu strong {
  font-size: 11.5px;
  font-weight: 650;
}

.layer-menu small {
  color: var(--text-muted);
  font-size: 9.5px;
}

.layer-check {
  opacity: 0;
  color: #87b3ff;
  font-weight: 800;
}

.layer-menu button.active .layer-check {
  opacity: 1;
}

.layer-preview {
  width: 44px;
  height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background-color: #20313e;
  overflow: hidden;
}

.atlas-preview {
  background:
    linear-gradient(33deg, transparent 44%, rgba(231, 232, 220, 0.85) 45%, rgba(231, 232, 220, 0.85) 48%, transparent 49%),
    linear-gradient(150deg, #2a5052 0 40%, #526f54 41% 62%, #2f5d67 63%);
}

.satellite-preview {
  background:
    radial-gradient(circle at 68% 35%, #6d7560 0 11%, transparent 12%),
    radial-gradient(circle at 28% 70%, #3a563e 0 18%, transparent 19%),
    linear-gradient(135deg, #172e36, #3f5945);
}

.grid-preview {
  background-color: #162733;
  background-image:
    linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 8px 8px;
}

.map-hint {
  position: absolute;
  z-index: 700;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  min-height: 38px;
  padding: 7px 8px 7px 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: rgba(8, 13, 19, 0.91);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  color: var(--text-soft);
  font-size: 10.5px;
  transition: 160ms ease;
}

.map-hint.hidden {
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
}

.hint-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--accent-soft);
  color: #9fc1ff;
  font-size: 11px;
  font-weight: 800;
}

.map-hint button {
  width: 23px;
  height: 23px;
  margin-left: 3px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
}

.map-hint button:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.coordinate-readout {
  position: absolute;
  z-index: 650;
  left: 18px;
  bottom: 18px;
  min-height: 35px;
  padding: 0 11px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(8, 13, 19, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 650;
}

.coordinate-readout strong {
  margin-left: 3px;
  color: #cad4df;
  font-weight: 600;
}

.map-credit {
  position: absolute;
  z-index: 600;
  right: 18px;
  bottom: 18px;
  color: rgba(218, 226, 235, 0.52);
  font-size: 8.5px;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
}

/* ---------------- Custom Markers ---------------- */

.custom-marker {
  background: none;
  border: 0;
}

.marker-pin {
  position: relative;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 10px 10px 10px 3px;
  transform: rotate(-45deg);
  box-shadow:
    0 5px 16px rgba(0, 0, 0, 0.44),
    inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  transition: 120ms ease;
}

.marker-pin::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px 7px 7px 2px;
}

.marker-pin svg {
  position: relative;
  z-index: 2;
  width: 17px;
  height: 17px;
  transform: rotate(45deg);
  fill: none;
  stroke: white;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.leaflet-marker-icon:hover .marker-pin {
  transform: rotate(-45deg) scale(1.08);
  filter: brightness(1.08);
}

/* ---------------- Popup ---------------- */

.leaflet-popup-content-wrapper {
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 14px !important;
  background: rgba(10, 15, 22, 0.97) !important;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.46) !important;
  backdrop-filter: blur(18px);
  color: var(--text) !important;
}

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

.leaflet-popup-tip {
  background: #0a0f16 !important;
}

.leaflet-popup-close-button {
  top: 9px !important;
  right: 9px !important;
  width: 28px !important;
  height: 28px !important;
  display: grid !important;
  place-items: center;
  border-radius: 8px;
  color: #768292 !important;
  font-size: 18px !important;
  line-height: 1 !important;
}

.leaflet-popup-close-button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: white !important;
}

.location-popup {
  overflow: hidden;
}

.popup-header {
  padding: 15px 44px 14px 15px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.035), transparent);
}

.popup-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
}

.popup-title {
  min-width: 0;
}

.popup-title strong {
  display: block;
  color: #f2f5f8;
  font-size: 13px;
  line-height: 1.25;
}

.popup-title span {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 9.5px;
}

.popup-body {
  padding: 14px 15px 15px;
}

.popup-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 11px;
}

.popup-meta span {
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(255,255,255,.03);
  color: #aeb9c7;
  font-size: 9.5px;
  font-weight: 600;
}

.popup-body p {
  margin: 0;
  color: #aeb8c5;
  font-size: 10.5px;
  line-height: 1.65;
}

.popup-actions {
  margin-top: 13px;
  display: flex;
  gap: 7px;
}

.popup-actions a {
  min-height: 33px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  background: var(--accent-soft);
  color: #cfe0ff;
  font-size: 9.5px;
  font-weight: 700;
  text-decoration: none;
}

.popup-actions a:hover {
  background: rgba(95, 156, 255, 0.2);
}

/* ---------------- Category colors ---------------- */

.category-law-enforcement {
  background: #2f71d8;
}

.category-government {
  background: #a07842;
}

.category-medical {
  background: #c34f5d;
}

.category-mechanic {
  background: #d77835;
}

.category-food {
  background: #4d9a70;
}

.category-smoke-shop {
  background: #7a659c;
}

.category-dealership {
  background: #8b63ce;
}

.category-public {
  background: #4f829d;
}

.category-jobs {
  background: #9a6b3f;
}

.category-postal {
  background: #4f83dc;
}

.category-other {
  background: #667384;
}

/* ---------------- Responsive ---------------- */

.mobile-only,
.mobile-menu-button {
  display: none;
}

.mobile-overlay {
  display: none;
}

@media (max-width: 900px) {
  :root {
    --sidebar-width: min(88vw, 365px);
  }

  .sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-102%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-only,
  .mobile-menu-button {
    display: flex;
  }

  .icon-button {
    width: 34px;
    height: 34px;
    margin-left: auto;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: rgba(255,255,255,.03);
    cursor: pointer;
  }

  .mobile-overlay {
    position: absolute;
    z-index: 900;
    inset: 0;
    display: block;
    background: rgba(0, 0, 0, 0.46);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  .mobile-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

  .map-title {
    display: none;
  }

  .map-hint {
    display: none;
  }
}

@media (max-width: 560px) {
  .map-topbar {
    top: 10px;
    left: 10px;
    right: 10px;
  }

  .map-button {
    height: 38px;
  }

  .map-button span {
    display: none;
  }

  .mobile-menu-button span {
    display: inline;
  }

  .coordinate-readout {
    left: 10px;
    bottom: 10px;
  }

  .map-credit {
    right: 10px;
    bottom: 52px;
  }

  .leaflet-control-zoom {
    margin: 0 10px 55px 0 !important;
  }
}
