/* 左下角：缩放 + 工具同一横条，圆角矩形（非胶囊） */
.pisell-floor-map-layout-view-controls {
  @vc-btn-size: 32px;
  @vc-bar-padding-y: 1px;
  @vc-bar-padding-x: 4px;
  @vc-bar-height: (@vc-btn-size + 2 * @vc-bar-padding-y + 2px); /* + 上下 border */

  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 20;
  pointer-events: auto;
  display: flex;
  flex-direction: row;
  align-items: center;

  &-bar {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 2px;
    height: @vc-bar-height;
    min-height: @vc-bar-height !important;
    max-height: @vc-bar-height !important;
    padding: @vc-bar-padding-y @vc-bar-padding-x;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #98a2b3;
    border-radius: 6px;
    box-shadow: 0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03);
    width: max-content;
    max-width: 100%;
  }

  &-bar-divider {
    flex-shrink: 0;
    width: 1px;
    height: 22px;
    margin: 0 4px;
    background: #e4e7ec;
    align-self: center;
  }

  &-zoom-value {
    flex: 0 0 auto;
    box-sizing: border-box;
    min-width: 40px;
    height: @vc-btn-size;
    padding: 0 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    line-height: @vc-btn-size;
    color: #101828;
  }

  @vc-icon-px: 14px;

  &-bar > &-tool-btn {
    flex-shrink: 0;
    box-sizing: border-box;
    width: @vc-btn-size;
    height: @vc-btn-size;
    min-width: @vc-btn-size;
    min-height: @vc-btn-size !important;
    max-width: @vc-btn-size;
    max-height: @vc-btn-size !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    color: #101828;
    font-size: @vc-icon-px;
    line-height: 1;
    appearance: none;
    vertical-align: middle;

    .anticon,
    .pisell-lowcode-icon,
    span[role='img'] {
      font-size: @vc-icon-px;
      line-height: 0;
      vertical-align: middle;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .anticon svg,
    .pisell-lowcode-icon svg,
    span[role='img'] svg {
      width: @vc-icon-px;
      height: @vc-icon-px;
      display: block;
    }

    &:hover {
      background: #f2f4f7;
      color: #101828;
    }
  }

  &-bar > &-tool-btn--active {
    background: #fff4ed;
    color: #ff692e;

    &:hover {
      background: #ffe8d9;
      color: #ff692e;
    }
  }

  /* —— 平面图 Dock：折叠入口与展开横条共用同一外框高度，避免切换时跳动 —— */
  @dock-btn-size: 42px;
  @dock-icon-px: 18px;
  /** 折叠按钮正方形边长 = 展开条高度（含 1px 边框的 border-box） */
  @dock-chrome-outer: 56px;

  &--dock {
    left: 14px;
    bottom: 14px;

    /** 折叠键与可伸缩展开区同一行 */

    .pisell-floor-map-layout-view-controls-dock-row {
      display: flex;
      flex-direction: row;
      align-items: center;
      gap: 0;
      min-height: 0;
    }

    /**
     * 展开/收起：max-width 过渡（变长 / 变短），内层 bar 为 width:max-content
     */

    .pisell-floor-map-layout-view-controls-dock-slide {
      box-sizing: border-box;
      max-width: 0;
      overflow: hidden;
      min-width: 0;
      display: flex;
      flex-direction: row;
      align-items: center;
      transition: max-width 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .pisell-floor-map-layout-view-controls-dock-slide--open {
      max-width: min(90vw, 720px);
    }

    .pisell-floor-map-layout-view-controls-dock-slide .pisell-floor-map-layout-view-controls-bar--dock {
      flex-shrink: 0;
      width: max-content;
      max-width: none;
    }

    .pisell-floor-map-layout-view-controls-bar--dock {
      border-radius: 14px;
      border-color: #e8eaed;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
      gap: 5px;
      box-sizing: border-box;
      height: @dock-chrome-outer;
      min-height: @dock-chrome-outer !important;
      max-height: @dock-chrome-outer !important;
      padding: 0 12px;
      align-items: center;
    }

    .pisell-floor-map-layout-view-controls-bar--dock > .pisell-floor-map-layout-view-controls-tool-btn {
      width: @dock-btn-size;
      min-width: @dock-btn-size;
      max-width: @dock-btn-size;
      height: @dock-btn-size;
      min-height: @dock-btn-size !important;
      max-height: @dock-btn-size !important;
      border-radius: 8px;
      font-size: @dock-icon-px;
      line-height: 0;

      .anticon,
      .pisell-lowcode-icon,
      span[role='img'] {
        font-size: @dock-icon-px !important;
        line-height: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
      }

      .anticon svg,
      .pisell-lowcode-icon svg,
      span[role='img'] svg {
        width: @dock-icon-px !important;
        height: @dock-icon-px !important;
        display: block;
      }
    }

    .pisell-floor-map-layout-view-controls-bar--dock > .pisell-floor-map-layout-view-controls-zoom-value {
      min-width: 50px;
      height: @dock-btn-size;
      line-height: @dock-btn-size;
      font-size: 15px;
      padding: 0 6px;
    }

    .pisell-floor-map-layout-view-controls-bar--dock > .pisell-floor-map-layout-view-controls-bar-divider {
      height: 28px;
      margin: 0 6px;
    }
  }

  &-dock-expand-btn {
    box-sizing: border-box;
    width: @dock-chrome-outer;
    height: @dock-chrome-outer;
    min-width: @dock-chrome-outer;
    min-height: @dock-chrome-outer;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e8eaed;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    color: #101828;
    font-size: @dock-icon-px;
    line-height: 0;
    appearance: none;
    flex-shrink: 0;
    overflow: hidden;
    transition: width 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    min-width 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    max-width 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    margin 0.32s cubic-bezier(0.22, 1, 0.36, 1);

    /** 与右侧条带同时：条带变长时入口收起为 0 宽；收起条带时入口从 0 拉回到正方形 */

    &--panel-open {
      width: 0;
      min-width: 0;
      max-width: 0;
      margin: 0;
      opacity: 0;
      border-color: transparent;
      box-shadow: none;
      pointer-events: none;
      cursor: default;
    }

    &:hover {
      background: #f9fafb;
    }

    .anticon {
      font-size: @dock-icon-px !important;
      line-height: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .anticon svg {
      width: @dock-icon-px !important;
      height: @dock-icon-px !important;
      display: block;
    }
  }

  &-dock-trailing {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 4px;
    max-width: min(300px, 58vw);

    .pisell-lowcode-btn,
    .ant-btn {
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      min-height: @dock-btn-size;
      height: @dock-btn-size;
      padding: 0 16px;
      font-size: 14px;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .pisell-floor-map-layout-view-controls--dock .pisell-floor-map-layout-view-controls-dock-slide,
  .pisell-floor-map-layout-view-controls--dock .pisell-floor-map-layout-view-controls-dock-expand-btn {
    transition-duration: 0.01ms;
  }
}
