﻿.mapping-block,
#custom-mapping-map,
#mapping-map {
  position: relative;
  z-index: 0;
}

.mapping-map-container {
  position: relative;
}

/* ---------- Markers Legend  ---------- */

.mapping-map-controls {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.mapping-map-legend {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e3e3e3;
  border-radius: 4px;
  padding: 8px 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  position: relative;
  z-index: auto;
  width: fit-content;
  display: flex;
  justify-content: center;
  flex-direction: column;
}

.mapping-map-legend-title {
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.mapping-map-legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 190px;
  overflow-y: auto;
  scrollbar-gutter: auto;
}

.mapping-map-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  /* height: 1.5rem; */
  margin-right: 2px;
}

.mapping-map-legend-toggle {
  display: flex;
  align-items: center;
}

/* Client Side Checkboxes */
.mapping-map-legend-toggle input[type="checkbox"] {
  margin: 0 4px 0 0;
  height: 16px;
  width: 16px;
  accent-color: #e76406;
}

.mapping-map-legend-pin {
  width: 18px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-top: 0.25rem;
}

.mapping-map-legend-pin svg {
  width: 18px;
  height: 26px;
}

.mapping-map-legend-label {
  padding-top: 0.25rem;
}

.mapping-map-legend.filters-hidden .mapping-map-legend-toggle {
  display: none;
}

.mapping-map-legend.filters-hidden .mapping-map-legend-all-item {
  display: none;
}

/* ---------- Marker Filter Toggle Button  ---------- */

.mapping-filter-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e3e3e3;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: #333;
  transition: all 0.2s ease;
  white-space: nowrap;
  align-self: flex-start;
}

.mapping-filter-toggle:hover {
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
}

.mapping-filter-toggle:active {
  transform: scale(0.98);
}

.mapping-filter-toggle-icon {
  width: 16px;
  height: 16px;
  fill: #333;
}

.mapping-filter-toggle[aria-pressed="false"] {
  opacity: 0.7;
}

.mapping-legend-filter-control a.mapping-legend-filter-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  text-decoration: none;
  font-size: 12px;
}

.mapping-legend-filter-control a.mapping-legend-filter-button svg {
  width: 16px;
  height: 16px;
  fill: #333;
}

.mapping-legend-filter-control a.mapping-legend-filter-button.is-disabled {
  opacity: 0.6;
}

/* ---------------------------------------- */

#custom-mapping-map + .pagination,
#mapping-map + .pagination {
  margin: 1rem auto;
  width: 100%;
  justify-content: center;
  text-align: center;
}

.leaflet-control-geosearch form input {
  border: 0 !important;
}

.leaflet-popup-content-wrapper {
  overflow: hidden;
}

.leaflet-container a.leaflet-popup-close-button {
  right: 4px;
  top: 6px;
  line-height: 18px;
  font-weight: bold;
}

.leaflet-container .resource-link img {
  display: block;
  height: auto;
  margin: 0 0 0.5rem;
}

.group-filters {
  margin-bottom: 0.5rem;
}

.group-filter {
  display: inline-flex;
  margin-bottom: 0.5rem;
  border: 1px solid #e3e3e3;
  border-radius: 2px;
}

.group-filter > * {
  display: inline-block;
  padding: 0.25rem 0.5rem;
}

.group-filter-label {
  background-color: #e3e3e3;
}

.group-value {
  font-size: 1.125rem;
  display: block;
  margin-bottom: 14px;
}

.group-type {
  padding: 8px 21px;
  background: #e3e3e3;
  display: block;
  margin: -14px -25px 14px -21px;
  font-weight: bold;
}

.mapping-group-item-features-bar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-top: 1rem;
}

.mapping-group-item-features-bar .filter {
  display: inline-flex;
  margin-right: 0.5rem;
}

.mapping-show-group-item-features {
  font-size: 14px;
  padding: 5px 7px;
  min-height: 0;
  line-height: 1;
}

.mapping-show-group-features {
  margin: 0 0 1rem;
}

.geojson-properties {
  overflow-y: auto;
  max-height: 200px;
}

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

#custom-mapping-feature-editor.sidebar {
  padding: 16px;
  gap: 16px;
  /* height: 100vh; */
  overflow-y: auto !important;
}

.gap {
  padding-top: 10px;
}

.sidebar .sidebar-header {
  display: flex;
  align-items: center;
  justify-content: start;
}

.sidebar-close {
  display: flex;
  justify-content: flex-end;
  text-decoration: none;
}

.sidebar-item-fields {
  margin-inline: 0.5rem;
}

