/* ========================================
   搜书神器 Web - 精美移动端样式 v2
======================================== */

/* ============ 基础重置 ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    color: #1a1a2e;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ============ 头部导航 ============ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.2), transparent);
}

.header-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.header-gradient::after {
    display: none;
}

.header-back {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 31px;
    position: relative;
    top: -6px;
}

.header-gradient .header-back,
.header-gradient .header-action {
    color: white;
}

.header-back:active,
.header-action:active {
    background: rgba(102, 126, 234, 0.1);
    transform: scale(0.95);
}

.header-title {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding: 0 40px;
}

.header-gradient .header-title {
    color: white;
    background: none;
    -webkit-text-fill-color: white;
}

.header-action {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* ============ 主内容区 ============ */
.main-content {
    padding-top: calc(56px + env(safe-area-inset-top));
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
    min-height: 100vh;
}

/* ============ 底部导航 ============ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(65px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: flex-start;
    padding-top: 8px;
    z-index: 1000;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.08);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 0;
    color: #8e8e93;
    font-size: 10px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: -8px;
    width: 40px;
    height: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0 0 3px 3px;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.3s ease;
}

.nav-item.active {
    color: #667eea;
}

.nav-item.active::before {
    opacity: 1;
    transform: translateY(0);
}

.nav-item i {
    font-size: 17px;
    transition: transform 0.3s ease;
}

.nav-item:active i {
    transform: scale(1.15);
}

/* ============ 搜索栏 ============ */
.search-bar {
    padding: 16px 20px;
    background: white;
    position: sticky;
    top: calc(56px + env(safe-area-inset-top));
    z-index: 100;
}

.search-box {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #f0f2f5 100%);
    border-radius: 16px;
    padding: 14px 18px;
    gap: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.search-icon {
    font-size: 18px;
    opacity: 0.5;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    color: #1a1a2e;
    outline: none;
}

.search-input::placeholder {
    color: #a0a5b1;
}

.search-clear {
    font-size: 16px;
    color: #c4c4c4;
    cursor: pointer;
    padding: 4px;
}

/* ============ 分类标签 ============ */
.category-bar {
    padding: 0 20px 16px;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-bar::-webkit-scrollbar {
    display: none;
}

.category-item {
    flex-shrink: 0;
    padding: 10px 20px;
    background: white;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    color: #5a5a6e;
    white-space: nowrap;
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.category-item:active {
    transform: scale(0.96);
}

.category-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.35);
}

/* ============ 统计卡片 ============ */
.stats-card {
    margin: 0 20px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 24px;
    padding: 24px;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.35);
}

.stats-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

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

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    position: relative;
    z-index: 1;
}

.stats-item {
    text-align: center;
}

