/* 卡片模板选择器样式 */

.template-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.template-btn {
    background: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.template-btn:hover {
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
    transform: translateY(-2px);
}

.template-btn.active {
    border-color: #007bff;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.3);
}

.template-info {
    text-align: center;
}

.template-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: inherit;
}

.template-desc {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.4;
}

.template-btn.active .template-desc {
    color: rgba(255, 255, 255, 0.9);
}

.template-tags {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}

.template-tag {
    background: #f8f9fa;
    color: #495057;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.template-btn.active .template-tag {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* 预览容器样式 */
.template-preview-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    min-height: 640px; /* 600 + 40px padding */
    max-height: 640px;
    width: 100%;
    max-width: 490px; /* 450 + 40px padding */
    margin: 0 auto;
    overflow: visible;
    position: relative;
}

.preview-canvas {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: visible;
    width: 100%;
    max-width: 600px;
    height: auto;
    min-height: 600px;
    position: relative;
    margin: 0 auto;
}

/* iframe 缩放样式 */
#preview-iframe {
    display: block;
    margin: 0 auto;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .template-options {
        grid-template-columns: 1fr;
    }
    
    .template-btn {
        padding: 16px;
    }
    
    .template-name {
        font-size: 16px;
    }
    
    .template-desc {
        font-size: 13px;
    }
}

/* 加载动画 */
.template-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 720px;
    flex-direction: column;
    color: #666;
}

.template-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* 模板预览iframe样式增强 */
#preview-iframe {
    transition: all 0.3s ease;
}

#preview-iframe:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;
}