/* ================================================
   Products Page — Apple 简约暗色风格
   全屏滑动浏览商品，TikTok 式交互
   ================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
                 'Helvetica Neue', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    padding: 0;
    margin: 0;
}

/* ============ 滑动容器 ============ */
.swipe-container {
    position: relative;
    width: 100%;
    height: 100vh; height: 100dvh;
    overflow: hidden;
    touch-action: none;
}

.product-item {
    position: absolute; inset: 0;
    background: #000;
    will-change: transform;
    transform: translate3d(0, 0, 0);
}

.product-item.active { transform: translate3d(0, 0, 0); }
.product-item.above  { transform: translate3d(0, -100%, 0); }
.product-item.below  { transform: translate3d(0, 100%, 0); }

/* ============ 图片区 ============ */
.image-wrapper {
    position: absolute; inset: 0;
}

.image-container {
    width: 100%; height: 100%;
    position: relative;
    overflow: hidden;
}

.product-image {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    background: #0a0a0a;
    opacity: 0;
    transition: none;
    will-change: transform;
}

.product-image.active {
    opacity: 1;
    z-index: 1;
}

/* ============ 图片指示点 ============ */
.img-dots {
    position: absolute;
    bottom: 130px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
}

.img-dots .dot {
    width: 6px; height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.3);
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.img-dots .dot.active {
    background: rgba(255,255,255,0.9);
    width: 20px;
}

/* ============ 图片计数 ============ */
.image-counter {
    position: absolute;
    top: 60px;
    right: 16px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(255,255,255,0.75);
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    z-index: 20;
    letter-spacing: 0.02em;
}

/* ============ 商品信息 ============ */
.product-detail {
    position: absolute;
    bottom: 110px;
    left: 16px;
    right: 70px;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.7);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.show-ui .product-detail {
    transform: translateY(0);
    opacity: 1;
}

.price {
    font-size: 24px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.title {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.desc {
    font-size: 14px;
    color: rgba(255,255,255,0.55);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

/* ============ 卖家卡片 ============ */
.seller-card {
    position: absolute;
    bottom: 110px;
    right: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.show-ui .seller-card {
    transform: translateY(0);
    opacity: 1;
}

.avatar {
    width: 48px; height: 48px;
    border-radius: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    object-fit: cover;
    background: rgba(255,255,255,0.1);
}

.seller-name {
    font-size: 12px;
    color: rgba(255,255,255,0.65);
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

/* ============ 点击提示 ============ */
.tap-hint {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255,255,255,0.25);
    font-size: 14px;
    animation: pulse 2s ease-in-out infinite;
    z-index: 10;
    pointer-events: none;
}

@keyframes pulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

.show-ui .tap-hint { display: none; }

/* ============ 顶部栏 ============ */
.header-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: calc(56px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 0;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.header-bar.show { opacity: 1; }

.header-bar svg {
    width: 24px; height: 24px;
    fill: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.header-center {
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ============ 底部操作栏 ============ */
.bottom-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 64px;
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.bottom-bar.show { transform: translateY(0); }

.btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: rgba(255,255,255,0.7);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 16px;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s;
}

.btn:active { color: #fff; }

.btn svg {
    width: 24px; height: 24px;
}

.btn-primary {
    background: #fff;
    border-radius: 20px;
    padding: 10px 28px;
    flex-direction: row;
    font-size: 14px;
    font-weight: 600;
    color: #1d1d1f;
    gap: 6px;
}

.btn-primary:active {
    transform: scale(0.96);
    opacity: 0.9;
}

.btn-primary svg {
    width: 20px; height: 20px;
}

/* ============ 加载屏 ============ */
.loading-screen {
    position: fixed; inset: 0;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(255,255,255,0.12);
    border-top-color: rgba(255,255,255,0.7);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
    color: rgba(255,255,255,0.5);
    margin-top: 16px;
    font-size: 14px;
}

/* ============ Toast ============ */
.toast-message {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 3000;
    display: none;
    pointer-events: none;
}

/* ============ 滑动提示 ============ */
.swipe-hint {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px; height: 40px;
    border: 1.5px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    animation: bounce 1.8s ease-in-out infinite;
}

.swipe-hint svg {
    width: 16px; height: 16px;
    fill: rgba(255,255,255,0.25);
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(10px); }
}

.show-ui .swipe-hint { display: none; }

/* ============ 右侧分类选择器（纯文字，最多显示5个） ============ */
.category-rail {
    position: fixed;
    right: 10px;
    top: 50%;
    transform: translateY(-50%) translateX(60px);
    z-index: 100;
    width: 56px;
    max-height: 220px;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.06);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-width: none;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
    pointer-events: none;
}

.category-rail::-webkit-scrollbar { display: none; }

.category-rail.show {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    pointer-events: auto;
}

.cat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    cursor: pointer;
    padding: 0 4px;
    transition: background 0.2s, opacity 0.15s;
    -webkit-tap-highlight-color: transparent;
    border-radius: 8px;
}

.cat-item:active {
    opacity: 0.6;
    background: rgba(255,255,255,0.06);
}

.cat-item-name {
    font-size: 12px;
    color: rgba(255,255,255,0.35);
    white-space: nowrap;
    transition: color 0.2s, font-weight 0.2s;
    font-weight: 400;
}

.cat-item.active .cat-item-name {
    color: rgba(255,255,255,0.9);
    font-weight: 600;
}

/* ============ 下拉刷新指示器 ============ */
.swipe-ptr {
    position: absolute;
    top: -60px;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 20;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    font-weight: 500;
    transition: none;
    pointer-events: none;
}

.swipe-ptr-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.swipe-ptr.ready .swipe-ptr-icon {
    transform: rotate(180deg);
}

.swipe-ptr.ready {
    color: rgba(255,255,255,0.8);
}

.swipe-ptr-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.15);
    border-top-color: rgba(255,255,255,0.7);
    border-radius: 50%;
    animation: swipe-spin 0.7s linear infinite;
}

@keyframes swipe-spin {
    to { transform: rotate(360deg); }
}

/* ============ 上拉加载更多指示器 ============ */
.swipe-loadmore {
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 20;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    font-weight: 500;
    transition: none;
    pointer-events: none;
}

.swipe-loadmore-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.15);
    border-top-color: rgba(255,255,255,0.7);
    border-radius: 50%;
    animation: swipe-spin 0.7s linear infinite;
}

.swipe-loadmore.loading .swipe-loadmore-spinner {
    display: block;
}

.swipe-loadmore.ready {
    color: rgba(255,255,255,0.8);
}

.swipe-loadmore.done {
    color: rgba(255,255,255,0.3);
    font-size: 12px;
}
