.note-editor[data-bs-theme="dark"],
html[data-bs-theme="dark"] .note-editor {
    color: var(--bs-body-color);
}

html[data-bs-theme="dark"] .note-editor .note-toolbar,
.note-editor[data-bs-theme="dark"] .note-toolbar {
    background-color: var(--bs-dark-bg-subtle);
    border-color: var(--bs-border-color);
}

html[data-bs-theme="dark"] .note-editor .note-toolbar .note-btn,
.note-editor[data-bs-theme="dark"] .note-toolbar .note-btn {
    background-color: transparent;
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

html[data-bs-theme="dark"] .note-editor .note-toolbar .note-btn:hover,
html[data-bs-theme="dark"] .note-editor .note-toolbar .note-btn:focus,
.note-editor[data-bs-theme="dark"] .note-toolbar .note-btn:hover,
.note-editor[data-bs-theme="dark"] .note-toolbar .note-btn:focus {
    background-color: var(--bs-dark-bg-subtle);
    color: var(--bs-body-color);
}

html[data-bs-theme="dark"] .note-popover .popover-content,
.note-editor[data-bs-theme="dark"] .note-popover .popover-content {
    background-color: var(--bs-dark-bg-subtle);
    color: var(--bs-body-color);
}

html[data-bs-theme="dark"] .note-dropdown-menu,
.note-editor[data-bs-theme="dark"] .note-dropdown-menu {
    background-color: var(--bs-dark-bg-subtle);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

html[data-bs-theme="dark"] .note-editor .note-dropdown-menu .dropdown-item,
html[data-bs-theme="dark"] .note-editor .note-dropdown-menu .note-dropdown-item,
.note-editor[data-bs-theme="dark"] .note-dropdown-menu .dropdown-item,
.note-editor[data-bs-theme="dark"] .note-dropdown-menu .note-dropdown-item {
    color: var(--bs-body-color);
}

html[data-bs-theme="dark"] .note-editor .note-dropdown-menu .dropdown-item *,
html[data-bs-theme="dark"] .note-editor .note-dropdown-menu .note-dropdown-item *,
.note-editor[data-bs-theme="dark"] .note-dropdown-menu .dropdown-item *,
.note-editor[data-bs-theme="dark"] .note-dropdown-menu .note-dropdown-item * {
    color: inherit;
}

html[data-bs-theme="dark"] .note-editor .note-dropdown-menu .dropdown-item:hover,
html[data-bs-theme="dark"] .note-editor .note-dropdown-menu .dropdown-item:focus,
html[data-bs-theme="dark"] .note-editor .note-dropdown-menu .note-dropdown-item:hover,
html[data-bs-theme="dark"] .note-editor .note-dropdown-menu .note-dropdown-item:focus,
.note-editor[data-bs-theme="dark"] .note-dropdown-menu .dropdown-item:hover,
.note-editor[data-bs-theme="dark"] .note-dropdown-menu .dropdown-item:focus,
.note-editor[data-bs-theme="dark"] .note-dropdown-menu .note-dropdown-item:hover,
.note-editor[data-bs-theme="dark"] .note-dropdown-menu .note-dropdown-item:focus {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    margin: 0;
}

.main {
    position: absolute;
    top: 70px;
    bottom: 50px;
    right: 5;
    left: 5;
    overflow-y: auto;
}

/* Sidebar and main content independent scroll */
#layout-root {
    height: calc(100vh - 70px); /* Adjust for navbar+accent bar height */
    display: flex;
    flex-direction: row;
    
}

body:has(footer.fixed-bottom) #layout-root {
    height: calc(100vh - 120px);
}

#sidebar {
    height: 100%;
    max-height: 100%;
    overflow-y: auto;

    flex: 0 0 auto;
    position: relative;
    transition: transform 0.3s ease, width 0.3s ease;
    min-width: 250px;
    max-width: 250px;
    z-index: 1000;
    background-color: var(--bs-secondary-bg);
}
#sidebar.unpinned {
    position: fixed;
    transform: translateX(-220px);
}
#sidebar.unpinned:hover {
    transform: translateX(0);
    box-shadow: 4px 0 8px rgba(0,0,0,0.1);
}

/* Sidebar controls */
.sidebar-controls {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    padding: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-secondary-bg);
    z-index: 2;
}

.sidebar-controls .form-control {
    font-size: 0.875rem;
    height: 30px;
    padding: 0.25rem 0.5rem;
}

.sidebar-controls .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Pin Button */
.sidebar-pin {
    position: static; /* Override previous absolute positioning */
    opacity: 0.8;
    transition: opacity 0.2s;
}
.sidebar-pin:hover {
    opacity: 1;
}

