imetting/frontend/src/pages/admin/PromptManagement.css

680 lines
11 KiB
CSS
Raw Normal View History

/* 提示词管理页面 - 左右分栏布局 */
.prompt-management {
height: 100vh;
background: #f8fafc;
display: flex;
flex-direction: column;
overflow: hidden;
}
/* 左右分栏布局 */
.prompt-layout {
display: flex;
gap: 1.5rem;
flex: 1;
overflow: hidden;
max-width: 1400px;
margin: 0 auto;
width: 100%;
padding: 1rem;
}
/* 左侧提示词列表 */
.prompt-sidebar {
width: 320px;
background: #fff;
border: 1px solid #e9ecef;
border-radius: 12px;
display: flex;
flex-direction: column;
overflow: hidden;
transition: width 0.3s ease;
}
.prompt-sidebar.collapsed {
width: 60px;
}
.sidebar-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 1.25rem;
border-bottom: 1px solid #e9ecef;
background: #f8f9fa;
gap: 0.75rem;
}
.sidebar-header h3 {
font-size: 1.1rem;
font-weight: 600;
color: #1e293b;
margin: 0;
flex: 1;
}
.btn-new-prompt {
background: #667eea;
border: none;
border-radius: 6px;
color: white;
cursor: pointer;
padding: 0.5rem;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
}
.btn-new-prompt:hover {
background: #5568d3;
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
.btn-toggle-sidebar {
background: none;
border: none;
cursor: pointer;
color: #64748b;
padding: 0.25rem;
border-radius: 4px;
transition: all 0.2s ease;
display: flex;
align-items: center;
justify-content: center;
}
.btn-toggle-sidebar:hover {
background: #e2e8f0;
color: #1e293b;
}
.prompt-list-sidebar {
flex: 1;
overflow-y: auto;
padding: 0.5rem;
}
/* 分组样式 */
.prompt-group {
margin-bottom: 1.5rem;
}
.group-header {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 0.75rem;
font-size: 0.875rem;
font-weight: 600;
color: #475569;
background: #f1f5f9;
border-radius: 6px;
margin-bottom: 0.5rem;
}
/* 提示词列表项 */
.prompt-list-item {
padding: 0.75rem 1rem;
margin-bottom: 0.5rem;
border: 1px solid #e2e8f0;
border-radius: 8px;
cursor: pointer;
transition: all 0.2s ease;
background: #fff;
display: flex;
align-items: center;
}
.prompt-list-item:hover {
background: #f8fafc;
border-color: #cbd5e1;
transform: translateX(4px);
}
.prompt-list-item.active {
background: #eff6ff;
border-color: #3b82f6;
box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}
.prompt-item-info {
flex: 1;
display: flex;
align-items: center;
gap: 0.5rem;
min-width: 0;
}
.prompt-item-info h4 {
font-size: 0.95rem;
font-weight: 600;
color: #1e293b;
margin: 0;
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.badge {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.25rem;
padding: 0.125rem 0.5rem;
border-radius: 12px;
font-size: 0.75rem;
font-weight: 500;
line-height: 1.5;
flex-shrink: 0;
}
.badge-default {
background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
color: white;
box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}
.badge-inactive {
background: #f1f5f9;
color: #64748b;
border: 1px solid #e2e8f0;
}
/* 右侧编辑区 */
.prompt-detail-area {
flex: 1;
background: #fff;
border: 1px solid #e9ecef;
border-radius: 12px;
overflow: hidden;
display: flex;
flex-direction: column;
}
/* 第一行:标题 + 操作按钮 */
.prompt-title-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1.5rem 2rem;
border-bottom: 1px solid #e9ecef;
background: #fafbfc;
}
.title-edit-container {
display: flex;
align-items: center;
gap: 0.75rem;
flex: 1;
min-width: 0;
}
.title-edit-container h1 {
font-size: 1.5rem;
font-weight: 700;
color: #1e293b;
margin: 0;
}
.title-input {
flex: 0.8;
font-size: 1.5rem;
font-weight: 700;
color: #1e293b;
border: 2px solid #667eea;
border-radius: 8px;
padding: 0.5rem 0.75rem;
background: white;
outline: none;
transition: all 0.2s ease;
}
.title-input:focus {
border-color: #5568d3;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.icon-btn-small {
width: 28px;
height: 28px;
border: none;
border-radius: 6px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
flex-shrink: 0;
}
.icon-btn-small svg {
flex-shrink: 0;
}
.icon-btn-small.edit-btn {
background: #f1f5f9;
color: #64748b;
}
.icon-btn-small.edit-btn:hover {
background: #e2e8f0;
color: #1e293b;
}
.icon-btn-small.confirm-btn {
background: #10b981;
color: white;
}
.icon-btn-small.confirm-btn svg {
color: white;
stroke: white;
}
.icon-btn-small.confirm-btn:hover:not(:disabled) {
background: #059669;
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.icon-btn-small.cancel-btn {
background: #f1f5f9;
color: #64748b;
}
.icon-btn-small.cancel-btn:hover {
background: #fee2e2;
color: #dc2626;
}
.icon-btn-small:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.title-actions {
display: flex;
gap: 0.5rem;
}
.icon-btn {
width: 36px;
height: 36px;
border: none;
border-radius: 6px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
flex-shrink: 0;
}
.icon-btn svg {
flex-shrink: 0;
}
.icon-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.icon-btn.save-btn {
background: #667eea;
color: white;
}
.icon-btn.save-btn svg {
color: white;
stroke: white;
}
.icon-btn.save-btn:hover:not(:disabled) {
background: #5568d3;
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
.icon-btn.delete-btn {
background: #fee2e2;
color: #dc2626;
}
.icon-btn.delete-btn svg {
color: #dc2626;
stroke: #dc2626;
}
.icon-btn.delete-btn:hover {
background: #fca5a5;
color: #991b1b;
}
.icon-btn.delete-btn:hover svg {
color: #991b1b;
stroke: #991b1b;
}
/* 第二行:控制区 */
.prompt-controls-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1.5rem;
padding: 1rem 2rem;
border-bottom: 1px solid #e9ecef;
background: #fff;
}
.prompt-actions-right {
display: flex;
align-items: center;
gap: 1rem;
}
.btn-set-default {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 1rem;
border: 1.5px solid #e2e8f0;
border-radius: 8px;
background: white;
color: #64748b;
font-size: 0.875rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
}
.btn-set-default:hover:not(:disabled) {
border-color: #f59e0b;
color: #f59e0b;
background: #fffbeb;
}
.btn-set-default.active {
border-color: #f59e0b;
background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
color: white;
box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}
.btn-set-default.active svg {
fill: white;
}
.btn-set-default:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.task-type-badge {
display: inline-flex;
align-items: center;
gap: 0.375rem;
padding: 0.375rem 0.75rem;
border-radius: 6px;
font-size: 0.875rem;
font-weight: 500;
background: #dbeafe;
color: #1e40af;
}
/* 描述行样式 */
.prompt-desc-row {
padding: 1rem 2rem;
border-bottom: 1px solid #e9ecef;
background: #fafbfc;
}
.prompt-desc-input {
width: 100%;
min-height: 60px;
padding: 0.75rem;
border: 1px solid #e2e8f0;
border-radius: 8px;
font-size: 0.875rem;
font-family: inherit;
color: #475569;
resize: vertical;
outline: none;
transition: all 0.2s ease;
box-sizing: border-box;
}
.prompt-desc-input:focus {
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
background: white;
}
.prompt-desc-input::placeholder {
color: #94a3b8;
}
/* Switch 开关样式 */
.switch-label {
display: flex;
align-items: center;
gap: 0.75rem;
font-size: 0.875rem;
font-weight: 500;
color: #475569;
cursor: pointer;
user-select: none;
}
.switch-wrapper {
position: relative;
width: 44px;
height: 24px;
}
.switch-input {
opacity: 0;
width: 0;
height: 0;
position: absolute;
}
.switch-slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #cbd5e1;
transition: 0.3s;
border-radius: 24px;
}
.switch-slider:before {
position: absolute;
content: "";
height: 18px;
width: 18px;
left: 3px;
bottom: 3px;
background-color: white;
transition: 0.3s;
border-radius: 50%;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.switch-input:checked + .switch-slider {
background-color: #10b981;
}
.switch-input:checked + .switch-slider:before {
transform: translateX(20px);
}
.switch-input:focus + .switch-slider {
box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}
/* Markdown 编辑器容器 */
.prompt-editor-container {
flex: 1;
padding: 2rem;
overflow: auto;
background: #fafbfc;
}
/* 空状态 */
.prompt-empty-placeholder {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
color: #94a3b8;
text-align: center;
}
.prompt-empty-placeholder p {
margin-top: 1rem;
font-size: 1rem;
}
.empty-state {
padding: 2rem;
text-align: center;
color: #94a3b8;
}
/* 表单样式 */
.form-group {
margin-bottom: 1.5rem;
}
.form-group:last-child {
margin-bottom: 0;
}
.form-group label {
display: flex;
align-items: center;
gap: 0.5rem;
font-weight: 500;
margin-bottom: 0.5rem;
color: #1e293b;
font-size: 0.95rem;
}
.form-group input[type="text"],
.form-group select {
width: 100%;
padding: 0.75rem;
border: 1px solid #e2e8f0;
border-radius: 8px;
font-size: 1rem;
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-group input[type="text"]:focus,
.form-group select:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
/* 按钮样式 */
.btn {
padding: 0.65rem 1.25rem;
border: none;
border-radius: 8px;
cursor: pointer;
font-weight: 500;
font-size: 0.95rem;
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
gap: 0.5rem;
}
.btn:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.btn-primary {
background-color: #667eea;
color: white;
}
.btn-primary:hover:not(:disabled) {
background-color: #5568d3;
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
.btn-secondary {
background-color: white;
color: #475569;
border: 1px solid #e2e8f0;
}
.btn-secondary:hover {
background-color: #f8fafc;
border-color: #cbd5e1;
}
.btn-danger {
background-color: #fee2e2;
color: #dc2626;
border: 1px solid #fecaca;
}
.btn-danger:hover {
background-color: #fca5a5;
color: #991b1b;
border-color: #f87171;
}
/* 错误信息 */
.error-message {
background-color: #fee2e2;
color: #dc2626;
padding: 0.75rem 1rem;
border-radius: 6px;
border-left: 3px solid #ef4444;
margin-bottom: 1rem;
font-size: 0.875rem;
font-weight: 500;
}
/* 响应式设计 */
@media (max-width: 1024px) {
.prompt-sidebar {
width: 280px;
}
}
@media (max-width: 768px) {
.prompt-layout {
flex-direction: column;
}
.prompt-sidebar {
width: 100%;
height: 300px;
}
.prompt-sidebar.collapsed {
height: 60px;
width: 100%;
}
.detail-controls {
flex-direction: column;
align-items: flex-start;
}
}