/* 快速搜索 - 悬浮按钮和弹窗 */

/* 悬浮搜索按钮 */
.quick-search-btn {
    position: fixed;
    bottom: 80px;
    right: 0;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    outline: none;
    gap: 2px;
    pointer-events: auto;
}

/* 桌面端：让按钮贴在500px宽页面容器的右边缘 */
@media (min-width: 768px) {
    .quick-search-btn {
        /* 计算公式：50%（屏幕中心） + 250px（容器一半） - 8px（稍微贴边） */
        right: calc(50% - 250px - 8px);
        left: auto;
    }
}

.quick-search-btn:active {
    transform: scale(0.95);
}

.quick-search-btn:hover {
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
    transform: translateY(-2px);
}

/* 搜索按钮文字提示 */
.quick-search-btn::before {
    content: '快速搜索';
    position: absolute;
    right: 65px;
    background: rgba(45, 52, 54, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.quick-search-btn::after {
    content: '';
    position: absolute;
    right: 56px;
    border: 6px solid transparent;
    border-left-color: rgba(45, 52, 54, 0.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.quick-search-btn:hover::before,
.quick-search-btn:hover::after {
    opacity: 1;
}

.quick-search-btn .search-icon {
    width: 24px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.35-4.35'%3E%3C/path%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.quick-search-btn .search-text {
    font-size: 11px;
    font-weight: 600;
    color: white;
    line-height: 1;
    letter-spacing: 0.5px;
}

/* 搜索弹窗遮罩 */
.search-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-modal-overlay.active {
    display: block;
    opacity: 1;
}

/* 搜索弹窗容器 */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    display: none;
    pointer-events: none;
}

.search-modal.active {
    display: block;
    pointer-events: auto;
}

.search-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-modal.active .search-modal-content {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* 搜索头部 */
.search-modal-header {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

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

.search-modal-input {
    flex: 1;
    height: 44px;
    padding: 0 40px 0 15px;
    border: 2px solid #e0e0e0;
    border-radius: 22px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.search-modal-input:focus {
    border-color: #667eea;
}

.search-clear-btn {
    position: absolute;
    right: 60px;
    width: 20px;
    height: 20px;
    background: #ccc;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    color: white;
}

.search-clear-btn.show {
    display: flex;
}

.search-close-btn {
    width: 44px;
    height: 44px;
    background: #f5f5f5;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: #666;
    flex-shrink: 0;
}

/* 搜索内容区 */
.search-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
    -webkit-overflow-scrolling: touch;
}

.search-modal-body::-webkit-scrollbar {
    width: 6px;
}

.search-modal-body::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

/* 热门搜索区域 */
.hot-keywords-section {
    margin-bottom: 20px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-title::before {
    content: '🔥';
    font-size: 16px;
}

.hot-keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hot-keyword-tag {
    padding: 6px 14px;
    background: #f5f5f5;
    border-radius: 16px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.hot-keyword-tag:active {
    transform: scale(0.95);
    background: #667eea;
    color: white;
}

/* 搜索结果区域 */
.search-results-section {
    display: none;
}

.search-results-section.show {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: inherit;
}

.search-result-item:active {
    background: #f5f5f5;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-size: 14px;
    font-weight: 600;
    color: #2d3436;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.search-result-category {
    color: #666;
}

.search-result-divider {
    color: #ccc;
}

.search-result-type {
    color: #667eea;
    font-weight: 500;
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.search-result-price {
    font-size: 16px;
    font-weight: 700;
    color: #ff6b6b;
    flex-shrink: 0;
}

/* 查看更多按钮 */
.search-show-more-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.search-show-more-btn:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.3);
}

.search-show-more-btn .show-more-icon {
    font-size: 16px;
}

.search-show-more-btn .show-more-text {
    flex: 1;
}

.search-show-more-btn .show-more-arrow {
    font-size: 16px;
    animation: arrowBounce 1s infinite;
}

@keyframes arrowBounce {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(4px);
    }
}

/* 空状态 */
.search-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.search-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.search-empty-text {
    font-size: 14px;
}

/* 加载状态 */
.search-loading {
    text-align: center;
    padding: 20px;
    color: #999;
    display: none;
}

.search-loading.show {
    display: block;
}

.search-loading::after {
    content: '...';
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0%, 100% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}

/* 关键词高亮 */
.search-highlight {
    color: #667eea;
    font-weight: 600;
}

/* 响应式优化 - 手机端 */
@media (max-width: 480px) {
    .search-modal-content {
        width: 95%;
        max-height: 85vh;
    }

    .search-modal-header {
        padding: 15px;
    }

    .search-modal-input {
        height: 40px;
        font-size: 15px;
    }

    .search-close-btn {
        width: 40px;
        height: 40px;
    }

    .quick-search-btn {
        width: 50px;
        height: 50px;
        bottom: 70px;
    }

    .search-result-meta {
        flex-wrap: wrap;
    }

    .search-result-type {
        font-size: 11px;
        padding: 1px 6px;
    }
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.search-result-item {
    animation: fadeIn 0.3s ease;
}
