/* 伪全屏宿主：锁定 body 滚动，避免双滚动条与触摸滑动穿透 */
body.pisell-floor-map-layout-fullscreen-host {
  overflow: hidden !important;
}

.pisell-floor-map-layout {
  position: relative;
  width: 100%;
  height: 400px;
  overflow: hidden;
  background: #fafafa;

  /**
   * 伪全屏：撑满视口，替代浏览器 Fullscreen API；与资源墙大屏（pisell-resource-wall-fixed-viewport）
   * 一致体验。z-index 故意高于常见弹层但低于 antd Modal 默认 1000，必要时可在宿主侧覆盖。
   */
  &--pseudo-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 2000;
    background: #fff;
  }

  &-loading,
  &-save-error {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 8px 12px;
    font-size: 14px;
  }

  &-loading {
    top: 0;
    background: rgba(255, 255, 255, 0.9);
    color: #666;
  }

  &-save-error {
    top: 0;
    background: #fff2f0;
    color: #cf1322;
  }

  &-edit-placeholder-toolbar {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    font-size: 12px;
    color: #999;
    background: #fff;
    border: 1px dashed #d9d9d9;
    border-radius: 4px;
    z-index: 5;
  }

  &-edit-panel-wrap {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    z-index: 10;
  }

  &-edit-panel-wrap--phone-drawer {
    /** 覆盖桌面端 &-edit-panel-wrap 的 absolute 居中，避免抽屉内排版错位 */
    position: relative;
    top: auto;
    right: auto;
    transform: none;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
  }

  /**
   * 手机编辑态：左侧图元栏悬浮，不占 flex，画布始终铺满下层。
   */
  &-edit-layout--phone-toolbar {
    position: relative;
    flex: 1 1 0;
    display: block;
    min-height: 0;
    /** 保证左侧悬浮抽屉的 absolute 参照高度为整块地图区（否则仅有绝对子项时高度链可能塌缩） */
    height: 100%;
    overflow: hidden;

    > .pisell-floor-map-layout-map-area--phone-fill {
      position: absolute;
      inset: 0;
      flex: none !important;
      width: auto !important;
      height: auto !important;
    }
  }

  &-place-overlay {
    position: absolute;
    left: 0;
    top: 0;
    cursor: crosshair;
    z-index: 1;
  }

  /* 编辑态拖入图源：平时穿透事件，激活时盖住画布以接收 drop */

  &-map-drop-layer {
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
    z-index: 0;
    box-sizing: border-box;

    &-active {
      pointer-events: auto;
      z-index: 100;
      box-shadow: inset 0 0 0 2px var(--fmap-primary, #1677ff);
      background: color-mix(in srgb,
      var(--fmap-primary, #1677ff) 6%,
      transparent);
    }
  }

  /** 视口内悬浮层：不随 Transform 缩放平移，与 ViewControls 同级 */

  &-viewport-overlay {
    position: absolute;
    left: 12px;
    top: 12px;
    z-index: 19;
    pointer-events: none;
    max-width: min(280px, 46vw);

    > * {
      pointer-events: auto;
    }

    &--bottom-start {
      top: auto;
      bottom: 12px;
      max-width: min(92vw, 560px);
    }
  }

  /** 编辑态：画布区域（含 Transform）为右侧 FloorMapEditPanel 预留宽度 */

  &-map-area {
    box-sizing: border-box;

    &--edit-panel-inset {
      padding-right: 336px;
    }
  }
}

/** 右侧属性 antd Drawer 根（portal body），顶栏安全区 */
.pisell-floor-map-layout-edit-panel-phone-drawer-root {
  padding-top: env(safe-area-inset-top, 0px);
}
