/* ========== 页面兜底 ========== */
html, body.search-page { height: 100%; }
body.search-page {
    background: #f7f8fa !important;
    background-color: #f7f8fa !important;
    color: #1f2937;
    margin: 0;
    padding: 0;
    font-family: "PingFang SC", "DFPKingGothicGB-Regular",
                 "Microsoft YaHei", "Source Han Sans CN", "Noto Sans CJK SC",
                 "HarmonyOS Sans SC", -apple-system, BlinkMacSystemFont,
                 "Segoe UI", sans-serif !important;
    font-size: 14px;
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* 搜索页所有元素强制统一字体，避免落到宋体 */
body.search-page,
body.search-page h1, body.search-page h2, body.search-page h3,
body.search-page h4, body.search-page h5, body.search-page h6,
body.search-page p, body.search-page span, body.search-page a,
body.search-page li, body.search-page td, body.search-page th,
body.search-page label, body.search-page input, body.search-page textarea,
body.search-page select, body.search-page button, body.search-page div,
body.search-page section, body.search-page article, body.search-page aside,
body.search-page header, body.search-page footer, body.search-page nav,
body.search-page blockquote, body.search-page table, body.search-page form,
body.search-page code, body.search-page pre, body.search-page kbd {
    font-family: "PingFang SC", "DFPKingGothicGB-Regular",
                 "Microsoft YaHei", "Source Han Sans CN", "Noto Sans CJK SC",
                 "HarmonyOS Sans SC", -apple-system, BlinkMacSystemFont,
                 "Segoe UI", sans-serif !important;
}
body.search-page * { box-sizing: border-box; }
body.search-page a { text-decoration: none; color: inherit; }
body.search-page img { max-width: 100%; display: block; }
body.search-page button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ========== 主体 ========== */
.search-main {
    min-height: calc(100vh - 64px);
    padding: 48px 0 80px;
}
.search-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== 搜索 Hero ========== */
.search-hero {
    position: relative;
    background: #fff;
    border-radius: 20px;
    padding: 52px 56px 44px;
    border: 1px solid #eceef2;
    overflow: hidden;
}
/* Hero 顶部微渐变装饰 */
.search-hero::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899, #6366f1);
    background-size: 200% 100%;
    animation: hero-line 6s linear infinite;
}
@keyframes hero-line {
    0% { background-position: 0% 0; }
    100% { background-position: 200% 0; }
}

