/* 首页样式 - 左侧导航 + 现代化布局
 * 设计变量与通用头部/底部见 css/theme.css
 */

/* ============ 主体布局 ============ */
.home-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 14px calc(var(--footer-h) + 24px);
    min-height: calc(100vh - var(--header-h));
}

.home-layout {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

/* ============ 左侧分类导航 ============ */
.side-nav {
    flex: 0 0 92px;
    width: 92px;
    position: sticky;
    top: calc(var(--header-h) + 12px);
    max-height: calc(100vh - var(--header-h) - var(--footer-h) - 24px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 108, 255, 0.25) transparent;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    padding: 12px 8px 10px;
}

.side-nav::-webkit-scrollbar {
    width: 4px;
}

.side-nav::-webkit-scrollbar-track {
    background: transparent;
}

.side-nav::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background: rgba(59, 108, 255, 0.22);
}

.side-nav-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--t3);
    letter-spacing: 1px;
    padding: 0 4px 10px;
}

.side-nav-title::before {
    content: '';
    width: 3px;
    height: 12px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--brand), var(--brand-2));
}

.category-tabs {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    overflow: visible;
}

.category-tabs .tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 10px 2px 9px;
    border: 1px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    transition: background .25s ease, border-color .25s ease, transform .18s ease;
    -webkit-tap-highlight-color: transparent;
}

.category-tabs .tab:active {
    transform: scale(.96);
}

.category-tabs .tab .tab-icon {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0;
    box-shadow: 0 4px 10px rgba(31, 36, 48, .14), inset 0 0 0 1px rgba(255, 255, 255, .22);
    transition: transform .25s ease, box-shadow .25s ease;
}

.category-tabs .tab .tab-text {
    max-width: 100%;
    font-size: 12px;
    font-weight: 500;
    color: var(--t2);
    text-align: center;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .25s ease;
}

.category-tabs .tab:hover {
    background: #f6f8fc;
}

.category-tabs .tab.active {
    background: linear-gradient(135deg, rgba(59, 108, 255, .12), rgba(107, 77, 255, .05));
    border-color: rgba(59, 108, 255, .25);
}

.category-tabs .tab.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, var(--brand), var(--brand-2));
}

.category-tabs .tab.active .tab-icon {
    transform: scale(1.05);
    box-shadow: 0 6px 14px rgba(59, 108, 255, .35);
}

.category-tabs .tab.active .tab-text {
    color: var(--brand);
    font-weight: 700;
}

/* 首字母头像配色 */
.av-0 { background: linear-gradient(135deg, #3b6cff, #6b4dff); }
.av-1 { background: linear-gradient(135deg, #00c2ff, #3b6cff); }
.av-2 { background: linear-gradient(135deg, #7c5cff, #c46bff); }
.av-3 { background: linear-gradient(135deg, #ff7a45, #ff3b5c); }
.av-4 { background: linear-gradient(135deg, #00c48c, #00a3a3); }
.av-5 { background: linear-gradient(135deg, #ffb020, #ff7a45); }
.av-6 { background: linear-gradient(135deg, #5b8def, #7c5cff); }
.av-7 { background: linear-gradient(135deg, #ff5c8a, #c46bff); }

/* ============ 右侧内容区 ============ */
.content-area {
    flex: 1;
    min-width: 0;
}

/* 通知横幅 */
.notification-container {
    display: flex;
    align-items: center;
    height: 38px;
    padding: 0 12px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ffffff, #f3f7ff);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--sh-1);
    overflow: hidden;
}

.notification-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    margin-right: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

.noti-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    animation: notiPulse 1.4s ease-in-out infinite;
}

@keyframes notiPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .35; transform: scale(.7); }
}

.notification-scroll-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 100%;
}

.notification-content {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: max-content;
    display: flex;
    align-items: center;
    white-space: nowrap;
    animation: scroll-left 32s linear infinite;
}

.notification-text {
    font-size: 13px;
    color: var(--t2);
    letter-spacing: .2px;
}

@keyframes scroll-left {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* 内容头部 */
.content-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.content-head-left {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.content-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--t1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.content-sub {
    font-size: 12px;
    color: var(--t3);
    white-space: nowrap;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    max-width: 190px;
    padding: 7px 12px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--t3);
    transition: border-color .25s ease, box-shadow .25s ease;
}

.search-box:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(59, 108, 255, .12);
}

.search-box input {
    flex: 1;
    min-width: 0;
    width: 120px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    color: var(--t1);
}

.search-box input::placeholder {
    color: var(--t3);
}

.search-box input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

/* ============ 商品列表 ============ */
.product-category {
    margin-bottom: 18px;
}

.category-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 10px;
}

.category-avatar {
    width: 26px;
    height: 26px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 3px 8px rgba(31, 36, 48, .16);
}

.category-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--t1);
    margin: 0;
    padding: 0;
    border: none;
    line-height: 1.3;
}

.category-count {
    font-size: 12px;
    color: var(--t3);
}

.product-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.product-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--card);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    transition: transform .25s ease, box-shadow .25s ease;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sh-2);
}

.product-thumb {
    flex: 0 0 92px;
    width: 92px;
    height: 92px;
    border-radius: var(--r-md);
    overflow: hidden;
    background: linear-gradient(135deg, #f2f5fb, #e9eefb);
}

.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}

.product-card:hover .product-thumb img {
    transform: scale(1.06);
}

.product-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--t1);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
}

.tag {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    background: #f2f5fb;
    color: var(--t2);
}

.tag-blue {
    background: rgba(59, 108, 255, .1);
    color: var(--brand);
}

.tag-green {
    background: rgba(0, 196, 140, .12);
    color: #00a377;
}

.tag-orange {
    background: rgba(255, 160, 32, .14);
    color: #e08a00;
}

.product-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
}

.product-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--price);
    margin: 0;
    line-height: 1.2;
}

.buy-btn {
    flex: 0 0 auto;
    padding: 8px 18px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 108, 255, .28);
    transition: transform .2s ease, box-shadow .2s ease;
}

