/* ================================================================
 * 系统级自定义下拉组件样式（2026-09-26，配合 custom-select.js）
 * 设计：圆角 10px 触发框 + chevron 旋转动画 + 面板搜索框 + 选中对勾
 * 变量可被页面作用域覆盖：--cs-primary / --cs-border / --cs-text / --cs-muted
 * ================================================================ */
.cs-select {
    --cs-primary: #6366f1;
    --cs-border: #e2e8f0;
    --cs-text: #1e293b;
    --cs-muted: #94a3b8;
    position: relative;
    width: 100%;
    font-size: 13px;
    color: var(--cs-text);
}
/* ---- 触发框 ---- */
.cs-select .cs-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--cs-border);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color .18s, box-shadow .18s;
    user-select: none;
    outline: none;
}
.cs-select .cs-trigger:hover { border-color: #c7d2fe; }
.cs-select.cs-open .cs-trigger,
.cs-select .cs-trigger:focus-visible {
    border-color: var(--cs-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}
.cs-select .cs-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cs-select .cs-label.cs-placeholder { color: var(--cs-muted); }
.cs-select .cs-arrow {
    font-size: 12px;
    color: var(--cs-muted);
    transition: transform .22s cubic-bezier(.4, 0, .2, 1);
    flex-shrink: 0;
}
.cs-select.cs-open .cs-arrow { transform: rotate(180deg); color: var(--cs-primary); }
.cs-select.cs-disabled-box .cs-trigger {
    background: #f8fafc;
    cursor: not-allowed;
    opacity: .6;
}
/* ---- 展开面板（展开时由 JS 挂到 body 下 fixed 定位，脱离 overflow:hidden 裁剪） ---- */
.cs-panel {
    /* 变量需在面板自身重复定义：挂到 body 后不再继承 .cs-select 作用域 */
    --cs-primary: #6366f1;
    --cs-border: #e2e8f0;
    --cs-text: #1e293b;
    --cs-muted: #94a3b8;
    position: fixed;
    /* 2000：高于 Bootstrap modal(1055)/backdrop(1050)，保证弹窗内下拉不被遮挡 */
    z-index: 2000;
    font-size: 13px;
    color: var(--cs-text);
    background: #fff;
    border: 1px solid var(--cs-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .12), 0 2px 8px rgba(15, 23, 42, .06);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-6px) scale(.98);
    transform-origin: top center;
    pointer-events: none;
    transition: opacity .18s, transform .18s;
}
.cs-panel.cs-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
/* 向上展开（视口底部空间不足时由 custom-select.js 加 cs-dropup） */
.cs-panel.cs-dropup {
    transform-origin: bottom center;
    transform: translateY(6px) scale(.98);
}
.cs-panel.cs-dropup.cs-open {
    transform: translateY(0) scale(1);
}
/* 搜索框 */
.cs-panel .cs-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 10px 6px;
    padding: 0 10px;
    height: 34px;
    border: 1px solid var(--cs-border);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--cs-muted);
}
.cs-panel .cs-search:focus-within { border-color: var(--cs-primary); background: #fff; }
.cs-panel .cs-search input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    outline: none;
    font-size: 12.5px;
    color: var(--cs-text);
}
/* 选项列表 */
.cs-panel .cs-list {
    max-height: 260px;
    overflow-y: auto;
    padding: 4px 6px 6px;
}
.cs-panel .cs-list::-webkit-scrollbar { width: 6px; }
.cs-panel .cs-list::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 99px; }
.cs-panel .cs-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .12s;
    font-size: 13px;
}
.cs-panel .cs-option:hover,
.cs-panel .cs-option.cs-active { background: #eef2ff; }
.cs-panel .cs-option.cs-selected {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    color: var(--cs-primary);
    font-weight: 600;
}
.cs-panel .cs-option.cs-disabled { opacity: .45; cursor: not-allowed; }
.cs-panel .cs-option-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cs-panel .cs-option-hint {
    font-size: 11px;
    color: var(--cs-muted);
    flex-shrink: 0;
}
.cs-panel .cs-option.cs-selected .cs-option-hint { color: var(--cs-primary); opacity: .75; }
.cs-panel .cs-check { font-size: 14px; flex-shrink: 0; }
.cs-panel .cs-empty {
    padding: 18px 0;
    text-align: center;
    color: var(--cs-muted);
    font-size: 12.5px;
}

/* ================================================================
 * 自动增强模式（2026-09-26）：原生 <select> 统一替换为 CustomSelect 外壳
 * ================================================================ */
/* 被增强的原生 select：视觉隐藏但保留 DOM（表单提交 / 既有 JS 读写不受影响） */
select.cs-native-hidden {
    display: none !important;
}
/* 包裹容器：默认块级占满（与原生 block select 行为一致），宽度由 enhance 按需继承 */
.cs-enhanced-wrap {
    display: block;
    min-width: 0;
}
.cs-enhanced-wrap > .cs-select {
    width: 100%;
}
/* 小尺寸变体：对应 form-select-sm / qc-select 等紧凑型筛选控件 */
.cs-select.cs-select-sm { font-size: 12.5px; }
.cs-select.cs-select-sm .cs-trigger {
    height: 32px;
    padding: 0 10px;
    border-radius: 8px;
}
/* 小尺寸面板：JS 在展开时给挂到 body 的面板同步加 cs-panel-sm */
.cs-panel.cs-panel-sm { font-size: 12.5px; }
.cs-panel.cs-panel-sm .cs-option { padding: 6px 10px; font-size: 12.5px; }
