/* ====== Chrome 样式 ====== */

/* ========== 侧边栏样式 ========== */
.sidebar {
    position: fixed;
    left: 0;
    top: 48px;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: #f5f5f0 !important;
    border-right: 1px solid #e8e8e0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transform: translateX(calc(-100% - 8px));
    transition: transform 0.3s ease-in-out;
}

.sidebar-scrollbox {
    flex: 1;
    overflow-y: auto;
    padding: var(--sidebar-scrollbox-padding-top) 0 16px 0;
    background-color: #f5f5f0 !important;
}

.sidebar-title {
    padding: 16px;
    font-size: 14px;
    font-weight: 600;
    color: #228B22;
    border-bottom: 1px solid #e8e8e0;
    background-color: #f5f5f0 !important;
}

.sidebar-title a {
    color: #342a65;
    text-decoration: none;
}

.sidebar nav {
    padding: 0 8px;
    background-color: #f5f5f0 !important;
}

.sidebar ol,
.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar li {
    margin: 0;
}

.sidebar li a {
    display: block;
    padding: 6px 12px;
    color: #070708;
    text-decoration: none;
    font-size: 14px;
    border-radius: 4px;
    transition: background-color 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-color: transparent;
}

.sidebar li a:hover {
    background-color: #e8e8e0;
    color: #6a4fdb;
}

.sidebar li.active > a {
    background-color: #7b61ec;
    color: white;
}

.sidebar li.chapter-item > a::before {
    display: none;
}

.sidebar-resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-resize-indicator-width);
    cursor: col-resize;
    background-color: transparent;
}

.sidebar-resize-handle:hover {
    background-color: var(--sidebar-header-border-color);
}

/* ========== 页面包装器 ========== */
.page-wrapper {
    display: flex;
    min-height: 100vh;
    padding-top: 96px;
}

/* ========== 主页面区域 ========== */
.page {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease-in-out;
    max-width: 1200px;
    margin: 0 auto;
    background-color: var(--content-bg);
}

/* ========== 头部导航 ========== */
header[role="banner"] {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    height: 40px;
    background-color: #3f3568;
    border-bottom: 1px solid #393062;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.nav-title {
    flex: 1;
    text-align: center;
    margin: 0 16px;
}

.nav-title .title-link {
    font-size: 14px;
    font-weight: 500;
    color: white;
    text-decoration: none;
    transition: color 0.2s;
}

.nav-title .title-link:hover {
    color: rgba(255, 255, 255, 0.8);
}

.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background-color: transparent;
    color: white;
    cursor: pointer;
    border-radius: 4px;
    font-size: 16px;
    transition: all 0.2s;
}

.menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.949);
}

.nav-inner {
    display: flex;
    gap: 8px;
}

.nav-inner .icon-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background-color: transparent;
    color: white;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-inner .icon-link:hover {
    background-color: rgba(255, 255, 255, 0.949);
    color: rgba(255, 255, 255, 0.8);
}

/* 搜索按钮样式 */
.nav-inner #search-button.icon-link {
    color: white !important;
    opacity: 1 !important;
}

/* 隐藏打印按钮 */
.nav-inner a[href="print.html"] {
    display: none !important;
}

/* 顶部导航菜单栏样式 */
.top-nav {
    position: fixed;
    top: 40px;
    left: 0;
    right: 0;
    background-color: white;
    border-bottom: 1px solid #eee;
    width: 100%;
    margin: 0;
    padding: 16px 32px;
    z-index: 998;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    color: #333;
}

.menu-toggle:hover {
    color: #9a8ac9;
}

.top-nav-left {
    flex: 1;
}

.top-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.top-nav-search {
    display: flex;
    align-items: center;
    margin-left: 20px;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    width: 200px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: rgb(61, 50, 116);
}

.search-button {
    padding: 8px 16px;
    border: 1px solid rgb(61, 50, 116);
    border-left: none;
    border-radius: 0 4px 4px 0;
    background-color: rgb(61, 50, 116);
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.search-button:hover {
    background-color: #5a4a9e;
}

.top-nav-list li {
    display: inline-block;
}

.top-nav-list li a {
    color: rgb(61, 50, 116);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px;
    transition: color 0.2s;
}

.top-nav-list li a:hover {
    color: #9a8ac9;
}

/* 搜索结果面板样式 */
.search-results-panel {
    display: none;
    position: fixed;
    top: 100px;
    right: 32px;
    width: 350px;
    background-color: white;
    border: 1px solid #eee;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
}

.search-results-panel.open {
    display: block;
}

.search-results-panel ul {
    list-style: none;
    margin: 0;
    padding: 8px;
}

.search-results-panel li {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.search-results-panel li:last-child {
    border-bottom: none;
}

.search-results-panel li a {
    color: rgb(61, 50, 116);
    text-decoration: none;
    font-size: 14px;
    display: block;
}

.search-results-panel li a:hover {
    color: #9a8ac9;
}

/* 自定义搜索面板样式 */
.custom-search-panel {
    display: none;
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    max-width: 800px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
}

.custom-search-panel.open {
    display: block;
}

.custom-search-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.custom-search-header input[type="text"] {
    flex: 1;
    padding: 10px 12px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
    background: white;
}

.custom-search-header input[type="text"]:focus {
    border-color: #7b61ec;
}

.custom-search-close {
    margin-left: 12px;
    padding: 8px;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.custom-search-close:hover {
    background: #eee;
}

.custom-search-results {
    max-height: 400px;
    overflow-y: auto;
}

.custom-search-results ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.custom-search-results li {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.custom-search-results li:hover {
    background: #f8f8f8;
}

.custom-search-results li a {
    text-decoration: none;
    color: #333;
    font-size: 14px;
}

.custom-search-results li a:hover {
    color: #7b61ec;
}

.nav-chapters {
    display: flex;
    gap: 8px;
}

.nav-chapters a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-chapters a:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

.nav-chapters .previous i {
    margin-right: 2px;
}

.nav-chapters .next i {
    margin-left: 2px;
}

/* ========== 工具栏 ========== */
.toolbar {
    display: none;
}

/* ========== 侧边栏切换复选框 ========== */
.sidebar-toggle-checkbox,
.menu-toggle-checkbox {
    display: none;
}

.sidebar-toggle-checkbox:checked ~ .page-wrapper .sidebar {
    transform: translateX(0);
}

.sidebar-toggle-checkbox:checked ~ .page-wrapper .page {
    margin-left: var(--sidebar-width);
}

/* ========== 图标颜色 ========== */
.fa {
    color: white;
}