.search-hero-title {
    text-align: center;
    margin-bottom: 32px;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #6366f1;
    background: linear-gradient(135deg, rgba(99,102,241,.08), rgba(139,92,246,.08));
    border-radius: 999px;
    margin-bottom: 14px;
    letter-spacing: 0.3px;
}
.search-hero-title h1 {
    margin: 0 0 10px 0;
    font-size: 34px;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.3px;
}
.search-hero-title h1 .accent {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.search-hero-title p {
    margin: 0;
    color: #6b7280;
    font-size: 15.5px;
}

/* ===== 新搜索框：单层 sb-group，不再包套 ===== */
.sb-box {
    max-width: 760px;
    margin: 0 auto 28px;
}
.sb-group {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 58px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 6px 6px 6px 18px;
    transition: all 0.25s ease;
}
.sb-group:focus-within {
    background: #fff;
    border-color: #c7d2fe;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1), 0 6px 16px rgba(99, 102, 241, 0.08);
}
.sb-icon {
    color: #9ca3af;
    flex-shrink: 0;
    transition: color 0.2s;
    display: flex;
    align-items: center;
}
.sb-icon svg { display: block; }
.sb-group:focus-within .sb-icon { color: #6366f1; }
.sb-input {
    flex: 1;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15.5px;
    padding: 0 4px;
    color: #111827;
    min-width: 0;
}
.sb-input::placeholder { color: #9ca3af; font-size: 14.5px; }
.sb-clear {
    width: 32px; height: 32px;
    border-radius: 10px;
    color: #9ca3af;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    opacity: 0; visibility: hidden;
    transition: all 0.2s;
}
.sb-group:focus-within .sb-clear,
.sb-group .sb-input:not(:placeholder-shown) ~ .sb-clear { opacity: 1; visibility: visible; }
.sb-clear:hover { background: #f3f4f6; color: #6366f1; }
.sb-sep {
    width: 1px; height: 24px; background: #e5e7eb; flex-shrink: 0;
    transition: background 0.2s;
}
.sb-group:focus-within .sb-sep { background: #e5e7eb; }
.sb-btn {
    height: 44px;
    padding: 0 22px;
    border-radius: 12px;
    background-color: #6366f1 !important;
    background: #6366f1 linear-gradient(135deg, #6366f1, #8b5cf6) !important;
    color: #fff !important;
    font-size: 15px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.22s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
    overflow: hidden;
    white-space: nowrap;
}
.sb-btn svg { color: #fff !important; }
.sb-btn:hover {
    transform: translateY(-1px);
    background-color: #5856e8 !important;
    background: #5856e8 linear-gradient(135deg, #5856e8, #7c3aed) !important;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}
.sb-btn:active { transform: translateY(0); }

/* 热门搜索 */
.hot-search {
    max-width: 100%;
    width: 100%;
    margin: 0;
}
.hs-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #ef4444;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 12px;
}
.hs-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.hs-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px 7px 9px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #eceef2;
    font-size: 13px;
    color: #4b5563;
    transition: all 0.2s ease;
}
.hs-item:hover {
    background: #fff;
    border-color: #c7d2fe;
    color: #6366f1;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(99, 102, 241, 0.08);
}
.hs-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: #e5e7eb;
    color: #6b7280;
    font-size: 12px;
    font-weight: 700;
    font-style: normal;
    line-height: 1;
}
.hs-rank.hot {
    background: linear-gradient(135deg, #f97316, #ef4444);
    color: #fff;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
}

/* ========== 搜索结果 ========== */
.search-result { margin-top: 32px; }

.sr-head {
    background: #fff;
    border-radius: 16px;
    padding: 20px 28px 0;
    border: 1px solid #eceef2;
    margin-bottom: 20px;
}
.sr-head-left {
    display: flex;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.sr-head-left h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}
.sr-count {
    font-size: 13.5px;
    color: #6b7280;
}
.sr-count em { color: #6366f1; font-style: normal; font-weight: 600; }

.sr-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    position: relative;
    border-top: 1px solid #f3f4f6;
    padding-top: 14px;
    margin: 0 -28px;
    padding-left: 28px;
    padding-right: 28px;
    overflow-x: auto;
}
.sr-tabs::-webkit-scrollbar { display: none; }
.rtab {
    position: relative;
    display: inline-block;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s;
    white-space: nowrap;
    z-index: 1;
}
.rtab:hover { color: #6366f1; background: #fafafa; }
.rtab.active { color: #6366f1; font-weight: 600; background: transparent; }
.rtab-line {
    position: absolute;
    bottom: 0;
    height: 2.5px;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== 新卡片：学习笔记风格 ========== */
body.search-page .waterfall {
    column-count: 5;
    column-gap: 14px;
}
.wf-card {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    display: block;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #eceef2;
    margin-bottom: 14px;
    transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.wf-card:hover {
    transform: translateY(-4px);
    border-color: #e0e7ff;
    box-shadow: 0 14px 28px -8px rgba(17, 24, 39, 0.12), 0 4px 10px rgba(99, 102, 241, 0.06);
}

.wf-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f3ff, #eef2ff);
    display: flex;
    align-items: center;
    justify-content: center;
}
.wf-cover.cover-tall { aspect-ratio: 3 / 4; }
.wf-cover.cover-wide { aspect-ratio: 16 / 10; }

/* 分类徽章 */
.wf-cat {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    padding: 5px 10px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.92);
    color: #fff;
    backdrop-filter: blur(6px);
    letter-spacing: 0.2px;
}
.wf-cat.news { background: rgba(239, 68, 68, 0.92); }
.wf-cat.activity { background: rgba(249, 115, 22, 0.92); }
.wf-cat.course { background: rgba(16, 185, 129, 0.92); }

/* Logo 居中（工具类卡片） */
.wf-logo {
    width: 58%;
    height: 58%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 4px 14px rgba(17, 24, 39, 0.08);
    transition: transform 0.4s ease;
}
.wf-card:hover .wf-logo { transform: scale(1.05) rotate(-1deg); }
.wf-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 资讯类封面（整图） */
.wf-img {
    width: 100%;
    height: 100%;
}
.wf-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.wf-card:hover .wf-img img { transform: scale(1.06); }

/* 正文 */
.wf-body {
    padding: 14px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.wf-body h3 {
    margin: 0;
    font-size: 14.5px;
    font-weight: 600;
    color: #111827;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}
.wf-card:hover .wf-body h3 { color: #6366f1; }
.wf-body p {
    margin: 0 0 4px 0;
    font-size: 12.5px;
    color: #6b7280;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 底部 meta */
.wf-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 2px;
}
.wf-meta-bottom {
    margin-top: 4px;
    border-top: 1px dashed #f0f1f5;
    padding-top: 10px;
    gap: 8px;
}

.wf-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.wf-tags span {
    font-size: 11.5px;
    color: #6366f1;
    padding: 3px 8px;
    background: #eef2ff;
    border-radius: 6px;
    font-weight: 500;
    line-height: 1.6;
}

.wf-views {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #9ca3af;
}

.wf-sub {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
}
.wf-sub span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #9ca3af;
}
.wf-sub span + span { margin-left: auto; }

/* ========== 分页 ========== */
body.search-page .pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 44px;
    flex-wrap: wrap;
}
.pg-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.pg-btn:hover:not([disabled]):not(.active) {
    border-color: #c7d2fe;
    color: #6366f1;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.1);
}
.pg-btn.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 14px rgba(99, 102, 241, 0.28);
}
.pg-btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}
.pg-prev, .pg-next {
    min-width: 38px;
}
.pg-ellipsis {
    color: #9ca3af;
    padding: 0 4px;
    font-size: 14px;
}
.pg-info {
    margin-left: 10px;
    font-size: 13px;
    color: #9ca3af;
}

/* ========== 登录弹窗按钮 · 强色彩兜底（防 style.css 缓存/渐变失效导致按钮变白） ========== */
body .auth-dialog .auth-submit {
    width: 100% !important;
    height: 48px !important;
    border: none !important;
    border-radius: 12px !important;
    background-color: #6366f1 !important;
    background-image: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
    background: #6366f1 linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
    color: #ffffff !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    line-height: 48px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.32) !important;
    transition: all 0.25s ease !important;
    margin-top: 4px !important;
    padding: 0 !important;
    display: block !important;
    text-align: center !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}
body .auth-dialog .auth-submit:hover {
    transform: translateY(-2px) !important;
    background-color: #5856e8 !important;
    background-image: linear-gradient(135deg, #5856e8 0%, #7c3aed 100%) !important;
    background: #5856e8 linear-gradient(135deg, #5856e8 0%, #7c3aed 100%) !important;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.42) !important;
}
body .auth-dialog .auth-submit:active {
    transform: translateY(0) !important;
}
/* 兜底：button 标签默认 reset 导致的白背景 */
body .auth-dialog button.auth-submit {
    background-color: #6366f1 !important;
    background: #6366f1 linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
}

/* 返回顶部 */
body.search-page .back-to-top {
    position: fixed;
    right: 24px;
    bottom: 92px;
    z-index: 98;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #fff;
    color: #6366f1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(17, 24, 39, 0.08), 0 0 0 1px rgba(17, 24, 39, 0.04);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: all 0.25s ease;
    user-select: none;
    border: none;
    padding: 0;
}
body.search-page .back-to-top:hover {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(99, 102, 241, 0.3);
}
body.search-page .back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ========== 响应式 ========== */
@media (max-width: 1400px) {
    .waterfall { column-count: 4; }
}
@media (max-width: 1180px) {
    .waterfall { column-count: 3; }
    .search-hero { padding: 44px 36px 36px; }
    .search-hero-title h1 { font-size: 30px; }
    .search-topbar-inner { padding: 0 20px; }
}
@media (max-width: 900px) {
    .waterfall { column-count: 2; column-gap: 12px; }
    .wf-card { margin-bottom: 12px; border-radius: 14px; }
    .search-nav { display: none; }
    .search-hero { padding: 36px 22px 28px; border-radius: 16px; }
    .search-hero-title h1 { font-size: 26px; }
    .sb-group { height: 52px; padding: 5px 5px 5px 14px; border-radius: 14px; gap: 8px; }
    .sb-btn { height: 40px; padding: 0 18px; font-size: 14px; }
    .sb-sep { display: none; }
    .sb-input { font-size: 14.5px; }
    .sr-head { padding: 16px 16px 0; border-radius: 14px; }
    .sr-head-left h2 { font-size: 18px; }
    .sr-tabs { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 640px) {
    .waterfall { column-count: 2; column-gap: 10px; }
    .wf-card { margin-bottom: 10px; border-radius: 12px; }
    .wf-body { padding: 12px 12px 14px; }
    .wf-body h3 { font-size: 13.5px; }
    .wf-body p { font-size: 12px; }
    .search-topbar-inner { padding: 0 14px; gap: 12px; height: 58px; }
    .search-logo span { display: none; }
    .top-login { display: none; }
    .search-main { padding: 28px 0 60px; }
    .search-container { padding: 0 12px; }
    .search-hero-title { margin-bottom: 22px; }
    .search-hero-title h1 { font-size: 22px; }
    .search-hero-title p { font-size: 13.5px; }
    .sb-btn { padding: 0 14px; border-radius: 10px; }
    .sb-btn span { display: none; }
    .hs-list { gap: 8px; }
    .hs-item { padding: 6px 10px; font-size: 12.5px; }
    .pg-info { display: none; }
}

