/* 弹框蒙层 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

/* 显示蒙层 */
.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* 弹框容器 */
.modal-box {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    padding: 0;
    min-width: 300px;
    max-width: 300px;
    width: 90%;
    transform: translateY(-50px) scale(0.9);
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.modal-overlay.show .modal-box {
    transform: translateY(0) scale(1);
}

/* 弹框头部 */
.modal-header {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.modal-close:hover {
    background: #e9ecef;
    color: #333;
}

/* 弹框内容 */
.modal-content {
   /* padding: 20px;*/
    font-size: 14px;
    line-height: 1.5;
    color: #666;
    word-wrap: break-word;
}

/* 弹框底部 */
.modal-footer {
    /*padding: 16px 20px;*/
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

/* 按钮样式 */
.modal-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
    min-width: 60px;
}

.modal-btn-primary {
    background: #1890ff;
    color: white;
}

.modal-btn-primary:hover {
    background: #40a9ff;
    transform: translateY(-1px);
}

.modal-btn-primary:active {
    background: #096dd9;
    transform: translateY(0);
}

.modal-btn-default {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #d9d9d9;
}

.modal-btn-default:hover {
    background: #e6f7ff;
    border-color: #1890ff;
    color: #1890ff;
    transform: translateY(-1px);
}

.modal-btn-default:active {
    background: #bae7ff;
    transform: translateY(0);
}

/* 不同类型弹框的图标 */
.modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    font-size: 24px;
    flex-shrink: 0;
}

.modal-info .modal-icon {
    background: #e6f7ff;
    color: #1890ff;
}

.modal-warning .modal-icon {
    background: #fff7e6;
    color: #fa8c16;
}

.modal-error .modal-icon {
    background: #fff2f0;
    color: #ff4d4f;
}

.modal-success .modal-icon {
    background: #f6ffed;
    color: #52c41a;
}

/* 带图标的弹框布局 */
.modal-with-icon {
    display: flex;
    align-items: flex-start;
}

.modal-icon-content {
    flex: 1;
    margin: 0;
    padding-top: 15px;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .modal-box {
        min-width: unset;
        width: 95%;
        margin: 0 10px;
    }

    .modal-header {
        padding: 12px 16px;
    }

    .modal-content {
        padding: 16px;
    }

    .modal-footer {
        padding: 12px 16px;
        flex-direction: column-reverse;
    }

    .modal-btn {
        width: 100%;
    }

    .modal-with-icon {
        flex-direction: column;
        text-align: center;
    }

    .modal-icon {
        margin-right: 0;
        margin-bottom: 12px;
        align-self: center;
    }
}

/* 动画关键帧 */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
}

/* 无障碍支持 */
.modal-close:focus,
.modal-btn:focus {
    outline: 2px solid #1890ff;
    outline-offset: 2px;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .modal-box {
        border: 2px solid #000;
    }

    .modal-header {
        border-bottom: 2px solid #000;
    }

    .modal-footer {
        border-top: 2px solid #000;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    .modal-overlay,
    .modal-box,
    .modal-btn {
        transition: none;
    }
}