/* Adjust main content when sidebar is unpinned */
#main-content {
    height: 100%;
    max-height: calc(100vh - 70px);
    overflow: auto;
    flex: 1 1 0%;
    transition: margin-left 0.3s ease;
    padding-bottom: 1rem;
}

body:has(footer.fixed-bottom) #main-content {
    max-height: calc(100vh - 120px);
}

#my-articles-content,
#profile-content {
    height: 100%;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
}

#main-content.sidebar-unpinned {
    margin-left: 30px;
    transition: margin-left 0.3s ease;
}

/* Search input width transition */
form[role="search"] .form-control {
    width: 100px;
    transition: width 0.3s ease;
    display: inline-block;
}
form[role="search"] .form-control:focus {
    width: 200px;
}
#navbar-actions form[role="search"] {
    margin-bottom: 0;
}

#navbar-container{
    position:absolute;
    bottom:10px;
}

/* Modern Navbar */
.navbar {
    border-radius: 0 0 1rem 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s;
}

/* Modern Buttons */
.btn {
    border-radius: 2rem;
    transition: background 0.2s, color 0.2s;
}

/* Responsive and modern search input */
form[role="search"] .form-control {
    border-radius: 2rem;
    font-size: 1.1rem;
}

/* Accent bar */
.navbar-accent-bar {
    height: 4px;
    width: 100%;
    background: linear-gradient(90deg,#ffc107 0%, #754f22 100%);
    position: relative;
    top: 0;
    left: 0;
    z-index: 1051;
    border-radius: 0 0 2px 2px;
}
[data-bs-theme="dark"] .navbar-accent-bar {
    background: linear-gradient(90deg, #6610f2 0%, #0d6efd 100%);
}

/* Article styling */
.article-header {
    max-width:85%;
}

/* Category Tree Styling */
#categoryTree {
    padding-top: 45px; /* Updated padding to match new header */
    padding-bottom: 3rem;
}

:root {
    --kb-nav-category-fg: var(--bs-emphasis-color);
    --kb-nav-article-fg: var(--bs-secondary-color);
    --kb-nav-row-hover-bg: color-mix(in srgb, var(--bs-primary) 8%, transparent);
    --kb-nav-row-active-bg: var(--bs-primary-bg-subtle, rgba(13, 110, 253, 0.15));
    --kb-nav-row-active-border: var(--bs-primary, #0d6efd);
    --kb-nav-hover-line: color-mix(in srgb, var(--bs-primary) 75%, transparent);
    --kb-nav-indent-step: 0.4rem;
}

html[data-bs-theme="dark"] {
    --kb-nav-category-fg: color-mix(in srgb, var(--bs-body-color) 92%, white);
    --kb-nav-article-fg: color-mix(in srgb, var(--bs-body-color) 72%, white);
    --kb-nav-row-hover-bg: color-mix(in srgb, var(--bs-primary) 16%, transparent);
    --kb-nav-row-active-bg: color-mix(in srgb, var(--bs-primary) 28%, transparent);
    --kb-nav-hover-line: color-mix(in srgb, var(--bs-primary) 92%, white);
}

#categoryTree .list-group-item {
    background: transparent;
    border: none;
    padding: 0.1rem 0.25rem;
}

#categoryTree .tree-node {
    position: relative;
    border-radius: 0.375rem;
    min-height: 2.1rem;
    padding: 0.32rem 0.5rem;
    transition: background-color 0.16s ease, color 0.16s ease;
}

#categoryTree .tree-node::after {
    content: "";
    position: absolute;
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.1rem;
    height: 2px;
    border-radius: 999px;
    background: var(--kb-nav-hover-line);
    transform: scaleX(0);
    transform-origin: center;
    opacity: 0;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

#categoryTree .tree-node:hover,
#categoryTree .tree-node:focus-within {
    background: var(--kb-nav-row-hover-bg);
}

#categoryTree .tree-node:hover::after,
#categoryTree .tree-node:focus-within::after {
    transform: scaleX(1);
    opacity: 1;
}

#categoryTree .tree-node-category .category-name {
    color: var(--kb-nav-category-fg);
    font-weight: 600;
    letter-spacing: 0.01em;
}

#categoryTree .tree-node-article .article-name {
    color: var(--kb-nav-article-fg);
    font-weight: 500;
    line-height: 1.25;
}

#categoryTree .category-header {
    align-items: center;
}

#categoryTree .category-toggle {
    width: 1rem;
    min-width: 1rem;
    margin-right: 0.4rem !important;
    color: var(--bs-secondary-color);
}

#categoryTree .category-toggle i {
    transition: transform 0.18s ease;
}

