/* RUP Book Custom Theme */

/* Bilingual annotation styling */
.content main {
    max-width: 900px;
    margin: 0 auto;
}

/* Chinese annotations in parentheses */
.content p, .content li {
    line-height: 1.8;
}

/* Table styling */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

table th, table td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}

table th {
    background-color: #f5f5f5;
    font-weight: 600;
}

/* Image sizing */
img {
    max-width: 100%;
    height: auto;
}

/* Blockquote styling for notes */
blockquote {
    border-left: 4px solid #4a90d9;
    padding: 0.5em 1em;
    margin: 1em 0;
    background: #f8f9fa;
}

/* ============================================
   TreeView Sidebar Enhancements
   ============================================ */

/* --- TOC Filter / Outline Search --- */
#toc-filter-wrap {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 8px 10px 6px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--sidebar-separator);
    display: flex;
    align-items: center;
    gap: 4px;
}

#toc-filter-input {
    flex: 1;
    min-width: 0;
    padding: 5px 8px;
    border: 1px solid var(--sidebar-separator, #ddd);
    border-radius: 4px;
    font-size: 0.82em;
    color: var(--sidebar-fg);
    background: var(--sidebar-bg);
    outline: none;
    transition: border-color 0.15s;
}

#toc-filter-input::placeholder {
    color: var(--sidebar-non-existant, #999);
    opacity: 0.7;
}

#toc-filter-input:focus {
    border-color: var(--sidebar-active, #4a90d9);
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.15);
}

/* WebKit: hide native clear button so our custom one works */
#toc-filter-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

#toc-filter-clear {
    cursor: pointer;
    font-size: 0.8em;
    color: var(--sidebar-non-existant, #999);
    padding: 2px 4px;
    line-height: 1;
    user-select: none;
    flex-shrink: 0;
}

#toc-filter-clear:hover {
    color: var(--sidebar-fg);
}

/* Sidebar section headers */
.sidebar .chapter li.part-title {
    font-weight: 700;
    font-size: 0.9em;
    color: #2c3e50;
    letter-spacing: 0.02em;
    margin-top: 12px;
    padding: 4px 0;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    user-select: none;
}

.sidebar .chapter li.part-title:hover {
    color: #4a90d9;
}

.sidebar .chapter li.part-title .part-toggle {
    font-size: 0.75em;
    display: inline-block;
    width: 1.2em;
    text-align: center;
    color: #888;
}

.sidebar .chapter li.part-title.collapsed {
    border-bottom-color: transparent;
    opacity: 0.85;
}

.sidebar .chapter li.part-title.collapsed:hover {
    opacity: 1;
}

/* Better nesting indentation */
.sidebar .chapter ol.section {
    padding-left: 16px;
}

/* Current active item highlight */
.sidebar .chapter li.chapter-item .active {
    background: linear-gradient(90deg, #4a90d9 3px, #eef4fb 3px);
    border-radius: 0 4px 4px 0;
    padding-left: 10px;
    font-weight: 600;
}

/* Hover effect on sidebar items */
.sidebar .chapter li a:hover {
    background: #f0f4f8;
    border-radius: 3px;
    transition: background 0.15s ease;
}

/* Collapsed sections - handled by sidebar-collapse.js */

/* Discipline section styling - visual grouping */
.sidebar .chapter > ol > li > ol > li > ol {
    border-left: 2px solid #e8e8e8;
    margin-left: 4px;
    padding-left: 12px;
}

/* Compact sidebar for deep nesting */
.sidebar .chapter li a {
    padding: 3px 8px;
    font-size: 0.88em;
    line-height: 1.5;
}

/* Sidebar scrollbar styling */
.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Dark theme sidebar adjustments */
.coal .sidebar .chapter li.part-title,
.navy .sidebar .chapter li.part-title {
    color: #ccc;
    border-bottom-color: #444;
}

.coal .sidebar .chapter li.part-title:hover,
.navy .sidebar .chapter li.part-title:hover {
    color: #5ba0e0;
}

.coal .sidebar .chapter li.part-title .part-toggle,
.navy .sidebar .chapter li.part-title .part-toggle {
    color: #777;
}

.coal .sidebar .chapter li a:hover,
.navy .sidebar .chapter li a:hover {
    background: #333;
}

.coal .sidebar .chapter li.chapter-item .active,
.navy .sidebar .chapter li.chapter-item .active {
    background: linear-gradient(90deg, #5ba0e0 3px, #2a2e33 3px);
}

.coal .sidebar .chapter > ol > li > ol > li > ol,
.navy .sidebar .chapter > ol > li > ol > li > ol {
    border-left-color: #444;
}

/* ============================================
   Knowledge Graph Toolbar Button
   ============================================ */

#kg-toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--icons);
    cursor: pointer;
}

#kg-toolbar-btn:hover {
    color: var(--icons-hover);
}
