/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    touch-action: auto; /* 改为auto，让浏览器智能处理 */
    -webkit-overflow-scrolling: touch; /* iOS平滑滚动 */
}

.container {
    max-width: 100%;
    margin: 0 auto;
    background-color: #fff;
    min-height: 100vh;
    overflow: auto;
    position: relative;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    display: inline-block;
}

.header p {
    font-size: 1rem;
    opacity: 0.9;
}

/* 刷新按钮样式 */
.refresh-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) rotate(180deg);
}

.refresh-btn:active {
    transform: translateY(-50%) rotate(180deg) scale(0.95);
}

/* 主内容区域 */
.main-content {
    padding: 1.5rem 1rem;
}

/* 菜单网格 */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
}

.menu-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.menu-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.menu-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-align: center;
}

.menu-desc {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    line-height: 1.4;
}

/* 模块容器 */
.module-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #fff;
    z-index: 9999;
    display: none;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: auto;
}

/* 确保模块容器完全覆盖主界面 */
.module-container.active {
    display: block;
}

/* 移除重复定义，合并到下面的完整定义中 */

/* 模块样式 */
.module {
    display: none;
    min-height: 100vh;
}

.module.active {
    display: block;
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.module-header h2 {
    font-size: 1.5rem;
}

.back-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.back-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* 确保模块内容有足够的内边距，方便填写底部信息 */
.module-content {
    padding: 1.5rem 1rem 3rem 1rem;
    min-height: calc(100vh - 120px);
}

/* 活动列表 */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    padding: 1.2rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.activity-item:hover {
    background-color: #e9ecef;
    transform: translateX(5px);
}

.activity-item h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.activity-item p {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

.activity-files-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.activity-file {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.activity-file .file-icon {
    font-size: 1.5rem;
}

.activity-file .file-info {
    flex: 1;
}

.activity-file .file-name {
    font-weight: 500;
    font-size: 0.95rem;
}

.activity-file .file-time {
    font-size: 0.8rem;
    color: #999;
}

.activity-file .download-btn {
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.activity-file .download-btn:hover {
    background-color: #556bda;
}

/* 表单样式 */
.form {
    max-width: 500px;
    margin: 0 auto;
    background-color: #f8f9fa;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
    font-size: 0.95rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 搜索区域 */
.search-section {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.search-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 积分查询结果 */
.points-result {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.points-info {
    margin-bottom: 1.5rem;
}

.points-info h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #333;
}

.points-info p {
    margin-bottom: 0.8rem;
    font-size: 1rem;
}

.points-info span {
    font-weight: 600;
    color: #667eea;
}

.points-logs h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #333;
}

.points-logs-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.points-logs-list li {
    padding: 1rem;
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    font-size: 0.95rem;
}

/* 图书搜索结果 */
.book-search-result {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.book-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.book-item:hover {
    background-color: #e9ecef;
}

.book-info {
    flex: 1;
}

.book-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.book-info p {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.3rem;
}

.recommend-btn {
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    align-self: center;
    transition: all 0.3s ease;
}

.recommend-btn:hover {
    background-color: #556bda;
    transform: translateY(-2px);
}

/* 荐购表单容器 */
.recommend-form-container {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.recommend-form-container h3 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: #333;
    text-align: center;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .menu-grid {
        grid-template-columns: 1fr;
    }
    
    .search-section {
        flex-direction: column;
    }
    
    .search-input {
        width: 100%;
    }
    
    .book-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .recommend-btn {
        align-self: flex-start;
    }
    
    /* 移动端优化：确保 select 下拉菜单能够正常显示 */
    .module-content {
        padding: 1.5rem 1rem 100px 1rem;
    }
    
    /* 移动端 select 元素样式优化 */
    .form-group select {
        appearance: none;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 0.7rem center;
        background-size: 1.2em;
        padding-right: 2.5rem;
        min-height: 48px;
    }
    
    /* 移动端 select 聚焦时的样式 */
    .form-group select:focus {
        outline: none;
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }
    
    /* 移动端：使用 absolute 定位避免下拉菜单被裁剪 */
    .module-container {
        position: absolute;
    }
}

/* 活动选择框优化 */
.activity-select {
    position: relative;
}

/* 优化选择框的显示，支持长文本换行 */
.form-group select {
    /* 允许选择框内容换行显示 */
    white-space: normal;
    /* 增加内边距，提高可读性 */
    padding: 0.8rem;
    /* 设置最小高度，确保足够空间显示内容 */
    min-height: 48px;
    /* 使用 auto 高度，根据内容自动调整 */
    height: auto;
    /* 确保选择框有足够宽度 */
    width: 100%;
    /* 多行文本显示 */
    display: block;
    /* 允许内容自动换行 */
    word-wrap: break-word;
    /* 确保选择框内容可以完整显示 */
    text-overflow: clip;
    overflow: visible;
}

/* 优化下拉选项的样式 */
.form-group select option {
    /* 允许选项文本换行 */
    white-space: normal;
    /* 设置行高，提高可读性 */
    line-height: 1.4;
    /* 添加内边距，增加选项之间的间距 */
    padding: 8px 12px;
    /* 增加选项的最小高度 */
    min-height: 40px;
    /* 确保选项有足够宽度 */
    width: 100%;
    /* 允许选项内容自动换行 */
    word-wrap: break-word;
}

/* 移动端优化：确保选项之间有足够间距 */
@media (max-width: 768px) {
    .form-group select option {
        /* 移动端增加选项间距 */
        padding: 12px 16px;
        /* 移动端增加行高 */
        line-height: 1.5;
        /* 移动端增加字体大小 */
        font-size: 16px;
    }
    
    /* 移动端优化选择框宽度 */
    .form-group select {
        /* 确保选择框宽度适应内容 */
        width: 100%;
        /* 移动端增加内边距 */
        padding: 12px;
        /* 移动端增加最小高度 */
        min-height: 56px;
        /* 移动端增加字体大小，防止缩放问题 */
        font-size: 16px;
    }
}

/* 移动端特殊处理：小屏幕设备 */
@media (max-width: 480px) {
    .file-actions {
        flex-direction: column;
        gap: 0.2rem;
    }
    
    .view-btn, .download-btn {
        min-width: auto;
        width: 100%;
    }
    
    /* 确保在小屏幕上 select 下拉菜单也能正常显示 */
    .form-group {
        margin-bottom: 1.8rem;
    }
    
    .form-group select {
        font-size: 16px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.module-container.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.loading::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 文件项样式（匹配JS中使用的结构） */
.activity-files {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.file-name {
    font-weight: 500;
    font-size: 0.95rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

/* 在线浏览按钮样式 */
.view-btn, .download-btn {
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-width: 70px;
    color: white;
}

.view-btn {
    background-color: #4ade80;
}

.view-btn:hover {
    background-color: #22c55e;
}

.download-btn {
    background-color: #667eea;
}

.download-btn:hover {
    background-color: #556bda;
}

/* 响应式设计：确保按钮在小屏幕上正常显示 */
@media (max-width: 480px) {
    .file-actions {
        flex-direction: column;
        gap: 0.2rem;
    }
    
    .view-btn, .download-btn {
        min-width: auto;
        width: 100%;
    }
}