#categoryTree .category-toggle i.bi-chevron-down {
    transform: rotate(90deg);
}

#categoryTree .category-toggle:hover,
#categoryTree .category-toggle:focus {
    color: var(--kb-nav-row-active-border);
}

#categoryTree .category-toggle-spacer {
    display: inline-block;
    width: 1.4rem;
    min-width: 1.4rem;
}

#categoryTree .category-children {
    margin-left: var(--kb-nav-indent-step);
    border-left: 1px solid color-mix(in srgb, var(--bs-border-color) 72%, transparent);
    padding-left: 0.2rem;
}

#categoryTree .article-list {
    margin-left: 0;
}

/* Hide text when collapsed */
#sidebar.unpinned .category-name,
#sidebar.unpinned .article-name {
    opacity: 0;
    transition: opacity 0.2s;
}

/* Show text on hover */
#sidebar.unpinned:hover .category-name,
#sidebar.unpinned:hover .article-name {
    opacity: 1;
}

/* Handle unpinned state */
#sidebar.unpinned .sidebar-controls {
    padding: 5px 2px;
}

#sidebar.unpinned .sidebar-controls > *:not(.sidebar-pin) {
    opacity: 0;
    pointer-events: none;
}

#sidebar.unpinned:hover .sidebar-controls > * {
    opacity: 1;
    pointer-events: auto;
}

/* Ensure smooth transitions for all transformable elements */
.category-name,
.article-name,
.category-toggle,
.article-item,
.category-header,
.tree-node {
    transition: all 0.3s ease;
}
/* Article items styling */
.article-item {
    padding: 0.2rem 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.subcategory-list .list-group-item {
    border: none;
    background-color: transparent;
    padding-left: 0;
}

.article-item:hover {
    background-color: transparent;
}

/* Dark theme adjustments */
[data-bs-theme="dark"] .article-item:hover {
    background-color: transparent;
}

.user-dropdown-menu {
    top: 100%;
    left: 0;
    z-index: 1100;
}

.language-switcher .dropdown-menu {
    z-index: 1100;
}

.sidebar-active {
    border-left: none;
}

#categoryTree .tree-node.sidebar-active,
#categoryTree .category-item.sidebar-active > .category-header {
    background: var(--kb-nav-row-hover-bg);
}

#categoryTree .tree-node.sidebar-active::after,
#categoryTree .category-item.sidebar-active > .category-header::after {
    transform: scaleX(1);
    opacity: 1;
}

#categoryTree .tree-node.sidebar-active .category-name,
#categoryTree .tree-node.sidebar-active .article-name,
#categoryTree .category-item.sidebar-active > .category-header .category-name {
    font-weight: 600;
}

@media (max-width: 768px) {
    #categoryTree .tree-node {
        min-height: 2.75rem;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    #categoryTree .category-children {
        margin-left: 0.2rem;
        padding-left: 0.15rem;
    }

    #categoryTree .tree-node:active {
        background: var(--kb-nav-row-hover-bg);
    }

    #categoryTree .tree-node:active::after {
        transform: scaleX(1);
        opacity: 1;
    }
}

#header nav {
    height: 69px;
}

#admin-content{
    height: calc(100vh - 70px);
    max-width:295px;
}

/* Application Drawer */
.app-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1064;
}

.app-drawer-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.app-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 100vw);
    max-width: 100%;
    background: var(--bs-body-bg);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 1065;
    display: flex;
    flex-direction: column;
}

.app-drawer.is-open {
    transform: translateX(0);
}

/* Raise user role modals above the app drawer and its overlay */
#kb-add-user-role-modal,
#kb-remove-user-role-modal {
    z-index: 1070 !important;
}

#kb-add-user-role-modal ~ .modal-backdrop,
#kb-remove-user-role-modal ~ .modal-backdrop {
    z-index: 1066 !important;
}

.app-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-secondary-bg);
}

.app-drawer-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1.25rem;
}

.users-row.is-selected {
    background-color: var(--bs-primary-bg-subtle);
}

[data-bs-theme="dark"] .users-row.is-selected {
    background-color: rgba(13, 110, 253, 0.25);
}

.admin-user-drawer .admin-drawer-section {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    background-color: var(--bs-body-bg);
}

.admin-user-drawer .admin-drawer-section + .admin-drawer-section {
    margin-top: 1.5rem;
}

.permissions-table-head th {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    border-bottom: 1px solid var(--bs-border-color);
}

[data-bs-theme="dark"] .permissions-table-head th {
    background-color: var(--bs-secondary-bg);
}

.card-placeholder {
    min-height: 140px;
}

