/* ========================================
   智能搜索增强 - 样式表
   ======================================== */

/* ===== 搜索模态框增强 ===== */
.xnss-modal-enhance {
    padding: 12px 20px 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.xnss-section-title {
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 10px;
    justify-content: space-between;
}

.xnss-title-icon {
    margin-right: 6px;
    font-size: 14px;
}

.xnss-clear-history {
    font-size: 12px;
    font-weight: 400;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s;
}

.xnss-clear-history:hover {
    color: #6366f1;
}

.xnss-hot-tags,
.xnss-history-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.xnss-hot-tag,
.xnss-history-tag {
    display: inline-block;
    padding: 5px 12px;
    background: #f1f5f9;
    color: #475569;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.xnss-hot-tag:hover,
.xnss-history-tag:hover {
    background: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
    color: #fff;
    transform: translateY(-1px);
}

.xnss-history-section {
    margin-top: 14px;
}

/* ===== 搜索建议下拉框 ===== */
.xnss-suggest-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    max-height: 360px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.xnss-suggest-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f1f5f9;
}

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

.xnss-suggest-item:hover,
.xnss-suggest-item.active {
    background: #f8fafc;
}

.xnss-suggest-icon {
    margin-right: 10px;
    font-size: 14px;
    color: #94a3b8;
    width: 20px;
    text-align: center;
}

.xnss-suggest-text {
    flex: 1;
    font-size: 14px;
    color: #334155;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.xnss-suggest-text mark {
    background: none;
    color: #6366f1;
    font-weight: 600;
}

.xnss-suggest-type {
    font-size: 11px;
    color: #94a3b8;
    padding: 2px 8px;
    background: #f1f5f9;
    border-radius: 10px;
    margin-left: 10px;
}

/* ===== 搜索结果页 ===== */
.xnss-search-page {
    padding: 24px 0;
}

.xnss-search-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 24px;
    border: 1px solid rgba(99, 102, 241, 0.12);
}

.xnss-search-title {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 12px;
}

.xnss-search-title .keyword {
    background: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.xnss-search-stats {
    font-size: 14px;
    color: #64748b;
}

.xnss-search-stats .count {
    font-weight: 600;
    color: #6366f1;
}

.xnss-search-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.xnss-sort-tabs {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
}

.xnss-sort-tab {
    padding: 6px 16px;
    font-size: 13px;
    color: #64748b;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    text-decoration: none;
}

.xnss-sort-tab:hover {
    color: #334155;
}

.xnss-sort-tab.active {
    background: #fff;
    color: #6366f1;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* ===== 搜索结果布局 ===== */
.xnss-search-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.xnss-filter-sidebar {
    width: 240px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
}

/* 桌面端隐藏关闭按钮和遮罩 */
.xnss-filter-close-btn,
.xnss-filter-mask {
    display: none;
}

/* 移动端筛选按钮 - 桌面端隐藏 */
.xnss-mobile-filter-btn {
    display: none;
}

.xnss-filter-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.xnss-filter-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.xnss-filter-clear {
    font-size: 12px;
    color: #94a3b8;
    cursor: pointer;
    font-weight: 400;
}

.xnss-filter-clear:hover {
    color: #6366f1;
}

.xnss-filter-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.xnss-filter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    margin-bottom: 2px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #475569;
    transition: all 0.15s;
}

.xnss-filter-item:hover {
    background: #f8fafc;
    color: #6366f1;
}

.xnss-filter-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    font-weight: 600;
}

.xnss-filter-count {
    font-size: 11px;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 10px;
}

.xnss-filter-item.active .xnss-filter-count {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

/* 筛选空状态 */
.xnss-filter-empty {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.xnss-filter-empty-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.xnss-filter-empty-text {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #64748b;
}

.xnss-filter-empty-desc {
    font-size: 12px;
    line-height: 1.5;
}

/* ===== 搜索结果列表 ===== */
.xnss-results-main {
    flex: 1;
    min-width: 0;
}

.xnss-result-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.xnss-result-item:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.08);
    transform: translateY(-1px);
}

.xnss-result-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.5;
}

.xnss-result-title a {
    color: #0f172a;
    text-decoration: none;
}

.xnss-result-title a:hover {
    color: #6366f1;
}

.xnss-result-title .xnss-highlight {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 700;
}

.xnss-result-excerpt {
    font-size: 13px;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 12px;
}

.xnss-result-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
    color: #94a3b8;
}

.xnss-result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.xnss-result-tag {
    display: inline-block;
    padding: 3px 10px;
    font-size: 11px;
    border-radius: 6px;
    font-weight: 500;
}

