.gallery-map-page {
  padding: 0 18px 24px;
}

.gallery-map-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.55);
}

.gallery-map-loading-overlay .execute-button-spinner {
  width: 64px;
  height: 64px;
  border: 6px solid rgba(0, 0, 0, 0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: execute-button-spin 0.85s linear infinite;
}

@keyframes execute-button-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.gallery-map-page h2 {
  margin-bottom: 12px;
}

.gallery-map-controls {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #d4d4d4;
  background: #fafafa;
}

.gallery-map-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 18px;
  flex-wrap: wrap;
}

.gallery-map-control-row + .gallery-map-control-row {
  margin-top: 12px;
}

.gallery-map-control-row-primary {
  justify-content: flex-start;
}

.gallery-map-control-row-primary .gallery-map-secondary-button {
  min-width: 150px;
}

.gallery-map-secondary-button,
.gallery-map-control-row-primary button,
.map-selector-modal-footer button {
  padding: 8px 14px;
  border: 1px solid #222;
  border-radius: 8px;
  background: #fff;
  color: #111;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(17, 17, 17, 0.16);
  transition: transform 0.08s ease, box-shadow 0.14s ease, background-color 0.14s ease, border-color 0.14s ease;
}

.gallery-map-secondary-button:hover,
.gallery-map-control-row-primary button:hover,
.map-selector-modal-footer button:hover {
  background: #f5f5f5;
  box-shadow: 0 2px 6px rgba(17, 17, 17, 0.12);
}

.gallery-map-secondary-button:active,
.gallery-map-control-row-primary button:active,
.map-selector-modal-footer button:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(17, 17, 17, 0.16);
}

.gallery-map-secondary-button:focus-visible,
.gallery-map-control-row-primary button:focus-visible,
.map-selector-modal-footer button:focus-visible,
.gallery-map-execute-button:focus-visible,
.gallery-map-switch:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.gallery-map-control-row-primary button:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
  transform: none;
}

.gallery-map-threshold-block {
  min-width: 320px;
  max-width: 460px;
  width: 100%;
}

.gallery-map-threshold-block label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: #444;
}

.gallery-map-threshold-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gallery-map-threshold-inline input {
  width: 100%;
}

.gallery-map-state-filters {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gallery-map-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.gallery-map-control-label {
  font-size: 13px;
  color: #444;
}

.gallery-map-filter-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.gallery-map-switch-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.gallery-map-switch-label {
  color: #111;
}

.gallery-map-switch {
  position: relative;
  width: 46px;
  height: 26px;
  border: 1px solid #999;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(17, 17, 17, 0.12);
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.08s ease, box-shadow 0.14s ease;
}

.gallery-map-switch:hover {
  box-shadow: 0 2px 6px rgba(17, 17, 17, 0.12);
}

.gallery-map-switch:active {
  transform: translateY(1px);
}

.gallery-map-switch.is-active {
  background: #2563eb;
  border-color: #2563eb;
}

.gallery-map-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease;
}

.gallery-map-switch.is-active .gallery-map-switch-thumb {
  transform: translateX(20px);
}

.gallery-map-error {
  margin: 0 0 12px;
  color: #b91c1c;
}

.gallery-map-warnings {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #e5c267;
  background: #fff8dd;
}

.gallery-map-warnings h3 {
  margin: 0 0 6px;
}

.gallery-map-action-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  margin-bottom: 12px;
}

.gallery-map-execute-button {
  min-width: 150px;
  padding: 10px 18px;
  border: 1px solid #0b5bd3;
  border-radius: 8px;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.08s ease, box-shadow 0.14s ease, background 0.14s ease, border-color 0.14s ease, filter 0.14s ease;
}

.gallery-map-execute-button:hover {
  cursor: pointer;
  background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
  border-color: #2563eb;
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  filter: saturate(1.05);
}

.gallery-map-execute-button:active {
  transform: translateY(1px);
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: inset 0 3px 8px rgba(11, 27, 66, 0.24);
}

.gallery-map-execute-button:disabled {
  opacity: 0.55;
  border-color: #94a3b8;
  background: linear-gradient(180deg, #cbd5e1 0%, #94a3b8 100%);
  color: rgba(255, 255, 255, 0.96);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  filter: none;
}

.gallery-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-left: auto;
}

.gallery-map-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gallery-map-legend-swatch {
  width: 12px;
  height: 12px;
  border: 1px solid #444;
  display: inline-block;
}

.map-network-shell {
  position: relative;
  width: 100%;
  min-height: 760px;
  border: 1px solid #ccc;
  background: #fff;
  overflow: hidden;
}

.map-network-canvas {
  width: 100%;
  height: 760px;
}

.map-network-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 6px 10px;
  border: 1px solid #ccc;
  background: rgba(255, 255, 255, 0.95);
}

.map-network-overlay-content {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.map-network-overlay-content .execute-button-spinner {
  width: 16px;
  height: 16px;
  border-width: 2px;
  margin: 0;
}

.map-network-context-menu {
  position: fixed;
  z-index: 50;
  padding: 10px 14px;
  border: 1px solid #222;
  background: #fff;
  color: #111;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  white-space: nowrap;
}

.map-network-context-menu:hover {
  background: #f3f4f6;
}

.gallery-map-label-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
  margin-top: 12px;
}

.gallery-map-label-controls .gallery-map-switch-row {
  margin-left: 0;
}

.gallery-map-label-size-control {
  min-width: 240px;
}

.gallery-map-label-size-control label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: #444;
}

.gallery-map-label-size-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gallery-map-label-size-inline input {
  width: 100%;
}

.map-selector-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.35);
}

.map-selector-modal {
  width: min(920px, 100%);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  border: 1px solid #bbb;
  background: #fff;
}

.map-selector-modal-head,
.map-selector-modal-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #ddd;
}

.map-selector-modal-head h3 {
  margin: 0;
}

.map-selector-modal-head {
  justify-content: flex-start;
}

.map-selector-modal-footer {
  justify-content: flex-start;
  border-top: 1px solid #ddd;
  border-bottom: none;
}

.map-selector-modal-body {
  overflow: auto;
  padding: 14px;
  display: block;
}

.map-selector-filter-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.map-selector-filter-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: #444;
}

.map-selector-filter-group input {
  width: 100%;
  min-width: 0;
}

.map-selector-filter-actions {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.map-selector-filter-note {
  margin: 0 0 14px;
  font-size: 13px;
  color: #555;
}

.map-selector-modal-body .map-selector-list {
  width: 100%;
}

.map-selector-section h3 {
  margin: 0 0 8px;
}

.map-selector-list {
  border: 1px solid #ddd;
}

.map-selector-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.map-selector-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
}

.map-selector-item:last-child {
  border-bottom: none;
}

.map-selector-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.map-selector-empty {
  margin: 0;
  padding: 10px;
  color: #666;
}

@media (max-width: 960px) {
  .gallery-map-control-row {
    align-items: flex-start;
    justify-content: flex-start;
  }

  .gallery-map-threshold-inline input {
    width: 220px;
  }

  .gallery-map-switch-row {
    margin-left: 0;
  }

  .gallery-map-label-controls {
    align-items: flex-start;
    justify-content: flex-start;
    flex-direction: column;
  }

  .gallery-map-label-size-control {
    min-width: 0;
    width: 100%;
  }

  .map-selector-filter-row {
    grid-template-columns: 1fr;
  }
}
