/* 页面右上角工具搜索 */
.header-search {
    position: relative;
    width: 320px;
    max-width: 100%;
}

.header-search-form {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    overflow: hidden;
    transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.header-search-form:focus-within {
    background: #fff;
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(46, 156, 109, 0.35);
}

.header-search-input {
    flex: 1;
    min-width: 0;
    padding: 9px 14px;
    border: none;
    outline: none;
    background: transparent;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
}

.header-search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.header-search-form:focus-within .header-search-input {
    color: #2c3e50;
}

.header-search-form:focus-within .header-search-input::placeholder {
    color: #999;
}

.header-search-input::-webkit-search-cancel-button {
    cursor: pointer;
}

.header-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    height: 38px;
    border: none;
    background: transparent;
    color: #fff;
    line-height: 1;
    cursor: pointer;
    transition: color 0.3s;
}

.header-search-form:focus-within .header-search-btn {
    color: #2e9c6d;
}

.header-search-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 1000;
    width: min(720px, calc(100vw - 40px));
    max-height: 70vh;
    overflow-y: auto;
    padding: 16px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}

.header-search-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

/* 复用首页 tool-card 样式，并针对下拉面板做紧凑处理 */
.header-search-results .tool-card {
    padding: 14px;
    border: 1px solid #eef1f4;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.header-search-results .tool-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.header-search-results .tool-name {
    font-size: 15px;
    margin-bottom: 6px;
}

.header-search-results .tool-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12px;
}

.header-search-results mark {
    padding: 0 1px;
    background: #fff3b0;
    color: inherit;
    border-radius: 2px;
}

.header-search-empty {
    padding: 20px 10px;
    color: #888;
    font-size: 14px;
    text-align: center;
}

.header-search-more {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #eef1f4;
    text-align: right;
}

.header-search-more a {
    color: #2e9c6d;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.header-search-more a:hover {
    text-decoration: underline;
}

.search-tool-category {
    display: inline-block;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #eaf6f0;
    color: #2e9c6d;
    font-size: 11px;
    line-height: 1.6;
}

/* 搜索结果页 */
.search-page-header {
    margin-bottom: 24px;
}

.search-page-title {
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 26px;
}

.search-page-summary {
    color: #666;
    font-size: 14px;
}

.search-page-keyword {
    color: #2e9c6d;
    font-weight: 600;
}

.search-results-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.search-empty {
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #666;
    text-align: center;
}

.search-empty-tip {
    margin-top: 10px;
    color: #999;
    font-size: 13px;
}

.search-empty-tip a {
    color: #2e9c6d;
    text-decoration: none;
}

.search-empty-tip a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .header-search {
        width: 100%;
    }

    .header-search-panel {
        right: auto;
        left: 0;
        width: 100%;
    }

    .header-search-results {
        grid-template-columns: 1fr;
    }

    .search-results-grid {
        grid-template-columns: 1fr;
    }
}
