/* Minecraft Coloring Pages 样式表 */

/* 涂色页网格布局 */
.coloring-pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    margin: 30px 0;
    animation: grid-fade-in 0.6s ease-out;
}

@keyframes grid-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 涂色页项目卡片样式 */
.coloring-page-item {
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid #565656;
    border-radius: 4px;
    padding: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    opacity: 0;
    animation: item-fade-in 0.6s ease-out forwards;
}

@keyframes item-fade-in {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 为每个项目添加延迟动画 */
.coloring-page-item:nth-child(1) { animation-delay: 0.1s; }
.coloring-page-item:nth-child(2) { animation-delay: 0.2s; }
.coloring-page-item:nth-child(3) { animation-delay: 0.3s; }
.coloring-page-item:nth-child(4) { animation-delay: 0.4s; }
.coloring-page-item:nth-child(5) { animation-delay: 0.5s; }
.coloring-page-item:nth-child(6) { animation-delay: 0.6s; }
.coloring-page-item:nth-child(7) { animation-delay: 0.7s; }
.coloring-page-item:nth-child(8) { animation-delay: 0.8s; }
.coloring-page-item:nth-child(n+9) { animation-delay: 0.9s; }

.coloring-page-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    border-color: #7e7e7e;
}

/* 缩略图容器 */
.coloring-thumbnail {
    height: 200px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

/* 缩略图图像 */
.coloring-thumbnail img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

/* PDF缩略图默认样式 */
.pdf-thumbnail {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f44336;
    color: white;
    font-weight: bold;
    position: relative;
    overflow: hidden;
    border-radius: 3px;
}

/* PDF图标 */
.pdf-thumbnail::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 5px;
    z-index: 1;
}

/* PDF文本 */
.pdf-thumbnail span {
    font-size: 32px;
    letter-spacing: 1px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
    transform: rotate(-5deg);
}

/* PDF预览图样式 */
.pdf-preview {
    position: relative;
    width: 100%;
    height: 100%;
}

/* PDF预览图像 */
.pdf-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pdf-preview:hover img {
    opacity: 0.9;
}

/* PDF标签 */
.pdf-label {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #f44336;
    color: white;
    padding: 3px 8px;
    font-size: 12px;
    border-radius: 3px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 涂色页标题 */
.coloring-page-item h3 {
    font-family: 'MinecraftTen', sans-serif;
    text-align: center;
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #f0f0f0;
    line-height: 1.4;
    min-height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
}

/* 页面操作按钮 */
.page-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
}

/* 下载按钮 */
.download-btn {
    display: inline-block;
    padding: 8px 15px;
    background-color: #2e7d32;
    color: white;
    text-decoration: none;
    border-radius: 3px;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    flex: 1;
    border: none;
}

.download-btn:hover {
    background-color: #1b5e20;
    cursor: pointer;
}

/* 预览按钮 */
.preview-btn {
    display: inline-block;
    padding: 8px 15px;
    background-color: #1976d2;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    flex: 1;
    font-family: inherit;
    transition: background-color 0.3s ease;
    text-align: center;
    text-decoration: none;
}

.preview-btn:hover {
    background-color: #1565c0;
}

/* 确保按钮样式一致性 */
.minecraft-btn {
    display: inline-block;
    padding: 8px 15px;
    border: none;
    border-radius: 3px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s ease;
    font-family: inherit;
}

.minecraft-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 模态框样式 */
.preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    z-index:     overflow-y: auto;
    animation: fade-in 0.2s ease;
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.preview-modal[style*="block"] {
    display: flex !important;
}