.auth-provider-panels .auth-provider {
    background-color: var(--bs-body-bg);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-provider-button {
    background-color: transparent;
    border: 0;
    padding: 0.75rem 1rem;
}

.auth-provider-button:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.auth-provider .form-check-input {
    cursor: pointer;
}

.auth-provider .collapse {
    transition: height 0.3s ease;
}

.auth-provider.border-primary {
    box-shadow: 0 0 0 1px rgba(13, 110, 253, 0.2);
}

.auth-provider-chevron {
    transition: transform 0.2s ease;
}

.rotate-180 {
    transform: rotate(180deg);
}

.admin-system-toolbar .btn {
    border-radius: 999px;
}

.admin-system-grid .card {
    border-radius: 1rem;
}

.admin-system-grid .form-check.form-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Summernote dialog z-index fix: ensure dialogs appear above Bootstrap modals */
.note-modal-backdrop {
    z-index: 1059 !important;
}
.note-modal.open {
    z-index: 1060 !important;
}

/* Fix custom button sizing - Bootstrap Icons need explicit sizing to match Summernote's buttons */
.note-toolbar .note-btn i.bi,
.note-toolbar button i.bi {
    display: inline-block;
    width: 14px;
    height: 14px;
    font-size: 14px;
    line-height: 14px;
    vertical-align: baseline;
}

.note-toolbar .note-btn,
.note-toolbar button.note-btn {
    padding: 0.375rem 0.5rem;
    min-height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Summernote already renders .note-icon-caret, so hide Bootstrap's extra caret */
.note-editor .note-toolbar .dropdown-toggle::after,
.note-editor .note-popover .dropdown-toggle::after {
    display: none;
}

/* Summernote source mode readability */
.note-editor.codeview .note-codable {
    font-family: Consolas, 'Courier New', Menlo, Monaco, monospace;
    font-size: 0.95rem;
    line-height: 1.65;
    tab-size: 2;
    -moz-tab-size: 2;
    padding: 1rem 1.25rem;
}

html[data-bs-theme="dark"] .note-editor.codeview .note-codable {
    background-color: #0f172a;
    color: #e2e8f0;
}

/* Prettyprint code blocks (editor + rendered article content) */
pre.prettyprint {
    margin: 0.9rem 0;
    padding: 0.85rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--bs-border-color);
    background-color: #f8fafc;
    color: #0f172a;
    font-family: Consolas, 'Courier New', Menlo, Monaco, monospace;
    font-size: 0.92rem;
    line-height: 1.5;
    white-space: pre;
    overflow-x: auto;
    max-width:80%;
}

pre.prettyprint code {
    background: transparent;
    color: inherit;
    font: inherit;
    padding: 0;
}

html[data-bs-theme="dark"] pre.prettyprint,
.note-editor[data-bs-theme="dark"] pre.prettyprint {
    background-color: #0f172a;
    color: #e2e8f0;
    border-color: #334155;
}
pre {
    overflow-x: auto;
    max-width:80%;
}

/* Article editor modal layout */
.article-editor-form {
    min-height: 70vh;
}

.article-editor-form .article-editor-layout {
    width: 100%;
}

.article-editor-form .article-metadata-column,
.article-editor-form .article-editor-column,
.article-editor-form .article-editor-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.article-editor-form .article-editor-column,
.article-editor-form .article-editor-column.article-editor-column-expanded,
.article-editor-form .article-editor-column.article-editor-column-expanded-partial {
    flex-grow: 1;
    min-width: 0;
}

.article-editor-form .kb-tinymce-toolbar-host {
    position: sticky;
    top: 0;
    z-index: 6;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 0.25rem;
}

.article-editor-form .kb-tinymce-toolbar-host .tox-tinymce-inline {
    border: 0;
}

.article-editor-form .article-editor-panel {
    transition: flex-basis 0.25s ease, max-width 0.25s ease, width 0.25s ease;
}

.article-editor-form .article-panel-header {
    flex: 0 0 auto;
}

.article-editor-form .article-panel-content {
    flex: 1 1 auto;
}

.article-editor-form .article-panel-title-text {
    display: inline-block;
    transition: transform 0.25s ease, margin 0.25s ease;
    transform-origin: center;
    white-space: nowrap;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
}

.article-editor-form .article-editor-panel.article-panel-collapsed {
    flex: 0 0 3rem !important;
    max-width: 3rem !important;
}

.article-editor-form .article-editor-panel.article-panel-collapsed .article-panel-header {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.article-editor-form .article-editor-panel.article-panel-collapsed .article-panel-toggle {
    flex-direction: column;
    align-items: center;
}

.article-editor-form .article-editor-panel.article-panel-collapsed .article-panel-title-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: none;
    margin-top: 0.5rem;
}

.article-editor-form .article-editor-panel.article-panel-collapsed .btn {
    width: 100%;
}

@media (min-width: 1200px) {
    .article-editor-form .article-metadata-column {
        flex: 0 0 12rem;
        max-width: 12rem;
        align-self: stretch;
    }

    .article-editor-form .article-editor-column {
        flex: 1 1 auto;
        max-width: none;
    }

    .article-editor-form .article-panel-placement {
        flex: 0 0 18rem;
        max-width: 18rem;
    }

    .article-editor-form .article-panel-versions {
        flex: 0 0 14rem;
        max-width: 14rem;
        min-width: 14rem;
    }

    .article-editor-form .article-panel-versions.article-panel-collapsed {
        min-width: 3rem !important;
    }
}

.article-flag-icon-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.article-flag-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.article-flag-toggle .bi {
    font-size: 1.1rem;
}

.article-flag-toggle-label {
    font-size: 0.85rem;
    font-weight: 500;
}

.article-flag-toggle:hover,
.article-flag-toggle:focus {
    text-decoration: none;
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.15);
}

