/**
 * 搜索页 - 样式文件
 * 设计风格：杂志编辑风 + 暖色调主题
 * 特点：精致的搜索体验、流畅的动画、优雅的交互
 */

/* ========================================
   迷你 Header
   ======================================== */
.mini-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    max-width: 680px;
    margin: 0 auto;
}

.mini-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.mini-back-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.mini-back-btn:active {
    transform: scale(0.95);
}

.mini-back-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.mini-category {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-category-name {
    font-size: 1rem;
    font-weight: 600;
    color: white;
}

.mini-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mini-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mini-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.mini-action-btn:active {
    transform: scale(0.95);
}

.mini-action-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* ========================================
   搜索区域
   ======================================== */
.search-section {
    background: linear-gradient(180deg, rgba(255, 251, 247, 0.98) 0%, rgba(255, 251, 247, 0.95) 100%);
    padding: 12px 16px 16px;
    border-bottom: 1px solid rgba(255, 85, 46, 0.08);
}

.search-container {
    max-width: 680px;
    margin: 0 auto;
}

/* 搜索表单 */
.search-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    fill: var(--text-muted);
    pointer-events: none;
    transition: fill 0.25s ease;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 42px;
    font-size: 0.9rem;
    font-family: var(--font-body);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.9);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    outline: none;
    transition: all 0.25s ease;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 85, 46, 0.1);
    background: white;
}

.search-input:focus ~ .search-icon {
    fill: var(--primary);
}

.search-clear {
    position: absolute;
    right: 10px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.search-clear svg {
    width: 14px;
    height: 14px;
    fill: var(--text-muted);
}

.search-clear:hover {
    background: rgba(0, 0, 0, 0.1);
}

.search-clear:hover svg {
    fill: var(--text-secondary);
}

.search-input:not(:placeholder-shown) ~ .search-clear {
    opacity: 1;
    visibility: visible;
}

.search-btn {
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: white;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 10px rgba(255, 85, 46, 0.25);
}

.search-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 85, 46, 0.35);
}

.search-btn:active {
    transform: translateY(0);
}

/* ========================================
   热门搜索
   ======================================== */
.hot-search {
    margin-top: 20px;
    animation: fadeInUp 0.4s ease;
}

.hot-search-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.hot-search-header svg {
    width: 16px;
    height: 16px;
    fill: var(--accent);
}

.hot-search-header span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.hot-search-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hot-tag {
    padding: 6px 14px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border);
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.25s ease;
}

.hot-tag:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(255, 85, 46, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(255, 85, 46, 0.1);
}

/* ========================================
   搜索历史
   ======================================== */
.search-history {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px dashed var(--border);
    animation: fadeInUp 0.5s ease;
}

.search-history-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.search-history-header svg {
    width: 16px;
    height: 16px;
    fill: var(--text-muted);
}

.search-history-header span {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.clear-history {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.clear-history svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.clear-history:hover {
    background: rgba(255, 85, 46, 0.08);
    color: var(--primary);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid transparent;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.25s ease;
}

.history-item svg {
    width: 14px;
    height: 14px;
    fill: var(--text-muted);
    flex-shrink: 0;
}

.history-item span {
    font-size: 0.85rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 85, 46, 0.15);
    color: var(--primary);
}

.history-item:hover svg {
    fill: var(--primary);
}

/* ========================================
   筛选排序区
   ======================================== */
.filter-section {
    position: relative;
    z-index: 80;
}

.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.6);
    border-bottom: 1px solid var(--border);
    gap: 12px;
    max-width: 680px;
    margin: 0 auto;
}

.filter-tabs {
    display: flex;
    gap: 8px;
}

.filter-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: var(--font-body);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.filter-tab svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    opacity: 0.7;
}

.filter-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-tab.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(255, 85, 46, 0.25);
}

.filter-tab.active svg {
    opacity: 1;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

.filter-action-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: var(--font-body);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.filter-action-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.filter-action-btn .arrow {
    width: 12px;
    height: 12px;
    transition: transform 0.25s ease;
}

.filter-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-action-btn.active .arrow {
    transform: rotate(180deg);
}

/* 排序面板 */
.sort-panel {
    position: absolute;
    top: 100%;
    right: 16px;
    width: 180px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
    border: 1px solid var(--border);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s ease;
    z-index: 100;
}

.sort-panel.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sort-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-option:hover {
    background: rgba(255, 85, 46, 0.05);
    color: var(--primary);
}

.sort-option.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.sort-option svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sort-option.active svg {
    opacity: 1;
}

/* 遮罩层 */
.filter-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 70;
}

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

/* ========================================
   搜索结果统计
   ======================================== */
.search-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(255, 85, 46, 0.03);
    border-bottom: 1px solid var(--border);
    max-width: 680px;
    margin: 0 auto;
}

.stats-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stats-text strong {
    color: var(--primary);
    font-weight: 600;
}

