/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #F5F5F7;
    color: #1a1a1a;
    min-height: 100vh;
    padding-bottom: 80px;
}

/* ========== 顶部导航 ========== */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-logo {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-fav-page {
    background: none;
    border: 1.5px solid #E5E5EA;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.btn-fav-page:hover {
    background: #FFF8E1;
    border-color: #FFD54F;
    color: #F9A825;
}

.fav-count {
    background: #FFD54F;
    color: #333;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
}

/* ========== 搜索区域 ========== */
.search-section {
    background: white;
    border-radius: 12px;
    padding: 12px;
    margin: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.search-box {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

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

.search-icon {
    font-size: 18px;
}

.search-box input {
    width: 100%;
    padding: 10px 36px 10px 12px;
    border: 1.5px solid #E5E5EA;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    background: #F9F9FB;
}

.search-box input:focus {
    border-color: #64B5F6;
}

.search-btn {
    padding: 10px 18px;
    background: #64B5F6;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.search-btn:hover {
    background: #42A5F5;
}

/* 搜索框清除按钮 */
.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #CCC;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.search-clear:hover {
    background: #999;
}

/* 热门搜索 */
.hot-search-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.hot-search-label {
    font-size: 11px;
    color: #F57F17;
    white-space: nowrap;
    flex-shrink: 0;
}
.hot-search-tag {
    padding: 3px 10px;
    background: #FFF8E1;
    color: #E65100;
    border-radius: 12px;
    font-size: 11px;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}
.hot-search-tag:hover { background: #FFE0B2; }
.hot-search-tag:active { background: #FFCC80; }

/* 搜索历史 */
.search-history {
    background: #fff;
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.search-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #999;
    margin-bottom: 6px;
}
.search-history-clear {
    cursor: pointer;
    color: #CCC;
}
.search-history-clear:hover { color: #E53935; }
.search-history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.search-history-item {
    padding: 3px 10px;
    background: #F5F5F7;
    border-radius: 12px;
    font-size: 11px;
    color: #666;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}
.search-history-item:hover { background: #E8E8F0; }

/* 筛选标签 */
.filter-tags {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}

.filter-tags::-webkit-scrollbar {
    display: none;
}

.tag {
    padding: 5px 12px;
    background: white;
    color: #666;
    border: 1px solid #E5E5EA;
    border-radius: 20px;
    font-size: 11px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.tag:hover {
    background: #F0F0F5;
}

.tag.active {
    background: #64B5F6;
    color: white;
    border-color: #64B5F6;
}

/* ========== 分类浏览标签 ========== */
.category-tags {
    display: flex;
    gap: 6px;
    padding: 6px 0 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.category-tags::-webkit-scrollbar {
    display: none;
}
.category-tag {
    white-space: nowrap;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    background: #F0F0F5;
    border: 1px solid transparent;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.category-tag:hover {
    background: #E8E8F0;
}
.category-tag.active {
    background: #E3F2FD;
    color: #1565C0;
    border-color: #BBDEFB;
    font-weight: 600;
}

/* ========== 平台筛选标签 ========== */
.platform-tags {
    display: flex;
    gap: 8px;
    padding: 6px 14px 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-top: 1px solid #F0F0F5;
}
.platform-tags::-webkit-scrollbar {
    display: none;
}
.platform-tag-filter {
    white-space: nowrap;
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 11px;
    background: #F5F5F7;
    border: 1px solid transparent;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.platform-tag-filter:hover {
    background: #EBEBF0;
}
.platform-tag-filter.active {
    background: #333;
    color: white;
    border-color: #333;
}
.platform-tag-filter.domestic {
    background: #FFF3E0;
    color: #E65100;
    border-color: #FFE0B2;
}
.platform-tag-filter.domestic.active {
    background: #E65100;
    color: white;
    border-color: #E65100;
}
.platform-tag-filter.international {
    background: #E3F2FD;
    color: #1565C0;
    border-color: #BBDEFB;
}
.platform-tag-filter.international.active {
    background: #1565C0;
    color: white;
    border-color: #1565C0;
}

/* ========== 推荐分区 ========== */
.recommend-section {
    padding: 0 12px;
    margin-bottom: 4px;
}

.recommend-title {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.recommend-scroll {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recommend-card {
    background: white;
    border-radius: 12px;
    padding: 14px 14px 14px 42px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border: 2px solid transparent;
}

.recommend-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.12);
}

.recommend-card-icon {
    width: 64px;
    height: 64px;
    background: #F5F5F7;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}

.recommend-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recommend-card-price {
    font-size: 17px;
    font-weight: 700;
    color: #448AFF;
}

/* ========== 商品列表 ========== */
.product-list {
    padding: 0 12px;
}

/* 商品卡片 */
.product-card {
    background: white;
    border-radius: 12px;
    padding: 14px 14px 14px 42px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border: 2px solid transparent;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.12);
}

.product-card.selected {
    border-color: #64B5F6;
    background: #F8FBFF;
}

/* 复选框 */
.card-checkbox {
    position: absolute;
    left: 12px;
    top: 14px;
    width: 18px;
    height: 18px;
    border: 2px solid #DDD;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background: white;
    z-index: 10;
}

.card-checkbox:hover {
    border-color: #64B5F6;
}

.card-checkbox.checked {
    background: #64B5F6;
    border-color: #64B5F6;
    color: white;
    font-size: 11px;
}

/* 收藏按钮（卡片右上角） */
.btn-fav {
    position: absolute;
    top: 14px;
    right: 12px;
    width: 26px;
    height: 26px;
    border: none;
    background: #F5F5F7;
    border-radius: 50%;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s;
}

.btn-fav:hover {
    background: #FFF8E1;
    transform: scale(1.1);
}

.btn-fav.active {
    background: #FFF8E1;
}

/* 卡片头部：平台 + 趋势 + 时间 */
.card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    min-height: 24px;
}

.card-header .update-time-header {
    margin-left: auto;
    font-size: 10px;
    color: #999;
    flex-shrink: 0;
    margin-right: 36px;
}

.platform-tag {
    font-size: 10px;
    padding: 3px 7px;
    border-radius: 4px;
    font-weight: 600;
    flex-shrink: 0;
}

.platform-amazon {
    background: #E8F5E9;
    color: #2E7D32;
}

.platform-jd {
    background: #E3F2FD;
    color: #1565C0;
}

.platform-ebay {
    background: #E8F5E9;
    color: #2E7D32;
}

.trend-tag {
    font-size: 10px;
    padding: 3px 7px;
    border-radius: 4px;
    font-weight: 600;
    flex-shrink: 0;
}

.trend-rising {
    background: #FFF8E1;
    color: #FF8F00;
}

.trend-hot {
    background: #FFEBEE;
    color: #E53935;
}

.trend-potential {
    background: #E8EAF6;
    color: #5C6BC0;
}

/* 商品信息 */
.product-info {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.product-icon {
    width: 64px;
    height: 64px;
    background: #F5F5F7;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}

.product-details {
    flex: 1;
    min-width: 0;
}

.product-title {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-price {
    font-size: 17px;
    font-weight: 700;
    color: #448AFF;
    margin-bottom: 4px;
}

/* 库存行 */
.card-meta-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.stock-status {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.stock-in {
    background: #E8F5E9;
    color: #2E7D32;
}

.stock-low {
    background: #FFF8E1;
    color: #F9A825;
}

.stock-out {
    background: #FFEBEE;
    color: #C62828;
}

/* 指数进度条 */
.index-bars {
    display: flex;
    gap: 10px;
    font-size: 10px;
    color: #666;
}

.index-item {
    flex: 1;
}

.index-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.index-value {
    font-weight: 700;
}

.index-bar {
    height: 4px;
    background: #EEE;
    border-radius: 2px;
    overflow: hidden;
}

.index-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s;
}

.hot-score .index-value {
    color: #FFA726;
}

.hot-score .index-bar-fill {
    background: linear-gradient(90deg, #FFA726, #FFD54F);
}

.sales-index .index-value {
    color: #66BB6A;
}

.sales-index .index-bar-fill {
    background: linear-gradient(90deg, #66BB6A, #A5D6A7);
}

/* 快捷数据 */
.product-meta {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    font-size: 10px;
    color: #888;
}

/* ========== 底部浮动操作栏 ========== */
.bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
    z-index: 200;
    padding: 8px 12px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.bottom-bar.active {
    display: flex;
}

.bottom-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    flex-shrink: 0;
}

.bottom-bar-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #DDD;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background: white;
    cursor: pointer;
    font-size: 11px;
}

.bottom-bar-checkbox.checked {
    background: #64B5F6;
    border-color: #64B5F6;
    color: white;
}

.bottom-bar-count {
    font-weight: 600;
    color: #333;
}

.bottom-bar-right {
    display: flex;
    gap: 8px;
}

.btn-batch-store {
    padding: 9px 14px;
    background: #FFA726;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.btn-batch-store:hover {
    background: #FF9800;
}

.btn-batch-source {
    padding: 9px 14px;
    background: #90CAF9;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.btn-batch-source:hover {
    background: #64B5F6;
}

/* ========== 收藏页面 ========== */
.favorites-page {
    display: none;
    padding: 0 12px;
}

.favorites-page.active {
    display: block;
}

.fav-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 0;
    flex-wrap: nowrap;
}
.fav-header > * {
    flex-shrink: 0;
}

.fav-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

.fav-back {
    background: none;
    border: 1.5px solid #E5E5EA;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.fav-back:hover {
    background: #F5F5F7;
}

.fav-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 13px;
}

.fav-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

/* 收藏分组标签 */
.fav-group-tabs {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    overflow-x: auto;
    border-bottom: 1px solid #EEE;
}

.fav-group-tab {
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    background: #F5F5F7;
    color: #666;
    white-space: nowrap;
    border: none;
    transition: all 0.2s;
}

.fav-group-tab.active {
    background: #1565C0;
    color: #fff;
    font-weight: 600;
}

/* ========== 加载更多按钮 ========== */
.load-more-btn {
    width: calc(100% - 24px);
    margin: 10px 12px 10px;
    padding: 13px;
    background: white;
    color: #64B5F6;
    border: 1.5px solid #64B5F6;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: all 0.2s;
}

.load-more-btn:hover {
    background: #E3F2FD;
}

/* ========== 底部声明 ========== */
.footer {
    padding: 10px;
    font-size: 10px;
    color: #AAA;
    text-align: center;
    line-height: 1.6;
}

/* ========== 弹窗 ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: none;
    background: #F5F5F7;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.modal-close:hover {
    background: #E5E5EA;
}

/* ========== 登录弹窗 ========== */
.btn-login {
    background: #64B5F6;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}
.btn-login:hover { background: #42A5F5; }
.btn-login.logged-in { background: #E8F5E9; color: #2E7D32; }

.login-modal-box {
    background: white;
    border-radius: 16px;
    padding: 28px 24px;
    position: relative;
    width: 320px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.login-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 6px;
    text-align: center;
}
.login-subtitle {
    font-size: 12px;
    color: #999;
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.5;
}
.login-submit-btn {
    width: 100%;
    padding: 12px;
    background: #64B5F6;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.login-submit-btn:hover { background: #42A5F5; }
.login-submit-btn:disabled { background: #CCC; cursor: not-allowed; }

/* ========== 商品详情：图片轮播 ========== */
.detail-carousel {
    margin-bottom: 14px;
    position: relative;
}

.detail-carousel-main {
    width: 100%;
    height: 280px;
    background: #F5F5F7;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 72px;
    position: relative;
    overflow: hidden;
}

.detail-carousel-main img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.detail-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255,255,255,0.85);
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    z-index: 5;
    transition: background 0.2s;
}

.detail-carousel-btn:hover {
    background: white;
}

.detail-carousel-prev {
    left: 8px;
}

.detail-carousel-next {
    right: 8px;
}

.detail-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 8px;
}

.detail-carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #DDD;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    padding: 0;
}

.detail-carousel-dot.active {
    background: #64B5F6;
    width: 16px;
    border-radius: 3px;
}

/* 视频占位 */
.detail-video-placeholder {
    width: 100%;
    height: 120px;
    background: #1a1a1a;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: white;
    cursor: pointer;
    margin-bottom: 14px;
    position: relative;
}

.detail-video-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
}

/* ========== 商品详情（极简版） ========== */
.detail-section {
    margin-bottom: 16px;
}

.detail-price-section {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
}

.detail-price {
    font-size: 26px;
    font-weight: 800;
    color: #448AFF;
}

.detail-original-price {
    font-size: 13px;
    color: #999;
    text-decoration: line-through;
}

.detail-discount {
    font-size: 11px;
    background: #FFEBEE;
    color: #E53935;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.detail-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
}

.detail-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-stat-label {
    font-size: 10px;
    color: #999;
}

.detail-stat-value {
    font-size: 13px;
    font-weight: 700;
    color: #333;
}

.stock-status-detail {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    margin-bottom: 14px;
}

.detail-features {
    margin-bottom: 14px;
}

.detail-features-title {
    font-size: 11px;
    color: #999;
    margin-bottom: 6px;
}

.detail-feature-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #333;
    padding: 4px 0;
    border-bottom: 0.5px solid #F0F0F0;
}

.detail-feature-item:last-child {
    border-bottom: none;
}

.detail-feature-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #66BB6A;
    flex-shrink: 0;
}

.detail-platform {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #888;
    margin-bottom: 6px;
}

.detail-updated {
    font-size: 10px;
    color: #BBB;
    margin-bottom: 16px;
}

.detail-actions {
    display: flex;
    gap: 8px;
    position: sticky;
    bottom: 0;
    background: white;
    padding: 12px 0;
    border-top: 0.5px solid #E5E5EA;
}

/* ========== 加载动画 ========== */
.loading {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 13px;
}

/* ========== 响应式 ========== */
@media (max-width: 480px) {
    .search-section {
        margin: 8px;
        padding: 10px;
    }

    .product-card {
        padding: 12px 12px 12px 40px;
    }

    .product-icon {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }

    .product-title {
        font-size: 12px;
    }

    .product-price {
        font-size: 16px;
    }

    .detail-price {
        font-size: 22px;
    }

    .bottom-bar {
        padding: 6px 10px;
    }

    .btn-batch-store, .btn-batch-source {
        padding: 6px 8px;
        font-size: 10px;
    }

    .detail-carousel-main {
        height: 180px;
    }

    .recommend-card {
        min-width: 120px;
        max-width: 120px;
    }

    /* 弹窗移动端边距 */
    .modal-content {
        margin: 0 12px;
        max-width: calc(100% - 24px);
        padding: 16px;
    }

    /* 选品页顶部按钮 */
    .fav-header h2 {
        font-size: 14px;
    }

    .fav-back {
        padding: 4px 8px;
        font-size: 11px;
    }

    /* PID栏移动端 */
    .pid-inline-bar {
        flex-wrap: wrap;
        padding: 6px 10px;
        gap: 6px;
    }

    .pid-inline-bar input {
        min-width: 100px;
        font-size: 10px;
    }

    .pid-inline-status {
        font-size: 9px;
    }

    /* ===== 以下为新增移动端优化 ===== */

    /* 搜索按钮触屏 */
    .search-btn {
        padding: 12px 16px;
        font-size: 14px;
        min-height: 44px;
    }

    .search-box input {
        font-size: 16px;  /* 防 iOS 缩放 */
        padding: 10px 12px;
        min-height: 44px;
    }

    /* 筛选标签放大 */
    .tag, .category-tag, .platform-tag-filter {
        padding: 6px 14px;
        font-size: 12px;
        min-height: 32px;
    }

    /* 商品卡操作按钮 — 紧凑 */
    .btn-fav, .card-checkbox {
        min-width: 22px;
        min-height: 22px;
        font-size: 13px;
    }

    /* 详情弹窗全屏 */
    .modal-overlay {
        padding-top: 0;
    }
    .modal-content {
        margin: 0;
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 95vh;
        overflow-y: auto;
    }
    .modal-close {
        top: 12px;
        right: 14px;
        font-size: 18px;
        min-width: 32px;
        min-height: 32px;
    }

    /* 详情操作按钮 */
    .detail-actions {
        flex-direction: column;
        gap: 8px;
        padding: 10px 0;
    }
    .detail-actions .btn-source,
    .detail-actions .btn-add-store {
        width: 100%;
        min-height: 44px;
        font-size: 14px;
    }

    /* 排行榜 */
    .leaderboard-item {
        padding: 10px 8px;
        gap: 6px;
    }
    .leaderboard-img {
        width: 40px;
        height: 40px;
    }
    .leaderboard-title {
        font-size: 12px;
    }
    .leaderboard-cat {
        padding: 5px 10px;
        font-size: 11px;
    }

    /* 选品清单 */
    .selection-item {
        padding: 10px 8px;
        margin: 6px 4px;
    }
    .selection-item img {
        width: 48px;
        height: 48px;
    }

    /* 收藏页操作按钮 */
    .fav-header .btn-authorize {
        padding: 4px 6px;
        font-size: 10px;
        min-height: 28px;
        white-space: nowrap;
    }

    /* 底部栏 */
    .bottom-bar-left {
        font-size: 11px;
    }
    .bottom-bar-right {
        gap: 4px;
    }

    /* 分析面板 */
    .analysis-horizontal {
        flex-direction: column;
        gap: 8px;
    }

    /* 商品列表间距 */
    .product-list {
        padding: 0 4px;
    }
    .product-card {
        margin: 6px 4px;
    }

    /* 顶部导航 */
    .top-header {
        padding: 8px 10px;
    }
    .header-logo {
        font-size: 13px;
    }
    .btn-fav-page {
        padding: 4px 8px;
        font-size: 10px;
    }

    /* 选品页导出/导入按钮 */
    .fav-header button[id="exportCsvBtn"],
    .fav-header button[id="importSelectionBtn"],
    .fav-header button[id="batchPromoBtn"] {
        padding: 4px 6px;
        font-size: 10px;
    }
}

/* 平板/小屏笔记本 */
@media (min-width: 481px) and (max-width: 768px) {
    .modal-content {
        max-width: 90%;
    }
    .product-card {
        padding: 14px 14px 14px 45px;
    }
    .search-section {
        margin: 10px;
    }
}

/* ========== 按钮样式 ========== */
.btn-add-store {
    padding: 9px 14px;
    background: #FFA726;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-add-store:hover {
    background: #FF9800;
}

.btn-source {
    padding: 9px 14px;
    background: #90CAF9;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-source:hover {
    background: #64B5F6;
}

.btn-source:disabled {
    background: #CCC;
    cursor: not-allowed;
}

/* ========== 空搜索结果 ========== */
.empty-result {
    text-align: center;
    padding: 50px 24px;
}
.empty-result-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}
.empty-result-title {
    font-size: 14px;
    color: #555;
    margin-bottom: 8px;
}
.empty-result-title b {
    color: #1565C0;
}
.empty-result-hint {
    font-size: 12px;
    color: #999;
    margin-bottom: 16px;
}
.empty-result-action {
    display: inline-block;
    padding: 8px 20px;
    background: #64B5F6;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}
.empty-result-action:hover {
    background: #42A5F5;
}

/* ========== 自动加载指示器 ========== */
.auto-loader {
    text-align: center;
    padding: 20px;
    color: #AAA;
    font-size: 12px;
}
.auto-loader-spin {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #DDD;
    border-top-color: #64B5F6;
    border-radius: 50%;
    animation: loader-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes loader-spin {
    to { transform: rotate(360deg); }
}

/* ========== 利润可视化 ========== */
.profit-bar-wrap {
    margin: 4px 0;
}
.profit-bar-track {
    height: 8px;
    background: #E0E0E0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}
.profit-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}
.profit-bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #999;
}

/* ========== 商品卡片图片 ========== */
.card-image {
    width: 100%;
    height: 180px;
    background: #F5F5F7;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 8px;
    margin: 0 14px;
    width: calc(100% - 28px);
}
.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.card-image-placeholder {
    font-size: 48px;
    color: #CCC;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}


.btn-authorize {
    margin-left: auto;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-authorize:hover {
    background: #219a52;
}

/* ========== 选品清单页面 ========== */
.selection-page {
    display: none;
    padding: 0 0 80px 0;
    min-height: 100vh;
    background: #F5F5F7;
}
.selection-page.active {
    display: block;
}
.selection-item {
    transition: all 0.15s;
}
.selection-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* PID 行内配置栏 */
.pid-inline-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    margin: 0 12px 8px;
    background: #FFF8E1;
    border: 1px solid #FFE082;
    border-radius: 10px;
    font-size: 11px;
}
.pid-inline-label {
    font-weight: 600;
    color: #F57F17;
    white-space: nowrap;
    flex-shrink: 0;
}
.pid-inline-bar input {
    flex: 1;
    padding: 5px 10px;
    border: 1px solid #E5E5EA;
    border-radius: 6px;
    font-size: 11px;
    outline: none;
    background: #fff;
    min-width: 0;
}
.pid-inline-bar input:focus {
    border-color: #F57F17;
}
.pid-inline-status {
    font-size: 10px;
    color: #2E7D32;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ========== 推广结果弹窗 ========== */
.promo-result-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.promo-result-modal {
    background: #fff;
    border-radius: 16px;
    max-width: 520px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.promo-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    border-bottom: 1px solid #F0F0F0;
}
.promo-result-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 4px;
}
.promo-result-count {
    padding: 8px 20px;
    font-size: 12px;
    color: #666;
}
.promo-result-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 12px;
}
.promo-result-item {
    background: #F8F9FA;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
}
.promo-result-title {
    font-size: 12px;
    color: #333;
    font-weight: 500;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.promo-result-url-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
}
.promo-result-url-text {
    font-size: 11px;
    color: #1D9E75;
    word-break: break-all;
    background: #F1F8E9;
    padding: 6px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    line-height: 1.4;
    max-height: 40px;
    overflow: hidden;
}
.promo-result-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.promo-result-link {
    flex: 1;
    background: #1D9E75;
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    display: inline-block;
    transition: background 0.2s;
}
.promo-result-link:hover {
    background: #17A070;
}
.promo-result-copy {
    background: #E8F5E9;
    border: 1px solid #C8E6C9;
    color: #2E7D32;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.promo-result-copy:hover {
    background: #C8E6C9;
}
.promo-result-footer {
    display: flex;
    gap: 10px;
    padding: 12px 20px 16px;
    border-top: 1px solid #F0F0F0;
}
.promo-result-btn-copyall {
    flex: 1;
    background: #448AFF;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.promo-result-btn-copyall:hover {
    background: #2979FF;
}
.promo-result-btn-close {
    background: #F5F5F5;
    color: #666;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
}
.promo-result-tip {
    padding: 0 20px 16px;
    font-size: 11px;
    color: #999;
    text-align: center;
}

/* 推广结果 - 操作指南 */
.promo-result-guide {
    padding: 12px 20px;
    background: #FFF8E1;
    margin: 0 20px 8px;
    border-radius: 10px;
    border: 1px solid #FFE082;
}
.promo-result-guide-title {
    font-size: 12px;
    font-weight: 700;
    color: #F57F17;
    margin-bottom: 8px;
}
.promo-result-guide-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.promo-guide-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #555;
}
.promo-guide-num {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #F57F17;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ========== 选品分析面板 ========== */
.btn-analysis-toggle {
    background: #F5F5F7;
    color: #1565C0;
    border: 1px dashed #BBDEFB;
    border-radius: 8px;
    padding: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-analysis-toggle:hover {
    background: #E3F2FD;
    border-color: #64B5F6;
}
.analysis-panel {
    margin-top: 8px;
    background: #FAFAFE;
    border-radius: 12px;
    padding: 12px;
    border: 1px solid #E8E8F0;
}
.analysis-section {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #F0F0F5;
}
.analysis-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.analysis-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}
.analysis-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.analysis-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
}
.analysis-label {
    font-size: 11px;
    color: #666;
}
.analysis-value {
    font-size: 12px;
    font-weight: 600;
    color: #333;
}
.analysis-horizontal {
    display: flex;
    gap: 12px;
}
.analysis-metric {
    flex: 1;
    text-align: center;
    background: #fff;
    border-radius: 8px;
    padding: 10px 6px;
    border: 1px solid #EEEEF3;
}
.analysis-metric-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 2px;
}
.analysis-metric-label {
    font-size: 10px;
    color: #999;
}
.analysis-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.analysis-bar-val {
    font-size: 9px;
    color: #1976D2;
    font-weight: 700;
    line-height: 1;
}
.analysis-bar {
    width: 100%;
    max-width: 24px;
    background: linear-gradient(180deg, #64B5F6 0%, #1976D2 100%);
    border-radius: 3px 3px 0 0;
    min-width: 8px;
    transition: height 0.3s;
}
.analysis-bar-label {
    font-size: 8px;
    color: #AAA;
}

/* 选品分析 - 推荐指数 */
.analysis-score-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    margin-bottom: 8px;
}
.analysis-score-badge {
    border-radius: 12px;
    padding: 8px 16px;
    text-align: center;
    color: #fff;
    min-width: 80px;
}
.analysis-score-num {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
}
.analysis-score-label {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.9;
}
.analysis-score-detail {
    font-size: 10px;
    color: #999;
    line-height: 1.3;
}

/* 选品分析 - 销量图表 */
.analysis-chart-wrap {
    background: linear-gradient(180deg, #E3F2FD 0%, #fff 100%);
    border-radius: 10px;
    padding: 12px 8px 4px;
    height: 90px;
}
.analysis-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 70px;
    gap: 6px;
}
.analysis-chart-tick {
    text-align: center;
    font-size: 9px;
    color: #AAA;
    padding-top: 4px;
    border-top: 1px solid #E0E0E0;
}
.analysis-chart-summary {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #666;
    margin-top: 8px;
    padding: 0 4px;
}

/* 选品分析 - 多平台价格对比 */
.analysis-price-compare {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}
.analysis-price-col {
    background: #fff;
    border: 1px solid #E8E8F0;
    border-radius: 8px;
    padding: 8px 4px;
    text-align: center;
}
.analysis-price-platform {
    font-size: 10px;
    color: #999;
    margin-bottom: 4px;
    font-weight: 500;
}
.analysis-price-val {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    margin-bottom: 2px;
}
.analysis-price-profit {
    font-size: 10px;
    font-weight: 600;
}
.analysis-price-note {
    font-size: 10px;
    color: #999;
    line-height: 1.5;
    padding: 6px 8px;
    background: #F5F5F7;
    border-radius: 6px;
}

/* ========== 排行榜 ========== */
.leaderboard-page {
    padding: 0 12px 80px;
}

.leaderboard-cats {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #EEE;
}

.leaderboard-cat {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    background: #F5F5F7;
    color: #666;
    border: none;
    transition: all 0.2s;
}

.leaderboard-cat.active {
    background: #1565C0;
    color: #fff;
    font-weight: 600;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    gap: 10px;
}

.leaderboard-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.leaderboard-rank.gold { background: #FFD700; color: #5D4037; }
.leaderboard-rank.silver { background: #C0C0C0; color: #424242; }
.leaderboard-rank.bronze { background: #CD7F32; color: #fff; }
.leaderboard-rank.normal { background: #F5F5F7; color: #999; }

.leaderboard-img {
    width: 48px; height: 48px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: #F5F5F7;
}

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

.leaderboard-title {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-meta {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    display: flex;
    gap: 8px;
}

.leaderboard-hot {
    font-size: 11px;
    font-weight: 600;
    color: #E65100;
    flex-shrink: 0;
    text-align: right;
}

.leaderboard-platform-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #E3F2FD;
    color: #1565C0;
}
