/* 
 * 电纸书之家 - 全局样式
 * 创建时间：2026年02月14日 14:51（北京时间）
 * 修改时间：2026年02月14日 18:35（北京时间）
 * 修改原因：增加色彩活力，参考小程序设计风格；优化移动端适配
 */

/* ========== CSS 变量 ========== */
:root {
    --color-bg: #f5f6fa;
    --color-surface: #ffffff;
    --color-text: #1a1a1a;
    --color-text-secondary: #555555;
    --color-text-light: #999999;
    --color-border: #e8e8e8;
    --color-border-light: #f0f0f0;

    /* 主题色 - 橙色系（呼应小程序风格） */
    --color-primary: #FF6B35;
    --color-primary-light: #FF8C5A;
    --color-primary-dark: #E55A28;
    --color-primary-bg: #FFF5F0;

    /* 辅助色 */
    --color-blue: #4A90D9;
    --color-blue-light: #E8F1FB;
    --color-purple: #7B61C4;
    --color-purple-light: #F3EFFC;
    --color-red: #E53935;
    --color-red-light: #FFEBEE;
    --color-green: #43A047;
    --color-green-light: #E8F5E9;

    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --max-width: 1200px;
    --nav-height: 60px;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

/* ========== 全局重置 ========== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-text);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-primary);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    list-style: none;
}

/* ========== 布局容器 ========== */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

.main-content {
    flex: 1;
    padding-top: var(--nav-height);
}

/* ========== 导航栏 ========== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    display: flex;
    align-items: center;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: 1px;
}

.navbar-brand:hover {
    color: var(--color-primary-dark);
}

.navbar-brand svg {
    width: 28px;
    height: 28px;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.navbar-nav a {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    position: relative;
    padding: 6px 14px;
    border-radius: 20px;
    transition: all 0.2s ease;
}

.navbar-nav a:hover {
    color: var(--color-primary);
    background: var(--color-primary-bg);
}

.navbar-nav a.active {
    color: #fff;
    background: var(--color-primary);
    font-weight: 500;
}

/* 移动端菜单按钮 */
.navbar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.2s;
}

.navbar-toggle:active {
    background: var(--color-primary-bg);
}

.navbar-toggle svg {
    width: 22px;
    height: 22px;
    stroke: var(--color-text);
}

