﻿/* 模态框容器基础样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    display: none;
    width: 100%;
    height: 100%;
    overflow: hidden;
    outline: 0;
}

/* 淡入淡出过渡效果 */
.fade {
    transition: opacity 0.15s linear;
}

    .fade:not(.show) {
        opacity: 0;
    }

/* 模态框对话框容器 */
.modal-dialog {
    position: relative;
    width: auto;
    margin: 0.5rem;
    pointer-events: none;
}

.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 1rem);
}

/* 模态框内容容器 */
.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 0.3rem;
    outline: 0;
}

/* 模态框头部 */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem;
    border-bottom: 1px solid #dee2e6;
    border-top-left-radius: calc(0.3rem - 1px);
    border-top-right-radius: calc(0.3rem - 1px);
}

.modal-title {
    margin-bottom: 0;
    line-height: 1.5;
}

/* 关闭按钮 */
.close {
    float: right;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: 0.5;
    background-color: transparent;
    border: 0;
    -webkit-appearance: none;
}

    .close:hover {
        color: #000;
        text-decoration: none;
        opacity: 0.75;
    }

    .close:not(:disabled):not(.disabled) {
        cursor: pointer;
    }

/* 模态框主体内容 */
.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1rem;
}

/* 模态框底部按钮区域 */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem;
    border-top: 1px solid #dee2e6;
    border-bottom-right-radius: calc(0.3rem - 1px);
    border-bottom-left-radius: calc(0.3rem - 1px);
}

    .modal-footer > :not(:first-child) {
        margin-left: 0.5rem;
    }

/* 按钮基础样式 */
.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

    .btn:not(:disabled):not(.disabled) {
        cursor: pointer;
    }

/* 次要按钮样式 */
.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

    .btn-secondary:hover {
        color: #fff;
        background-color: #5a6268;
        border-color: #545b62;
    }

/* 主要按钮样式 */
.btn-primary {
    color: #fff;
    background-color: #0063be;
    border-color: #0063be;
}

    .btn-primary:hover {
        color: #fff;
        background-color: #0069d9;
        border-color: #0062cc;
    }

/* 模态框显示状态（默认隐藏，显示时添加 .show 类） */
.modal.show .modal-dialog {
    transform: translate(0, 0);
}

.modal.show {
    display: block;
}

.modal-dialog {
    transition: transform 0.3s ease-out;
    transform: translate(0, -25%);
}

/* 修复模态框垂直居中的关键样式 */
.modal-dialog-centered::before {
    display: block;
    height: calc(100vh - 1rem);
    content: "";
}

@media (min-width: 576px) {
    .modal-dialog {
        max-width: 500px;
        margin: 1.75rem auto;
    }

    .modal-dialog-centered {
        min-height: calc(100% - 3.5rem);
    }

        .modal-dialog-centered::before {
            height: calc(100vh - 3.5rem);
        }
}