/* 基本样式设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #2c3e50;
    background-color: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* 主内容区域 */
main {
    flex: 1;
    padding: 20px 0;
}

/* 头部样式更新 */
header {
    background-color: transparent;
    color: #2c3e50;
    padding: 3rem 0;
    text-align: center;
    box-shadow: none;
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
}

.header-left {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.header-left h1 {
    margin: 0 0 1rem 0;
    font-size: 3rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    letter-spacing: 2px;
    color: white;
}

.header-left .subtitle {
    margin: 0;
    font-size: 1.3rem;
    opacity: 0.95;
    white-space: nowrap;
    font-weight: 300;
    letter-spacing: 1px;
    color: white;
}

.header-right {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 24px;
    border-radius: 30px;
    backdrop-filter: blur(15px);
    border: 2px solid rgba(74, 144, 226, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.user-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    border-color: rgba(74, 144, 226, 0.5);
}

.welcome-text {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 500;
}

.logout-btn {
    background-color: #4a90e2;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.logout-btn:hover {
    background-color: #7b68ee;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .header-left h1 {
        font-size: 2rem;
    }
    
    .header-right {
        position: static;
        margin-top: 15px;
    }
    
    .user-info {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
}

/* 主要内容样式 */
section {
    margin-bottom: 40px;
    padding: 25px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

h2 {
    color: #4a90e2;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e8f4fd;
    font-weight: 600;
}

h3 {
    color: #7b68ee;
    margin: 20px 0 10px;
    font-weight: 500;
}

p {
    margin-bottom: 15px;
}

ul, ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

li {
    margin-bottom: 8px;
}

/* 目录样式 */
.toc {
    background-color: #e8f4fd;
    padding: 25px;
    border-radius: 12px;
    margin: 20px 0;
    border: 1px solid rgba(74, 144, 226, 0.2);
    box-shadow: 0 2px 15px rgba(74, 144, 226, 0.1);
}

.toc ul {
    list-style-type: none;
    margin-left: 0;
}

.toc li {
    padding: 8px 0;
    border-bottom: 1px solid #ddd;
}

.toc li:last-child {
    border-bottom: none;
}

.toc a {
    color: #4a90e2;
    text-decoration: none;
    display: block;
    transition: all 0.3s ease;
    font-weight: 500;
}

.toc a:hover {
    color: #7b68ee;
    padding-left: 5px;
    transform: translateX(3px);
}

/* 章节样式 */
.chapter {
    display: none;
    padding: 30px;
    background: rgba(255, 255, 255, 0.95);
    border-left: 5px solid #4a90e2;
    margin-top: 30px;
    border-radius: 0 12px 12px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.chapter:target {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 页码跳转功能样式 */
.page-navigation {
    margin: 15px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.page-navigation label {
    font-weight: 500;
    color: #2c3e50;
    margin: 0;
}

.page-input {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    width: 120px;
    transition: border-color 0.3s ease;
}

.page-input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.jump-btn {
    padding: 8px 16px;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.jump-btn:hover {
    background-color: #357abd;
}

.jump-btn:active {
    background-color: #2968a3;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .page-navigation {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .page-input {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }
    
    .jump-btn {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }
}

/* PDF翻页控制器样式 */
.pdf-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #dee2e6;
}

.page-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
    min-width: 100px;
    justify-content: center;
}

.page-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.4);
}

.page-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.page-btn:disabled,
.page-btn.disabled {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: 0 1px 2px rgba(108, 117, 125, 0.2);
}

.page-btn i {
    font-size: 12px;
}

.page-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    border: 2px solid #007bff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    color: #007bff;
    min-width: 80px;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.1);
}

.current-page {
    color: #007bff;
    font-weight: 700;
}

.page-separator {
    color: #6c757d;
    font-weight: 400;
}

.total-pages {
    color: #6c757d;
    font-weight: 500;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .pdf-controls {
        flex-direction: column;
        gap: 15px;
        padding: 15px 10px;
    }
    
    .page-btn {
        width: 100%;
        max-width: 200px;
        padding: 14px 20px;
        font-size: 16px;
    }
    
    .page-info {
        font-size: 18px;
        padding: 12px 24px;
    }
}

@media (max-width: 480px) {
    .pdf-controls {
        gap: 12px;
        padding: 12px 8px;
    }
    
    .page-btn {
        padding: 12px 16px;
        font-size: 14px;
        min-width: 80px;
    }
    
    .page-btn span {
        display: none;
    }
    
    .page-btn i {
        font-size: 16px;
    }
    
    .page-info {
        font-size: 16px;
        padding: 10px 16px;
        min-width: 60px;
    }
}

/* 高对比度和无障碍支持 */
@media (prefers-contrast: high) {
    .pdf-controls {
        border: 2px solid #000;
        background: #fff;
    }
    
    .page-btn {
        background: #000;
        color: #fff;
        border: 2px solid #000;
    }
    
    .page-btn:hover:not(:disabled) {
        background: #333;
    }
    
    .page-info {
        border: 2px solid #000;
        color: #000;
    }
}

/* 减少动画效果（用户偏好） */
@media (prefers-reduced-motion: reduce) {
    .page-btn {
        transition: none;
    }
    
    .page-btn:hover:not(:disabled) {
        transform: none;
    }
}

.back-to-toc {
    display: inline-block;
    margin-top: 20px;
    color: #4a90e2;
    text-decoration: none;
    padding: 8px 16px;
    border: 2px solid #4a90e2;
    border-radius: 25px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.back-to-toc:hover {
    background-color: #4a90e2;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

/* 页脚样式 */
footer {
    background-color: transparent;
    color: #2c3e50;
    text-align: center;
    padding: 20px 0;
    margin-top: auto;
    box-shadow: none;
}

footer p {
    margin: 0;
    white-space: nowrap;
    font-size: 14px;
    opacity: 0.9;
    color: white;
}

/* PDF查看器样式 */
.pdf-wrap {
    margin-top: 15px;
}

.pdf-viewer {
    width: 100%;
    height: 70vh;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* 图片资源栅格与卡片样式 */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.resources-grid.one {
    grid-template-columns: 1fr;
}

.resource-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    overflow: hidden;
}

.img-card {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    background: #f5f7fa;
    display: block;
}

.resource-card figcaption {
    padding: 10px 12px;
    font-size: 0.95rem;
    color: #4b5563;
    border-top: 1px solid #eef2f7;
}

@media (max-width: 992px) {
    .resources-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
    .resources-grid { grid-template-columns: 1fr; }
}

/* 响应式设计 */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    header .subtitle {
        font-size: 1rem;
    }
    
    section {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .container {
        width: 95%;
        padding: 0 10px;
    }
}