/* ============================================================
   MAP CONTAINER
   ============================================================ */

#map-container {
  position: fixed !important;
  top: 80px !important;
  left: 40px !important;
  width: calc(100vw - 80px) !important;
  height: calc(100vh - 120px) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  z-index: 0 !important;
}

#map-container.fullscreen {
  top: 40px !important;
  left: 0px !important;
  width: 100vw !important;
  height: calc(100vh - 40px) !important;
  border-radius: 0 !important;
}


/* ============================================================
   P5 CANVAS
   ============================================================ */

canvas#defaultCanvas0 {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 1 !important;
  pointer-events: none !important;
}


/* ============================================================
   UI LAYER — expands when popups are open
   ============================================================ */

#ui-layer {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 40px !important;
  z-index: 2 !important;
  pointer-events: all !important;
}


/* ============================================================
   LEAFLET OVERRIDES
   ============================================================ */

/* HIDE DEFAULT LEAFLET ZOOM BUTTONS */
.leaflet-control-zoom {
  display: none !important;
}

/* MATCH POPUP FONT TO APP */
.leaflet-popup-content {
  font-family: 'Montserrat', sans-serif;
}


/* ============================================================
   CODE EDITOR PANEL (Icon Editor)
   ============================================================ */

#code-panel {
  display: none;
  flex-direction: column;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 420px;
  height: 500px;
  background: white;
  border: 2px solid rgb(240, 50, 123);
  border-radius: 8px;
  z-index: 1000;
  overflow: hidden;
}

#code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgb(240, 50, 123);
  color: white;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: bold;
}

#code-buttons {
  display: flex;
  gap: 6px;
}

#code-buttons button {
  padding: 4px 12px;
  background: white;
  color: rgb(240, 50, 123);
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: bold;
}

#code-buttons button:hover {
  background: rgb(200, 30, 100);
  color: white;
}

#code-instructions {
  padding: 10px 14px;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  color: #333;
  background: #fdf0f5;
  border-bottom: 1px solid rgb(240, 50, 123);
  max-height: 180px;
  overflow-y: auto;
}

#code-instructions p {
  margin: 6px 0 2px;
}

#code-instructions strong {
  color: rgb(240, 50, 123);
}

#code-instructions code {
  display: block;
  background: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: #555;
  margin-bottom: 4px;
}

#code-instructions table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin: 4px 0;
}

#code-instructions td {
  padding: 2px 6px;
  vertical-align: top;
}

#code-instructions td:first-child {
  color: rgb(240, 50, 123);
  white-space: nowrap;
}

#code-instructions td:last-child {
  color: #888;
}

#code-instructions a {
  color: rgb(240, 50, 123);
  font-size: 11px;
}

#code-input {
  flex: 1;
  width: 100%;
  padding: 10px;
  font-family: monospace;
  font-size: 13px;
  border: none;
  resize: none;
  outline: none;
  color: #333;
  box-sizing: border-box;
  min-height: 150px;
}

#code-error {
  display: none;
  padding: 6px 12px;
  background: rgb(255, 220, 220);
  color: rgb(180, 0, 0);
  font-family: monospace;
  font-size: 12px;
}

/* ============================================================
   MAP EDITOR PANEL
   ============================================================ */

#map-editor-panel {
  display: none;
  flex-direction: column;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 420px;
  height: 500px;
  background: white;
  border: 2px solid rgb(240, 50, 123);
  border-radius: 8px;
  z-index: 1000;
  overflow: hidden;
}

#map-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgb(240, 50, 123);
  color: white;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: bold;
}

#map-editor-buttons {
  display: flex;
  gap: 6px;
}

#map-editor-buttons button {
  padding: 4px 12px;
  background: white;
  color: rgb(240, 50, 123);
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: bold;
}

#map-editor-buttons button:hover {
  background: rgb(200, 30, 100);
  color: white;
}

#map-editor-instructions {
  padding: 10px 14px;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  color: #333;
  background: #fdf0f5;
  border-bottom: 1px solid rgb(240, 50, 123);
}

#map-editor-instructions p {
  margin: 6px 0 2px;
}

#map-editor-instructions strong {
  color: rgb(240, 50, 123);
}

#map-editor-instructions code {
  display: block;
  background: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: #555;
  margin-bottom: 4px;
}

#map-editor-input {
  flex: 1;
  width: 100%;
  padding: 10px;
  font-family: monospace;
  font-size: 13px;
  border: none;
  resize: none;
  outline: none;
  color: #333;
  box-sizing: border-box;
}

#map-editor-error {
  display: none;
  padding: 6px 12px;
  background: rgb(255, 220, 220);
  color: rgb(180, 0, 0);
  font-family: monospace;
  font-size: 12px;
}