.stats-keyword {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stats-keyword span {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ========================================
   信息列表
   ======================================== */
.main {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 16px;
}

.listing-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 12px;
}

/* 分类信息卡片 */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all 0.25s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-classified {
    padding: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-classified:hover {
    box-shadow: var(--shadow-hover);
}

.classified-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.classified-badge {
    flex-shrink: 0;
    padding: 3px 8px;
    background: linear-gradient(135deg, var(--accent) 0%, #FFC107 100%);
    color: #8B6914;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

.classified-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.classified-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 2px;
}

.classified-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.classified-category {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 20px;
    border: 1px solid rgba(255, 85, 46, 0.15);
}

.classified-category svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.classified-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.classified-info span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.classified-info svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

/* ========================================
   空状态
   ======================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    animation: fadeInUp 0.4s ease;
}

.empty-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 85, 46, 0.08) 0%, rgba(255, 152, 0, 0.08) 100%);
    border-radius: 50%;
    margin-bottom: 20px;
}

.empty-icon svg {
    width: 36px;
    height: 36px;
    fill: var(--text-muted);
}

.empty-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ========================================
   分页
   ======================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 32px 0 20px;
}

.page-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.page-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--text-secondary);
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(255, 85, 46, 0.15);
}

.page-btn:hover:not(:disabled) svg {
    fill: var(--primary);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-numbers {
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-num {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.page-num:hover {
    background: rgba(255, 85, 46, 0.05);
    color: var(--primary);
}

.page-num.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(255, 85, 46, 0.3);
}

.page-ellipsis {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0 4px;
}

/* ========================================
   迷你Header定制
   ======================================== */
.mini-category {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.mini-category-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
}

.mini-actions {
    display: flex;
    gap: 8px;
}

.mini-action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.mini-action-btn svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.mini-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

/* ========================================
   动画
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-classified {
    animation: cardSlideIn 0.35s ease backwards;
}

.card-classified:nth-child(1) { animation-delay: 0.03s; }
.card-classified:nth-child(2) { animation-delay: 0.06s; }
.card-classified:nth-child(3) { animation-delay: 0.09s; }
.card-classified:nth-child(4) { animation-delay: 0.12s; }
.card-classified:nth-child(5) { animation-delay: 0.15s; }

/* ========================================
   响应式
   ======================================== */
@media (min-width: 768px) {
    .search-section {
        padding: 16px 24px 24px;
    }

    .search-container {
        max-width: 680px;
    }

    .search-input {
        font-size: 0.95rem;
        padding: 14px 40px 14px 42px;
    }

    .search-btn {
        padding: 14px 24px;
        font-size: 0.95rem;
    }

    .hot-search,
    .search-history {
        max-width: 680px;
        margin-left: auto;
        margin-right: auto;
    }

    .card-classified {
        padding: 18px;
    }

    .classified-title {
        font-size: 1rem;
    }

    .classified-desc {
        -webkit-line-clamp: 3;
    }

    .sort-panel {
        right: 50%;
        transform: translateX(50%) translateY(-10px);
    }

    .sort-panel.show {
        transform: translateX(50%) translateY(0);
    }
}

@media (max-width: 374px) {
    .search-form {
        flex-direction: column;
        gap: 8px;
    }

    .search-btn {
        width: 100%;
    }

    .card-classified {
        padding: 14px;
    }

    .classified-title {
        font-size: 0.85rem;
    }

    .classified-desc {
        font-size: 0.8rem;
    }

    .hot-tag {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
}

/* 深色模式 */
@media (prefers-color-scheme: dark) {
    .search-section {
        background: linear-gradient(180deg, rgba(26, 26, 26, 0.98) 0%, rgba(26, 26, 26, 0.95) 100%);
        border-bottom-color: rgba(255, 255, 255, 0.06);
    }

    .search-input {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .search-input:focus {
        background: rgba(255, 255, 255, 0.08);
    }

    .search-clear {
        background: rgba(255, 255, 255, 0.1);
    }

    .hot-tag {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.08);
    }

    .history-item {
        background: rgba(255, 255, 255, 0.03);
    }

    .history-item:hover {
        background: rgba(255, 255, 255, 0.06);
    }

    .filter-bar {
        background: rgba(26, 26, 26, 0.6);
    }

    .filter-tab,
    .filter-action-btn {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .search-stats {
        background: rgba(255, 85, 46, 0.05);
    }

    .card-classified {
        background: var(--bg-card);
        border-color: rgba(255, 255, 255, 0.06);
    }

    .classified-footer {
        border-top-color: rgba(255, 255, 255, 0.06);
    }

    .empty-icon {
        background: linear-gradient(135deg, rgba(255, 85, 46, 0.15) 0%, rgba(255, 152, 0, 0.15) 100%);
    }

    .page-btn {
        background: var(--bg-card);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .filter-overlay {
        background: rgba(0, 0, 0, 0.6);
    }
}