.mapping-feature-item-fields {
  display: flex;
  flex-direction: column;
  /* gap: 8px; */
}

.mapping-feature-item-fields-picker {
  display: flex;
  margin-bottom: 8px;
}

.mapping-feature-item-fields-list {
  display: flex;
  width: 100%;
  gap: 8px;
  flex-wrap: wrap;
}

.mapping-feature-item-field {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
  padding: 2px 10px;
  border: 1px solid #dedede;
  border-radius: 10px;
  background: #d8d8d8;
  min-width: 0;
  /* width: 100%; */
}

.mapping-feature-item-field-label {
  font-weight: 600;
  /* color: #333; */
}

.mapping-feature-item-field-values {
  font-size: 0.95rem;
  color: #444;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mapping-feature-item-fields-empty {
  color: #666;
  font-size: 0.95rem;
}

.mapping-feature-item-fields-add {
  background-color: transparent !important;
  color: rgb(103, 103, 103) !important;
  border: none !important;
  box-shadow: none;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  margin-right: -10px;
}

.mapping-feature-item-fields-add:hover {
  color: #333 !important;
  background-color: transparent;
  border: none !important;
  box-shadow: none !important;
}

.mapping-feature-item-field-remove.o-icon-close {
  background-color: transparent;
  color: rgb(103, 103, 103);
  border: none;
  box-shadow: none;
  height: 16px;
  width: 16px;
  padding: 0;
  margin: 0;
}
.mapping-feature-item-field-remove.o-icon-close:hover {
  background-color: transparent;
  color: #333;
  border: none;
  box-shadow: none;
}

.mapping-feature-item-values {
  margin: 1.5rem 0 0;
  align-items: top;
}

.mapping-feature-item-values-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 3fr;
  margin-bottom: 8px;
}

.mapping-feature-item-values-row dt {
  font-weight: 600;
  font-size: 1rem;
  font-family: "Open Sans", sans-serif;
  max-width: 170px;
}

.mapping-feature-item-values-row dd {
  margin: 0;
  text-align: justify;
  color: #444;
  font-size: 1rem;
  font-family: "Open Sans", sans-serif;
}

/* ---------- Marker Pins ---------- */
.custom-pin-marker .pin {
  width: 24px;
  height: 24px;
  background: #3498db;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  position: relative;
  left: 2px;
  top: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.custom-pin-marker .pin::after {
  content: "";
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 8px;
  left: 8px;
}

/* ---------- Marker Colors ---------- */

/* Color Picker */

.color-swatch {
  border-radius: 50%;
  min-width: 0px;
  min-height: auto;
  padding: 10px;
  display: inline-block;
}

.color-swatch.red {
  background-color: #db1d08;
}
.color-swatch.blue {
  background-color: #3498db;
}
.color-swatch.green {
  background-color: #2ecc71;
}
.color-swatch.orange {
  background-color: #f39c12;
}
.color-swatch.purple {
  background-color: #9b59b6;
}

.color-swatch.selected {
  outline: 1.5px solid #8a8a8a;
  outline-offset: 0.7px;
}

.color-picker {
  width: 0;
  height: 0;
  border: none;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

#add-custom-color {
  background: none;
  cursor: pointer;
  color: #afafaf;
}

#add-custom-color:hover {
  background: #f5f5f5;
  color: #8a8a8a;
}

.color-picker-trigger {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  min-width: 0px;
  min-height: auto;
  /* padding: 10px; */
}

.mapping-feature-color-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.color-swatches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ---------- Edit Type PopUp ---------- */

.type-selection-container {
  display: flex;
  justify-content: flex-end;
}

.mapping-type-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 3000;
}

.mapping-type-modal.is-open {
  display: block;
}

.mapping-type-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.mapping-type-modal-dialog {
  position: relative;
  width: min(560px, 90vw);
  max-height: 80vh;
  margin: 8vh auto 0;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
}

.mapping-type-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 0px 12px;
}
#mapping-type-manager-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.mapping-type-modal-body {
  padding: 0px 16px 16px 16px;
  overflow-y: auto;
}

.mapping-type-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

/* .mapping-type-add-toggle {
  /* margin-bottom: 12px;
} */

.mapping-type-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #e3e3e3;
  border-radius: 3px;
}

.mapping-type-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #ccc;
}

.mapping-type-label-text {
  flex: 1;
}

.mapping-type-add-form h4 {
  margin: 0 0 8px;
}

