/* 商品搜索页面样式 */

.m-product-search-page {
    background: #f5f5f5;
    min-height: 100vh;
    padding-bottom: 60px;
}

/* 固定在顶部的头部容器 */
.search-header-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    padding: var(--space-sm) var(--space-xl) var(--space-md);
    overflow: hidden;
}
.search-header-fixed::after {
    content: '';
    position: absolute;
    bottom: -40px;
    right: -30px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(201,162,39,0.12);
}

/* 顶部搜索栏 */
.m-search-header {
    padding: 0;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: transparent;
    border-radius: var(--radius-full);
    padding: 4px;
    position: relative;
    z-index: 1;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper input {
    width: 100%;
    border: none;
    background: white;
    font-size: var(--font-size-base);
    color: var(--color-text);
    outline: none;
    padding: 12px 36px 12px 44px;
    border-radius: var(--radius-full);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    min-width: 0;
}

.search-camera-btn {
    position: absolute;
    left: 10px;
    z-index: 1;
    display: flex;
    align-items: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    padding: 6px;
}

.search-input-wrapper input::placeholder { color: #BDBDBD; }

.search-bar .search-clear-btn {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.search-bar .search-clear-btn:hover {
    background: #f0f0f0;
}

.search-bar .search-clear-btn svg path {
    fill: #999;
}

.search-bar .search-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #C9A227, #E6C44A);
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.search-bar .search-btn:active { transform: scale(0.92); }

.search-bar .search-btn svg path { fill: white; }

/* 图片搜索按钮适配绿色背景 */
.search-bar .search-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    padding-right: 6px;
    flex-shrink: 0;
}

.search-bar .search-action-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.search-bar .search-action-btn--photo {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
}

.search-bar .search-action-btn--submit {
    background: linear-gradient(135deg, var(--color-accent), #E6C44A);
    color: white;
}

.search-bar .search-action-btn:active { transform: scale(0.92); }

/* 平台切换标签 - 白色文字在绿色背景上 */
.platform-tabs {
    display: flex !important;
    visibility: visible !important;
    background: transparent;
    padding: 6px 15px 0;
}

.platform-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.platform-tab svg { flex-shrink: 0; }

.platform-tab.active {
    color: #fff;
    border-bottom-color: #FFD700;
}

.platform-tab:active {
    transform: scale(0.95);
}

/* 排序栏 */
.sort-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding-top: 18px;
    background: transparent;
}

.sort-item {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 0.2s;
    padding: 2px 0;
}

.sort-item.active {
    color: #fff;
    font-weight: 600;
}

.sort-item .sort-arrows {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.sort-item .sort-arrows svg {
    width: 10px;
    height: 10px;
}

/* 分类横向滚动栏 */
.filter-bar {
    background: transparent;
    padding: 20px 0 0 0;
}

.filter-scroll {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 8px;
}

.filter-scroll::-webkit-scrollbar {
    display: none;
}

.filter-tag {
    flex-shrink: 0;
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 14px;
    background: rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.filter-tag.active {
    background: rgba(255,255,255,0.9);
    color: var(--color-primary);
    font-weight: 600;
}

/* 商品列表 */
.product-container {
    margin-top: 180px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px;
}

.product-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.product-card:active {
    transform: scale(0.98);
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    background: #f9f9f9;
    position: relative;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-tag {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #ff6b6b;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
}

.product-info {
    padding: 10px;
}

.product-title {
    font-size: 13px;
    color: #333;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
    min-height: 36px;
}

.product-price-row {
    display: flex;
    align-items: baseline;
    margin-bottom: 6px;
}

.product-price {
    color: #ff6b6b;
    font-size: 16px;
    font-weight: bold;
}

.product-price .currency {
    font-size: 12px;
}

.product-original-price {
    color: #999;
    font-size: 12px;
    text-decoration: line-through;
    margin-left: 6px;
}

.product-stats {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #999;
}

.product-stat {
    display: flex;
    align-items: center;
}

.product-stat span {
    margin-left: 2px;
}

/* 加载和空状态 */
.loading-indicator {
    text-align: center;
    padding: 30px;
    margin-top: 180px;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.loading-indicator::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top-color: #007AFF;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-result {
    text-align: center;
    padding: 60px 20px;
    margin-top: 180px;
}

.empty-result p {
    color: #999;
    margin-bottom: 15px;
}

.empty-result button {
    padding: 10px 20px;
    background: #ff6b6b;
    color: #fff;
    border: none;
    border-radius: 20px;
    cursor: pointer;
}

/* 底部导航 */
.m-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: #fff;
    border-top: 1px solid #eee;
    padding: 5px 0;
    padding-bottom: env(safe-area-inset-bottom, 5px);
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #666;
    font-size: 11px;
    position: relative;
}

.nav-item.active {
    color: #00695c;
}

.nav-item svg {
    margin-bottom: 2px;
}

.cart-badge {
    position: absolute;
    top: -3px;
    right: calc(50% - 18px);
    background: #ff6b6b;
    color: #fff;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

/* 图片搜索Loading */
.image-search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    margin-top: 180px;
    grid-column: 1 / -1;
    width: 100%;
}

.image-search-loading__spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e8f5e9;
    border-top-color: #10b981;
    border-radius: 50%;
    animation: image-search-spin 0.8s linear infinite;
    margin-bottom: 20px;
}

@keyframes image-search-spin {
    to { transform: rotate(360deg); }
}

.image-search-loading__text {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px;
}

.image-search-loading__sub {
    font-size: 14px;
    color: #999;
    margin: 0;
}
