/* ==========================================================================
   页面顶部功能条 (Page Toolbar)
   ========================================================================== */

/* --- 容器 (Container) --- */
.zuoekai-page-toolbar {
  background: var(--zuoekai-color-surface-panel);
  border: 1px solid var(--zuoekai-color-border);
  border-radius: var(--zuoekai-radius-lg);
  box-shadow: var(--zuoekai-shadow-sm);
  padding: 16px;
}

/* --- 悬浮功能按钮 (Floating Action Button) --- */
.zuoekai-page-toolbar__fab {
  position: fixed;
  right: 16px;
  bottom: 96px;
  width: 56px;
  height: 56px;
  border: 1px solid var(--zuoekai-color-border);
  border-radius: 18px;
  background: var(--zuoekai-color-surface-float);
  box-shadow: var(--zuoekai-shadow-lg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--zuoekai-color-text);
  cursor: pointer;
  z-index: var(--zuoekai-z-modal);

  display: none;
  align-items: center;
  justify-content: center;

  transition:
    transform var(--zuoekai-motion-duration-normal) var(--zuoekai-motion-ease-out),
    background var(--zuoekai-motion-duration-fast) var(--zuoekai-motion-ease-out),
    box-shadow var(--zuoekai-motion-duration-fast) var(--zuoekai-motion-ease-out);
}

.zuoekai-page-toolbar__fab:hover {
  transform: translateY(-1px);
  background: var(--zuoekai-color-action-hover-bg);
}

.zuoekai-page-toolbar__fab:active {
  transform: translateY(0);
}

.zuoekai-page-toolbar__fab svg {
  width: 22px;
  height: 22px;
  stroke: url(#zuoekai-gradient-primary);
}

.zuoekai-page-toolbar__inner {
  /* 内部布局容器：负责多控件自动换行/间距 */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.zuoekai-page-toolbar--grouped {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.zuoekai-page-toolbar--grouped .zuoekai-page-toolbar__stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.zuoekai-page-toolbar--grouped .zuoekai-page-toolbar__group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  padding: 16px;
  background: var(--zuoekai-color-surface-panel);
  border: 1px solid var(--zuoekai-color-border);
  border-radius: var(--zuoekai-radius-lg);
  box-shadow: var(--zuoekai-shadow-sm);
}

.zuoekai-page-toolbar__row {
  /* 单行控件组：label + input/select/button 等 */
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- 拉伸行：允许字段自动换行并在桌面端分栏 --- */
.zuoekai-page-toolbar__row--stretch {
  width: 100%;
  flex: 1 1 100%;
  flex-wrap: wrap;
  align-items: flex-end;
}

/* --- 字段容器：为输入框、下拉、多选器提供统一伸缩规则 --- */
.zuoekai-page-toolbar__field {
  flex: 1 1 180px;
  min-width: 180px;
}

.zuoekai-page-toolbar__field--wide {
  flex: 2 1 280px;
  min-width: 260px;
}

.zuoekai-page-toolbar__field--search {
  flex: 1.8 1 240px;
  min-width: 220px;
}

.zuoekai-page-toolbar__field--panel {
  flex: 1.4 1 220px;
  min-width: 200px;
}

.zuoekai-page-toolbar__field--compact {
  flex: 1 1 140px;
  min-width: 120px;
}

/* --- 操作区：查询/重置/刷新等按钮组 --- */
.zuoekai-page-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

/* --- 抽屉变体：桌面端静态展开，移动端抽屉 --- */
.zuoekai-page-toolbar-drawer-overlay {
  display: none;
}

@media (min-width: 769px) {
  .zuoekai-page-toolbar--with-drawer .zuoekai-page-toolbar__fab {
    display: none;
  }

  /* 桌面端：抽屉容器“退化”为普通静态容器，直接展示内容 */
  .zuoekai-page-toolbar-drawer-overlay {
    position: static;
    width: auto;
    height: auto;
    background: transparent;
    backdrop-filter: none;
    opacity: 1;
    visibility: visible;
    display: block !important;
    z-index: auto;
  }

  .zuoekai-page-toolbar-drawer-overlay .zuoekai-drawer {
    position: static;
    transform: none;
    width: auto;
    max-width: none;
    height: auto;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    overflow: visible;
  }

  .zuoekai-page-toolbar-drawer-overlay .zuoekai-drawer__header {
    display: none;
  }

  .zuoekai-page-toolbar-drawer-overlay .zuoekai-drawer__body {
    padding: 0;
    overflow: visible;
  }
}

@media (max-width: 768px) {
  .zuoekai-page-toolbar--with-drawer {
    position: static;
    top: auto;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .zuoekai-page-toolbar--with-drawer .zuoekai-page-toolbar__fab {
    display: flex;
  }

  .zuoekai-page-toolbar--grouped .zuoekai-page-toolbar__stack,
  .zuoekai-page-toolbar--grouped .zuoekai-page-toolbar__group {
    width: 100%;
  }

  .zuoekai-page-toolbar--grouped .zuoekai-page-toolbar__group {
    padding: 14px;
    gap: 16px;
  }

  .zuoekai-page-toolbar--with-drawer .zuoekai-page-toolbar__fab:hover,
  .zuoekai-page-toolbar--with-drawer .zuoekai-page-toolbar__fab:active {
    transform: none;
  }

  .zuoekai-card:has(.zuoekai-card__header--banner) .zuoekai-page-toolbar--with-drawer .zuoekai-page-toolbar__fab {
    transform: none;
  }

  .zuoekai-card:has(.zuoekai-card__header--banner):hover:has(.zuoekai-page-toolbar--with-drawer) {
    transform: none;
  }

  /* --- 抽屉型工具栏：在移动端将控件改为纵向堆叠，便于单手操作 --- */
  .zuoekai-page-toolbar--with-drawer .zuoekai-page-toolbar__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    overflow: visible;
  }

  .zuoekai-page-toolbar--with-drawer .zuoekai-page-toolbar__row,
  .zuoekai-page-toolbar--with-drawer .zuoekai-page-toolbar__actions {
    flex: 1 1 auto;
    flex-direction: column;
    align-items: stretch;
    margin-left: 0;
  }

  .zuoekai-page-toolbar--with-drawer .zuoekai-page-toolbar__field,
  .zuoekai-page-toolbar--with-drawer .zuoekai-page-toolbar__field--wide {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
  }

  .zuoekai-page-toolbar--with-drawer .zuoekai-page-toolbar__actions .zuoekai-button {
    width: 100%;
    justify-content: center;
  }
}