/* Inline Actions */
.mapping-type-inline-fields {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.mapping-type-edit.o-icon-edit {
  background-color: transparent;
  color: rgb(103, 103, 103);
}

.mapping-type-delete.o-icon-delete {
  background-color: transparent;
  color: rgb(103, 103, 103);
}

.mapping-type-manager-close.o-icon-close {
  background-color: transparent;
  color: rgb(103, 103, 103);
  border: none;
  box-shadow: none;
}

.mapping-type-manager-close.o-icon-close:hover {
  background-color: transparent;
  color: #333;
  border: none;
  box-shadow: none;
}

/* Color picker for types */
.mapping-type-color-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mapping-type-edit-color-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mapping-type-color-swatch {
  border-radius: 50%;
  width: 22px;
  height: 22px;
  border: 1px solid #cfcfcf;
  cursor: pointer;
  background: transparent;

  min-width: 0px;
  min-height: auto;
  padding: 10px;
  display: inline-block;
}

.mapping-type-color-swatch.selected {
  outline: 1.5px solid #8a8a8a;
  outline-offset: 1px;
}

.mapping-type-edit-color-swatch {
  border-radius: 50%;
  width: 22px;
  height: 22px;
  border: 1px solid #cfcfcf;
  padding: 0;
  cursor: pointer;
  background: transparent;

  min-width: 0px;
  min-height: auto;
  padding: 10px;
  display: inline-block;
}

.mapping-type-edit-color-swatch.selected {
  outline: 1.5px solid #8a8a8a;
  outline-offset: 1px;
}

.mapping-type-add-custom-color,
.mapping-type-edit-add-custom-color {
  background: none !important;
  cursor: pointer !important;
  color: #afafaf !important;
}

.mapping-type-add-custom-color,
.mapping-type-edit-add-custom-color {
  border-radius: 50%;
  width: 22px;
  height: 22px;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-width: 0px;
  min-height: auto;
}

.mapping-type-add-custom-color:hover,
.mapping-type-edit-add-custom-color:hover {
  background: #f5f5f5;
  color: #8a8a8a;
}

.mapping-type-custom-color-input,
.mapping-type-edit-custom-color-input {
  width: 0;
  height: 0;
  border: none;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

/* Edit Color types Section  */
.mapping-type-edit-panel {
  border-top: 1px solid #e3e3e3;
  padding-top: 12px;
  display: none;
}

.mapping-type-edit-panel.is-open {
  display: block;
}

.mapping-type-edit-current {
  margin-bottom: 8px;
  font-weight: 600;
}

.mapping-type-edit-fields {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Edit types Icon */

.type-selection-container button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  box-shadow: none;
  background-color: transparent;
  margin-right: -10px;
}

.mapping-type-manager-button svg {
  width: 20px;
  height: 20px;
  fill: rgb(103, 103, 103);
}
.mapping-type-manager-button svg:hover {
  fill: #333;
}

.mapping-type-manager-button:hover {
  background: transparent;
  border: none;
  box-shadow: none;
}
.mapping-type-manager-button:hover:not(.inactive) {
  background: transparent;
  border: none;
  box-shadow: none;
}

/* Toast */
.mapping-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #333;
  color: #fff;
  padding: 10px 14px;
  border-radius: 4px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  z-index: 4000;
  font-size: 13px;
  max-width: 280px;
}

.mapping-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ----------- Client Side Sidebar ----------- */

/* Option 2 In the map  */
#mapping-container {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.client-sidebar {
  position: fixed !important;
  top: 0;
  right: 0 !important;

  width: 30%;
  height: 100vh;
  transition:
    top 0.3s ease,
    height 0.3s ease,
    width 0.3s ease,
    opacity 0.3s ease,
    transform 0.3s ease;

  border-left: 1px solid #ddd;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(255, 255, 255, 0.98);
  z-index: 999999 !important;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.2);
  padding: 16px;
  box-sizing: border-box;

  /* Hidden state */
  opacity: 0;
  transform: translateX(100%);
  pointer-events: none;
  will-change: opacity, transform;
}

/* Show sidebar when active */
.client-sidebar.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1rem;
  margin-top: 0;
}

.sidebar-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0;
}

.sidebar-title a {
  text-decoration: none;
  color: inherit;
}

.sidebar-title a:hover {
  opacity: 0.8;
}