.stats-value {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stats-label {
    font-size: 11px;
    opacity: 0.85;
}

/* ============ 书籍网格 ============ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 14px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

.section-more {
    font-size: 13px;
    color: #8e8e9a;
    display: flex;
    align-items: center;
    gap: 4px;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    padding: 0 16px 20px;
}

.book-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

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

.book-card:active {
    transform: scale(0.97) translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* ============ 书籍卡片（无图片版） ============ */
.book-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.book-card:active {
    transform: scale(0.97);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 卡片顶部渐变背景 */
.book-card-header {
    position: relative;
    padding: 20px 16px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
}

/* 装饰性背景图案 */
.book-card-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.book-card-header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

/* 标题区域 */
.book-card-title-area {
    position: relative;
    z-index: 1;
}

.book-card-rank {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.25);
    backdrop-filter: blur(8px);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 10px;
}

.book-card-rank.gold {
    background: linear-gradient(135deg, #ffd700, #ffb700);
    color: #8B6914;
}

.book-card-rank.silver {
    background: linear-gradient(135deg, #e0e0e0, #c0c0c0);
    color: #555;
}

.book-card-rank.bronze {
    background: linear-gradient(135deg, #cd7f32, #a0522d);
    color: white;
}

.book-card-title {
    font-size: 16px;
    font-weight: 700;
    color: white;
    line-height: 1.4;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-card-author {
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 标签区域 */
.book-card-tags {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.book-card-tag {
    padding: 3px 10px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(4px);
    border-radius: 12px;
    font-size: 11px;
    color: white;
}

.book-card-tag.r18 {
    background: rgba(255,100,100,0.3);
    border: 1px solid rgba(255,100,100,0.5);
}

/* 卡片底部统计 */
.book-card-footer {
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
}

.book-card-stats {
    display: flex;
    gap: 10px;
}

.book-card-stat {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    color: #666;
}

.book-card-stat .icon {
    font-size: 12px;
}

.book-card-stat.highlight {
    color: #ff6b6b;
    font-weight: 600;
}

/* 评分显示 */
.book-card-rating {
    display: flex;
    align-items: center;
    gap: 2px;
    background: linear-gradient(135deg, #fff9e6, #fff3cc);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: #ff9500;
    font-weight: 600;
}

/* 卡片底部操作栏 */
.book-card-actions {
    padding: 10px 16px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.book-card-desc {
    flex: 1;
    font-size: 12px;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 12px;
}

.book-card-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.book-card-btn:active {
    transform: scale(0.95);
}

/* ============ 书籍列表 ============ */
.book-list {
    padding: 0 20px 20px;
}

.book-list-item {
    display: flex;
    background: white;
    border-radius: 20px;
    padding: 14px;
    margin-bottom: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.book-list-item:nth-child(1) { animation-delay: 0.05s; }
.book-list-item:nth-child(2) { animation-delay: 0.1s; }
.book-list-item:nth-child(3) { animation-delay: 0.15s; }
.book-list-item:nth-child(4) { animation-delay: 0.2s; }
.book-list-item:nth-child(5) { animation-delay: 0.25s; }

.book-list-item:active {
    transform: scale(0.98);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.book-list-cover {
    width: 70px;
    height: 93px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-list-cover-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
}

.book-list-cover-placeholder {
    position: relative;
    z-index: 1;
    font-size: 28px;
    color: white;
}

.book-list-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8) 0%, rgba(118, 75, 162, 0.8) 100%);
    opacity: 0.9;
}

.book-list-cover-placeholder {
    position: absolute;
    z-index: 2;
    font-size: 28px;
}

.book-list-info {
    flex: 1;
    margin-left: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.book-list-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-list-author {
    font-size: 13px;
    color: #8e8e9a;
    margin-bottom: 8px;
}

.book-list-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #a0a5b1;
}

.book-list-stat {
    display: flex;
    align-items: center;
    gap: 3px;
}

.book-list-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    flex-shrink: 0;
}

/* ============ 按钮样式 ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 44px;
    cursor: pointer;
    border: none;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.35);
}

.btn-primary:active {
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
}

.btn-outline {
    background: white;
    border: 1.5px solid #e8eaed;
    color: #5a5a6e;
}

.btn-outline:active {
    background: #f5f7fa;
    border-color: #d1d1d6;
}

.btn-text {
    background: transparent;
    color: #667eea;
    padding: 8px 16px;
}

.btn-success {
    background: linear-gradient(135deg, #2ed573 0%, #1abc9c 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(46, 213, 115, 0.35);
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.35);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    min-height: 36px;
    border-radius: 20px;
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
}

/* ============ 卡片组件 ============ */
.card {
    background: white;
    border-radius: 20px;
    padding: 18px;
    margin: 0 20px 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

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

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
}

/* ============ 用户卡片 ============ */
.user-card {
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0 0 30px 30px;
    padding: calc(20px + env(safe-area-inset-top)) 24px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

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

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

.user-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 14px;
    border: 3px solid rgba(255, 255, 255, 0.5);
    position: relative;
    z-index: 1;
}

.user-name {
    font-size: 22px;
    font-weight: 700;
    color: white;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}

.user-level {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.user-level-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 16px;
    border-radius: 20px;
    margin-bottom: 20px;
}

.user-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    position: relative;
    z-index: 1;
}

.user-stat {
    text-align: center;
}

.user-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: white;
}

.user-stat-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    margin-top: 2px;
}

/* ============ 设置列表 ============ */
.setting-list {
    background: white;
    margin: 0;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f5f5f7;
    transition: background 0.2s ease;
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item:active {
    background: #fafafa;
}

.setting-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.setting-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.setting-icon.gradient-red {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
}

.setting-icon.gradient-green {
    background: linear-gradient(135deg, #2ed573 0%, #1abc9c 100%);
}

.setting-icon.gradient-orange {
    background: linear-gradient(135deg, #ffa502 0%, #ff7f50 100%);
}

.setting-icon.gradient-purple {
    background: linear-gradient(135deg, #a55eea 0%, #8854d0 100%);
}

.setting-info {
    flex: 1;
}

.setting-title {
    font-size: 15px;
    font-weight: 500;
    color: #1a1a2e;
    margin-bottom: 2px;
}

.setting-desc {
    font-size: 12px;
    color: #8e8e9a;
}

.setting-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-value {
    font-size: 14px;
    color: #8e8e9a;
}

/* ============ 开关 ============ */
.toggle {
    width: 52px;
    height: 30px;
    background: #e8eaed;
    border-radius: 15px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.toggle::after {
    content: '';
    position: absolute;
    width: 26px;
    height: 26px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.toggle.active::after {
    transform: translateX(22px);
}

/* ============ 排行榜 ============ */
.rank-list {
    background: white;
    margin: 0;
}

.rank-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #f5f5f7;
    transition: background 0.2s ease;
}

.rank-item:last-child {
    border-bottom: none;
}

.rank-item:active {
    background: #fafafa;
}

.rank-medal {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-right: 14px;
    font-weight: 700;
}

.rank-medal.gold {
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    color: #8B6914;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.rank-medal.silver {
    background: linear-gradient(135deg, #c0c0c0 0%, #a8a8a8 100%);
    color: #666;
    box-shadow: 0 4px 12px rgba(192, 192, 192, 0.4);
}

.rank-medal.bronze {
    background: linear-gradient(135deg, #cd7f32 0%, #b87333 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(205, 127, 50, 0.4);
}

.rank-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    color: #8e8e9a;
    margin-right: 14px;
}

.rank-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    margin-right: 14px;
}

.rank-info {
    flex: 1;
}

.rank-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 3px;
}

.rank-value {
    font-size: 12px;
    color: #8e8e9a;
}

.rank-badge {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    color: #ff9800;
}

/* ============ 模态框 ============ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    width: 100%;
    max-height: 85vh;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #f0f0f2;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #8e8e9a;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:active {
    background: #f5f5f7;
    color: #5a5a6e;
}

.modal-body {
    padding: 20px;
    max-height: calc(85vh - 70px);
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    display: flex;
    gap: 12px;
    border-top: 1px solid #f0f0f2;
}

/* ============ 空状态 ============ */
.empty-state {
    text-align: center;
    padding: 60px 30px;
}

.empty-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.6;
}

.empty-text {
    font-size: 15px;
    color: #8e8e9a;
    margin-bottom: 24px;
    line-height: 1.6;
}

/* ============ 加载状态 ============ */
.loading {
    text-align: center;
    padding: 50px;
}

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid #f0f2f5;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 14px;
    color: #8e8e9a;
}

/* ============ Toast ============ */
.toast {
    position: fixed;
    top: calc(70px + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 28px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
}

.toast.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: linear-gradient(135deg, #2ed573 0%, #1abc9c 100%);
    box-shadow: 0 8px 30px rgba(46, 213, 115, 0.4);
}

.toast.error {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    box-shadow: 0 8px 30px rgba(255, 107, 107, 0.4);
}

/* ============ 分页 ============ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 24px 20px;
}

.page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border-radius: 20px;
    background: white;
    color: #5a5a6e;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
}

.page-btn:active {
    transform: scale(0.95);
    background: #f5f7fa;
}

.page-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.35);
}

/* ============ Tab 栏 ============ */
.tab-bar {
    display: flex;
    background: white;
    margin: 0;
    padding: 0 20px;
    border-bottom: 1px solid #f0f2f5;
}

.tab-item {
    flex: 1;
    padding: 16px 0;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    color: #8e8e9a;
    position: relative;
    transition: color 0.3s ease;
}

.tab-item.active {
    color: #667eea;
    font-weight: 600;
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px 3px 0 0;
}

/* ============ 评论 ============ */
.comment-item {
    padding: 18px 0;
    border-bottom: 1px solid #f5f5f7;
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    margin-right: 12px;
}

.comment-info {
    flex: 1;
}

.comment-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
}

.comment-time {
    font-size: 12px;
    color: #8e8e9a;
}

.comment-rating {
    font-size: 14px;
}

.comment-content {
    font-size: 14px;
    color: #4a4a5a;
    line-height: 1.7;
    margin-bottom: 10px;
}

.comment-footer {
    display: flex;
    gap: 20px;
    color: #a0a5b1;
    font-size: 12px;
}

/* ============ 书籍详情页 ============ */
.book-detail-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: calc(70px + env(safe-area-inset-top)) 20px 30px;
    color: white;
    position: relative;
    overflow: hidden;
}

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

.book-detail-cover {
    width: 130px;
    height: 175px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 52px;
    margin: 0 auto 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.book-detail-title {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.book-detail-author {
    text-align: center;
    opacity: 0.9;
    margin-bottom: 20px;
    font-size: 15px;
    position: relative;
    z-index: 1;
}

.book-detail-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 13px;
    position: relative;
    z-index: 1;
}

.book-detail-stat {
    text-align: center;
}

.book-detail-stat-value {
    font-size: 20px;
    font-weight: 700;
    display: block;
}

.book-detail-actions {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 24px;
    position: relative;
    z-index: 1;
}

.book-detail-content {
    padding: 20px;
    margin-top: -20px;
    position: relative;
    z-index: 2;
}

.book-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.book-detail-tag {
    padding: 6px 14px;
    background: linear-gradient(135deg, #f5f7fa 0%, #f0f2f5 100%);
    border-radius: 15px;
    font-size: 13px;
    color: #5a5a6e;
}

/* ============ 登录页 ============ */
.login-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -200px;
    right: -200px;
    width: 500px;
    height: 500px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.login-container::after {
    content: '';
    position: absolute;
    bottom: -150px;
    left: -150px;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.login-logo {
    font-size: 72px;
    margin-bottom: 18px;
    position: relative;
    z-index: 1;
}

.login-title {
    font-size: 30px;
    font-weight: 800;
    color: white;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.login-subtitle {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
}

.login-form {
    width: 100%;
    background: white;
    border-radius: 28px;
    padding: 32px 26px;
    position: relative;
    z-index: 1;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.login-input-group {
    margin-bottom: 22px;
}

.login-input-label {
    font-size: 14px;
    font-weight: 500;
    color: #5a5a6e;
    margin-bottom: 10px;
    display: block;
}

.login-input {
    width: 100%;
    padding: 16px 18px;
    border: 1.5px solid #e8eaed;
    border-radius: 14px;
    font-size: 16px;
    background: #fafbfc;
    transition: all 0.3s ease;
}

.login-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.login-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 28px;
    font-size: 17px;
    font-weight: 700;
    margin-top: 8px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.login-btn:active {
    transform: scale(0.97);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.login-btn:disabled {
    opacity: 0.7;
}

.login-footer {
    margin-top: 28px;
    text-align: center;
    font-size: 14px;
    color: #8e8e9a;
    position: relative;
    z-index: 1;
}

.login-footer a {
    color: white;
    font-weight: 600;
    text-decoration: none;
}

.login-skip {
    margin-top: 30px;
    position: relative;
    z-index: 1;
}

.login-skip a {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    text-decoration: none;
}

/* ============ 辅助类 ============ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #8e8e9a; }
.text-primary { color: #667eea; }
.text-danger { color: #ff6b6b; }
.text-success { color: #2ed573; }

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }

.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.hidden { display: none !important; }

/* ============ 响应式 ============ */
@media (min-width: 768px) {
    .book-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
        padding: 0 30px 30px;
    }
    
    .header {
        height: 60px;
    }
    
    .main-content {
        padding-top: calc(60px + env(safe-area-inset-top));
    }
    
    .stats-grid {
        gap: 24px;
    }
    
    .stats-value {
        font-size: 26px;
    }
}

/* ============ 滚动条美化 ============ */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}
