/* 搜索功能样式 */

/* 搜索模态框 */
.qm-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
}

.qm-search-modal.active {
    display: flex;
}

.qm-search-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.qm-search-modal-content {
    position: relative;
    width: 90%;
    max-width: 700px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.qm-search-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: all 0.2s;
    z-index: 100;
    pointer-events: auto;
}

.qm-search-modal-close:hover {
    background: #e5e7eb;
    color: #374151;
    transform: scale(1.1);
}

/* 搜索表单 */
.qm-search-form {
    padding: 30px;
    border-bottom: 1px solid #e5e7eb;
}

.qm-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 0 16px;
    transition: all 0.2s;
}

.qm-search-input-wrapper:focus-within {
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.qm-search-icon {
    color: #9ca3af;
    margin-right: 12px;
    font-size: 18px;
}

.qm-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    padding: 14px 0;
    outline: none;
    color: #1f2937;
}

.qm-search-input::placeholder {
    color: #9ca3af;
}

.qm-search-submit {
    border: none;
    background: #3b82f6;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-left: 12px;
}

.qm-search-submit:hover {
    background: #2563eb;
    transform: scale(1.05);
}

/* 搜索建议 */
.qm-search-suggestions {
    max-height: 300px;
    overflow-y: auto;
    border-bottom: 1px solid #e5e7eb;
}

.qm-suggestions-list {
    padding: 10px 0;
}

.qm-suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 30px;
    color: #374151;
    text-decoration: none;
    transition: background 0.2s;
}

.qm-suggestion-item:hover {
    background: #f9fafb;
}

.qm-suggestion-item i {
    color: #9ca3af;
    width: 20px;
}

/* 搜索历史和热门搜索 */
.qm-search-footer {
    padding: 20px 30px;
    max-height: 400px;
    overflow-y: auto;
}

.qm-search-history-section,
.qm-popular-searches-section {
    margin-bottom: 24px;
}

.qm-search-history-section:last-child,
.qm-popular-searches-section:last-child {
    margin-bottom: 0;
}

.qm-search-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
}

.qm-clear-history {
    border: none;
    background: none;
    color: #3b82f6;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.qm-clear-history:hover {
    background: #eff6ff;
}

.qm-search-history,
.qm-popular-searches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.qm-search-history-item,
.qm-popular-search-item {
    padding: 6px 14px;
    background: #f3f4f6;
    border-radius: 20px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.qm-search-history-item:hover,
.qm-popular-search-item:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.qm-empty-state {
    color: #9ca3af;
    font-size: 13px;
    padding: 20px;
    text-align: center;
}

/* 搜索结果页面 */
.qm-search-results {
    padding: 0px 0;
}

@media (min-width: 1024px) {
    .qm-search-results {
        padding: 0 24px;
    }
}

@media (min-width: 1280px) {
    .qm-search-results {
        padding: 0 32px;
    }
}

@media (min-width: 1536px) {
    .qm-search-results {
        padding: 0 40px;
    }
}

/* 搜索结果顶部栏（统计+筛选） */
.qm-search-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px 24px;
    padding-bottom: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}

.qm-search-top-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
    opacity: 0.8;
}

.qm-search-header {
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    border: none;
}

.qm-search-title-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qm-search-title-icon {
    font-size: 24px;
    color: #3b82f6;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.qm-search-title {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    text-align: left;
    position: relative;
}

.qm-search-count {
    color: #3b82f6;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    display: inline-block;
}

.qm-search-count::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 2px;
    opacity: 0.6;
}

.qm-search-keyword {
    font-size: 16px;
    color: #6b7280;
    text-align: center;
}

.qm-search-keyword strong {
    color: #1f2937;
}

/* 搜索筛选 */
.qm-search-filters {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.qm-search-filters:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.qm-filter-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.qm-filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.qm-filter-group label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    white-space: nowrap;
}

.qm-filter-select {
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    min-width: 100px;
}

.qm-filter-select:focus {
    border-color: #3b82f6;
}

.qm-filter-submit {
    padding: 8px 16px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
    position: relative;
    overflow: hidden;
}