.xnss-tag-type {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.xnss-tag-region {
    background: rgba(6, 182, 212, 0.1);
    color: #06b6d4;
}

.xnss-tag-year {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.xnss-tag-cloud {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.xnss-tag-quality {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.xnss-result-meta .dot {
    width: 3px;
    height: 3px;
    background: #cbd5e1;
    border-radius: 50%;
}

/* ===== 无结果页面 ===== */
.xnss-no-result {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.xnss-no-result-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.xnss-no-result-title {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 8px;
}

.xnss-no-result-desc {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 24px;
}

.xnss-no-result-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

/* ===== 已选筛选条件 ===== */
.xnss-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.xnss-active-filter {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.xnss-active-filter .remove {
    margin-left: 6px;
    cursor: pointer;
    opacity: 0.7;
    font-size: 14px;
    line-height: 1;
}

.xnss-active-filter .remove:hover {
    opacity: 1;
}

/* ===== 分页 ===== */
.xnss-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}

.xnss-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: #f1f5f9;
    border-radius: 10px;
    font-size: 14px;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.xnss-page-btn:hover {
    background: #e2e8f0;
    color: #475569;
    transform: translateY(-1px);
}

.xnss-page-btn.active {
    background: linear-gradient(135deg, #6366f1, #06b6d4);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

.xnss-page-prev,
.xnss-page-next {
    font-size: 12px;
    min-width: 36px;
}

.xnss-page-total {
    font-size: 13px;
    color: #94a3b8;
    background: #f8fafc;
    min-width: 60px;
}

.xnss-page-total:hover {
    color: #64748b;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    /* 页面容器适配 */
    .xnss-search-page {
        padding: 12px 0;
    }

    .xnss-search-layout {
        flex-direction: column;
        gap: 16px;
    }

    /* 搜索头部 */
    .xnss-search-header {
        padding: 16px;
        border-radius: 12px;
    }

    .xnss-search-title {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .xnss-search-stats {
        font-size: 12px;
    }

    /* 工具栏 - 防止溢出 */
    .xnss-search-toolbar {
        gap: 8px;
        margin-bottom: 16px;
    }

    .xnss-sort-tabs {
        flex: 1;
        min-width: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .xnss-sort-tabs::-webkit-scrollbar {
        display: none;
    }

    .xnss-sort-tab {
        padding: 6px 12px;
        font-size: 12px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* 移动端筛选按钮 */
    .xnss-mobile-filter-btn {
        display: block;
        flex-shrink: 0;
        padding: 6px 14px;
        font-size: 12px;
        border: 1px solid #e2e8f0;
        background: #fff;
        border-radius: 8px;
        cursor: pointer;
        color: #475569;
        white-space: nowrap;
    }

    /* 筛选侧边栏 - 移动端抽屉式 */
    .xnss-filter-sidebar {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        height: 100dvh;
        background: #fff;
        z-index: 9999;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 16px;
        padding-top: 20px;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
        transition: right 0.3s ease;
        display: block !important;
    }

    .xnss-filter-sidebar.open {
        right: 0;
    }

    /* 移动端关闭按钮 */
    .xnss-filter-close-btn {
        display: block;
        width: 100%;
        padding: 10px;
        margin-bottom: 12px;
        background: #f1f5f9;
        border: none;
        border-radius: 8px;
        font-size: 14px;
        color: #64748b;
        cursor: pointer;
        text-align: center;
    }

    /* 遮罩层 */
    .xnss-filter-mask {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
    }

    .xnss-filter-mask.show {
        opacity: 1;
        visibility: visible;
    }

    /* 筛选卡片 */
    .xnss-filter-card {
        padding: 14px;
        margin-bottom: 12px;
    }

    /* 搜索结果卡片 - 防止溢出 */
    .xnss-results-main {
        width: 100%;
        min-width: 0;
    }

    .xnss-result-item {
        padding: 14px;
        border-radius: 10px;
        overflow: hidden;
    }

    .xnss-result-title {
        font-size: 14px;
        line-height: 1.5;
        word-break: break-all;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .xnss-result-title a {
        display: block;
        word-break: break-all;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* 标签 - 防止溢出 */
    .xnss-result-tags {
        flex-wrap: wrap;
        gap: 4px 6px;
        margin-bottom: 8px;
    }

    .xnss-result-tag {
        padding: 2px 8px;
        font-size: 10px;
        white-space: nowrap;
    }

    /* 摘要 - 防止溢出 */
    .xnss-result-excerpt {
        font-size: 12px;
        word-break: break-all;
        word-wrap: break-word;
        overflow-wrap: break-word;
        line-height: 1.5;
    }

    /* 元信息 - 防止溢出 */
    .xnss-result-meta {
        font-size: 11px;
        gap: 6px;
        flex-wrap: wrap;
    }

    .xnss-result-meta .dot {
        width: 2px;
        height: 2px;
    }

    /* 已选筛选条件 */
    .xnss-active-filters {
        gap: 6px;
        margin-bottom: 12px;
    }

    .xnss-active-filter {
        padding: 4px 10px;
        font-size: 11px;
    }

    /* 无结果页 */
    .xnss-no-result {
        padding: 40px 16px;
    }

    .xnss-no-result-icon {
        font-size: 48px;
    }

    .xnss-no-result-title {
        font-size: 16px;
    }

    .xnss-no-result-desc {
        font-size: 13px;
    }

    /* 模态框增强 */
    .xnss-modal-enhance {
        padding: 10px 16px 12px;
    }

    /* 分页 */
    .xnss-pagination {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
    }
}

/* 小屏手机额外适配 (≤ 380px) */
@media (max-width: 380px) {
    .xnss-sort-tab {
        padding: 6px 10px;
        font-size: 11px;
    }

    .xnss-result-title {
        font-size: 13px;
    }

    .xnss-result-item {
        padding: 12px;
    }

    .xnss-search-header {
        padding: 14px;
    }

    .xnss-search-title {
        font-size: 15px;
    }
}

/* ===== 深色模式适配 ===== */
@media (prefers-color-scheme: dark) {
    .xnss-suggest-dropdown {
        background: #1e293b;
        border-color: #334155;
    }

    .xnss-suggest-item {
        border-bottom-color: #334155;
    }

    .xnss-suggest-item:hover,
    .xnss-suggest-item.active {
        background: #1e293b;
    }

    .xnss-suggest-text {
        color: #e2e8f0;
    }
}


/* =============== 首页 Hero 搜索框 =============== */

.xnss-hero-search {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 36px 20px 32px;
    margin-bottom: 24px;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}

.xnss-hero-search::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.xnss-hero-search::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -5%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.xnss-hero-container {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.xnss-hero-title {
    text-align: center;
    margin-bottom: 30px;
}

.xnss-hero-title h1 {
    color: #fff;
    font-size: 36px;
    font-weight: 700;
    margin: 0 0 12px 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.15);
    letter-spacing: 1px;
}

.xnss-hero-subtitle {
    color: rgba(255,255,255,0.85);
    font-size: 16px;
    margin: 0;
    font-weight: 400;
}

.xnss-hero-search-box {
    position: relative;
    margin-bottom: 16px;
}

.xnss-hero-input-wrap {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 50px;
    padding: 6px 6px 6px 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    transition: box-shadow 0.3s;
}

.xnss-hero-input-wrap:focus-within {
    box-shadow: 0 15px 50px rgba(0,0,0,0.3);
}

.xnss-hero-icon {
    font-size: 22px;
    color: #94a3b8;
    margin-right: 12px;
    flex-shrink: 0;
}

.xnss-hero-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 14px 0;
    background: transparent;
    color: #1e293b;
}

.xnss-hero-input::placeholder {
    color: #94a3b8;
}

.xnss-hero-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}

.xnss-hero-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.xnss-hero-btn i {
    font-size: 18px;
}

/* Hero 搜索建议 */
.xnss-hero-suggest {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    overflow: hidden;
    z-index: 100;
}

.xnss-hero-suggest-footer {
    padding: 16px 20px;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
}

.xnss-hero-suggest-footer .xnss-hot-title {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    color: #64748b;
}

.xnss-hero-suggest-footer .xnss-hot-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.xnss-hero-suggest-footer .xnss-hot-tag {
    padding: 5px 14px;
    font-size: 13px;
    border-radius: 20px;
    background: #fff;
    color: #475569;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
}

.xnss-hero-suggest-footer .xnss-hot-tag:hover {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}

/* 快捷搜索标签 */
.xnss-hero-quick {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.xnss-hero-quick-label {
    color: rgba(255,255,255,0.75);
    font-size: 12px;
}

.xnss-hero-quick-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.xnss-hero-quick-tag {
    display: inline-block;
    padding: 3px 10px;
    font-size: 12px;
    color: #fff;
    background: rgba(255,255,255,0.18);
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    line-height: 1.6;
}

.xnss-hero-quick-tag:hover {
    background: rgba(255,255,255,0.35);
    color: #fff;
    transform: translateY(-1px);
}

/* 响应式 */
@media (max-width: 768px) {
    .xnss-hero-search {
        padding: 40px 16px 35px;
        margin-bottom: 20px;
        border-radius: 12px;
    }

    .xnss-hero-title h1 {
        font-size: 24px;
    }

    .xnss-hero-subtitle {
        font-size: 14px;
    }

    .xnss-hero-input-wrap {
        padding: 4px 4px 4px 16px;
    }

    .xnss-hero-icon {
        font-size: 18px;
        margin-right: 8px;
    }

    .xnss-hero-input {
        font-size: 14px;
        padding: 12px 0;
    }

    .xnss-hero-btn {
        padding: 10px 18px;
        font-size: 14px;
    }

    .xnss-hero-btn span {
        display: none;
    }

    .xnss-hero-btn i {
        margin: 0;
    }

    .xnss-hero-quick-label {
        width: 100%;
        text-align: center;
        margin-bottom: 4px;
    }

    .xnss-hero-quick-tags {
        justify-content: center;
    }
}