.article-flag-toggle:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.article-flag-toggle-active {
    color: var(--bs-body-bg);
}

.article-flag-toggle-helper {
    max-width: 9rem;
    line-height: 1.2;
}

.article-flag-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Version Panel Styles */
.version-list {
    max-height: 400px;
    overflow-y: auto;
}

.version-item {
    transition: background-color 0.2s ease;
}

.version-item:last-child {
    border-bottom: none !important;
}

.version-item.cursor-pointer {
    cursor: pointer;
}

.version-item.hover-bg-light:hover {
    background-color: var(--bs-light);
}

[data-bs-theme="dark"] .version-item.hover-bg-light:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.version-number {
    min-width: 1.75rem;
    font-size: 0.8rem;
    color: var(--bs-primary);
}

.version-details {
    font-size: 0.75rem;
    line-height: 1.3;
}

.version-details .badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
}

.version-metadata {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.version-metadata i {
    opacity: 0.7;
    font-size: 0.7rem;
}

/* ── Missing-translation row crossfade ── */
.missing-row-default,
.missing-row-hover {
    transition: opacity 0.2s ease;
}

.missing-row-hover {
    position: absolute;
    inset: 0;
    opacity: 0;
    font-weight: 600;
    pointer-events: none;
    color: var(--bs-success);
}

button:hover > .missing-row-default,
button:focus-visible > .missing-row-default {
    opacity: 0;
}

button:hover > .missing-row-hover,
button:focus-visible > .missing-row-hover {
    opacity: 1;
}

button:has(.missing-row-hover):hover,
button:has(.missing-row-hover):focus-visible {
    border-color: var(--bs-success) !important;
    background-color: var(--bs-success-bg-subtle) !important;
}

/* Asset detail drawer */
.asset-detail-content {
    padding: 0.5rem 0;
}

.asset-detail-section {
    margin-bottom: 1.5rem;
}

.asset-detail-section h6 {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.asset-detail-content dl.row dt {
    font-weight: 500;
}

.asset-detail-content dl.row dd {
    word-break: break-word;
}

/* Asset picker grid (Summernote "Insert existing image" modal) */
.asset-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
    max-height: 55vh;
    overflow-y: auto;
    padding: 2px;
}

.asset-picker-item {
    border: 2px solid var(--bs-border-color);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: var(--bs-body-bg);
    display: flex;
    flex-direction: column;
}

.asset-picker-item:hover,
.asset-picker-item:focus-visible {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.25);
}

.asset-picker-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    background: var(--bs-secondary-bg);
}

.asset-picker-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bs-secondary-bg);
}

.asset-picker-label {
    padding: 4px 6px;
    border-top: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
}

/* ── Category Tree Styles ── */
.category-tree-container {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
}

.category-tree {
    padding: 0;
    margin: 0;
}

.category-tree li {
    list-style: none;
    position: relative;
}

.category-tree-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--bs-border-color);
    transition: background-color 0.15s ease;
    cursor: pointer;
}

.category-tree-item:hover {
    background-color: var(--bs-secondary-bg);
}

.category-tree-item.selected {
    background-color: var(--bs-primary-bg-subtle);
    border-left: 3px solid var(--bs-primary);
}

.category-tree-item .category-toggle {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--bs-secondary);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.category-tree-item .category-toggle.expanded {
    transform: rotate(90deg);
}

.category-tree-item .category-toggle:hover {
    color: var(--bs-primary);
}

.category-tree-item .category-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    color: var(--bs-primary);
    flex-shrink: 0;
}