/* ========== 页脚 ========== */
.footer {
    background: #2c2c2c;
    color: #ccc;
    padding: 36px 0;
    margin-top: 60px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-text {
    font-size: 0.85rem;
    color: #aaa;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    font-size: 0.85rem;
    color: #bbb;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--color-primary-light);
}

/* ========== Hero 区域 ========== */
.hero {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 50%, #FFAB76 100%);
    padding: 52px 0 44px;
    text-align: center;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -5%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
}

.hero-subtitle {
    font-size: 1rem;
    margin-top: 12px;
    opacity: 0.92;
    letter-spacing: 2px;
    position: relative;
    z-index: 1;
}

/* Hero 快捷入口 */
.hero-shortcuts {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 28px;
    position: relative;
    z-index: 1;
}

.hero-shortcut {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 0.85rem;
    transition: transform 0.2s;
}

.hero-shortcut:hover {
    color: #fff;
    transform: translateY(-2px);
}

.hero-shortcut-icon {
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.hero-shortcut-icon svg {
    width: 26px;
    height: 26px;
    stroke: #fff;
    fill: none;
}

/* ========== 通用卡片 ========== */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 0;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    display: block;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.card-body {
    padding: 14px 16px 16px;
}

.card-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: var(--color-border-light);
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-desc {
    font-size: 0.83rem;
    color: var(--color-text-secondary);
    margin-top: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    font-size: 0.78rem;
    color: var(--color-text-light);
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========== 网格布局 ========== */
.grid {
    display: grid;
    gap: 18px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ========== 区块标题 ========== */
.section {
    margin-top: 40px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: var(--color-primary);
    border-radius: 2px;
}

/* 区块颜色变体 */
.section-title.blue::before { background: var(--color-blue); }
.section-title.purple::before { background: var(--color-purple); }
.section-title.red::before { background: var(--color-red); }
.section-title.green::before { background: var(--color-green); }

.section-more {
    font-size: 0.83rem;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 2px;
}

.section-more:hover {
    color: var(--color-primary-dark);
}

/* ========== 标签 ========== */
.tag {
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.72rem;
    border-radius: 20px;
    font-weight: 500;
}

.tag-default {
    color: var(--color-text-secondary);
    background: var(--color-border-light);
}

.tag-orange {
    color: var(--color-primary-dark);
    background: var(--color-primary-bg);
}

.tag-blue {
    color: var(--color-blue);
    background: var(--color-blue-light);
}

.tag-purple {
    color: var(--color-purple);
    background: var(--color-purple-light);
}

.tag-green {
    color: var(--color-green);
    background: var(--color-green-light);
}

.tag-red {
    color: var(--color-red);
    background: var(--color-red-light);
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 24px;
    font-size: 0.9rem;
    font-family: inherit;
    border: none;
    border-radius: 24px;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: #ffffff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
    color: #ffffff;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--color-primary);
    color: var(--color-primary);
    box-shadow: none;
}

.btn-outline:hover {
    background: var(--color-primary-bg);
}

/* ========== 加载状态 ========== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.loading-text {
    text-align: center;
    padding: 40px 0;
    color: var(--color-text-light);
    font-size: 0.9rem;
    grid-column: 1 / -1;
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-light);
    grid-column: 1 / -1;
}

/* ========== 页面标题栏 ========== */
.page-header {
    padding: 32px 0 24px;
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-title::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 26px;
    background: var(--color-primary);
    border-radius: 3px;
}

.page-desc {
    font-size: 0.88rem;
    color: var(--color-text-secondary);
    margin-top: 6px;
    margin-left: 15px;
}

/* ========== 价格样式 ========== */
.price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-red);
}

.price-small {
    font-size: 0.8rem;
}

/* ========== 排行序号 ========== */
.rank-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    background: var(--color-text-light);
}

.rank-num.top1 { background: var(--color-red); }
.rank-num.top2 { background: var(--color-primary); }
.rank-num.top3 { background: var(--color-blue); }

/* ========== 响应式 ========== */

/* 平板 */
@media (max-width: 768px) {
    :root {
        --nav-height: 54px;
    }

    .navbar-nav {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: var(--color-surface);
        box-shadow: var(--shadow-md);
        flex-direction: column;
        padding: 12px 16px;
        gap: 4px;
    }

    .navbar-nav.show {
        display: flex;
    }

    .navbar-nav a {
        padding: 10px 16px;
        border-radius: var(--radius-sm);
        font-size: 0.95rem;
    }

    .navbar-toggle {
        display: block;
    }

    .hero {
        padding: 40px 0 32px;
    }

    .hero-title {
        font-size: 1.6rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
    }

    .hero-shortcuts {
        gap: 16px;
    }

    .hero-shortcut-icon {
        width: 46px;
        height: 46px;
        border-radius: 12px;
    }

    .hero-shortcut-icon svg {
        width: 22px;
        height: 22px;
    }

    .hero-shortcut {
        font-size: 0.8rem;
    }

    .grid-3, .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid {
        gap: 12px;
    }

    .section {
        margin-top: 32px;
    }

    .section-title {
        font-size: 1.05rem;
    }

    .page-title {
        font-size: 1.3rem;
    }

    .footer {
        padding: 28px 0;
        margin-top: 40px;
    }

    .footer-content {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

/* 手机 */
@media (max-width: 480px) {
    .container {
        padding: 0 14px;
    }

    .hero {
        padding: 32px 0 24px;
    }

    .hero-title {
        font-size: 1.35rem;
        letter-spacing: 2px;
    }

    .hero-subtitle {
        font-size: 0.82rem;
    }

    .hero-shortcuts {
        gap: 12px;
        flex-wrap: wrap;
    }

    .hero-shortcut-icon {
        width: 42px;
        height: 42px;
        border-radius: 10px;
    }

    .hero-shortcut-icon svg {
        width: 20px;
        height: 20px;
    }

    .hero-shortcut {
        font-size: 0.75rem;
    }

    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-3, .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid {
        gap: 10px;
    }

    .card-body {
        padding: 10px 12px 12px;
    }

    .card-title {
        font-size: 0.85rem;
    }

    .card-desc {
        font-size: 0.78rem;
    }

    .section {
        margin-top: 24px;
    }

    .section-header {
        margin-bottom: 14px;
    }

    .section-title {
        font-size: 1rem;
    }

    .section-title::before {
        width: 3px;
        height: 16px;
    }

    .page-header {
        padding: 24px 0 16px;
        margin-bottom: 16px;
    }

    .page-title {
        font-size: 1.15rem;
    }

    .page-title::before {
        width: 4px;
        height: 20px;
    }

    .page-desc {
        font-size: 0.82rem;
        margin-left: 12px;
    }

    .btn {
        padding: 8px 18px;
        font-size: 0.85rem;
    }

    .footer {
        padding: 24px 0;
        margin-top: 32px;
    }

    .footer-text {
        font-size: 0.8rem;
    }

    .footer-links a {
        font-size: 0.8rem;
    }
}
