/* 试卷下载平台样式 - 最终修复版 */

/* 全局变量 */
:root {
    --primary: #4a6cf7;
    --primary-light: #eef2ff;
    --primary-dark: #3a5ce5;
    --secondary: #6c757d;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --gray-light: #dee2e6;
    --border-radius: 8px;
    --shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --transition: all 0.2s ease;
    --background-opacity: 0.08;
    --background-image: none;
    --footer-bg-color: rgba(26, 26, 26, 0.5); /* 默认值 */
    --footer-text-color: #ffffff;
    --navbar-bg-color: rgba(74, 108, 247, 1); /* 默认值 */
    --splash-bg-color: #4a6cf7;
    --splash-text-color: #ffffff;
    --splash-spiral-color: #ffffff;
}

/* 基础样式 - 修复布局问题 */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Segoe UI', Helvetica, Arial, sans-serif;
    color: var(--dark);
    line-height: 1.6;
    background-color: var(--light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* 背景图样式 */
body.has-background::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--background-image);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    opacity: var(--background-opacity);
    z-index: -1;
    pointer-events: none;
}

/* 主应用容器 - 修复布局 */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    flex: 1;
}

/* 主内容区 - 确保撑开内容 */
main.container {
    flex: 1 0 auto;
    padding-bottom: 3rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 15px;
    padding-right: 15px;
}

/* 导航栏 - 使用CSS变量 */
.navbar {
    padding: 0.75rem 0;
    box-shadow: var(--shadow);
    background-color: var(--navbar-bg-color) !important;
    flex-shrink: 0;
    transition: background-color 0.3s ease;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
    color: white !important;
}

.navbar-brand .small {
    font-size: 0.8rem;
    opacity: 0.9;
    font-weight: normal;
    margin-left: 0.25rem;
}

.navbar-text {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* 搜索和筛选区域 */
.card {
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    background-color: rgba(255, 255, 255, 0.95);
}

.input-group-text {
    background-color: white;
    border-right: none;
}

.form-control:focus {
    box-shadow: none;
    border-color: var(--primary);
}

/* 筛选标签按钮 */
#quick-filters .btn {
    border-radius: 20px;
    padding: 0.375rem 1rem;
    font-size: 0.875rem;
    transition: var(--transition);
}

#quick-filters .btn-outline-primary {
    border: 1px solid var(--gray-light);
    color: var(--gray);
}

#quick-filters .btn-outline-primary:hover,
#quick-filters .btn-outline-primary.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* 高级筛选面板 */
#advanced-filters-panel {
    background-color: var(--light);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 1rem;
}

/* 试卷网格 */
#exams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

@media (max-width: 768px) {
    #exams-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 576px) {
    #exams-grid {
        grid-template-columns: 1fr;
    }
}

/* 试卷卡片 */
.exam-card {
    background: white;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}

.exam-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

/* 试卷图片区域 */
.exam-image-container {
    position: relative;
    height: 180px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    overflow: hidden;
}

.exam-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.exam-card:hover .exam-image {
    transform: scale(1.05);
}

/* 图片加载失败时的样式 */
.exam-image-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray);
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    content: '\f15c';
    font-size: 3rem;
    z-index: 1;
}

.exam-image-container.loaded::before {
    display: none;
}

.exam-image.loaded {
    z-index: 2;
    position: relative;
}

/* 收藏按钮 */
.exam-favorite-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--warning);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 3;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.exam-favorite-btn:hover {
    background: white;
    transform: scale(1.1);
    color: #ffb300;
}

.exam-favorite-btn.active {
    background: white;
    color: #ffb300;
}

/* 试卷内容 */
.exam-content {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.exam-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--dark);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3em;
}

.exam-description {
    color: var(--gray);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 4.2em;
}

.exam-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.exam-tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

.exam-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--gray);
    margin-top: auto;
}

.exam-meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.exam-view-btn {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    text-align: center;
    display: block;
    width: 100%;
}

.exam-view-btn:hover {
    background-color: var(--primary-dark);
    text-decoration: none;
    color: white;
}

/* 空状态 */
#empty-state {
    grid-column: 1 / -1;
}

/* 模态框修复 */
.modal-backdrop {
    z-index: 1050 !important;
}

.modal {
    z-index: 1060 !important;
}

/* 修复模态框关闭问题 */
body.modal-open {
    overflow: auto !important;
    padding-right: 0 !important;
}

.modal-backdrop.show {
    opacity: 0.5 !important;
}

.modal.show .modal-dialog {
    transform: translate(0, 0) !important;
}

/* 模态框内容 */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
}

.modal-header {
    padding: 1.5rem 1.5rem 0.5rem;
    border-bottom: 1px solid var(--gray-light);
}

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-light);
}

/* 模态框图片预览 */
.modal-images {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-light) transparent;
}

