/* ===========================
   首页UI - 全新设计 v3
   =========================== */

/* ---------- 搜索栏 ---------- */
.home-search-wrap {
    padding: 12px 16px 8px;
    background: #ffffff;
    position: relative;
    z-index: 100;
}

.home-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f5f6fa;
    border: 1.5px solid transparent;
    border-radius: 14px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.home-search-bar:active {
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.08);
}

.home-search-bar svg {
    flex-shrink: 0;
    color: #9ca3af;
}

.home-search-bar .search-text {
    flex: 1;
    color: #9ca3af;
    font-size: 14px;
    font-weight: 400;
}

.home-search-msg {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f5f6fa;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
}

.home-search-msg:active {
    background: rgba(102,126,234,0.1);
}

.home-search-msg .msg-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 7px;
    height: 7px;
    background: #ef4444;
    border-radius: 50%;
    border: 1.5px solid #f5f6fa;
}

/* ---------- Banner轮播 ---------- */
.home-banner-wrap {
    padding: 0 16px;
    margin-bottom: 20px;
}

.home-banner {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    height: 160px;
    box-shadow: 0 8px 24px rgba(102,126,234,0.18);
}

.banner-item {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    padding: 0 22px;
    overflow: hidden;
}

.banner-item.active { opacity: 1; }

/* 背景装饰圆 */
.banner-item::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 160px; height: 160px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}

.banner-item::after {
    content: '';
    position: absolute;
    bottom: -60px; left: -30px;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
}

.banner-content {
    position: relative;
    z-index: 2;
    max-width: 65%;
}

.banner-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.15);
}

.banner-title {
    color: white;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.banner-desc {
    color: rgba(255,255,255,0.9);
    font-size: 12px;
    margin-bottom: 14px;
    line-height: 1.4;
}

.banner-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.95);
    color: #1f2937;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 22px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: none;
}

.banner-btn:active {
    transform: scale(0.96);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.banner-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
}

.banner-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #d1d5db;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    padding: 0;
}

.banner-dot.active {
    width: 20px;
    border-radius: 3px;
    background: #667eea;
}

/* ---------- 分类网格（新设计）---------- */
.home-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    margin-bottom: 14px;
}

.home-section-title h2 {
    color: #1f2937;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.home-section-title .section-more {
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 2px;
    transition: color 0.2s ease;
}

.home-section-title .section-more:active {
    color: #667eea;
}

.cat-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 0 12px;
    margin-bottom: 24px;
}

.cat-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 2px;
    cursor: pointer;
    transition: transform 0.2s ease;
    border-radius: 12px;
}

.cat-grid-item:active {
    transform: scale(0.92);
    background: rgba(0,0,0,0.02);
}

.cat-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.3s ease;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.cat-grid-item:active .cat-icon-wrap {
    transform: scale(0.92);
}

.cat-icon-wrap svg {
    width: 22px;
    height: 22px;
    position: relative;
    z-index: 1;
}

/* 分类真实图片 */
.cat-icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px;
    display: block;
}

.cat-label {
    color: #374151;
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
}

/* ---------- 二级子分类列表 ---------- */
.subcat-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
    cursor: pointer;
    transition: background 0.15s ease;
}
.subcat-list-item:active {
    background: #f5f5f5;
}
.subcat-name {
    flex: 1;
    font-size: 15px;
    color: #333;
    font-weight: 500;
}
.subcat-arrow {
    flex-shrink: 0;
    margin-left: auto;
}

/* 二级分类真实图片 */
.subcat-icon-img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}
.subcat-icon-fallback {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* 分类页各层级滚动 */
#category-level-1,
#category-level-2,
#category-product-page {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* ---------- 商品卡片（新设计）---------- */
.product-grid {
    display: flex;
    gap: 10px;
    padding: 0 16px;
    margin-bottom: 20px;
}

.product-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-card {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid #f0f0f5;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    animation: cardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.product-card:active {
    transform: scale(0.97);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(15px); }
    to   { opacity: 1; transform: translateY(0); }
}

.product-card:nth-child(1) { animation-delay: 0.03s; }
.product-card:nth-child(2) { animation-delay: 0.06s; }
.product-card:nth-child(3) { animation-delay: 0.09s; }
.product-card:nth-child(4) { animation-delay: 0.12s; }

.product-img-area {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 20px;
    aspect-ratio: 1 / 0.85;
}

.product-img-area .product-icon {
    position: relative;
    z-index: 2;
    font-size: 36px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}
.product-img-area img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
}

/* 图片区域背景渐变 */
.product-img-area .img-bg {
    position: absolute;
    inset: 0;
    opacity: 0.12;
    z-index: 0;
}

/* 装饰圆 */
.product-img-area .img-deco {
    position: absolute;
    bottom: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.08;
    z-index: 1;
}

.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    font-size: 9px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 8px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.product-badge.hot {
    background: #ef4444;
    color: white;
    box-shadow: 0 2px 6px rgba(239,68,68,0.3);
}

.product-badge.new {
    background: #10b981;
    color: white;
    box-shadow: 0 2px 6px rgba(16,185,129,0.3);
}

.product-badge.discount {
    background: #f59e0b;
    color: white;
    box-shadow: 0 2px 6px rgba(245,158,11,0.3);
}

.product-info {
    padding: 10px 12px 12px;
}

.product-name {
    color: #1f2937;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 3px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-desc {
    color: #9ca3af;
    font-size: 10px;
    margin-bottom: 6px;
}

.product-price-row {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-bottom: 6px;
}

.product-price {
    color: #ef4444;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.product-original {
    color: #d1d5db;
    font-size: 10px;
    text-decoration: line-through;
}

.product-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.product-tag {
    background: #fef2f2;
    color: #ef4444;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

/* ---------- 首页主内容滚动区 ---------- */
.home-scroll {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
    scroll-behavior: smooth;
}

.home-scroll::-webkit-scrollbar { display: none; }

/* ---------- 加载/空状态 ---------- */
.home-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    color: #9ca3af;
    font-size: 13px;
}

/* ---------- 首页顶部整合区域 ---------- */
.home-top {
    background: #ffffff;
    border-bottom: 1px solid #f0f0f5;
    padding-bottom: 4px;
}