.category-tree-item .category-name {
    flex-grow: 1;
    font-weight: 500;
    color: var(--bs-body-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-tree-item .category-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
    flex-shrink: 0;
}

.category-tree-item .category-article-count {
    font-size: 0.875rem;
    color: var(--bs-secondary);
}

/* Clickable article count - styled like regular text but with pointer cursor */
.category-tree-item .category-article-count-link {
    font-size: 0.875rem;
    color: var(--bs-secondary);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
}

.category-tree-item .category-article-count-link:hover {
    color: var(--bs-secondary);
}

.category-tree-item .category-child-count {
    font-size: 0.875rem;
    color: var(--bs-secondary);
    margin-left: 8px;
}

.category-tree-item .category-badge {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: var(--bs-secondary-bg);
    color: var(--bs-secondary);
}

.category-tree-item .badge-orphaned {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.category-tree-item .badge-empty {
    background-color: #e7f3ff;
    color: #004085;
    border: 1px solid #b8daff;
}

[data-bs-theme="dark"] .category-tree-item .badge-orphaned {
    background-color: #664d03;
    color: #ffecb5;
    border-color: #997404;
}

[data-bs-theme="dark"] .category-tree-item .badge-empty {
    background-color: #052c65;
    color: #b6d4fe;
    border-color: #084298;
}

.category-tree-item .category-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}

.category-tree-item .category-action-btn {
    padding: 2px 6px;
    font-size: 0.875rem;
    border: none;
    background: transparent;
    color: var(--bs-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.15s, color 0.15s;
}

.category-tree-item .category-action-btn:hover {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-primary);
}

.category-tree ul.category-children {
    padding-left: 28px;
    margin: 0;
}

.category-tree ul.category-children.collapsed {
    display: none;
}

/* Dark mode adjustments */
html[data-bs-theme="dark"] .category-tree-item:hover {
    background-color: var(--bs-dark-bg-subtle);
}

html[data-bs-theme="dark"] .category-tree-item.selected {
    background-color: rgba(var(--bs-primary-rgb), 0.2);
}

/* Category actions dropdown */
.category-actions-dropdown {
    min-width: 200px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border: 1px solid var(--bs-border-color);
    background-color: var(--bs-body-bg);
}

.category-actions-dropdown .dropdown-item {
    padding: 0.5rem 1rem;
    color: var(--bs-body-color);
    transition: background-color 0.15s ease;
}

.category-actions-dropdown .dropdown-item:hover {
    background-color: var(--bs-secondary-bg);
}

.category-actions-dropdown .dropdown-item.text-danger:hover {
    background-color: var(--bs-danger-bg-subtle);
    color: var(--bs-danger);
}

.category-actions-dropdown .dropdown-divider {
    margin: 0.5rem 0;
    border-top: 1px solid var(--bs-border-color);
}

html[data-bs-theme="dark"] .category-actions-dropdown {
    background-color: var(--bs-dark-bg-subtle);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
}

/* Refresh button animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spin-animation {
    animation: spin 0.5s linear;
}

/* Category translation panel */
#kb-edit-category-translations-panel {
    border-top: 1px solid var(--bs-border-color);
    padding-top: 1rem;
}

#kb-edit-category-translations-list .translation-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

#kb-edit-category-translations-list .translation-row:hover {
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-primary);
}

#kb-edit-category-translations-list .translation-row.active {
    background-color: var(--bs-primary-bg-subtle);
    border-color: var(--bs-primary);
    border-width: 2px;
}

#kb-edit-category-translations-list .translation-row .translation-language {
    font-weight: 500;
    color: var(--bs-body-color);
}

#kb-edit-category-translations-list .translation-row .translation-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#kb-edit-category-translations-list .translation-row .primary-indicator {
    color: var(--bs-warning);
}

#kb-edit-category-translations-list .translation-row .translation-menu-trigger {
    opacity: 0;
    transition: opacity 0.15s ease;
}

#kb-edit-category-translations-list .translation-row:hover .translation-menu-trigger {
    opacity: 1;
}

html[data-bs-theme="dark"] #kb-edit-category-translations-list .translation-row:hover {
    background-color: var(--bs-dark-bg-subtle);
}

#kb-edit-category-translations-list .translation-row.translation-missing {
    opacity: 0.7;
    cursor: default;
}

#kb-edit-category-translations-list .translation-row.translation-missing:hover {
    background-color: transparent;
    border-color: var(--bs-border-color);
}

/* Translation context menu */
.translation-context-menu {
    min-width: 200px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.translation-context-menu .dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    cursor: pointer;
}

.translation-context-menu .dropdown-item:hover:not(.disabled) {
    background-color: var(--bs-secondary-bg);
}

