/* 自定义模态框样式 */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1055;
    display: none;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
}

.custom-modal.show {
    display: block;
}

.custom-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.15s linear;
}

.custom-modal-backdrop.show {
    opacity: 1;
}

.custom-modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem;
    pointer-events: none;
    transform: translate(0, -50px);
    transition: transform 0.3s ease-out;
}

.custom-modal.show .custom-modal-dialog {
    transform: translate(0, 0);
}

.custom-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;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.5);
}

.custom-modal-header {
    display: flex;
    align-items: flex-start;
    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);
}

.custom-modal-title {
    margin-bottom: 0;
    line-height: 1.5;
    font-size: 1.25rem;
    font-weight: 500;
}

.custom-modal-close {
    padding: 0.5rem 0.5rem;
    margin: -0.5rem -0.5rem -0.5rem auto;
    background: transparent;
    border: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: 0.5;
    cursor: pointer;
}

.custom-modal-close:hover {
    opacity: 0.75;
}

.custom-modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1rem;
}

.custom-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.75rem;
    border-top: 1px solid #dee2e6;
    border-bottom-right-radius: calc(0.3rem - 1px);
    border-bottom-left-radius: calc(0.3rem - 1px);
}

.custom-modal-footer > * {
    margin: 0.25rem;
}

/* 响应式设计 */
@media (min-width: 576px) {
    .custom-modal-dialog {
        max-width: 500px;
        margin: 1.75rem auto;
    }
}

@media (min-width: 992px) {
    .custom-modal-dialog-lg {
        max-width: 800px;
    }
}

@media (min-width: 1200px) {
    .custom-modal-dialog-xl {
        max-width: 1140px;
    }
}

/* 动画效果 */
.custom-modal.fade .custom-modal-dialog {
    transition: transform 0.3s ease-out;
    transform: translate(0, -50px);
}

.custom-modal.fade.show .custom-modal-dialog {
    transform: none;
}

/* 确保模态框在最顶层 */
.custom-modal {
    z-index: 1055 !important;
}

.custom-modal-backdrop {
    z-index: 1050 !important;
}

/* 防止页面滚动 */
body.modal-open {
    overflow: hidden;
    padding-right: 17px; /* 补偿滚动条宽度 */
}

/* 兼容现有Bootstrap样式 */
.custom-modal .modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem;
    pointer-events: none;
}

.custom-modal .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;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.5);
}

.custom-modal .modal-header {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.custom-modal .modal-body {
    padding: 1rem;
    flex: 1 1 auto;
}

.custom-modal .modal-footer {
    padding: 0.75rem;
    border-top: 1px solid #dee2e6;
}

/* 兼容Bootstrap标记的模态框（页面采用 .modal 结构但未引入完整Bootstrap样式） */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1055; /* 实际显示层级由JS内联z-index覆盖，这里提供兜底 */
    display: none;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
}

.modal.show {
    display: block;
}

/* 动画与过渡（与自定义管理器的内联transform保持一致） */
.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
    transform: translate(0, -50px);
}

.modal.fade.show .modal-dialog {
    transform: none;
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem;
    pointer-events: none;
}

.modal.show .modal-dialog {
    transform: translate(0, 0);
}

.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;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.5);
}

/* 头部/主体/底部保持Bootstrap语义 */
.modal-header {
    display: flex;
    align-items: flex-start;
    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;
    font-size: 1.25rem;
    font-weight: 500;
}

.btn-close {
    padding: 0.5rem 0.5rem;
    margin: -0.5rem -0.5rem -0.5rem auto;
    background: transparent;
    border: 0;
    font-size: 1.25rem;
    line-height: 1;
    opacity: 0.6;
    cursor: pointer;
}

.btn-close:hover {
    opacity: 0.85;
}

.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.75rem;
    border-top: 1px solid #dee2e6;
    border-bottom-right-radius: calc(0.3rem - 1px);
    border-bottom-left-radius: calc(0.3rem - 1px);
}

/* 响应式对话框宽度 */
@media (min-width: 576px) {
    .modal-dialog {
        max-width: 500px;
        margin: 1.75rem auto;
    }
}

@media (min-width: 992px) {
    .modal-lg {
        max-width: 800px;
    }
}

@media (min-width: 1200px) {
    .modal-xl {
        max-width: 1140px;
    }
}

/* 备用：如有第三方脚本使用 .modal-backdrop，则确保其显示在遮罩层级；本项目主要使用 custom-modal-backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.15s linear;
}

.modal-backdrop.show {
    opacity: 1;
}

/* 保持与自定义选择器层级一致（冗余兜底） */
.modal {
    z-index: 1055 !important;
}
.custom-modal {
    z-index: 1055 !important;
}
.custom-modal-backdrop {
    z-index: 1050 !important;
}

/* Markdown 内容基础样式，作用于文章详情区域 */
.article-content { line-height: 1.8; font-size: 1rem; color: #1f2937; }
.article-content h1, .article-content h2, .article-content h3, .article-content h4, .article-content h5, .article-content h6 { margin: 1.2em 0 0.6em; font-weight: 700; line-height: 1.3; }
.article-content p { margin: 0.8em 0; }
.article-content ul, .article-content ol { padding-left: 1.5rem; margin: 0.8em 0; }
.article-content li + li { margin-top: 0.25em; }
.article-content a { color: #0d6efd; text-decoration: underline; }
.article-content a:hover { color: #0b5ed7; }
.article-content code { background: #f6f8fa; padding: 0.15em 0.35em; border-radius: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 0.95em; }
.article-content pre { background: #0b1220; color: #e5e7eb; padding: 1rem; border-radius: 8px; overflow: auto; margin: 1rem 0; }
.article-content pre code { background: transparent; color: inherit; padding: 0; }
.article-content blockquote { border-left: 4px solid #e5e7eb; margin: 1rem 0; padding: 0.5rem 1rem; color: #4b5563; background: #f9fafb; border-radius: 4px; }
.article-content img { max-width: 100%; height: auto; display: block; margin: 0.5rem 0; border-radius: 6px; }