/* 编辑态单行顶栏：画布 Tab + 保存 / 扩展操作 */
.pisell-floor-map-layout-edit-top-bar {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex-shrink: 0;
  min-height: 48px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  z-index: 3;

  /** 单画布：无 Tab 区时操作区靠右，去掉左侧竖线 */

  &--tabs-hidden {
    justify-content: flex-end;

    .pisell-floor-map-layout-edit-top-bar-actions {
      border-left: none;
    }
  }

  &-tabs {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: stretch;
    overflow: hidden;
  }

  /* 嵌入顶栏时去掉 CanvasTabs 自身底边，避免双线 */

  &-canvas-tabs.pisell-floor-map-layout-canvas-tabs {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    border-bottom: none;
    flex-wrap: nowrap;
    align-items: center;
  }

  &-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border-left: 1px solid #f0f0f0;
  }

  &-error {
    max-width: 160px;
    font-size: 12px;
    color: #ff4d4f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* 全屏顶栏：未保存标签在保存按钮左侧，单行对齐 */

  &-save-group {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  &-dirty-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 8px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    color: #ad6800;
    white-space: nowrap;
    background: linear-gradient(180deg, #fffef7 0%, #fff7e6 100%);
    border: 1px solid #ffe7a3;
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(173, 104, 0, 0.06);

    &::before {
      content: '';
      width: 6px;
      height: 6px;
      flex-shrink: 0;
      border-radius: 50%;
      background: #faad14;
      box-shadow: 0 0 0 2px rgba(250, 173, 20, 0.25);
    }
  }

  &-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 32px;
    padding: 0 14px;
    font-size: 14px;
    line-height: 1;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #d9d9d9;
    background: #fff;
    color: rgba(0, 0, 0, 0.88);
    transition: border-color 0.2s, background 0.2s;

    &:hover:not(:disabled) {
      border-color: var(--fmap-primary, #1677ff);
      color: var(--fmap-primary, #1677ff);
    }

    &:disabled {
      opacity: 0.6;
      cursor: not-allowed;
    }

    &.primary {
      color: #fff;
      background: var(--fmap-primary, #1677ff);
      border-color: var(--fmap-primary, #1677ff);

      &:hover:not(:disabled) {
        background: color-mix(in srgb,
        var(--fmap-primary, #1677ff) 88%,
        #fff);
        border-color: color-mix(in srgb,
        var(--fmap-primary, #1677ff) 88%,
        #fff);
        color: #fff;
      }
    }
  }

  &-btn-ghost {
    min-width: 32px;
    padding: 0 8px;
    font-size: 16px;
  }

  /**
   * 只读顶栏（`edit-top-bar` + `read-canvas-tabs-bar` 并列）、编辑态 compact、
   * 以及全屏/locked 时的 full 顶栏：与左侧 Tab 同一浅灰底，去掉右侧大块白底与竖线分割。
   */

  &.pisell-floor-map-layout-read-canvas-tabs-bar,
  &--compact,
  &--full-chrome {
    background: rgba(0, 0, 0, 0.04);

    .pisell-floor-map-layout-edit-top-bar-actions {
      background: transparent;
      border-left: none;
    }

    .pisell-floor-map-layout-edit-top-bar-canvas-tabs.pisell-floor-map-layout-canvas-tabs {
      background: transparent;
    }
  }
}
