/* ============================================================
 * 全站搜索 - 全屏搜索面板
 * ============================================================ */

.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.96);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

.search-overlay.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0s linear 0s;
}

.search-overlay-close {
    position: absolute;
    top: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.search-overlay-close:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: rotate(90deg);
}

.search-overlay-form {
    width: 100%;
    max-width: 720px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px 4px;
    transition: border-color 0.2s ease;
}

.search-overlay-form:focus-within {
    border-color: #fff;
}

.search-overlay-icon {
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    flex-shrink: 0;
}

.search-overlay-form input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: 0;
    color: #fff;
    font-size: clamp(20px, 4vw, 32px);
    font-weight: 300;
    letter-spacing: 0.5px;
    padding: 12px 0;
    font-family: inherit;
}

.search-overlay-form input::placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-weight: 300;
}

.search-overlay-submit {
    background: #fff;
    color: #111;
    border: 0;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    font-family: inherit;
    flex-shrink: 0;
}

.search-overlay-submit:hover {
    background: #ddd;
}

.search-overlay-suggest {
    width: 100%;
    max-width: 720px;
    margin-top: 32px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    align-items: center;
}

.search-overlay-suggest > span {
    flex-shrink: 0;
}

.search-overlay-suggest a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 4px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    transition: all 0.2s ease;
}

.search-overlay-suggest a:hover {
    color: #111;
    background: #fff;
    border-color: #fff;
}

body.no-scroll {
    overflow: hidden;
}

@media (max-width: 640px) {
    .search-overlay {
        padding: 24px 16px;
    }
    .search-overlay-close {
        top: 16px;
        right: 16px;
    }
    .search-overlay-form {
        gap: 10px;
    }
    .search-overlay-icon {
        font-size: 18px;
    }
    .search-overlay-submit {
        padding: 10px 18px;
        font-size: 13px;
    }
}

/* ============================================================
 * 全站搜索 - 搜索结果页
 * ============================================================ */

/* 让 page-hero 紧凑一些，给下方搜索条留出空间。
   注意：.main-header 是 position:fixed，自身高度约 88-96px（24px*2 padding + logo），
   所以 padding-top 必须 ≥ 120px 才能让标题不被 header 遮挡。 */
.search-page .page-hero {
    padding: 120px 0 56px;
}

/* 顶部搜索条（粘性）
   fixed header 高度通过 main.js 写入 :root --header-h（默认 88px，scrolled 后 64px）
   sticky top 跟着 header 高度走，避免被遮也不会悬空 */
.search-bar-sticky {
    position: sticky;
    top: var(--header-h, 68px);
    z-index: 50;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid #eee;
    padding: 20px 0;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
    transition: top 0.3s ease;
}

.search-bar-form {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 4px 4px 4px 20px;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.search-bar-form:focus-within {
    border-color: #1a1a1a;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.06);
}

.search-bar-form > i {
    color: #888;
    font-size: 16px;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.search-bar-form:focus-within > i {
    color: #1a1a1a;
}

.search-bar-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: #999;
    background: #ececec;
    text-decoration: none;
    font-size: 12px;
    flex-shrink: 0;
    margin-left: -4px;
    transition: color 0.2s ease, background 0.2s ease;
}

.search-bar-clear:hover {
    color: #1a1a1a;
    background: #e0e0e0;
}

.search-bar-form input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 15px;
    padding: 14px 0;
    color: #1a1a1a;
    font-family: inherit;
    min-width: 0;
}

.search-bar-form input::placeholder {
    color: #aaa;
}

