/**
 * 表格 / 平面图切换：与中间搜索、右侧 Sort/Filter（50px）同高
 * antd 与 pisell-lowcode 前缀并存时双写选择器
 */
.record-board-toolbar-body-view-segmented {
  &.ant-segmented,
  &.pisell-lowcode-segmented {
    height: 50px;
    min-height: 50px;
    padding: 4px !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center;
  }

  .ant-segmented-group,
  .pisell-lowcode-segmented-group {
    flex: 1;
    min-height: 0;
    align-self: stretch;
    display: flex;
    align-items: center;
  }

  .ant-segmented-item,
  .pisell-lowcode-segmented-item {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1;
    font-size: 16px !important;
    font-weight: 500 !important;
    padding: 0 16px !important;
    box-sizing: border-box !important;
  }

  /** 文案垂直居中：去掉固定 line-height，避免在 antd 选项格内视觉上偏上 */

  .ant-segmented-item-label,
  .pisell-lowcode-segmented-item-label {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: normal !important;
  }

  /** 低代码：选中背景与 antd Button primary / 编辑平面图同源 */

  .pisell-lowcode-segmented-item-selected {
    background: var(--color-primary,
    var(--ant-color-primary, #5d3f9f)) !important;
    color: var(--ant-color-text-light-solid, #fff) !important;
    font-weight: 600 !important;
  }

  .pisell-lowcode-segmented-thumb {
    background: var(--color-primary,
    var(--ant-color-primary, #5d3f9f)) !important;
  }
}

/** 左侧：div + flex 布局，下单时间快筛 + Find（占满剩余宽度）+ slots.topLeft */
.record-board-toolbar-top-left {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  width: 100%;
  gap: 16px;

  .record-board-toolbar-find-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;

    .ant-input,
    .ant-input-affix-wrapper {
      width: 100%;
      max-width: 100%;
    }
  }

  .pisell-lowcode-form-item {
    margin-right: 0;
  }

  .MuiFormLabel-root {
    line-height: 30px;
  }

  /**
   * 与 Find（PisellLookup min-height 50px）、右侧 Filter/Sort（50px）同高；
   * 原先 48px 会在桌面 Table 顶栏快筛里显得比 Find 矮一截。
   */
  .MuiInputBase-root {
    height: 50px !important;
    min-height: 50px !important;
    border-radius: 8px !important;
    box-sizing: border-box;
  }

  .record-board-toolbar-find-wrap {
    .pisell-lookup-trigger-input.ant-input-affix-wrapper,
    .pisell-lookup-trigger-input.pisell-lowcode-input-affix-wrapper {
      height: 50px;
      min-height: 50px;
      box-sizing: border-box;
    }
  }
}

.record-board-toolbar-quick-filter-form {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;

  .ant-form-item,
  .pisell-lowcode-form-item {
    margin-bottom: 0;
  }

  .ant-form-item-row,
  .pisell-lowcode-form-item-row {
    align-items: center;
  }
}

/**
 * 手机版宽度：左侧快筛 + 搜索 支持换行，避免挤在一行
 */
@media (max-width: 768px) {
  .record-board-toolbar-top-left {
    flex-wrap: wrap;
  }

  .record-board-toolbar-top-left .record-board-toolbar-find-wrap {
    flex: 1 1 100%;
    min-width: 100%;
  }

  .record-board-toolbar-quick-filter-form {
    flex-wrap: wrap;
  }
}

/**
 * RecordBoard 工具栏「筛选」按钮样式
 * 依据 Figma Pisell 2.0 Component Library - Filter Button (node-id=13586-90537)
 * - 边框: 1px solid #E5E7EB (neutral-200)
 * - 圆角: 8px
 * - 背景: #FFFFFF (neutral-0)
 * - 文字: 16px Medium, line-height 24px, #374151 (neutral-700)
 * - 图标: 16px, #6B7280 (neutral-500)
 * - 内边距: 12px 20px，高度 50px
 */
.record-board-toolbar-filter-btn {
  height: 50px !important;
  padding: 12px 20px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 24px !important;
  color: #374151 !important;
  background-color: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-width: 1px !important;
  border-radius: 8px !important;
  box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05) !important;

  .anticon {
    font-size: 16px;
    color: #6b7280;
  }

  &.pisell-lowcode-btn-lg {
    height: 50px !important;
    padding: 12px 20px !important;
    font-size: 16px !important;
  }

  &:hover:not(:disabled) {
    color: #374151 !important;
    background-color: #f9fafb !important;
    border-color: #e5e7eb !important;

    .anticon {
      color: #6b7280;
    }
  }

  &:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
  }
}

/**
 * 紧凑工具栏：介于默认 50px 与 antd small 之间（约 38px），覆盖 Figma 的 !important
 * Find：antd Input size=middle 时 affix 无 -sm 后缀，仍会吃到 PisellLookup 全局 min-height:50px，此处对 find 容器单独压高度
 */
.pisell-grid-pro-toolbar.pisell-record-board-toolbar--compact {
  .record-board-toolbar-filter-btn {
    height: auto !important;
    min-height: 38px !important;
    padding: 6px 14px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 22px !important;

    .anticon {
      font-size: 15px;
    }

    &.pisell-lowcode-btn-lg {
      height: auto !important;
      min-height: 38px !important;
      padding: 6px 14px !important;
      font-size: 15px !important;
    }
  }

  .record-board-toolbar-top-left .MuiInputBase-root {
    height: 38px !important;
    min-height: 38px !important;
  }

  .record-board-toolbar-find-wrap {
    .pisell-lookup-trigger-input.ant-input-affix-wrapper,
    .pisell-lookup-trigger-input.pisell-lowcode-input-affix-wrapper {
      height: 38px !important;
      min-height: 38px !important;
      padding: 3px 6px 3px 12px !important;

      .ant-input,
      .pisell-lowcode-input {
        font-size: 15px !important;
        line-height: 22px !important;
      }

      .ant-input::placeholder,
      .pisell-lowcode-input::placeholder {
        font-size: 15px !important;
        line-height: 22px !important;
      }
    }

    .pisell-lookup-trigger-input-no-confirm {
      > .ant-input-affix-wrapper,
      > .pisell-lowcode-input-affix-wrapper {
        min-height: 38px !important;
        padding: 3px 6px 3px 12px !important;

        .ant-input,
        .pisell-lowcode-input {
          font-size: 15px !important;
          line-height: 22px !important;
        }

        .ant-input::placeholder,
        .pisell-lowcode-input::placeholder {
          font-size: 15px !important;
          line-height: 22px !important;
        }
      }
    }

    .pisell-lookup-input-confirm.pisell-lowcode-btn,
    .pisell-lookup-input-confirm.ant-btn {
      font-size: 14px !important;
    }
  }
}
