/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #FF6B35;
    --secondary-color: #4ECDC4;
    --bg-color: #F5F7FA;
    --text-color: #2C3E50;
    --text-light: #999;
    --text-lighter: #666;
    --white: #ffffff;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --gold: #FFD700;
    --silver: #C0C0C0;
    --bronze: #CD7F32;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Roboto', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 14px;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

/* 导航栏 */
.navbar {
    position: sticky;
    top: 0;
    background: var(--white);
    box-shadow: var(--shadow);
    z-index: 100;
    height: 64px;
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 100%;
    gap: 12px;
    position: relative;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    white-space: nowrap;
    flex-shrink: 0;
}

.category-tabs-wrapper {
    flex: 1 1 auto;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 12px;
    min-width: 0;
    position: relative;
    padding-right: 20px;
}

.category-tabs-wrapper::-webkit-scrollbar {
    display: none;
}

.category-tabs {
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: max-content;
    padding-right: 16px;
}

.tab {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-lighter);
    border: 1px solid var(--border-color);
    background: transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.tab.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 0;
}

.filter-select {
    width: 110px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--white);
    color: var(--text-color);
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.filter-select:hover {
    border-color: var(--primary-color);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.refresh-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--text-lighter);
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.refresh-btn:hover {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.refresh-btn:active {
    transform: scale(0.98);
}

.refresh-btn svg {
    animation: none;
}

.refresh-btn.loading svg {
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 主容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* 热榜列表 */
.hot-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    min-height: 400px;
}

/* 热榜卡片 */
.hot-card {
    background: var(--white);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow-card);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    gap: 12px;
    animation: slideUp 0.3s ease forwards;
    opacity: 0;
    border: 1px solid transparent;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hot-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(255, 107, 53, 0.2);
}

.hot-card .rank-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    color: var(--white);
    z-index: 2;
    background: var(--text-lighter);
}

.hot-card .rank-badge.rank-1 {
    background: var(--gold);
}

.hot-card .rank-badge.rank-2 {
    background: var(--silver);
}

.hot-card .rank-badge.rank-3 {
    background: var(--bronze);
}

.hot-card .thumbnail-wrapper {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf0 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hot-card:hover .thumbnail-wrapper {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.hot-card .thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 0;
    transform: scale(1.05);
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf0 100%);
}

.hot-card .thumbnail.loaded {
    opacity: 1;
    transform: scale(1);
}

.hot-card .content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.hot-card .title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    transition: color 0.3s ease;
}

.hot-card .title a {
    color: inherit;
    transition: color 0.3s ease;
}

.hot-card .title a:hover {
    color: var(--primary-color);
}

.hot-card .meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.hot-card .category-tag {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    background: var(--bg-color);
    color: var(--text-lighter);
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: inline-block;
}

.hot-card:hover .category-tag {
    transform: translateY(-1px);
}

.hot-card .category-tag.haojia {
    background: #FFF3E0;
    color: #E65100;
}

.hot-card .category-tag.haiwai {
    background: #E3F2FD;
    color: #1565C0;
}

.hot-card .category-tag.shequ {
    background: #F3E5F5;
    color: #6A1B9A;
}

.hot-card .category-tag.pinpai {
    background: #E8F5E9;
    color: #2E7D32;
}

.hot-card .category-tag.quality-demand {
    background: #FFF9C4;
    color: #F57F17;
}

.hot-card .category-tag.standard-crowdfunding {
    background: #E1F5FE;
    color: #0277BD;
}

.hot-card .category-tag.store {
    background: #FCE4EC;
    color: #C2185B;
}

.hot-card .views,
.hot-card .comments {
    font-size: 13px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 4px;
}

.hot-card .footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.hot-card .time {
    font-size: 12px;
    color: var(--text-light);
}

.hot-card .badges {
    display: flex;
    gap: 6px;
}

.hot-card .hot-badge,
.hot-card .new-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
}

.hot-card .hot-badge {
    background: #FFEBEE;
    color: #C62828;
}

.hot-card .new-badge {
    background: #E8F5E9;
    color: #2E7D32;
}

.hot-card .price-info {
    margin-top: 4px;
}

.hot-card .price {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.hot-card .price-original {
    font-size: 14px;
    color: var(--text-light);
    text-decoration: line-through;
}

.hot-card .price-discount {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
}

.hot-card .mall {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

/* 加载骨架屏 */
.loading-skeleton {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    width: 100%;
}

.skeleton-card {
    background: var(--white);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow-card);
    display: flex;
    gap: 12px;
    border: 1px solid transparent;
}

.skeleton-thumbnail {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf0 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.skeleton-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-line {
    height: 16px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

.skeleton-title {
    height: 20px;
    width: 80%;
}

.skeleton-meta {
    height: 14px;
    width: 60%;
}

.skeleton-footer {
    height: 12px;
    width: 40%;
    margin-top: auto;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 错误状态 */
.error-state,
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.error-icon,
.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.error-message,
.empty-message {
    font-size: 16px;
    color: var(--text-light);
    margin-bottom: 24px;
}

.retry-btn {
    padding: 10px 24px;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.retry-btn:hover {
    background: #E55A2B;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.retry-btn:active {
    transform: scale(0.98);
}

/* 底部 */
.footer {
    background: var(--white);
    border-top: 1px solid var(--border-color);
    margin-top: 60px;
    padding: 24px 0;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
}

.footer-container a {
    color: var(--primary-color);
    transition: color 0.2s ease;
}

.footer-container a:hover {
    color: #E55A2B;
}

/* 响应式设计 */
@media (max-width: 1023px) {
    .navbar-container {
        padding: 0 16px;
        gap: 12px;
    }

    .category-tabs-wrapper {
        margin: 0 8px;
        padding-right: 12px;
    }

    .category-tabs {
        padding-right: 12px;
    }

    .filters {
        gap: 6px;
    }

    .filter-select {
        width: 100px;
        font-size: 12px;
        padding: 0 8px;
    }

    .hot-list {
        grid-template-columns: repeat(2, 1fr);
    }

    .loading-skeleton {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .navbar {
        height: auto;
        min-height: 64px;
    }

    .navbar-container {
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 12px;
    }

    .logo {
        font-size: 20px;
    }

    .category-tabs-wrapper {
        order: 3;
        width: 100%;
        margin: 0;
        margin-top: 8px;
        padding-right: 0;
    }

    .filters {
        gap: 8px;
    }

    .filter-select {
        width: 100px;
        height: 32px;
        font-size: 13px;
    }

    .refresh-btn {
        width: 32px;
        height: 32px;
    }

    .container {
        padding: 16px;
    }

    .hot-list {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .loading-skeleton {
        grid-template-columns: 1fr;
    }

    .hot-card {
        padding: 12px;
    }

    .hot-card .thumbnail {
        width: 100px;
        height: 100px;
    }

    .hot-card .title {
        font-size: 14px;
    }

    .hot-card .rank-badge {
        width: 28px;
        height: 28px;
        font-size: 16px;
        top: 8px;
        left: 8px;
    }
}

