body { margin: 0; padding: 0; overflow: hidden; }
#geoportal-wrap { display: flex; height: 100vh; width: 100vw; }

#gp-sidebar {
  width: 300px;
  min-width: 300px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px;
  gap: 12px;
  z-index: 1000;
}

#gp-logo img { max-width: 140px; margin-bottom: 8px; }

.gp-filter-group { display: flex; flex-direction: column; gap: 4px; }
.gp-filter-group label { font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; }
.gp-filter-group input,
.gp-filter-group select {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  color: #111827;
  outline: none;
  transition: border-color 0.15s;
}
.gp-filter-group input:focus,
.gp-filter-group select:focus { border-color: #2563eb; }
.gp-check { flex-direction: row; align-items: center; }
.gp-check label { font-size: 13px; font-weight: 400; color: #374151; text-transform: none; letter-spacing: 0; display: flex; align-items: center; gap: 8px; }

#gp-count { font-size: 12px; color: #6b7280; padding-top: 4px; }

#gp-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.gp-list-item {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.1s;
}
.gp-list-item:hover { background: #eff6ff; border-color: #bfdbfe; }
.gp-list-item .gp-school-name { font-size: 13px; font-weight: 600; color: #1e40af; }
.gp-list-item .gp-school-meta { font-size: 11px; color: #6b7280; margin-top: 2px; }

#gp-map { flex: 1; position: relative; }

/* Popup styles */
.gp-popup { min-width: 240px; font-size: 13px; line-height: 1.6; }
.gp-popup h3 { margin: 0 0 8px; font-size: 14px; color: #1e40af; }
.gp-popup .gp-row { display: flex; gap: 6px; }
.gp-popup .gp-label { color: #6b7280; min-width: 90px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.gp-popup .gp-val { color: #111827; }

#gp-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 2000;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 768px) {
  #gp-toggle { display: block; }
  #geoportal-wrap { flex-direction: column; }
  #gp-sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 85vw;
    max-width: 320px;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 1500;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  }
  #gp-sidebar.open { transform: translateX(0); }
  #gp-map { width: 100vw; height: 100vh; }
}

/* Override Frappe web template container constraints */
.page_content,
.container,
.container-fluid,
.web-page-container,
#page-geoportal,
.page-header-wrap {
  padding: 0 !important;
  margin: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
}

/* Ensure the wrap fills the full viewport from the left edge */
#geoportal-wrap {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 100;
}

/* Move mobile filter toggle to top-right to avoid map zoom controls and logo */
@media (max-width: 768px) {
  #gp-toggle {
    top: 12px;
    left: auto;
    right: 12px;
  }
}

/* Fix mobile toggle button width and position */
@media (max-width: 768px) {
  #gp-toggle {
    left: unset !important;
    right: 12px !important;
    width: auto !important;
  }
}

/* Address navigation link */
.gp-addr-link {
  color: #2563eb;
  text-decoration: none;
  font-size: 12px;
}
.gp-addr-link:hover { text-decoration: underline; }

/* Legend */
#gp-legend {
  display: none;
  position: absolute;
  bottom: 30px;
  right: 10px;
  z-index: 1000;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  max-height: 40vh;
  overflow-y: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  min-width: 160px;
}
.gp-legend-title {
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.gp-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 12px;
  color: #111827;
}
.gp-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.15);
}
.gp-legend-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