.sidebar-pin svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.sidebar-creator-date {
  display: flex;
  width: 100%;

  /* gap: 1.5rem; */
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.sidebar-creator,
.sidebar-date {
  display: flex;
  margin-inline: 0.5rem;
}

.sidebar-creator dt,
.sidebar-date dt {
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #333;
  font-size: 0.9rem;
}

.sidebar-creator dd,
.sidebar-date dd {
  margin: 0;
  color: #555;
  line-height: 1.4;
}

.sidebar-description {
  line-height: 1.6;
  color: #444;
  transition:
    max-height 0.3s ease,
    opacity 0.3s ease;
  margin-inline: 0.5rem;
  text-align: justify;
  font-size: 1rem;
  font-family: "Open Sans", sans-serif;
}

/* Truncate description by default (show ~5-6 lines) */
.sidebar-description.truncated {
  max-height: 10rem;
  overflow: hidden;
  position: relative;
}

/* Fade effect at the bottom of truncated descriptions */
.sidebar-description.truncated::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1.2rem;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.9));
}

/* Expanded state */
.sidebar-description.expanded {
  max-height: none;
}

.sidebar-description.expanded::after {
  display: none;
}

/* See more/less button styling */
.sidebar-description-toggle {
  display: none !important;
  margin-bottom: 1rem;
  background: none !important;
  border: none !important;
  appearance: none !important;
  -moz-appearance: none !important;
  -webkit-appearance: none !important;
  color: #0066cc !important;
  cursor: pointer !important;
  padding: 0 !important;
  font-size: 0.95rem !important;
  font-weight: 500 !important;
  transition: color 0.2s ease;
  box-shadow: none !important;
  text-transform: none !important;
  text-decoration: none !important;
  margin-inline: 0.5rem;
}

.sidebar-description-toggle:hover,
.sidebar-description-toggle:focus {
  color: #033b74 !important;
  text-decoration: underline !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

/* Show button only when needed */
.sidebar-description.needs-toggle ~ .sidebar-description-toggle {
  display: inline-block !important;
}

.sidebar-media img {
  width: 90%;
  height: auto;
  border-radius: 6px;
  margin-top: 1.5rem;
  display: flex;
  justify-self: center;
}

/* ---------- Fullscreen Mode ---------- */

body.mapping-fullscreen-active .mapping-map-legend,
body.mapping-fullscreen-active #custom-mapping-feature-editor.sidebar,
body.mapping-fullscreen-active #mapping-view-sidebar {
  z-index: 999999 !important;
}

body.mapping-fullscreen-active .mapping-map-legend {
  position: fixed !important;
  bottom: 12px !important;
  left: 12px !important;
}

/* Fullscreen sidebar positioning - but keep hidden until active */
body.mapping-fullscreen-active #mapping-view-sidebar.client-sidebar {
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  height: 100vh !important;
  width: 30% !important;
  transition: none !important;
  z-index: 2147483647 !important;
  pointer-events: auto !important;
}

body.mapping-fullscreen-active #mapping-view-sidebar.client-sidebar * {
  pointer-events: auto !important;
}

/* Show sidebar only when active in fullscreen mode */
body.mapping-fullscreen-active #mapping-view-sidebar.client-sidebar.active {
  opacity: 1 !important;
  transform: translateX(0) !important;
  pointer-events: auto !important;
}

/* ---------- Filters Menu Control ---------- */

.mapping-control-filters-menu {
  position: relative;
}

.mapping-control-filters-menu-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: white;
  border: none;
  cursor: pointer;
  text-decoration: none;
  border-radius: 4px;
  color: #333;
  font-size: 20px;
  transition: background-color 0.2s ease;
}

.mapping-control-filters-menu-button:hover {
  background-color: #f4f4f4;
}

.mapping-control-filters-menu-button:active {
  background-color: #e8e8e8;
}

.mapping-filters-menu-popup {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: white;
  border: 1px solid #e3e3e3;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  min-width: 150px;
  padding: 10px;
  pointer-events: auto;
}

.mapping-filters-menu-title {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 0.95rem;
  color: #333;
  padding-bottom: 4px;
  border-bottom: 1px solid #f0f0f0;
}

.mapping-filters-menu-items {
  display: flex;
  flex-direction: column;
}

.mapping-filters-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  gap: 8px;
}

.mapping-filters-menu-label {
  flex: 1;
  font-size: 0.85rem;
  color: #333;
  user-select: none;
  cursor: pointer;
}

.mapping-filters-menu-toggle {
  position: relative;
  width: 40px;
  height: 20px;
  background-color: #d1d1d1;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  flex-shrink: 0;
}

.mapping-filters-menu-toggle::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  background-color: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: left 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.mapping-filters-menu-toggle-active {
  background-color: #f38e47;
}

.mapping-filters-menu-toggle-active::after {
  left: 22px;
}

.mapping-filters-menu-toggle-disabled {
  background-color: #cccccc;
  opacity: 0.6;
  cursor: not-allowed !important;
}

.mapping-filters-menu-toggle-disabled::after {
  opacity: 0.5;
}

