/* * 模态框样式 * 包含动画效果、尺寸变体和响应式布局 */ /* 模态框背景遮罩 */ .modal-backdrop { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 9999; animation: fadeIn 0.3s ease forwards; padding: 1rem; overflow-y: auto; width: 100vw; height: 100vh; } /* 模态框容器 */ .modal-content { background-color: #fff; border-radius: 8px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); position: relative; animation: slideUpIn 0.3s ease forwards; width: 100%; margin: auto; display: flex; flex-direction: column; max-width: 90%; max-height: 90vh; overflow: hidden; z-index: 1; } /* 模态框尺寸变体 */ .modal-small { max-width: 400px; } .modal-medium { max-width: 600px; } .modal-large { max-width: 800px; } .modal-full { max-width: 90%; height: 90%; } /* 模态框头部 */ .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid rgba(0, 0, 0, 0.06); flex-shrink: 0; } .modal-title { margin: 0; color: #333; font-size: 18px; font-weight: 600; line-height: 1.4; } .modal-close { background: none; border: none; font-size: 20px; cursor: pointer !important; color: #999; padding: 0; border-radius: 4px; display: flex; align-items: center; justify-content: center; transition: all 0.2s; width: 24px; height: 24px; min-width: 24px; min-height: 24px; } .modal-close:hover { background-color: rgba(0, 0, 0, 0.04); color: #666; } /* .modal-close:focus { outline: 2px solid #4f46e5; outline-offset: 2px; } */ /* 模态框内容区域 */ .modal-body { padding: 24px; overflow-y: auto; flex: 1; max-height: calc(90vh - 120px); /* 减去header和footer的高度 */ } /* 模态框底部 */ .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid rgba(0, 0, 0, 0.06); background-color: #fafafa; border-radius: 0 0 8px 8px; flex-shrink: 0; } /* 动画效果 */ @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } @keyframes slideUpIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } /* 响应式调整 */ @media (max-width: 640px) { .modal-backdrop { padding: 0.5rem; } .modal-small, .modal-medium, .modal-large { max-width: 100%; } .modal-header, .modal-body, .modal-footer { padding: 12px 16px; } }