:root {
    --primary-color: #4a90e2;
    --text-color: #333;
    --background-color: #ffffff;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --scrollbar-width: 0px;
    --apple-bg-light: rgba(142, 142, 147, 0.12);
    --apple-bg-light-hover: rgba(142, 142, 147, 0.16);
    --apple-text-secondary: #8E8E93;
    --apple-blue: #007AFF;
}

/* 最关键的修复：让滚动条始终存在，防止任何布局偏移 */
html {
    overflow-y: scroll !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    padding-top: 60px;
    padding-right: 0 !important; 
    margin-right: 0 !important;
    width: 100% !important;
    position: relative;
}

/* 导航栏固定样式 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    padding: 10px 20px !important;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    color: var(--text-color) !important;
    font-weight: 600;
    letter-spacing: -0.02em;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
}

.brand-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    background: var(--apple-blue);
    color: white;
    border-radius: 8px;
    margin-right: 8px;
    font-weight: bold;
}

.nav-item .nav-link {
    color: var(--text-color) !important;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s;
    border-radius: 8px;
}

.nav-item .nav-link:hover,
.nav-item .nav-link.active {
    color: var(--apple-blue) !important;
    background-color: var(--apple-bg-light);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Logo样式 */
.logo-container {
    text-align: center;
    margin: 20px 0 40px;
}

.logo {
    max-width: 200px;
    height: auto;
}

/* 搜索框样式 */
.search-container {
    max-width: 600px;
    margin: 0 auto 40px;
    position: relative;
}

