/* ====================================================
   搜索自动完成下拉框 - 通用样式
   ==================================================== */

/* 下拉容器 */
.search-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.12);
    z-index: 9999;
    max-height: 420px;
    overflow-y: auto;
    animation: sacFadeIn 0.15s ease;
    /* 防止宽度溢出屏幕 */
    max-width: 100vw;
    box-sizing: border-box;
}

@keyframes sacFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 加载中 */
.search-autocomplete-loading {
    padding: 20px;
    text-align: center;
    color: #aaa;
    font-size: 14px;
}

/* ====================================================
   实时搜索结果区块（≥2字触发）
   ==================================================== */

.search-autocomplete-section {
    padding: 6px 0;
    border-bottom: 1px solid #f5f5f5;
}
.search-autocomplete-section:last-of-type {
    border-bottom: none;
}

.search-autocomplete-title {
    font-size: 11px;
    color: #bbb;
    padding: 6px 14px 4px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.search-autocomplete-item {
    display: block;
    padding: 10px 14px;
    cursor: pointer;
    text-decoration: none;
    color: #333;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    min-height: 40px;
    box-sizing: border-box;
}

.search-autocomplete-item:hover,
.search-autocomplete-item.active {
    background: #f5f8ff;
    border-left-color: #0d6efd;
    color: #0d6efd;
}

.search-autocomplete-item-title {
    font-size: 14px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-autocomplete-item-title mark {
    background-color: #fff176;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
    color: #222;
}

/* 查看全部按钮 */
.search-autocomplete-footer {
    border-top: 1px solid #f0f0f0;
    padding: 8px;
}

.search-autocomplete-all {
    display: block;
    text-align: center;
    padding: 8px;
    color: #0d6efd;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    transition: background 0.2s;
}

.search-autocomplete-all:hover {
    background: #f0f6ff;
}

/* ====================================================
   热门搜索 + 历史搜索 面板
   ==================================================== */

.sac-section {
    padding: 12px 14px 10px;
    border-bottom: 1px solid #f5f5f5;
}
.sac-section:last-child {
    border-bottom: none;
}

/* 标题行 */
.sac-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.sac-section-title {
    font-size: 12px;
    color: #bbb;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* 清除按钮 */
.sac-clear-btn {
    font-size: 12px;
    color: #ccc;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid #eee;
    background: #fafafa;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
    /* 手机端点击不会变色 */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}
.sac-clear-btn:hover {
    color: #f44336;
    background: #fff0f0;
    border-color: #ffd0cc;
}

/* 标签容器 */
.sac-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* 通用标签 */
.sac-tag {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    line-height: 1.4;
    white-space: nowrap;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.18s;
    /* 手机端最小点击区域 */
    min-height: 30px;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* 历史搜索标签 - 灰色系 */
.sac-history-tag {
    background: #f5f5f5;
    color: #555;
    border: 1px solid #e8e8e8;
}
.sac-history-tag:hover {
    background: #eaeaea;
    color: #222;
    border-color: #d0d0d0;
}

/* 热门搜索标签 - 橙红色系 */
.sac-hot-tag {
    background: #fff4f1;
    color: #e8542a;
    border: 1px solid #ffd5c8;
}
.sac-hot-tag:hover {
    background: #ffe5de;
    color: #c44020;
    border-color: #ffc0b0;
}

/* ====================================================
   移动端 / 微信浏览器 适配
   ==================================================== */

@media (max-width: 768px) {
    .search-autocomplete-dropdown {
        max-height: 360px;
        border-radius: 8px;
    }

    /* 手机端标签更大，方便手指点击 */
    .sac-tag {
        font-size: 14px;
        padding: 6px 14px;
        min-height: 36px;
    }

    .search-autocomplete-item {
        min-height: 46px;
        padding: 12px 14px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .sac-section {
        padding: 10px 12px 8px;
    }
    .sac-tags {
        gap: 6px;
    }
    .sac-tag {
        max-width: 110px;
    }
}