.buy-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 108, 255, .38);
}

.buy-btn:active {
    transform: scale(.96);
}

/* 骨架屏 */
.skeleton-card {
    pointer-events: none;
}

.sk {
    background: linear-gradient(90deg, #eef1f7 25%, #e3e8f2 37%, #eef1f7 63%);
    background-size: 400% 100%;
    animation: skShimmer 1.4s ease infinite;
    border-radius: var(--r-sm);
}

.sk-thumb {
    flex: 0 0 92px;
    width: 92px;
    height: 92px;
    border-radius: var(--r-md);
}

.sk-line {
    height: 14px;
}

@keyframes skShimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* 空状态 */
.empty-state,
.no-result {
    padding: 46px 16px;
    text-align: center;
    background: var(--card);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    color: var(--t3);
    font-size: 13px;
}

.no-result {
    margin-top: 12px;
    box-shadow: none;
    background: transparent;
}

.empty-icon {
    width: 54px;
    height: 54px;
    margin: 0 auto 12px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #cfd8ea, #b9c4dc);
}

.empty-text {
    margin: 0;
}

.grid-empty {
    grid-column: 1 / -1;
    padding: 18px;
    text-align: center;
    font-size: 12px;
    color: var(--t3);
    background: #fff;
    border-radius: var(--r-md);
}

/* ============ 响应式 ============ */
@media (min-width: 600px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (min-width: 768px) {
    .home-content {
        padding: 18px 20px calc(var(--footer-h) + 28px);
    }

    .home-layout {
        gap: 16px;
    }

    .side-nav {
        flex: 0 0 208px;
        width: 208px;
        padding: 14px 10px;
    }

    .side-nav-title {
        padding: 0 8px 12px;
    }

    .category-tabs {
        gap: 4px;
    }

    .category-tabs .tab {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        padding: 9px 12px;
        border-radius: 12px;
    }

    .category-tabs .tab .tab-icon {
        width: 36px;
        height: 36px;
        border-radius: 12px;
        font-size: 16px;
    }

    .category-tabs .tab .tab-text {
        flex: 1;
        min-width: 0;
        font-size: 13px;
        text-align: left;
    }

    .category-tabs .tab.active::before {
        height: 26px;
    }

    .content-area .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

@media (max-width: 480px) {
    .home-content {
        padding: 10px 10px calc(var(--footer-h) + 20px);
    }

    .home-layout {
        gap: 8px;
    }

    .side-nav {
        flex: 0 0 80px;
        width: 80px;
        padding: 10px 6px 8px;
    }

    .side-nav-title {
        padding: 0 4px 8px;
        font-size: 11px;
    }

    .category-tabs .tab {
        padding: 8px 2px 7px;
    }

    .category-tabs .tab .tab-icon {
        width: 38px;
        height: 38px;
        border-radius: 13px;
        font-size: 16px;
    }

    .category-tabs .tab .tab-text {
        font-size: 11px;
    }

    .content-title {
        font-size: 15px;
    }

    .search-box {
        max-width: 130px;
        padding: 6px 10px;
    }

    .search-box input {
        width: 74px;
        font-size: 12px;
    }

    .product-thumb,
    .sk-thumb {
        flex: 0 0 78px;
        width: 78px;
        height: 78px;
    }

    .product-name {
        font-size: 14px;
    }

    .product-price {
        font-size: 16px;
    }

    .buy-btn {
        padding: 7px 14px;
        font-size: 12px;
    }

    .logo-text {
        font-size: 15px;
    }

    .top-nav a {
        padding: 5px 9px;
        font-size: 13px;
    }
}
