/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    z-index: var(--z-modal);
    display: none;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
}

.modal.fade {
    transition: opacity 0.15s linear;
}

.modal.fade .modal-dialog {
    transition: transform 0.15s ease-out;
    transform: translate(0, -50px);
}

.modal.show .modal-dialog {
    transform: none;
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem;
    pointer-events: none;
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: white;
    background-clip: padding-box;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    outline: 0;
}

/* 模态框头部 */
.modal-header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    border-top-left-radius: calc(var(--border-radius) - 1px);
    border-top-right-radius: calc(var(--border-radius) - 1px);
    background: linear-gradient(135deg, white 0%, var(--gray-50) 100%);
}

.modal-title {
    margin-bottom: 0;
    line-height: 1.5;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-color);
}

/* 模态框主体 */
.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1.25rem;
    color: var(--text-color);
    line-height: 1.6;
}

/* 模态框底部 */
.modal-footer {
    display: flex;
    flex-wrap: wrap;
    flex-shrink: 0;
    align-items: center;
    justify-content: flex-end;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--gray-200);
    border-bottom-right-radius: calc(var(--border-radius) - 1px);
    border-bottom-left-radius: calc(var(--border-radius) - 1px);
    background-color: var(--gray-50);
    gap: 8px;
}

.modal-footer .btn {
    margin: 0;
}

/* 模态框背景 */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: calc(var(--z-modal) - 10);
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-backdrop.fade {
    opacity: 0;
}

.modal-backdrop.show {
    opacity: 0.5;
}

/* 模态框尺寸变体 */
.modal-sm {
    max-width: 300px;
}

.modal-lg {
    max-width: 800px;
}

.modal-xl {
    max-width: 1140px;
}

.modal-fullscreen {
    width: 100vw;
    max-width: none;
    height: 100%;
    margin: 0;
}

.modal-fullscreen .modal-content {
    height: 100%;
    border: 0;
    border-radius: 0;
}

.modal-fullscreen .modal-header,
.modal-fullscreen .modal-footer {
    border-radius: 0;
}

/* 居中对话框 */
.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}

/* 滚动长内容 */
.modal-dialog-scrollable {
    height: calc(100% - 3.5rem);
}

.modal-dialog-scrollable .modal-content {
    max-height: 100%;
    overflow: hidden;
}

.modal-dialog-scrollable .modal-body {
    overflow-y: auto;
}

/* 响应式模态框 */
@media (min-width: 576px) {
    .modal-dialog {
        max-width: 500px;
        margin: 1.75rem auto;
    }
    
    .modal-dialog-centered {
        min-height: calc(100% - 3.5rem);
    }
    
    .modal-dialog-scrollable {
        height: calc(100% - 3.5rem);
    }
    
    .modal-sm {
        max-width: 300px;
    }
}

@media (min-width: 992px) {
    .modal-lg,
    .modal-xl {
        max-width: 800px;
    }
}

@media (min-width: 1200px) {
    .modal-xl {
        max-width: 1140px;
    }
}

/* 模态框动画增强 */
.modal.fade .modal-dialog {
    transform: translate(0, -50px);
    transition: transform 0.3s ease-out;
}

.modal.show .modal-dialog {
    transform: translate(0, 0);
}

/* 自定义模态框样式 */
.modal-content {
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 确认对话框样式 */
.modal-confirm .modal-body {
    text-align: center;
    padding: 2rem;
}

.modal-confirm .modal-body i {
    font-size: 48px;
    color: var(--warning-color);
    margin-bottom: 16px;
}

.modal-confirm .modal-body p {
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 0;
}

/* 警告对话框样式 */
.modal-alert .modal-body {
    text-align: center;
    padding: 2rem;
}

.modal-alert .modal-body i {
    font-size: 48px;
    color: var(--info-color);
    margin-bottom: 16px;
}

/* 加载模态框 */
.modal-loading .modal-body {
    text-align: center;
    padding: 3rem 2rem;
}

.modal-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 系统管理员模式切换样式 */
.admin-mode-switcher {
    margin-right: 20px;
    position: relative;
    z-index: 10001;
}

.admin-mode-switcher .btn {
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition-speed);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.admin-mode-switcher .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.admin-mode-switcher .dropdown-menu {
    border: 1px solid #dee2e6 !important;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-radius: 8px;
    min-width: 250px;
    padding: 8px 0;
    z-index: 10002 !important;
    max-height: 400px;
    overflow-y: auto;
}

.admin-mode-switcher .dropdown-item {
    padding: 8px 16px !important;
    font-size: 14px;
    border-radius: 0;
    transition: background-color var(--transition-speed);
}

.admin-mode-switcher .dropdown-item:hover {
    background-color: var(--primary-color);
    color: white;
}

.admin-mode-switcher .dropdown-item:hover i {
    color: white;
}

.admin-mode-switcher .dropdown-header {
    padding: 8px 16px 4px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
}

.admin-mode-switcher .dropdown-divider {
    margin: 8px 0;
    opacity: 0.3;
}