/* 移动端自绘选择器样式，配合 select-picker.js。
   触发按钮刻意复用 .field input 的盒子参数（48px 高、8px 圆角、16px 字号、
   同一套边框与聚焦光环），这样它和上下相邻的输入框看起来是同一族控件。 */

.qzy-select {
  position: relative;
  min-width: 0;
}

/* 原生 select 只留作数据源，完全不参与布局和绘制。
   不用 width:1px + clip 那套视觉隐藏：`.field select { width: 100% }` 特异性更高，
   会把宽度顶回 390px，绝对定位后就溢出视口了。display:none 没有这个问题，
   而 select 的 .value、form.elements 取值和提交都不受影响。 */
.qzy-select-source {
  display: none;
}

.qzy-select-trigger {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid var(--line, #dce5e0);
  border-radius: 8px;
  outline: 0;
  color: var(--ink, #17262a);
  background-color: #fbfcfa;
  background-image: url("/chevron-down.svg?v=a89665de62");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 14px;
  font: inherit;
  font-size: 16px;
  text-align: left;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}

.qzy-select-trigger:active,
.qzy-select-trigger[aria-expanded="true"] {
  border-color: rgba(15, 118, 110, 0.58);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.qzy-select-trigger:focus-visible {
  border-color: rgba(15, 118, 110, 0.58);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.qzy-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qzy-select-trigger.is-empty .qzy-select-value {
  color: #8a9a9d;
}

/* 弹层挂在所属 dialog 内部以进入 top layer；fixed 定位让它不受祖先 overflow 裁切 */
.qzy-select-popup {
  position: fixed;
  z-index: 5;
  max-height: min(320px, 56vh);
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--line, #dce5e0);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 18px 44px rgba(13, 37, 41, 0.22);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.qzy-select-popup[hidden] {
  display: none;
}

.qzy-select-option {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink, #17262a);
  font: inherit;
  font-size: 16px;
  text-align: left;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

/* 选项文字不换行；真的过长时由 max-width 截断，而不是把行高撑成两行 */
.qzy-select-option {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qzy-select-option + .qzy-select-option {
  margin-top: 2px;
}

.qzy-select-option:hover,
.qzy-select-option.is-active {
  background: #eef5f3;
}

.qzy-select-option[aria-selected="true"] {
  color: var(--brand, #0f766e);
  font-weight: 600;
}

/* 用当前色画一个对勾，省掉一个图标依赖 */
.qzy-select-option[aria-selected="true"]::after {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 13px;
  margin-top: -2px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

@media (prefers-reduced-motion: no-preference) {
  .qzy-select-popup {
    animation: qzy-select-in 0.12s ease-out;
  }

  @keyframes qzy-select-in {
    from {
      opacity: 0;
      transform: translateY(-4px);
    }
  }
}

@media (max-width: 380px) {
  .qzy-select-trigger,
  .qzy-select-option {
    font-size: 15px;
  }
}