.translation-context-menu .dropdown-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

html[data-bs-theme="dark"] .translation-context-menu {
    background-color: var(--bs-dark-bg-subtle);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
}

/* Category context menu (unified for front-end and admin panel) */
.category-context-menu,
.category-actions-dropdown {
    min-width: 200px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.category-context-menu .dropdown-item,
.category-actions-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    cursor: pointer;
}

.category-context-menu .dropdown-item:hover:not(.disabled),
.category-actions-dropdown .dropdown-item:hover:not(.disabled) {
    background-color: var(--bs-secondary-bg);
}

.category-context-menu .dropdown-item.disabled,
.category-actions-dropdown .dropdown-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

html[data-bs-theme="dark"] .category-context-menu,
html[data-bs-theme="dark"] .category-actions-dropdown {
    background-color: var(--bs-dark-bg-subtle);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
}

/* ── Bootstrap Tooltip Customization ── */
.tooltip {
    font-size: 0.875rem;
    z-index: 1070;
}

.tooltip-inner {
    max-width: 300px;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    text-align: left;
}

/* Light theme tooltips */
.tooltip .tooltip-inner {
    background-color: var(--bs-dark);
    color: var(--bs-light);
}

.tooltip .tooltip-arrow::before {
    border-top-color: var(--bs-dark);
    border-bottom-color: var(--bs-dark);
    border-left-color: var(--bs-dark);
    border-right-color: var(--bs-dark);
}

/* Dark theme tooltips */
html[data-bs-theme="dark"] .tooltip .tooltip-inner {
    background-color: var(--bs-light);
    color: var(--bs-dark);
}

html[data-bs-theme="dark"] .tooltip .tooltip-arrow::before {
    border-top-color: var(--bs-light);
    border-bottom-color: var(--bs-light);
    border-left-color: var(--bs-light);
    border-right-color: var(--bs-light);
}

/* Custom tooltip classes for permissions */
.permissions-tooltip .tooltip-inner {
    max-width: 350px;
    text-align: left;
}