/* 淡入动画 - 加速 */
@keyframes fade-in {
    from { 
        opacity: 0;
        transform: scale(0.95);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content {
    position: relative;
    background: linear-gradient(135deg, #2a2a2a 0%, #1e1e1e 100%);
    margin: 0;
    padding: 30px;
    border: 2px solid #4a4a4a;
    border-radius: 12px;
    width: 95%;
    max-width: 1200px;
    max-height: 90vh;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: modal-appear 0.25s ease;
    overflow-y: auto;
}

@keyframes modal-appear {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 关闭按钮 */
.close-modal {
    position: absolute;
    top: 20px;
    right: 25px;
    color: #bbb;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.close-modal:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

#preview-title {
    margin-top: 0;
    margin-bottom: 25px;
    color: #f5f5f5;
    font-size: 26px;
    text-align: center;
    font-family: 'MinecraftTen', sans-serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    padding-right: 60px;
}

#preview-container {
    width: 100%;
    min-height: 400px;
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.preview-image {
    max-width: 100%;
    max-height: 70vh;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    transition: transform 0.3s ease;
}

.preview-image:hover {
    transform: scale(1.02);
}

.modal-actions {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* 没有找到涂色页时的提示 */
.no-pages-found {
    background-color: rgba(0, 0, 0, 0.1);
    border: 2px dashed #565656;
    border-radius: 4px;
    padding: 40px;
    text-align: center;
    grid-column: 1 / -1;
    color: #f0f0f0;
    font-size: 18px;
}

/* 错误信息 */
.error-message {
    background-color: rgba(244, 67, 54, 0.1);
    border: 2px solid #f44336;
    border-radius: 4px;
    padding: 20px;
    margin: 30px 0;
    text-align: center;
    grid-column: 1 / -1;
    color: #f44336;
}

/* 使用指南部分 */
.usage-guide {
    margin-top: 50px;
    padding: 30px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    border: 1px solid #444;
}

/* 使用步骤 */
.guide-steps {
    margin-top: 20px;
}

.guide-steps ol {
    padding-left: 25px;
}

.guide-steps li {
    margin-bottom: 10px;
    line-height: 1.6;
}

/* Minecraft备注 */
.minecraft-note {
    margin-top: 30px;
    padding: 15px;
    background-color: rgba(255, 193, 7, 0.1);
    border: 1px solid #ffc107;
    border-radius: 4px;
}

.minecraft-note h4 {
    margin-top: 0;
    color: #ffc107;
}

/* 加载动画 - 优化速度 */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top: 4px solid #4CAF50;
    border-right: 4px solid #2196F3;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
    position: relative;
}

.loading-spinner::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, #4CAF50, #2196F3);
    border-radius: 50%;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scale(0.9); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

/* PDF iframe 样式优化 */
#preview-container iframe {
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    background: #fff;
}

/* PDF预览容器样式 */
.pdf-preview-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 20px;
    margin: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* PDF缩略图预览样式 */
.pdf-thumbnail-preview {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.pdf-thumbnail-preview:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5) !important;
}

/* 预览错误信息样式 */
.preview-error {
    text-align: center;
    padding: 40px 20px;
    color: #ff6b6b;
    font-size: 16px;
    background: rgba(255, 107, 107, 0.1);
    border: 2px dashed #ff6b6b;
    border-radius: 8px;
    margin: 20px;
}

.preview-loading {
    text-align: center;
    padding: 40px 20px;
    color: #4CAF50;
    font-size: 16px;
    background: rgba(76, 175, 80, 0.1);
    border: 2px dashed #4CAF50;
    border-radius: 8px;
    margin: 20px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .coloring-pages-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 15px;
    }
    
    .coloring-thumbnail {
        height: 160px;
    }
    
    .coloring-page-item h3 {
        font-size: 14px;
    }
    
    .preview-modal {
        padding: 10px;
    }
    
    .modal-content {
        width: 98%;
        padding: 20px;
        max-height: 95vh;
        border-radius: 8px;
    }
    
    #preview-title {
        font-size: 22px;
        padding-right: 50px;
    }
    
    #preview-container {
        min-height: 300px;
    }
    
    .preview-image {
        max-height: 60vh;
    }
    
    .close-modal {
        top: 15px;
        right: 20px;
        width: 35px;
        height: 35px;
        font-size: 28px;
    }
    
    .page-actions {
        flex-direction: column;
    }
    
    .download-btn, .preview-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .coloring-pages-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
    
    .coloring-thumbnail {
        height: 140px;
    }
    
    .coloring-page-item {
        padding: 10px;
    }
    
    .modal-content {
        padding: 15px;
        border-radius: 6px;
    }
    
    #preview-title {
        font-size: 18px;
        padding-right: 40px;
    }
    
    #preview-container {
        min-height: 250px;
    }
    
    .preview-image {
        max-height: 50vh;
    }
    
    .close-modal {
        top: 10px;
        right: 15px;
        width: 30px;
        height: 30px;
        font-size: 24px;
    }
    
    .download-btn, .preview-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    #preview-container iframe {
        height: 350px;
    }
}

/* 分页信息样式 */
.pagination-info {
    text-align: center;
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    color: #E0E0E0;
    font-size: 14px;
}

/* 分页容器样式 */
.pagination-container {
    display: flex;
    justify-content: center;
    margin: 30px 0;
    padding: 20px 0;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    color: #E0E0E0;
    text-decoration: none;
    border: 1px solid var(--minecraft-secondary);
    border-radius: 4px;
    font-family: 'VT323', monospace;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.page-link:hover {
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--minecraft-green);
    color: var(--minecraft-green);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.page-link.active {
    background: var(--minecraft-green);
    border-color: var(--minecraft-green);
    color: #FFFFFF;
    font-weight: bold;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(68, 189, 50, 0.3);
}

.page-link.active:hover {
    background: #3aa129;
    transform: translateY(-2px);
}

/* 响应式分页 */
@media (max-width: 768px) {
    .pagination {
        gap: 4px;
    }
    
    .page-link {
        min-width: 35px;
        height: 35px;
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .pagination-info {
        font-size: 12px;
        padding: 8px;
    }
}