/* 弹窗模块 CSS - 完整版本 */

:root {
    /* 基础颜色 */
    --modal-bg: #fff;
    --modal-text: #333;
    --modal-border: #e5e7eb;
    
    /* 主题颜色 */
    --modal-primary: #3b82f6;
    --modal-primary-hover: #2563eb;
    --modal-secondary: #6b7280;
    --modal-secondary-hover: #4b5563;
    --modal-success: #10b981;
    --modal-success-hover: #059669;
    --modal-warning: #f59e0b;
    --modal-warning-hover: #d97706;
    --modal-danger: #ef4444;
    --modal-danger-hover: #dc2626;
    --modal-info: #3b82f6;
    --modal-info-hover: #2563eb;
    
    /* 尺寸和间距 */
    --modal-radius: 12px;
    --modal-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --modal-z-index: 9999;
    
    /* 动画时长 */
    --modal-animation-duration: 0.3s;
}

/* 弹窗遮罩层 */
.modal-overlay {
    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: var(--modal-z-index);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--modal-animation-duration) ease, visibility var(--modal-animation-duration) ease;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 弹窗容器 */
.modal-container {
    background-color: var(--modal-bg);
    border-radius: var(--modal-radius);
    box-shadow: var(--modal-shadow);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform var(--modal-animation-duration) ease;
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

/* 弹窗头部 */
.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--modal-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--modal-text);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--modal-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* 弹窗内容区域 */
.modal-content {
    padding: 24px;
    color: var(--modal-text);
    line-height: 1.6;
}

/* 弹窗底部按钮区域 */
.modal-footer {
    padding: 16px 24px 24px;
    border-top: 1px solid var(--modal-border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* 弹窗按钮 */
.modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-btn:active {
    transform: translateY(1px);
}

/* 按钮类型 */
.modal-btn-primary {
    background-color: var(--modal-primary);
    color: white;
}

.modal-btn-primary:hover {
    background-color: var(--modal-primary-hover);
}

.modal-btn-secondary {
    background-color: var(--modal-secondary);
    color: white;
}

.modal-btn-secondary:hover {
    background-color: var(--modal-secondary-hover);
}

.modal-btn-success {
    background-color: var(--modal-success);
    color: white;
}

.modal-btn-success:hover {
    background-color: var(--modal-success-hover);
}

.modal-btn-warning {
    background-color: var(--modal-warning);
    color: white;
}

.modal-btn-warning:hover {
    background-color: var(--modal-warning-hover);
}

.modal-btn-danger {
    background-color: var(--modal-danger);
    color: white;
}

.modal-btn-danger:hover {
    background-color: var(--modal-danger-hover);
}

.modal-btn-info {
    background-color: var(--modal-info);
    color: white;
}

.modal-btn-info:hover {
    background-color: var(--modal-info-hover);
}

.modal-btn-outline {
    background-color: transparent;
    border: 1px solid var(--modal-border);
    color: var(--modal-text);
}

.modal-btn-outline:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* 弹窗图标 */
.modal-icon {
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
}

.modal-icon svg {
    width: 48px;
    height: 48px;
}

.success-icon {
    color: var(--modal-success);
}

.warning-icon {
    color: var(--modal-warning);
}

.error-icon {
    color: var(--modal-danger);
}

.info-icon {
    color: var(--modal-info);
}

/* 动画效果 */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-container {
    animation: modalFadeIn var(--modal-animation-duration) ease-out;
}

/* 响应式设计 */
@media (max-width: 640px) {
    .modal-container {
        max-width: 100%;
        margin: 0 16px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .modal-btn {
        width: 100%;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --modal-bg: #1f2937;
        --modal-text: #f9fafb;
        --modal-border: #374151;
    }
    
    .modal-close:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    .modal-btn-outline:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
}

/* 加载动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.modal-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top: 4px solid var(--modal-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

/* 进度条 */
.modal-progress-bar {
    height: 10px;
    background-color: #e5e7eb;
    border-radius: 5px;
    overflow: hidden;
    margin: 20px 0;
}

.modal-progress {
    height: 100%;
    background-color: var(--modal-primary);
    border-radius: 5px;
    transition: width 0.3s ease;
}

/* 表单元素 */
.modal-form-group {
    margin-bottom: 20px;
}

.modal-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--modal-text);
}

.modal-form-group input,
.modal-form-group textarea,
.modal-form-group select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid var(--modal-border);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    background-color: var(--modal-bg);
    color: var(--modal-text);
}

.modal-form-group input:focus,
.modal-form-group textarea:focus,
.modal-form-group select:focus {
    outline: none;
    border-color: var(--modal-primary);
}

.modal-form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* 工具类 */
.modal-text-center {
    text-align: center;
}

.modal-text-left {
    text-align: left;
}

.modal-text-right {
    text-align: right;
}

.modal-mt-1 { margin-top: 4px; }
.modal-mt-2 { margin-top: 8px; }
.modal-mt-3 { margin-top: 12px; }
.modal-mt-4 { margin-top: 16px; }
.modal-mt-5 { margin-top: 20px; }

.modal-mb-1 { margin-bottom: 4px; }
.modal-mb-2 { margin-bottom: 8px; }
.modal-mb-3 { margin-bottom: 12px; }
.modal-mb-4 { margin-bottom: 16px; }
.modal-mb-5 { margin-bottom: 20px; }