/* 工作区域布局 */
.anim-workspace {
    display: flex;
    gap: 20px;
    min-height: 500px;
}

/* 左侧预览区域 */
.anim-workspace-left {
    flex: 0 0 45%;
    display: flex;
    flex-direction: column;
}

/* 右侧设置区域 */
.anim-workspace-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 5px;
}

/* 预览容器 */
.anim-preview-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 350px;
}

.anim-preview-element {
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #2196F3;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    position: absolute;
    left: 50%;
    top: 50%;
}
.anim-preview-element.square {
    width: 100px;
    height: 100px;
    margin-left: -50px;
    margin-top: -50px;
}
.anim-preview-element.circle {
    width: 100px;
    height: 100px;
    margin-left: -50px;
    margin-top: -50px;
    border-radius: 50%;
}
.anim-preview-element.text {
    width: 150px;
    height: 40px;
    margin-left: -75px;
    margin-top: -20px;
    padding: 0;
    font-size: 24px;
}
.anim-preview-element.icon {
    width: 100px;
    height: 100px;
    margin-left: -50px;
    margin-top: -50px;
    font-size: 48px;
}

.anim-preview-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 200px;
    justify-content: flex-end;
}
.anim-preview-btn {
    background: rgba(255,255,255,0.9);
    border: none;
    padding: 6px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 4px;
}
.anim-preview-btn:hover {
    background: white;
    transform: scale(1.05);
}
.anim-preview-btn i {
    font-size: 14px;
}

/* 预览元素切换按钮组 */
.anim-element-switcher {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    flex-wrap: wrap;
}
.anim-element-btn {
    flex: 1;
    min-width: 70px;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
}
.anim-element-btn:hover {
    border-color: #2196F3;
}
.anim-element-btn.active {
    border-color: #2196F3;
    background: #e3f2fd;
    color: #2196F3;
}
.anim-element-btn i {
    font-size: 24px;
}

/* 动画模板分类标签 */
.anim-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.anim-category-tab {
    padding: 6px 16px;
    border: none;
    border-radius: 20px;
    background: #f5f5f5;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
    font-size: 13px;
    border: 2px solid transparent;
}
.anim-category-tab.active {
    background: #2196F3;
    color: white;
}
.anim-category-tab:hover {
    border-color: #2196F3;
}

/* 动画模板网格 */
.anim-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.anim-card {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}
.anim-card:hover {
    border-color: #2196F3;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(33, 150, 243, 0.2);
}
.anim-card.active {
    border-color: #2196F3;
    background: #e3f2fd;
}
.anim-card-preview {
    width: 40px;
    height: 40px;
    margin: 0 auto 8px;
    background: #2196F3;
    border-radius: 6px;
}
.anim-card-name {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

/* 参数配置面板 */
.anim-config-panel {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}
.anim-config-panel h3 {
    margin-bottom: 15px;
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}
.anim-config-panel h3 i {
    color: #2196F3;
    font-size: 18px;
}
.anim-config-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}
.anim-config-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.anim-config-item label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}
.anim-config-item input[type="number"],
.anim-config-item select {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 13px;
    transition: border-color 0.3s;
}
.anim-config-item input[type="number"]:focus,
.anim-config-item select:focus {
    outline: none;
    border-color: #2196F3;
}
.anim-config-item input[type="range"] {
    width: 100%;
    height: 6px;
    accent-color: #2196F3;
}
.anim-range-value {
    font-size: 12px;
    color: #2196F3;
    font-weight: 600;
}

/* 代码生成区域 */
.anim-code-output {
    background: #1e1e1e;
    border-radius: 10px;
    padding: 15px;
    margin-top: 20px;
}
.anim-code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.anim-code-header h4 {
    color: #fff;
    font-size: 13px;
}
.anim-copy-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 6px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.anim-copy-btn:hover {
    background: #1976D2;
    transform: scale(1.05);
}
.anim-code-content {
    background: #2d2d2d;
    border-radius: 5px;
    padding: 15px;
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
}
.anim-code-content pre {
    margin: 0;
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
}
.anim-code-keyword { color: #569cd6; }
.anim-code-property { color: #9cdcfe; }
.anim-code-value { color: #ce9178; }
.anim-code-number { color: #b5cea8; }
.anim-code-comment { color: #6a9955; }

/* 自定义关键帧编辑器 */
.anim-custom-editor {
    margin-bottom: 15px;
}
.anim-editor-toggle {
    width: 100%;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}
.anim-editor-toggle:hover {
    border-color: #2196F3;
}
.anim-editor-toggle h4 {
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}
.anim-editor-toggle i {
    color: #2196F3;
    transition: transform 0.3s;
}
.anim-editor-toggle.active i {
    transform: rotate(180deg);
}
.anim-editor-content {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 15px;
    display: none;
}
.anim-editor-content.show {
    display: block;
}
.anim-keyframe-input {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    resize: vertical;
    background: #fff;
}
.anim-keyframe-input:focus {
    outline: none;
    border-color: #2196F3;
}
.anim-apply-custom-btn {
    margin-top: 10px;
    background: #2196F3;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}
.anim-apply-custom-btn:hover {
    background: #1976D2;
    transform: scale(1.02);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .anim-workspace {
        flex-direction: column;
        min-height: auto;
    }
    .anim-workspace-left {
        flex: none;
    }
    .anim-workspace-right {
        max-height: none;
        overflow-y: visible;
    }
    .anim-preview-container {
        min-height: 280px;
    }
    .anim-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .anim-config-row {
        grid-template-columns: 1fr;
    }
    .anim-code-content {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .anim-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .anim-preview-container {
        min-height: 220px;
    }
    .anim-preview-controls {
        flex-direction: column;
        top: 10px;
        right: 10px;
    }
    .anim-element-btn {
        min-width: 60px;
        padding: 8px;
    }
    .anim-code-content {
        max-height: 200px;
    }
}

/* 设置区域滚动条 */
.anim-workspace-right::-webkit-scrollbar {
    width: 5px;
}
.anim-workspace-right::-webkit-scrollbar-thumb {
    background: #bbb;
}