/* Map Studio toolbar — visual match to Toolbar/Toolbar.html */
.map-studio-root {
  --ms-bg: #f3f4f7;
  --ms-surface: #ffffff;
  --ms-surface-2: #f8f9fb;
  --ms-ink: #1a1d23;
  --ms-ink-2: #4a5260;
  --ms-ink-3: #8a93a3;
  --ms-line: #e4e7ee;
  --ms-accent: oklch(0.55 0.16 255);
  --ms-accent-soft: oklch(0.95 0.04 255);
  --ms-accent-ink: oklch(0.40 0.18 255);
  --ms-shadow-2: 0 4px 14px -4px rgba(20, 24, 32, 0.12), 0 2px 6px rgba(20, 24, 32, 0.06);
  --ms-radius: 10px;
  --ms-radius-btn: 8px;
}

.map-studio-root .toolbar {
  display: inline-flex;
  align-items: stretch;
  background: var(--ms-surface);
  border: 1px solid var(--ms-line);
  border-radius: var(--ms-radius);
  box-shadow: var(--ms-shadow-2);
  padding: 6px;
  gap: 4px;
  user-select: none;
  flex-wrap: wrap;
}

.map-studio-main-toolbar {
  width: 100%;
  flex-wrap: nowrap;
  align-items: center;
}

.map-studio-main-toolbar .toolbar-spacer {
  flex: 1;
  min-width: 8px;
}

.map-studio-main-toolbar .toolbar-group-sections {
  gap: 6px;
}

.map-studio-root .toolbar-section-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: var(--ms-radius-btn);
  background: transparent;
  color: var(--ms-ink-2);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.map-studio-root .toolbar-section-btn:hover:not(:disabled) {
  background: var(--ms-surface-2);
  color: var(--ms-ink);
  border-color: var(--ms-line);
}

.map-studio-root .toolbar-section-btn.is-active {
  background: var(--ms-accent-soft);
  color: var(--ms-accent-ink);
  border-color: color-mix(in oklab, var(--ms-accent) 35%, transparent);
}

.map-studio-root .toolbar-section-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.map-studio-root .toolbar-section-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
}

.map-studio-root .toolbar-section-icon svg {
  width: 18px;
  height: 18px;
}

.map-studio-root .toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 4px;
  position: relative;
}

.map-studio-root .toolbar-group + .toolbar-group::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--ms-line);
}

.map-studio-root .group-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ms-ink-3);
  text-transform: uppercase;
  padding: 0 6px;
  align-self: center;
  pointer-events: none;
  white-space: nowrap;
}

.map-studio-root .tool-btn {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ms-ink-2);
  width: 36px;
  height: 36px;
  border-radius: var(--ms-radius-btn);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 80ms ease;
}

.map-studio-root .tool-btn:hover:not(:disabled) {
  background: var(--ms-surface-2);
  color: var(--ms-ink);
  border-color: var(--ms-line);
}

.map-studio-root .tool-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.map-studio-root .tool-btn[aria-pressed="true"],
.map-studio-root .tool-btn.is-active {
  background: var(--ms-accent-soft);
  color: var(--ms-accent-ink);
  border-color: color-mix(in oklab, var(--ms-accent) 25%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ms-accent) 20%, transparent);
}

.map-studio-root .tool-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.map-studio-root .tool-btn svg {
  width: 22px;
  height: 22px;
  display: block;
  overflow: visible;
}

.map-studio-root .tt {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: #1a1d23;
  color: #f5f6f8;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(10, 12, 16, 0.22), 0 2px 6px rgba(10, 12, 16, 0.14);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 30;
  text-align: left;
}

.map-studio-root .tool-btn:hover:not(:disabled) .tt,
.map-studio-root .tool-btn:focus-visible .tt {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  transition-delay: 220ms;
}

.map-studio-root .tt::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: #1a1d23;
  border-radius: 1px;
}

.map-studio-root .tt-title {
  font-size: 12.5px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.005em;
}

.map-studio-workspace {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
}

.map-studio-chrome {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.map-studio-canvas-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  background: var(--ms-surface-2);
}

.map-studio-location-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.map-studio-location-bg.is-drag-enabled {
  pointer-events: auto;
  cursor: grab;
}

.map-studio-location-bg.is-dragging {
  cursor: grabbing;
}

.map-studio-canvas-wrap.is-bg-drag-mode canvas {
  pointer-events: none;
}

.map-studio-canvas-wrap canvas {
  position: relative;
  z-index: 1;
  display: block;
  touch-action: none;
}

.map-studio-canvas-popup-backdrop {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.4);
  pointer-events: auto;
}

.map-studio-canvas-popup-inner {
  position: relative;
  max-width: min(420px, 100%);
  max-height: 100%;
  overflow: auto;
}

.map-studio-canvas-popup-close {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--ms-radius-btn);
  background: var(--ms-surface);
  color: var(--ms-ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--ms-shadow);
}

.map-studio-root.is-fullscreen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1400;
  background: var(--ms-bg);
  padding: 12px 16px;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.map-studio-root.is-fullscreen .map-studio-alerts {
  flex-shrink: 0;
  max-height: 28vh;
  overflow-y: auto;
}

.map-studio-root.is-fullscreen .map-studio-workspace {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.map-studio-root.is-fullscreen .map-studio-main-row {
  flex: 1;
  min-height: 0;
}

.map-studio-root.is-visitor .map-studio-canvas-wrap {
  cursor: default;
}

body:has(.map-studio-root.is-fullscreen) {
  overflow: hidden;
}