.search-input {
    border-radius: 12px !important;
    padding: 14px 50px !important;
    font-size: 16px;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: #1d1d1f;
    border: none !important;
    background-color: var(--apple-bg-light);
    box-shadow: none;
    width: 100%;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.search-input::placeholder {
    color: var(--apple-text-secondary);
    opacity: 0.7;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.search-input:focus {
    background-color: var(--apple-bg-light-hover);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
    outline: none;
}

.search-form {
    position: relative;
}

.search-form::before {
    content: "\F52A";
    font-family: "bootstrap-icons";
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--apple-text-secondary);
    font-size: 18px;
    z-index: 10;
}

.search-form .btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 8px !important;
    padding: 8px 16px !important;
    background-color: var(--apple-blue);
    border: none;
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
    z-index: 5;
    height: auto;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.search-form .btn:hover {
    background-color: #0071eb;
    transform: translateY(-50%) scale(1.03);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

/* 自定义额外样式 */
.main-content {
    min-height: auto;
    padding-top: 0px;
}



@media (max-width: 767px) {
    footer .footer-top {
        padding: 30px 0 20px;
    }
    
    footer h5 {
        margin-top: 20px;
        margin-bottom: 15px;
    }
    
    footer .footer-bottom {
        padding: 12px 0;
    }
    
    footer .footer-bottom .disclaimer {
        font-size: 0.75rem;
    }
}

/* 模态框样式 - 基础版（小屏幕） */
.book-detail-container {
    display: flex;
    flex-direction: column;
    gap: 5px; /* 减少间距 */
    align-items: center;
    max-width: 100%; /* 去掉限制 */
    margin: 0;
}

/* 书籍封面容器 */
.book-cover-container {
    width: 100%;
    position: relative;
    text-align: center;
    margin-bottom: 0;
    max-width: 180px; /* 减小封面最大宽度 */
}

.book-detail-cover {
    width: 100%; /* 确保宽度填充 */
    max-width: 100%;
    height: auto;
    max-height: 240px; /* 减小高度 */
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    border-radius: 4px;
}

/* 在小屏幕上，使用两行文本省略效果 */
.book-detail-title {
    font-size: 1.2rem; /* 减小标题字体 */
    margin: 5px 0;
    padding: 0;
    font-weight: 600;
    line-height: 1.3;
    color: #333;
    text-align: center;
    width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 3.1rem;
    white-space: normal;
}

.book-info-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* 书籍信息容器 */
.book-info-container {
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.book-info-content {
    margin-bottom: 15px; /* 增加底部间距 */
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.book-info-item {
    display: flex;
    margin-bottom: 0;
    align-items: center;
    font-size: 0.9rem;
    line-height: 1.2;
}

.info-label {
    font-weight: 600;
    width: auto;
    color: #666;
    text-align: left;
    flex-shrink: 0;
    margin-right: 2px;
}

.info-value {
    flex: 1;
    color: #333;
}

.btn-download {
    margin-top: 8px; /* 增加顶部间距 */
    padding: 8px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%; /* 确保按钮占满宽度 */
}

.btn-download::before {
    content: "\F30A"; /* Bootstrap图标: 下载 */
    font-family: "bootstrap-icons";
    margin-right: 6px;
    font-size: 1rem;
}

/* 模态框整体样式优化 */
.modal-content {
    border-radius: 8px;
    border: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.modal-dialog {
    max-width: 320px; /* 减小模态框宽度 */
    margin: 1.5rem auto;
}

.modal-header {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.modal-body {
    padding: 10px;
}

/* 响应式布局 - 大屏幕采用水平布局 */
@media (min-width: 768px) {
    .modal-dialog {
        max-width: 550px; /* 减小模态框宽度 */
    }
    
    .book-detail-container {
        flex-direction: row; /* 水平排列 */
        max-width: 100%; /* 充分利用宽度 */
        align-items: flex-start; /* 顶部对齐 */
        gap: 15px; /* 减少左右间距 */
    }
    
    .book-cover-container {
        width: 40%; /* 左侧占比增加 */
        max-width: 200px; /* 限制最大宽度 */
    }
    
    .book-detail-cover {
        max-height: 280px; /* 减少封面高度 */
        width: 100%; /* 确保宽度填充容器 */
    }
    
    .book-info-wrapper {
        flex: 1;
        width: 60%; /* 确保占据右侧空间 */
        min-width: 0; /* 防止溢出 */
    }
    
    /* 在大屏幕上，使用单行省略效果 */
    .book-detail-title {
        text-align: left;
        font-size: 1.4rem;
        margin-top: 0;
        margin-bottom: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        display: block;
        -webkit-line-clamp: initial;
        -webkit-box-orient: initial;
        max-height: none;
    }
    
    .book-info-container {
        width: 100%; /* 右侧信息占满剩余宽度 */
        padding-top: 0;
    }
    
    .book-info-content {
        margin-bottom: 20px; /* 大屏幕上增加更多间距 */
    }
    
    .book-info-item {
        font-size: 0.95rem;
        line-height: 1.3;
        margin-bottom: 5px;
    }
    
    .info-label {
        min-width: 60px; /* 减少标签宽度 */
        margin-right: 3px;
    }
    
    .btn-download {
        margin-top: 10px; /* 大屏幕上增加更多顶部间距 */
        padding: 8px;
        width: 100%; /* 按钮宽度100% */
        max-width: none; /* 移除最大宽度限制 */
    }
    
    /* 减少模态框内边距 */
    .modal-header {
        padding: 12px 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
}

@media (max-width: 350px) {
    .modal-dialog {
        max-width: 300px;
        margin: 1rem auto;
    }
    
    .book-cover-container {
        max-width: 160px;
    }
    
    .book-detail-cover {
        max-height: 220px;
    }
}

/* 用户中心 */
.user-center {
    padding: 40px 0;
}

/* 用户中心侧边栏样式已移至 sidebar.html */

.content-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 25px;
    height: 100%;
}

.content-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.content-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
    color: #333;
}

.stats-card {
    background: linear-gradient(135deg, #f5f7fa, #e4e7eb);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.stats-icon {
    font-size: 2.5rem;
    color: var(--apple-blue);
    margin-bottom: 15px;
}

.stats-title {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.stats-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
}

.recent-favorites {
    margin-top: 30px;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
}

.favorite-books {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.favorite-book {
    transition: transform 0.3s;
    position: relative;
}

.favorite-book:hover {
    transform: translateY(-5px);
}

.favorite-book a {
    text-decoration: none;
    display: block;
    position: relative;
}

.favorite-cover {
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    margin-bottom: 10px;
    position: relative;
}

.favorite-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.favorite-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 5;
}

.btn-remove {
    background-color: rgba(220, 53, 69, 0.9);
    border: none;
    border-radius: 4px;
    padding: 3px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-remove i {
    margin-right: 3px;
}

.btn-remove:hover {
    background-color: #dc3545;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.favorite-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 5px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.favorite-author {
    font-size: 0.8rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.no-favorites {
    text-align: center;
    padding: 30px 0;
    color: #666;
}

.no-favorites i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 15px;
    display: block;
}

.email-verify-alert {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.email-verify-alert .btn {
    margin-top: 10px;
} 