.search-bar-form button {
    background: #1a1a1a;
    color: #fff;
    border: 0;
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease, transform 0.1s ease;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.search-bar-form button:hover {
    background: #000;
}

.search-bar-form button:active {
    transform: translateY(1px);
}

/* 5 个 tab
   位置 = header 高度 + 搜索条实际高度（由 main.js 写入 --search-bar-h）
   用 calc 累加，避免基于 padding 的估算造成覆盖或悬空 */
.search-tabs {
    background: #fff;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: calc(var(--header-h, 88px) + var(--search-bar-h, 68px));
    z-index: 49;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    transition: top 0.3s ease;
}

.search-tabs .container {
    display: flex;
    align-items: stretch;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.search-tabs .container::-webkit-scrollbar {
    display: none;
}

.search-tab {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 20px 26px;
    color: #666;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
    position: relative;
}

.search-tab:hover {
    color: #1a1a1a;
    background: rgba(0, 0, 0, 0.02);
}

.search-tab.active {
    color: #1a1a1a;
    border-bottom-color: #1a1a1a;
}

.search-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 12px;
    font-weight: 500;
    color: #888;
    background: #f0f0f0;
    border-radius: 10px;
    transition: color 0.2s ease, background 0.2s ease;
    line-height: 1;
}

.search-tab.active .search-tab-count {
    color: #fff;
    background: #1a1a1a;
}

/* tab pane 容器 */
.search-tab-pane {
    max-width: 1320px;
    margin: 0 auto;
    padding: 40px 32px 96px;
    min-height: 50vh;
    box-sizing: border-box;
}

@media (min-width: 1280px) {
    .search-tab-pane {
        padding-left: 40px;
        padding-right: 40px;
    }
}

/* 搜索页内 grid 容器：原页面自身带的 padding: 0 40px 在这里和外层 tab-pane padding 叠加过大，
   搜索页内让它们外间距为 0，交给 .search-tab-pane 统一管理 */
.search-page .scene-category-grid,
.search-page .projects-grid,
.search-page .articles-grid {
    padding-left: 0;
    padding-right: 0;
    margin-top: 0;
}

.search-pane {
    display: none;
    margin-bottom: 64px;
}

.search-pane:last-child {
    margin-bottom: 0;
}

.search-pane.active {
    display: block;
}

.search-pane-header {
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.search-pane-title {
    font-size: 22px;
    font-weight: 500;
    color: #1a1a1a;
    margin: 0;
    display: flex;
    align-items: baseline;
    gap: 10px;
    letter-spacing: 0.5px;
}

.search-pane-count {
    font-size: 14px;
    color: #999;
    font-weight: 400;
}

.search-pane-meta {
    font-size: 13px;
    color: #999;
}

/* 空态 */
.search-empty {
    padding: 60px 20px;
    text-align: center;
    color: #999;
    font-size: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.search-empty::before {
    content: "";
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: #f5f5f5;
    background-image: linear-gradient(135deg, transparent 49%, #d0d0d0 49%, #d0d0d0 51%, transparent 51%),
        linear-gradient(45deg, transparent 49%, #d0d0d0 49%, #d0d0d0 51%, transparent 51%);
    background-size: 16px 16px;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.55;
}

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

.search-empty-large {
    padding: 140px 20px;
    font-size: 18px;
    color: #666;
}

.search-empty-large::before {
    width: 80px;
    height: 80px;
    background-size: 22px 22px;
    opacity: 0.5;
}

/* 搜索结果网格 - 复用原页面的 grid 容器，这里只补充布局细节 */
.search-grid {
    width: 100%;
}

.search-dealers-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* 响应式 */
@media (max-width: 1024px) {
    .search-dealers-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    .search-tab {
        padding: 18px 22px;
    }
    .search-tabs {
        top: calc(var(--header-h, 64px) + var(--search-bar-h, 60px));
    }
    .search-tab-pane {
        padding-left: 24px;
        padding-right: 24px;
    }
}

@media (max-width: 640px) {
    .search-page .page-hero {
        padding: 80px 0 40px;
    }
    .search-bar-sticky {
        padding: 14px 0;
    }
    .search-bar-form {
        padding: 4px 4px 4px 14px;
        gap: 8px;
    }
    .search-bar-form input {
        font-size: 14px;
        padding: 12px 0;
    }
    .search-bar-form button {
        padding: 10px 14px;
        font-size: 13px;
    }
    .search-bar-form button > i {
        font-size: 13px;
    }
    .search-bar-form button > span {
        display: none;
    }
    .search-bar-clear {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    .search-tab {
        padding: 14px 18px;
        font-size: 14px;
    }
    .search-tab-count {
        min-width: 18px;
        height: 18px;
        font-size: 11px;
    }
    .search-tabs {
        top: calc(var(--header-h, 64px) + var(--search-bar-h, 56px));
    }
    .search-pane-title {
        font-size: 18px;
    }
    .search-pane-header {
        margin-bottom: 20px;
        padding-bottom: 14px;
    }
    .search-dealers-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .search-tab-pane {
        padding: 28px 16px 72px;
    }
    .search-empty-large {
        padding: 100px 20px;
        font-size: 16px;
    }
    .search-empty-large::before {
        width: 64px;
        height: 64px;
    }
}
