html {
    font-size: 16px;
}
/* 主题切换按钮 */
.theme-toggle-btn {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.theme-text {
    margin-left: 0.25rem;
}

/* 自定义导航栏样式 */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-color, #fff);
    border-bottom: 1px solid var(--border-color, #dee2e6);
    padding: 0.25rem 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--primary-color, #333);
    text-decoration: none;
    padding: 0.5rem 1rem;
    margin-right: 1rem;
}

.container-fluid {
    width: 100%;
    padding-right: 1rem;
    padding-left: 1rem;
    margin-right: auto;
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.navbar-toggler {
    padding: 0.25rem 0.5rem;
    background-color: transparent;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 0.25rem;
    cursor: pointer;
    display: none;
}

.navbar-toggler-icon {
    display: inline-block;
    width: 1.5em;
    height: 1.5em;
    vertical-align: middle;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280, 0, 0, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
}

.navbar-collapse {
    display: flex;
    flex-basis: 100%;
    flex-grow: 1;
    align-items: center;
}

.navbar-nav {
    display: flex;
    flex-direction: row;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
    margin-top: 0;
}

.ms-auto {
    margin-left: auto !important;
}

.nav-item {
    margin: 0 0.25rem;
}

.nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-color, #666);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
    border-radius: 0.25rem;
}

.nav-link:hover {
    color: var(--link-hover-color, #0a58ca);
    background-color: rgba(0, 0, 0, 0.05);
}

.nav-link.active {
    color: var(--active-color, #0d6efd);
    font-weight: 500;
    position: relative;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0.75rem;
    right: 0.75rem;
    height: 2px;
    background-color: var(--active-color, #0d6efd);
}

.nav-link svg {
    vertical-align: text-bottom;
    margin-right: 0.25rem;
}

/* 响应式设计 */
@media (max-width: 991.98px) {
    .navbar-toggler {
        display: block;
    }

    .navbar-collapse {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--bg-color, #fff);
        padding: 0.5rem 1rem;
        border-bottom: 1px solid var(--border-color, #dee2e6);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .navbar-collapse.show {
        display: block;
    }

    .navbar-nav {
        flex-direction: column;
        width: 100%;
    }

    .navbar-nav.ms-auto {
        margin-top: 0.5rem;
        border-top: 1px solid var(--border-color, #dee2e6);
        padding-top: 0.5rem;
    }

    .nav-item {
        margin: 0.25rem 0;
    }
}

/* 为浅色和深色主题提供变量 */
html[data-theme="light"] {
    --bg-color: #fff;
    --text-color: #333;
    --border-color: #dee2e6;
    --primary-color: #333;
    --link-hover-color: #0a58ca;
    --active-color: #0d6efd;
}

html[data-theme="dark"] {
    --bg-color: #222;
    --text-color: #eee;
    --border-color: #444;
    --primary-color: #eee;
    --link-hover-color: #8bb9fe;
    --active-color: #6ea8fe;
    color-scheme: dark;
}

/* 内容区域调整 */
.wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 自定义过渡效果 */
.nav-link, .navbar-brand, button {
    transition: all 0.2s ease-in-out;
}

/* 确保图片在暗模式下有适当的对比度 */
.dark img {
    filter: brightness(.8) contrast(1.2);
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background-color: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #555;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* 打印样式 */
@media print {
    @page {
        size: A4;
        margin: 0; /* 上下10mm，左右0 */
        @top-right {
        content: none;
        }
        @top-left {
        content: none;
        }
        @bottom-right {
        content: none;
        }
        @bottom-left {
        content: none;
        }
    }
    body {
        margin: 10mm 0;
        background: white !important;
        color: black !important;
    }
    body * {
        visibility: hidden;
    }
    .print-area,
    .print-area * {
        visibility: visible;
    }
    .print-area {
        position: absolute;
        left: 0;
        top: 0;
        margin: 0;
        box-shadow: none !important;
        background: none !important;
        box-sizing: border-box;
    }
    /* 确保打印时背景图片显示 */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* 辅助功能 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* 保留一些必要的自定义组件样式 */
.nav-link.active {
    color: var(--active-color, #0d6efd);
    font-weight: 500;
    position: relative;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0.75rem;
    right: 0.75rem;
    height: 2px;
    background-color: var(--active-color, #0d6efd);
}

.nav-link svg {
    vertical-align: text-bottom;
    margin-right: 0.25rem;
}