/* stock-picker —— 组件样式
 * --------------------------------------------------------------------------
 * 与 stock-picker.js 配套，类名统一 sp- 前缀，避免和宿主页面冲突。
 * 组件本身不依赖任何全局样式，整份拷走即可用。
 *
 * 依赖的 DOM 结构（由 stock-picker.js 在运行时生成）：
 *   <div class="sp-dropdown">
 *     <div class="sp-item is-active">
 *       <span class="sp-code">600519</span>
 *       <span class="sp-name">贵州茅台</span>
 *       <span class="sp-tag sp-tag-e">ETF</span>
 *     </div>
 *     <div class="sp-empty">没有找到匹配的标的</div>
 *   </div>
 *
 * 下拉容器需要挂在 position:relative 的父元素内（见 .sp-field）。
 */

/* 输入框与下拉的定位容器。宿主页面如果已有 relative 容器，不加这个类也行。 */
.sp-field {
    position: relative;
    display: inline-block;
}

/* 下拉面板：默认隐藏，由 JS 加 .is-open 打开 */
.sp-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    width: 320px;
    max-height: 264px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: none;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #dfe3e8;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.sp-dropdown.is-open {
    display: block;
}

.sp-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    font-size: 13px;
    color: #1f2329;
    cursor: pointer;
    border-bottom: 1px solid #f2f4f7;
}

.sp-item:last-child {
    border-bottom: none;
}

.sp-item:hover,
.sp-item.is-active {
    background: #f0f6ff;
}

/* 代码：等宽，方便对齐比对 */
.sp-code {
    flex: none;
    width: 52px;
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-weight: 600;
    color: #4b5563;
}

/* 名称：吃掉剩余宽度，过长省略 */
.sp-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* 品种标签。主板（a）不显示标签，数量太多没有区分度。 */
.sp-tag {
    flex: none;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    line-height: 16px;
    color: #fff;
    background: #9099a8;
}

.sp-tag-c { background: #e0562d; }  /* 创业板 */
.sp-tag-k { background: #7a5af5; }  /* 科创板 */
.sp-tag-b { background: #0f9d58; }  /* 北交所 */
.sp-tag-e { background: #2b7fd4; }  /* ETF */
.sp-tag-l { background: #5b6bd6; }  /* LOF */
.sp-tag-r { background: #0e8f8f; }  /* REIT */
.sp-tag-z { background: #c2410c; }  /* 可转债 */

.sp-empty {
    padding: 10px;
    text-align: center;
    color: #98a1ad;
    font-size: 12px;
}