.qm-filter-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.qm-filter-submit:hover {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.qm-filter-submit:hover::before {
    left: 100%;
}

/* 搜索结果使用首页卡片样式，无需额外样式 */

/* 搜索关键词高亮 */
.qm-search-highlight {
    background: #fef3c7;
    color: #92400e;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

/* 无结果页面 */
.qm-search-no-results {
    text-align: center;
    padding: 60px 20px;
}

.qm-no-results-icon {
    font-size: 64px;
    color: #d1d5db;
    margin-bottom: 20px;
}

.qm-search-no-results h3 {
    font-size: 24px;
    color: #1f2937;
    margin-bottom: 12px;
}

.qm-search-no-results p {
    font-size: 16px;
    color: #6b7280;
    margin-bottom: 40px;
}

.qm-recommended-content {
    margin-top: 40px;
    text-align: left;
}

.qm-recommended-content h4 {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 20px;
}

.qm-recommended-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.qm-recommended-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s;
}

.qm-recommended-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.qm-recommended-thumb {
    display: block;
    width: 100%;
    height: 120px;
    overflow: hidden;
    background: #f3f4f6;
}

.qm-recommended-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.qm-recommended-title {
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    margin: 0;
}

.qm-recommended-title a {
    color: #1f2937;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.qm-recommended-title a:hover {
    color: #3b82f6;
}

/* 分页 */
/* 搜索结果页分页样式 */
.qm-search-results .mt-8 {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.qm-search-results .pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0 auto;
    flex-wrap: wrap;
}

.qm-search-results .pagination .nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.qm-search-results .pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.qm-search-results .pagination .page-numbers:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.qm-search-results .pagination .page-numbers.current {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
    cursor: default;
}

.qm-search-results .pagination .page-numbers.prev,
.qm-search-results .pagination .page-numbers.next {
    min-width: 40px;
}

.qm-search-results .pagination .page-numbers.dots {
    border: none;
    background: transparent;
    box-shadow: none;
    cursor: default;
    min-width: auto;
    padding: 0 4px;
}

.qm-search-results .pagination .page-numbers.dots:hover {
    background: transparent;
    transform: none;
    box-shadow: none;
}

/* 搜索结果页分页暗色模式 */
.dark .qm-search-results .pagination .page-numbers,
body.dark-mode .qm-search-results .pagination .page-numbers,
.dark .pagination .page-numbers,
body.dark-mode .pagination .page-numbers {
    background: #1f2937 !important;
    border-color: #374151 !important;
    color: #e5e7eb !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
}

.dark .qm-search-results .pagination .page-numbers:hover,
body.dark-mode .qm-search-results .pagination .page-numbers:hover,
.dark .pagination .page-numbers:hover,
body.dark-mode .pagination .page-numbers:hover {
    border-color: #60a5fa !important;
    color: #60a5fa !important;
    background: #1e3a5f !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(96, 165, 250, 0.3) !important;
}

.dark .qm-search-results .pagination .page-numbers.current,
body.dark-mode .qm-search-results .pagination .page-numbers.current,
.dark .pagination .page-numbers.current,
body.dark-mode .pagination .page-numbers.current {
    background: linear-gradient(90deg, #60a5fa, #a78bfa) !important;
    color: #fff !important;
    border-color: #60a5fa !important;
    box-shadow: 0 4px 10px rgba(96, 165, 250, 0.4) !important;
    transform: translateY(-1px);
}

.dark .qm-search-results .pagination .page-numbers.prev,
.dark .qm-search-results .pagination .page-numbers.next,
body.dark-mode .qm-search-results .pagination .page-numbers.prev,
body.dark-mode .qm-search-results .pagination .page-numbers.next,
.dark .pagination .page-numbers.prev,
.dark .pagination .page-numbers.next,
body.dark-mode .pagination .page-numbers.prev,
body.dark-mode .pagination .page-numbers.next {
    background: #1f2937 !important;
    border-color: #374151 !important;
    color: #e5e7eb !important;
}

.dark .qm-search-results .pagination .page-numbers.prev:hover,
.dark .qm-search-results .pagination .page-numbers.next:hover,
body.dark-mode .qm-search-results .pagination .page-numbers.prev:hover,
body.dark-mode .qm-search-results .pagination .page-numbers.next:hover,
.dark .pagination .page-numbers.prev:hover,
.dark .pagination .page-numbers.next:hover,
body.dark-mode .pagination .page-numbers.prev:hover,
body.dark-mode .pagination .page-numbers.next:hover {
    border-color: #60a5fa !important;
    color: #60a5fa !important;
    background: #1e3a5f !important;
}

.dark .qm-search-results .pagination .page-numbers.dots,
body.dark-mode .qm-search-results .pagination .page-numbers.dots,
.dark .pagination .page-numbers.dots,
body.dark-mode .pagination .page-numbers.dots {
    background: transparent !important;
    color: #6b7280 !important;
    border-color: transparent !important;
}

.dark .qm-search-results .pagination .page-numbers.dots:hover,
body.dark-mode .qm-search-results .pagination .page-numbers.dots:hover,
.dark .pagination .page-numbers.dots:hover,
body.dark-mode .pagination .page-numbers.dots:hover {
    background: transparent !important;
    color: #6b7280 !important;
    transform: none;
    box-shadow: none !important;
}

/* 搜索结果顶部栏暗色模式 */
.dark .qm-search-top-bar {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: #334155;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark .qm-search-top-bar::before {
    background: linear-gradient(90deg, #60a5fa, #a78bfa, #f472b6);
}

.dark .qm-search-title {
    color: #f1f5f9;
}

.dark .qm-search-title-icon {
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dark .qm-search-count {
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dark .qm-search-count::after {
    background: linear-gradient(90deg, #60a5fa, #a78bfa);
}

.dark .qm-search-filters {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(51, 65, 85, 0.8);
}

.dark .qm-search-filters:hover {
    background: rgba(30, 41, 59, 0.95);
}

/* 暗色模式 */
.dark .qm-search-modal-content {
    background: #1f2937;
}

.dark .qm-search-input-wrapper {
    background: #374151;
    border-color: #4b5563;
}

.dark .qm-search-input-wrapper:focus-within {
    background: #374151;
    border-color: #60a5fa;
}

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

.dark .qm-search-suggestions {
    border-bottom-color: #374151;
}

.dark .qm-suggestion-item {
    color: #d1d5db;
}

.dark .qm-suggestion-item:hover {
    background: #374151;
}

.dark .qm-search-history-item,
.dark .qm-popular-search-item {
    background: #374151;
    color: #d1d5db;
}

.dark .qm-search-history-item:hover,
.dark .qm-popular-search-item:hover {
    background: #4b5563;
}

.dark .qm-search-item {
    background: #374151;
    border-color: #4b5563;
}

.dark .qm-search-item:hover {
    border-color: #60a5fa;
}

.dark .qm-search-item-title a {
    color: #f3f4f6;
}

.dark .qm-search-item-excerpt {
    color: #9ca3af;
}

.dark .qm-recommended-item {
    background: #374151;
    border-color: #4b5563;
}

.dark .qm-recommended-title a {
    color: #f3f4f6;
}

/* 响应式 */
@media (max-width: 768px) {
    .qm-search-modal {
        padding-top: 20px;
    }

    .qm-search-modal-content {
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .qm-search-item {
        flex-direction: column;
    }

    .qm-search-item-thumb {
        width: 100%;
        height: 200px;
    }

    .qm-search-top-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding-bottom: 12px;
        margin-bottom: 16px;
    }

    .qm-search-header {
        padding: 0;
        margin: 0;
        border: none;
    }

    .qm-search-title {
        font-size: 18px;
        text-align: center;
    }

    .qm-search-filters {
        flex: none;
        min-width: auto;
    }

    .qm-search-keyword {
        font-size: 14px;
    }

    .qm-search-filters {
        padding: 10px 12px;
        margin-bottom: 16px;
    }

    .qm-filter-form {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }

    .qm-filter-group {
        flex-direction: row;
        align-items: center;
        gap: 6px;
        flex: 1;
        min-width: 0;
    }

    .qm-filter-group label {
        font-size: 12px;
        flex-shrink: 0;
    }

    .qm-filter-select {
        flex: 1;
        padding: 8px 10px;
        font-size: 12px;
        min-width: 0;
    }

    .qm-filter-submit {
        padding: 8px 14px;
        font-size: 12px;
        flex-shrink: 0;
    }
}