.modal-images::-webkit-scrollbar {
    height: 6px;
}

.modal-images::-webkit-scrollbar-track {
    background: transparent;
}

.modal-images::-webkit-scrollbar-thumb {
    background-color: var(--gray-light);
    border-radius: 3px;
}

.modal-image {
    flex: 0 0 auto;
    width: 200px;
    height: 150px;
    border-radius: 6px;
    overflow: hidden;
    background-color: var(--light);
}

.modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 模态框详情 */
.modal-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: var(--light);
    border-radius: 6px;
}

.detail-icon {
    width: 20px;
    color: var(--primary);
    text-align: center;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.modal-description {
    line-height: 1.6;
    color: var(--gray);
    background: var(--light);
    padding: 1rem;
    border-radius: 6px;
}

/* 分页 */
.pagination .page-link {
    border: 1px solid var(--gray-light);
    color: var(--primary);
    margin: 0 2px;
    border-radius: 6px;
    min-width: 40px;
    text-align: center;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* 页脚 - 修复透明度问题 */
footer {
    background-color: var(--footer-bg-color) !important;
    color: var(--footer-text-color) !important;
    border-top: none !important;
    padding: 2rem 0 !important;
    width: 100%;
    text-align: center;
    position: relative;
    z-index: 10;
    margin-top: auto;
    flex-shrink: 0;
}

footer .container {
    max-width: 1200px;
    margin: 0 auto;
}

footer h5 {
    color: var(--footer-text-color) !important;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

/* 页脚内容样式修复 */
footer .footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

footer .footer-content p {
    color: rgba(255, 255, 255, 0.85) !important;
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    transition: color 0.2s ease;
}

/* 第一行样式 */
footer .footer-content p.first-line {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.95) !important;
}

/* 其他行样式 - 移除间隔 */
footer .footer-content p.other-line {
    font-size: 0.85rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.75) !important;
}

/* 移除所有分割线 */
footer .footer-divider {
    display: none !important;
}

/* 开屏特效 - 改为可配置 */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--splash-bg-color);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.splash-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.splash-content {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.splash-logo {
    font-size: 3rem;
    color: var(--splash-text-color);
    z-index: 2;
    opacity: 0;
    animation: fadeInLogo 1s ease 0.5s forwards;
}

.spiral-container {
    position: absolute;
    width: 200px;
    height: 200px;
}

.spiral {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
    animation: spiralOut 1.5s ease-out forwards;
}

.spiral:nth-child(1) {
    border-top-color: var(--splash-spiral-color);
    animation-delay: 0.1s;
}

.spiral:nth-child(2) {
    border-right-color: var(--splash-spiral-color);
    animation-delay: 0.2s;
}

.spiral:nth-child(3) {
    border-bottom-color: var(--splash-spiral-color);
    animation-delay: 0.3s;
}

.spiral:nth-child(4) {
    border-left-color: var(--splash-spiral-color);
    animation-delay: 0.4s;
}

@keyframes spiralOut {
    0% {
        transform: scale(0.1) rotate(0deg);
        opacity: 1;
    }
    70% {
        transform: scale(1.5) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(2.5) rotate(360deg);
        opacity: 0;
    }
}

@keyframes fadeInLogo {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeOutSplash {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* 响应式调整 */
@media (max-width: 992px) {
    #exams-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .exam-image-container {
        height: 160px;
    }
    
    .splash-content {
        width: 150px;
        height: 150px;
    }
    
    .splash-logo {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .navbar-text {
        font-size: 0.875rem;
    }
    
    #exams-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .exam-content {
        padding: 1rem;
    }
    
    .modal-images {
        flex-direction: column;
    }
    
    .modal-image {
        width: 100%;
        height: 200px;
    }
    
    .modal-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    footer {
        padding: 1.5rem 0 !important;
    }
    
    footer .footer-content p {
        font-size: 0.85rem;
    }
    
    .splash-content {
        width: 120px;
        height: 120px;
    }
    
    .splash-logo {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    #exams-grid {
        grid-template-columns: 1fr;
    }
    
    .exam-card {
        max-width: 400px;
        margin: 0 auto;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-details-grid {
        grid-template-columns: 1fr;
    }
    
    footer {
        padding: 1.25rem 0 !important;
    }
    
    footer h5 {
        font-size: 1.1rem;
    }
    
    footer .footer-content p {
        font-size: 0.8rem;
    }
    
    .splash-content {
        width: 100px;
        height: 100px;
    }
    
    .splash-logo {
        font-size: 1.8rem;
    }
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.exam-card {
    animation: fadeInUp 0.3s ease forwards;
}

/* 工具类 */
.rounded-lg {
    border-radius: var(--border-radius);
}

.shadow-sm {
    box-shadow: var(--shadow);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray);
}