/* Ensure tooltips appear above modals */
.modal-open .tooltip {
    z-index: 1080;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Wiki Syntax Styling
   Styles for wiki-style article links and widgets
   ═══════════════════════════════════════════════════════════════════════════ */

/* Internal article links */
.kb-internal-link {
    color: var(--bs-link-color, #0d6efd);
    text-decoration: none;
    border-bottom: 1px dotted var(--bs-link-color, #0d6efd);
    transition: all 0.2s ease;
}

.kb-internal-link:hover {
    color: var(--bs-link-hover-color, #0a58ca);
    border-bottom-style: solid;
    text-decoration: none;
}

.kb-internal-link:visited {
    color: var(--bs-link-color, #0d6efd);
}

/* Broken/invalid article links */
.kb-broken-link {
    color: #dc3545;
    text-decoration: line-through;
    cursor: help;
    font-style: italic;
}

.kb-broken-link:hover {
    color: #bb2d3b;
}

/* Unavailable/deleted article links */
.kb-unavailable-link {
    color: #6c757d;
    text-decoration: line-through;
    cursor: not-allowed;
    font-style: italic;
    opacity: 0.7;
}

.kb-unavailable-link:hover {
    color: #5c636a;
    opacity: 0.9;
}

/* Wiki link placeholders (before resolution) */
.kb-wikilink-placeholder {
    background-color: #fff3cd;
    padding: 0 0.25rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

/* Widget placeholders (before rendering) */
.kb-widget-placeholder {
    background-color: #d1ecf1;
    border: 1px dashed #0dcaf0;
    padding: 0.5rem;
    margin: 1rem 0;
    border-radius: 0.375rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #055160;
}

.kb-widget-placeholder::before {
    content: "Widget: ";
    font-weight: bold;
}

/* Rendered widgets */
.kb-widget {
    margin: 1.5rem 0;
}

/* Editor-specific styles (for syntax highlighting in Summernote) */
.note-editable .kb-wikilink-placeholder {
    background-color: #e7f3ff;
    border: 1px solid #b3d9ff;
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
    cursor: pointer;
}

.note-editable .kb-wikilink-placeholder:hover {
    background-color: #cce5ff;
}

.note-editable .kb-widget-placeholder {
    background-color: #f0f8ff;
    border: 2px dashed #4dabf7;
    padding: 0.75rem;
    margin: 0.5rem 0;
    cursor: pointer;
}

.note-editable .kb-widget-placeholder:hover {
    background-color: #e3f2fd;
    border-color: #1976d2;
}

/* Dark mode support */
html[data-bs-theme="dark"] .kb-internal-link {
    color: #6ea8fe;
    border-bottom-color: #6ea8fe;
}

html[data-bs-theme="dark"] .kb-internal-link:hover {
    color: #9ec5fe;
    border-bottom-color: #9ec5fe;
}

html[data-bs-theme="dark"] .kb-broken-link {
    color: #ea868f;
}

html[data-bs-theme="dark"] .kb-broken-link:hover {
    color: #f1aeb5;
}

html[data-bs-theme="dark"] .kb-unavailable-link {
    color: #adb5bd;
}

html[data-bs-theme="dark"] .kb-unavailable-link:hover {
    color: #ced4da;
}

html[data-bs-theme="dark"] .kb-wikilink-placeholder {
    background-color: #332701;
    color: #ffda6a;
}

html[data-bs-theme="dark"] .kb-widget-placeholder {
    background-color: #032830;
    border-color: #0dcaf0;
    color: #6edff6;
}

#myArticlesTable th.my-articles-open-col,
#myArticlesTable td.my-articles-open-col {
    width: 2.25rem;
    min-width: 2.25rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

#myArticlesTable .my-articles-open-link {
    opacity: 0;
    pointer-events: none;
    color: var(--bs-secondary-color);
    transition: opacity 0.15s ease, color 0.15s ease;
}

#myArticlesTable tbody tr:hover .my-articles-open-link,
#myArticlesTable tbody tr:focus-within .my-articles-open-link {
    opacity: 1;
    pointer-events: auto;
}

#myArticlesTable .my-articles-open-link:hover,
#myArticlesTable .my-articles-open-link:focus {
    color: var(--bs-primary);
}

/* Print styles - show links as plain text with URL */
@media print {
    .kb-internal-link::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }

    .kb-broken-link {
        text-decoration: none;
        color: #000;
    }

    .kb-broken-link::after {
        content: " [broken link]";
        font-size: 0.8em;
        color: #999;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Auto-Anchor Headings
   Makes h1-h4 headings linkable without visual change
   Right-click to copy link address, left-click updates URL without jump
   ═══════════════════════════════════════════════════════════════════════════ */

/* Heading anchor wrapper - invisible, looks like normal heading */
.article-content .heading-anchor {
    color: inherit;
    text-decoration: none;
    cursor: text;
}

.article-content .heading-anchor:hover,
.article-content .heading-anchor:focus {
    color: inherit;
    text-decoration: none;
}

/* Position relative for permalink icon */
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
    position: relative;
}

/* Permalink icon - appears on hover to indicate linkability */
.article-content h1 .heading-anchor::before,
.article-content h2 .heading-anchor::before,
.article-content h3 .heading-anchor::before,
.article-content h4 .heading-anchor::before {
    content: '#';
    position: absolute;
    left: -1.5em;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bs-secondary-color, #6c757d);
    font-size: 0.75em;
    font-weight: 400;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
}

/* Show icon on hover/focus */
.article-content h1:hover .heading-anchor::before,
.article-content h2:hover .heading-anchor::before,
.article-content h3:hover .heading-anchor::before,
.article-content h4:hover .heading-anchor::before,
.article-content h1:focus-within .heading-anchor::before,
.article-content h2:focus-within .heading-anchor::before,
.article-content h3:focus-within .heading-anchor::before,
.article-content h4:focus-within .heading-anchor::before {
    opacity: 0.5;
}

/* Icon hover effect */
.article-content h1 .heading-anchor:hover::before,
.article-content h2 .heading-anchor:hover::before,
.article-content h3 .heading-anchor:hover::before,
.article-content h4 .heading-anchor:hover::before {
    opacity: 1;
    color: var(--bs-primary, #0d6efd);
    background-color: var(--bs-secondary-bg, rgba(0,0,0,0.05));
}

/* Adjust left margin when inside article body to accommodate icon space */
.article-body .article-content h1,
.article-body .article-content h2,
.article-content h1,
.article-content h2 {
    padding-left: 0.5rem;
    margin-left: -0.5rem;
}

.article-body .article-content h3,
.article-body .article-content h4,
.article-content h3,
.article-content h4 {
    padding-left: 0.5rem;
    margin-left: -0.5rem;
}

/* Dark mode adjustments */
html[data-bs-theme="dark"] .article-content .heading-anchor::before {
    color: var(--bs-secondary-color, #adb5bd);
}

html[data-bs-theme="dark"] .article-content .heading-anchor:hover::before {
    color: var(--bs-primary, #6ea8fe);
    background-color: var(--bs-secondary-bg, rgba(255,255,255,0.05));
}

/* Toast feedback for link copy */
.heading-link-copied-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1080;
}