* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
}

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

.header {
    background: #fff;
    padding: 40px 0;
    text-align: center;
    border-bottom: 1px solid #e8eef5;
}

.header h1 {
    font-size: 36px;
    color: #333;
    margin-bottom: 10px;
}

.header h1 i {
    margin-right: 10px;
}

.header p {
    color: #888;
    font-size: 16px;
}

.main {
    padding: 40px 0;
}

.stats-bar {
    background: #fff;
    border-radius: 12px;
    padding: 20px 30px;
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
    gap: 60px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.stats-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    color: #666;
}

.stats-item i {
    font-size: 24px;
    color: #1677ff;
}

.stats-item strong {
    color: #1677ff;
    font-size: 20px;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.template-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.template-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.template-image {
    position: relative;
    padding-top: 141.4%;
    overflow: hidden;
    background: #f8fafc;
}

.template-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.template-card:hover .template-image img {
    transform: scale(1.05);
}

.download-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #1677ff;
    color: #fff;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(22, 119, 255, 0.3);
}

.template-info {
    padding: 15px;
}

.template-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 12px;
    line-height: 1.4;
    height: 40px;
    overflow: hidden;
}

.btn-group {
    display: flex;
    gap: 8px;
}

.preview-card-btn {
    flex: 1;
    background: #f1f5f9;
    color: #64748b;
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.preview-card-btn:hover {
    background: #e2e8f0;
    color: #475569;
}

.download-btn {
    flex: 1;
    background: #1677ff;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.download-btn:hover {
    background: #4096ff;
    box-shadow: 0 4px 12px rgba(22, 119, 255, 0.35);
    transform: translateY(-1px);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pagination a {
    background: #fff;
    color: #1677ff;
}

.pagination a:hover {
    background: #1677ff;
    color: #fff;
}

.pagination .current {
    background: #1677ff;
    color: #fff;
}

.pagination .dots {
    color: #999;
}

.preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
}

.preview-modal.active {
    display: flex;
}

.preview-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
}

.preview-content img {
    max-width: 500px;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.close-preview {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: none;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.close-preview:hover {
    background: #1677ff;
    color: #fff;
    transform: rotate(90deg);
}

.footer {
    background: #fff;
    padding: 25px 0;
    text-align: center;
    color: #999;
    font-size: 14px;
    margin-top: 40px;
    border-top: 1px solid #e8eef5;
}

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

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

@media (max-width: 768px) {
    .header h1 {
        font-size: 26px;
    }
    
    .stats-bar {
        flex-direction: column;
        gap: 12px;
        align-items: center;
    }
    
    .template-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

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