/* Global Search Styles */

/* Global search indicator */
.global-search-indicator {
    position: absolute;
    right: 48px; /* 留出搜索图标空间，避免重叠 */
    top: 50%;
    transform: translateY(-50%);
    background-color: #f0f0f0;
    color: #666;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
    z-index: 2; /* 保证在输入框与图标之上可点击 */
}

.global-search-indicator.active {
    background-color: #4CAF50;
    color: white;
}

/* Global search results styling */
.global-search-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.global-search-header h2 {
    margin: 0;
    font-size: 1.5rem;
    flex-grow: 1;
}

.back-to-results-btn {
    background-color: #f0f0f0;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 15px;
    display: flex;
    align-items: center;
    transition: background-color 0.3s;
}

.back-to-results-btn:hover {
    background-color: #e0e0e0;
}

.back-to-results-btn i {
    margin-right: 5px;
}

.global-search-results {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.category-section {
    margin-bottom: 20px;
}

.category-header {
    padding: 10px 15px;
    background-color: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 15px;
}

.category-header a {
    color: #333;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.category-header a:hover {
    color: #0066cc;
}

.product-count {
    color: #666;
    font-size: 0.9em;
}

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

.no-results {
    padding: 30px;
    text-align: center;
    font-size: 1.2rem;
    color: #666;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.global-loading-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    font-size: 1.2rem;
    color: #666;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .global-search-indicator {
        right: 40px; /* 移动端图标更靠右，pill 左移避免覆盖 */
        font-size: 11px;
        padding: 4px 8px;
    }
    
    .global-search-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .back-to-results-btn {
        margin-bottom: 10px;
        margin-right: 0;
    }
    
    .category-products {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    .global-search-indicator {
        right: 34px; /* 与 .search-icon { right: 10px } 保持间距 */
        font-size: 11px;
        padding: 3px 8px;
        border-radius: 12px;
    }
}

/* ------------------------------ */
/* Mobile Search Page UI (search.html) */
/* ------------------------------ */
.search-page .mobile-search-header {
    padding: 14px 12px;
}

.search-page .mobile-search-shell {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.06);
    padding: 8px 10px;
}

.search-page .search-back {
    display: inline-flex;
    width: 36px;
    height: 36px;
    border-radius: 18px;
    align-items: center;
    justify-content: center;
    background: #f4f4f4;
    border: none;
    color: #333;
}

.search-page .search-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 24px;
    border: 1px solid #eee;
    height: 46px;
}

.search-page .search-icon-inline {
    position: absolute;
    left: 14px;
    color: #666;
    font-size: 16px;
}

.search-page .search-box {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    padding: 0 14px 0 40px; /* 默认右侧较小间距，无按钮时更贴近 */
    font-size: 16px; /* iOS 聚焦输入时避免页面自动缩放 */
    color: #333;
    background: transparent;
}

/* 保持占位符字号一致，防止因占位符过小导致聚焦时缩放 */
.search-page .search-box::placeholder {
    font-size: 16px;
}

/* 避免 Safari 的文本尺寸自动调整影响输入框聚焦时的缩放行为 */
.search-page {
    -webkit-text-size-adjust: 100%;
}

.search-page .search-input-wrapper.has-text .search-box {
    padding-right: 54px; /* 有文本时给按钮预留空间 */
}

.search-page .search-action {
    position: absolute;
    right: 8px;
    width: 40px;
    height: 40px;
    border-radius: 20px;
    border: none;
    background: #000;
    color: #fff;
    display: none; /* 默认隐藏，无文本时不显示 */
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0,0,0,0.18);
}

.search-page .search-input-wrapper.has-text .search-action {
    display: inline-flex; /* 有文本时显示按钮 */
}

.search-page .search-action i {
    font-size: 16px;
}

.search-page .popular-section {
    padding: 8px 14px 0;
}

.search-page .popular-title {
    font-size: 18px;
    font-weight: 600;
    margin: 10px 0 6px;
}

.search-page .popular-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-page .popular-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 4px;
    border-bottom: 1px solid #f0f0f0;
    color: #2b2b2b;
}

.search-page .popular-list li i {
    color: #8a8a8a;
    margin-right: 10px;
}

.search-page .popular-list li span {
    flex: 1;
    margin-left: 10px;
}

.search-page .popular-list li em {
    font-style: normal;
    color: #8a8a8a;
    font-size: 13px;
}

@media (min-width: 769px) {
    /* 桌面访问搜索页的基本居中样式 */
    .search-page .mobile-search-header { max-width: 900px; margin: 0 auto; }
    .search-page .popular-section { max-width: 900px; margin: 0 auto; }
}
/* ------------------------------ */
/* Results Page UI (results.html) */
/* ------------------------------ */
.results-page {
    padding-top: 60px; /* 为固定导航栏预留空间，避免内容被遮挡 */
}
.results-page .results-header {
    padding: 25px 14px 8px;
    border-bottom: 1px solid #f0f0f0;
}

.results-page .results-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.results-page .results-meta {
    margin-top: 6px;
    color: #8a8a8a;
    font-size: 13px;
}

/* Results page top navigation */
.results-page .results-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.results-page .topbar-logo {
    text-decoration: none;
    font-weight: 700;
    font-size: 18px;
    color: #111;
    letter-spacing: 0.2px;
}

.results-page .topbar-search {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #000;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.results-page .topbar-search i {
    font-size: 16px;
}