/* =========================================================
   全局搜索短代码 [io_global_search]
   结构：.io-global-search > form + .suggestions-box
   ========================================================= */

.io-global-search {
    position: relative;
    padding: 18px 20px;
    margin: 0 0 20px;
    border-radius: 16px;
}

.io-global-search__form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.io-global-search__field {
    position: relative;
    flex: 1 1 320px;
    min-width: 0;
}

.io-global-search__icon {
    position: absolute;
    top: 50%;
    left: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    transform: translateY(-50%);
    pointer-events: none;
}

.io-global-search__input {
    width: 100%;
    height: 48px;
    padding: 0 16px 0 44px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    outline: none;
    background: #f8fafc;
    color: #111827;
    font-size: 15px;
    line-height: 1;
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.io-global-search__input::placeholder {
    color: #9ca3af;
}

.io-global-search__input:focus {
    border-color: #2563eb;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.io-global-search__input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.io-global-search__submit,
.io-global-search__ai {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 0 22px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.io-global-search__submit {
    background: #2563eb;
    box-shadow: 0 6px 16px rgba(37, 99, 235, .22);
}

.io-global-search__submit:hover {
    background: #1d4ed8;
    box-shadow: 0 8px 20px rgba(37, 99, 235, .28);
    transform: translateY(-1px);
}

.io-global-search__ai {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    box-shadow: 0 6px 16px rgba(139, 92, 246, .26);
}

.io-global-search__ai:hover {
    box-shadow: 0 8px 22px rgba(139, 92, 246, .34);
    transform: translateY(-1px);
}

/* 下拉联想容器 */
.io-global-search .suggestions-box {
    position: absolute;
    top: calc(100% - 6px);
    right: 20px;
    left: 20px;
    z-index: 60;
    max-height: 380px;
    padding: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .14);
    -webkit-overflow-scrolling: touch;
}

.io-global-search__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.io-global-search__list .ms-auto-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 2px 10px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color .15s ease;
}

.io-global-search__list .ms-auto-item:hover,
.io-global-search__list .ms-auto-item.is-active {
    background: #f0f7ff;
}

.io-global-search__list .ms-auto-type {
    grid-row: 1 / span 2;
    grid-column: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 2px 7px;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
}

.io-global-search__list .ms-auto-title {
    grid-column: 2;
    min-width: 0;
    overflow: hidden;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.io-global-search__list .ms-auto-title em {
    padding: 0 2px;
    border-radius: 3px;
    background: rgba(37, 99, 235, .10);
    color: #2563eb;
    font-style: normal;
    font-weight: 700;
}

.io-global-search__list .ms-auto-desc {
    grid-column: 2;
    min-width: 0;
    overflow: hidden;
    color: #9ca3af;
    font-size: 12px;
    line-height: 1.5;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.io-global-search__notice {
    padding: 16px 12px;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
}

/* 移动端 */
@media (max-width: 768px) {
    .io-global-search {
        padding: 14px;
        margin-bottom: 16px;
        border-radius: 14px;
    }

    .io-global-search__form {
        flex-wrap: wrap;
        gap: 8px;
    }

    .io-global-search__field {
        flex: 1 1 100%;
    }

    .io-global-search__input {
        height: 46px;
        font-size: 14px;
    }

    .io-global-search__submit,
    .io-global-search__ai {
        flex: 1 1 calc(50% - 4px);
        height: 44px;
        padding: 0 12px;
        font-size: 14px;
    }

    .io-global-search .suggestions-box {
        top: calc(100% - 4px);
        right: 14px;
        left: 14px;
        max-height: 320px;
    }

    .io-global-search__list .ms-auto-item {
        padding: 10px;
    }
}
