* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #f5f5f5;
    color: #333;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: 70px;
}

/* ===== 登录页 ===== */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.login-container {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    width: 100%;
    max-width: 340px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo h1 { font-size: 28px; color: #667eea; margin-bottom: 8px; }
.login-logo p { font-size: 14px; color: #999; }
.login-form .form-group { margin-bottom: 16px; }
.login-form input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.3s;
}
.login-form input:focus { border-color: #667eea; }
.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

/* ===== 搜索栏 ===== */
.search-bar {
    background: white;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.search-input-wrap {
    display: flex;
    gap: 10px;
    align-items: center;
}
.search-input-wrap input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
}
.search-input-wrap button {
    width: 40px;
    height: 40px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
}

/* ===== 大类标签 ===== */
.category-tabs {
    display: flex;
    background: white;
    padding: 0 16px;
    border-bottom: 1px solid #f0f0f0;
    overflow-x: auto;
    scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
    flex: 1;
    padding: 14px 8px;
    border: none;
    background: none;
    font-size: 15px;
    color: #666;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
}
.cat-tab.active {
    color: #667eea;
    font-weight: bold;
}
.cat-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 3px;
    background: #667eea;
    border-radius: 2px;
}

/* ===== 主内容区 ===== */
.main-content {
    display: flex;
    min-height: calc(100vh - 200px);
}

/* 子标签侧边栏 */
.sub-category-sidebar {
    width: 90px;
    background: white;
    border-right: 1px solid #f0f0f0;
    overflow-y: auto;
    padding: 8px 0;
}
.sub-tab {
    display: block;
    width: 100%;
    padding: 12px 8px;
    border: none;
    background: none;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    text-align: center;
    line-height: 1.4;
}
.sub-tab.active {
    color: #667eea;
    font-weight: bold;
    background: #f0f3ff;
    border-left: 3px solid #667eea;
}

/* 资源网格 */
.resource-grid {
    flex: 1;
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-content: start;
}
.resource-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    aspect-ratio: 1;
}
.resource-img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}
.resource-mask {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 10px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
}
.resource-name {
    color: white;
    font-size: 14px;
    font-weight: bold;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.empty-tip {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 14px;
}

/* ===== 搜索结果页 ===== */
.search-result-header {
    padding: 12px 16px;
    background: white;
    font-size: 14px;
    color: #666;
    border-bottom: 1px solid #f0f0f0;
}

/* ===== 详情页 ===== */
.detail-page { background: white; min-height: 100vh; }
.detail-header {
    padding: 12px 16px;
    background: white;
    position: sticky;
    top: 0;
    z-index: 100;
}
.back-btn {
    border: none;
    background: none;
    font-size: 16px;
    color: #667eea;
    cursor: pointer;
}
.detail-cover {
    width: 100%;
    height: 280px;
    background-size: cover;
    background-position: center;
}
.detail-info { padding: 20px 16px; }
.detail-info h1 { font-size: 22px; margin-bottom: 12px; }
.detail-info p { font-size: 15px; color: #666; line-height: 1.6; margin-bottom: 16px; }
.detail-meta { display: flex; gap: 16px; font-size: 13px; color: #999; }

/* ===== 底部导航 - 等距展开，左右留白 ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: white;
    border-top: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 8px 48px;
    z-index: 1000;
}
.nav-btn {
    border: none;
    background: none;
    font-size: 12px;
    color: #999;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 1;
}
.nav-btn.active { color: #667eea; }
.nav-icon { font-size: 22px; }
.nav-text { font-size: 11px; }
.add-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102,126,234,0.4);
}
