/**
 * 搜索下拉弹窗样式
 * 契合zibll主题设计的简约搜索弹窗
 */

/* ===== 搜索触发器 ===== */
.cxzzt-search-trigger {
    position: relative;
    display: inline-block;
}

/* ===== 搜索下拉弹窗主容器 ===== */
.cxzzt-search-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 440px;
    max-width: 90vw;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, var(--main-bg-color) 100%);
    border-radius: 22px;
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.16);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.24s ease, visibility 0.24s ease, transform 0.24s ease, box-shadow 0.24s ease;
    z-index: 1001; /* 确保在遮罩层之上 */
    margin-top: 10px;
    border: 1px solid rgba(255, 96, 0, 0.12);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.cxzzt-search-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    box-shadow: 0 28px 64px rgba(15, 23, 42, 0.2);
}

/* ===== 弹窗内容区域 ===== */
.search-dropdown-content {
    padding: 22px;
}

/* ===== 搜索表单区域 ===== */
.search-form-section {
    margin-bottom: 20px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #fff7f0 0%, #ffffff 100%);
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(255, 96, 0, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 12px 24px rgba(15, 23, 42, 0.06);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.search-input-wrapper:focus-within {
    background: var(--main-bg-color);
    border-color: rgba(255, 96, 0, 0.28);
    box-shadow: 0 0 0 4px rgba(255, 96, 0, 0.1), 0 20px 36px rgba(255, 96, 0, 0.14);
    transform: translateY(-1px);
}

.search-input {
    flex: 1;
    padding: 15px 18px;
    border: none;
    background: transparent;
    font-size: 15px;
    font-weight: 500;
    color: var(--main-color);
    outline: none;
}

.search-input::placeholder {
    color: #98a2b3;
}

.search-submit-btn {
    padding: 0 18px;
    min-height: 52px;
    border: none;
    background: linear-gradient(135deg, #ff7b1b 0%, #ff5b2e 100%);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.search-submit-btn:hover {
    filter: brightness(1.03);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 12px 24px rgba(255, 96, 0, 0.22);
}

.search-submit-btn:focus {
    outline: none;
}

.search-submit-btn:focus-visible {
    box-shadow: 0 0 0 4px rgba(255, 96, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.search-submit-btn:active {
    transform: scale(0.98);
}

.search-submit-btn i {
    font-size: 16px;
}

body.theme-dark .cxzzt-search-dropdown {
    background: linear-gradient(180deg, rgba(34, 40, 49, 0.98) 0%, rgba(27, 33, 40, 0.98) 100%);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.36);
}

body.theme-dark .search-input-wrapper {
    background: linear-gradient(135deg, #313943 0%, #242b34 100%);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 12px 24px rgba(0, 0, 0, 0.22);
}

body.theme-dark .search-input-wrapper:focus-within {
    border-color: rgba(255, 176, 117, 0.3);
    box-shadow: 0 0 0 4px rgba(255, 176, 117, 0.1), 0 18px 32px rgba(0, 0, 0, 0.3);
}

body.theme-dark .search-input {
    color: #f3f4f6;
}

body.theme-dark .search-input::placeholder {
    color: #9aa6b6;
}

/* ===== 搜索区域通用样式 ===== */
.search-section {
    margin-bottom: 16px;
}

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

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--main-color);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-title i {
    color: var(--muted-color);
    font-size: 13px;
}

/* ===== 关键词标签样式 ===== */
.keyword-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.keyword-tags .search_keywords {
    padding: 6px 12px;
    background: var(--muted-border-color);
    color: var(--main-color);
    text-decoration: none;
    border-radius: 16px;
    font-size: 13px;
    transition: all 0.2s ease;
    border: none;
    display: inline-block;
}

.keyword-tags .search_keywords:hover {
    background: var(--focus-color);
    color: #fff;
    transform: translateY(-1px);
}

/* ===== 热门搜索特殊样式 ===== */
.hot-search-section .section-title i {
    color: #ff6b35;
}

/* ===== 历史搜索特殊样式 ===== */
.history-search-section .section-title i {
    color: var(--muted-color);
}

.clear-history-btn {
    padding: 4px 8px;
    border: none;
    background: transparent;
    color: var(--muted-2-color);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 12px;
}

.clear-history-btn:hover {
    background: var(--muted-border-color);
    color: var(--main-color);
}

/* ===== 搜索建议样式 ===== */
.search-suggestions {
    border-top: 1px solid var(--muted-border-color);
    padding-top: 16px;
    margin-top: 16px;
}

.suggestions-list {
    max-height: 200px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-bottom: 1px solid var(--muted-border-color);
}

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

.suggestion-item:hover {
    background: var(--muted-border-color);
    transform: translateX(2px);
}

/* 建议项图标 */
.suggestion-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background: var(--muted-bg-color);
}

.suggestion-icon i {
    font-size: 12px;
    color: var(--muted-color);
}

/* 建议项内容 */
.suggestion-content {
    flex: 1;
    min-width: 0;
}

.suggestion-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--main-color);
    margin-bottom: 4px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggestion-excerpt {
    font-size: 12px;
    color: var(--muted-color);
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.suggestion-meta {
    font-size: 11px;
    color: var(--muted-2-color);
}

/* 建议项缩略图 */
.suggestion-thumb {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
}

.suggestion-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 软件类型建议项 */
.software-suggestion {
    border-left: 3px solid #ff8c2a;
}

.software-suggestion .suggestion-thumb--logo {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: 2px;
}

.software-suggestion .suggestion-title {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.suggestion-tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.5;
}

.suggestion-tag--type {
    background: linear-gradient(135deg, #ff8c2a, #ff6a00);
    color: #fff;
    letter-spacing: 0.5px;
}

.suggestion-tag--ver {
    background: rgba(44, 123, 229, 0.12);
    color: #2c7be5;
    font-weight: 500;
}

.software-suggestion .suggestion-meta {
    display: flex;
    gap: 10px;
    font-size: 11.5px;
    color: var(--muted-color, #888);
}

.suggestion-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.suggestion-meta-item + .suggestion-meta-item::before {
    content: "·";
    margin-right: 6px;
    opacity: 0.5;
}

/* 不同类型建议的图标颜色 */
.post-suggestion .suggestion-icon {
    background: rgba(52, 152, 219, 0.1);
}

.post-suggestion .suggestion-icon i {
    color: #3498db;
}

.tag-suggestion .suggestion-icon {
    background: rgba(46, 204, 113, 0.1);
}

.tag-suggestion .suggestion-icon i {
    color: #2ecc71;
}

.category-suggestion .suggestion-icon {
    background: rgba(155, 89, 182, 0.1);
}

.category-suggestion .suggestion-icon i {
    color: #9b59b6;
}

/* 加载状态 */
.suggestion-loading .suggestion-icon {
    background: rgba(52, 152, 219, 0.1);
}

.suggestion-loading .suggestion-icon i {
    color: #3498db;
}

/* 无结果状态 */
.suggestion-no-results .suggestion-icon {
    background: rgba(149, 165, 166, 0.1);
}

.suggestion-no-results .suggestion-icon i {
    color: #95a5a6;
}

.search-anyway-btn {
    margin-top: 8px;
    padding: 6px 12px;
    background: var(--focus-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-anyway-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* 错误状态 */
.suggestion-error .suggestion-icon {
    background: rgba(231, 76, 60, 0.1);
}

.suggestion-error .suggestion-icon i {
    color: #e74c3c;
}

/* ===== 空状态样式 ===== */
.empty-state {
    text-align: center;
    padding: 20px;
}

.empty-content {
    color: var(--muted-color);
}

.empty-content i {
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-content p {
    margin: 0;
    font-size: 14px;
}



/* ===== 响应式设计 ===== */
@media (max-width: 767px) {
    .cxzzt-search-dropdown {
        width: 350px;
        right: -10px;
    }
    
    .search-dropdown-content {
        padding: 16px;
    }
    
    .search-input {
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    .keyword-tags {
        gap: 6px;
    }
    
    .keyword-tags .search_keywords {
        padding: 5px 10px;
        font-size: 12px;
    }

    /* 移动端搜索建议优化 */
    .suggestion-item {
        padding: 10px;
        gap: 10px;
    }

    .suggestion-icon {
        width: 20px;
        height: 20px;
    }

    .suggestion-title {
        font-size: 13px;
    }

    .suggestion-excerpt {
        font-size: 11px;
        -webkit-line-clamp: 1;
        line-clamp: 1;
    }

    .suggestion-thumb {
        width: 32px;
        height: 32px;
    }

    .search-anyway-btn {
        padding: 5px 10px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .cxzzt-search-dropdown {
        width: 320px;
        right: -20px;
    }
    
    .search-dropdown-content {
        padding: 14px;
    }
    
    .section-title {
        font-size: 13px;
    }
}

/* ===== 暗色模式支持 ===== */
.dark-theme .cxzzt-search-dropdown {
    background: var(--main-bg-color);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.dark-theme .search-input-wrapper {
    background: var(--muted-bg-color);
}

.dark-theme .search-input-wrapper:focus-within {
    background: var(--main-bg-color);
}

.dark-theme .keyword-tags .search_keywords {
    background: var(--muted-bg-color);
    color: var(--main-color);
}

.dark-theme .cxzzt-search-overlay {
    background: rgba(0, 0, 0, 0.2);
}

/* 2026-03-26 搜索卡片改为平直导航风格 */
.cxzzt-search-dropdown {
    width: 456px;
    max-width: min(456px, calc(100vw - 32px));
    margin-top: 8px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.cxzzt-search-dropdown.show {
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.1);
}

.search-dropdown-content {
    padding: 18px 18px 16px;
}

.search-form-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eceff3;
}

.search-input-wrapper {
    min-height: 54px;
    background: #ffffff;
    border: 1px solid #d7dce3;
    border-radius: 0;
    box-shadow: none;
}

.search-input-wrapper:focus-within {
    background: #ffffff;
    border-color: #ff6a1a;
    box-shadow: none;
    transform: none;
}

.search-input {
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 500;
}

.search-input::placeholder {
    color: #a0a8b4;
}

.search-submit-btn {
    align-self: stretch;
    min-width: 58px;
    padding: 0 18px;
    border-left: 1px solid rgba(255, 106, 26, 0.22);
    background: #ff6a1a;
    border-radius: 0;
    box-shadow: none;
    transition: background-color 0.2s ease;
}

.search-submit-btn:hover,
.search-submit-btn:focus-visible {
    background: #f15c0a;
    box-shadow: none;
}

.search-submit-btn:active {
    transform: none;
    background: #dc5206;
}

.search-section {
    margin-bottom: 14px;
}

.section-header {
    margin-bottom: 10px;
}

.section-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #4b5563;
    text-transform: uppercase;
}

.section-title i {
    color: #ff6a1a;
}

.keyword-tags {
    gap: 8px;
}

.keyword-tags .search_keywords {
    padding: 7px 10px;
    background: #f7f8fa;
    border: 1px solid #e7eaf0;
    border-radius: 0;
    color: #4b5563;
}

.keyword-tags .search_keywords:hover {
    background: #fff4ec;
    border-color: #ffd2b7;
    color: #ff6a1a;
    transform: none;
}

.clear-history-btn {
    padding: 0;
    color: #98a2b3;
    border-radius: 0;
}

.clear-history-btn:hover {
    color: #ff6a1a;
    background: transparent;
}

body.theme-dark .cxzzt-search-dropdown,
.dark-theme .cxzzt-search-dropdown {
    background: #1f2329;
    border-color: #323844;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

body.theme-dark .search-form-section,
.dark-theme .search-form-section {
    border-bottom-color: #323844;
}

body.theme-dark .search-input-wrapper,
.dark-theme .search-input-wrapper {
    background: #171b21;
    border-color: #323844;
    box-shadow: none;
}

body.theme-dark .search-input-wrapper:focus-within,
.dark-theme .search-input-wrapper:focus-within {
    background: #171b21;
    border-color: #ff8a45;
    box-shadow: none;
}

body.theme-dark .keyword-tags .search_keywords,
.dark-theme .keyword-tags .search_keywords {
    background: #171b21;
    border-color: #323844;
    color: #d2d7df;
}

body.theme-dark .keyword-tags .search_keywords:hover,
.dark-theme .keyword-tags .search_keywords:hover {
    background: rgba(255, 106, 26, 0.12);
    border-color: rgba(255, 138, 69, 0.3);
    color: #ffb182;
}

@media (max-width: 767px) {
    .cxzzt-search-dropdown {
        width: min(360px, calc(100vw - 20px));
        right: 0;
    }
}

@media (max-width: 480px) {
    .cxzzt-search-dropdown {
        width: min(340px, calc(100vw - 16px));
        right: -8px;
    }

    .search-dropdown-content {
        padding: 14px;
    }
}

/* 2026-03-28 移动端搜索弹层改为视口居中紧凑版 */
@media (max-width: 767px) {
    .cxzzt-search-dropdown {
        position: fixed;
        top: calc(var(--header-h, 66px) + 8px);
        left: 50vw;
        right: auto;
        width: min(300px, calc(100vw - 24px));
        max-width: calc(100vw - 24px);
        margin-top: 0;
        border-radius: 14px;
        transform: translate(-50%, 8px);
        box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
    }

    .cxzzt-search-dropdown.show {
        transform: translate(-50%, 0);
    }

    .search-dropdown-content {
        padding: 12px;
    }

    .search-form-section {
        margin-bottom: 12px;
        padding-bottom: 12px;
    }

    .search-input-wrapper {
        min-height: 44px;
        border-radius: 10px;
    }

    .search-input {
        padding: 10px 12px;
        font-size: 15px;
        line-height: 1.4;
    }

    .search-submit-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 0 12px;
    }

    .search-submit-btn i {
        font-size: 14px;
    }

    .search-section {
        margin-bottom: 10px;
    }

    .section-header {
        margin-bottom: 8px;
    }

    .section-title {
        font-size: 12px;
    }

    .keyword-tags {
        gap: 6px;
    }

    .keyword-tags .search_keywords {
        padding: 5px 9px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .cxzzt-search-dropdown {
        width: min(280px, calc(100vw - 20px));
        max-width: calc(100vw - 20px);
        top: calc(var(--header-h, 66px) + 6px);
    }

    .search-dropdown-content {
        padding: 10px;
    }

    .search-input {
        padding: 9px 10px;
        font-size: 14px;
    }

    .search-submit-btn {
        min-width: 42px;
        padding: 0 10px;
    }
}
