/* Import Inter font for modern typography */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Fira+Code:wght@400;500&display=swap');

/* Define CSS Variables for Light / Dark Mode */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-color: #6366f1; /* Premium Indigo */
    --accent-hover: #4f46e5;
    --accent-light: rgba(99, 102, 241, 0.08);
    --border-color: #e2e8f0;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --success-color: #10b981;
    --success-hover: #059669;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Fira Code', monospace;
    --sidebar-width: 290px;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #818cf8;
    --accent-hover: #6366f1;
    --accent-light: rgba(129, 140, 248, 0.15);
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

input, textarea, button {
    font-family: inherit;
    font-size: inherit;
}

/* Layout Container */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: transform var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.site-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-title a {
    color: inherit;
}

.site-tagline {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Search Bar Container */
.search-container {
    padding: 16px 24px 8px 24px;
}

.search-wrapper {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    font-size: 14px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

/* Navigation List */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.nav-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item a {
    display: block;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.nav-item a:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active a {
    background-color: var(--accent-light);
    color: var(--accent-color);
    font-weight: 600;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.sidebar-action-btn:hover {
    background-color: var(--bg-tertiary);
}

.sidebar-action-btn.primary {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #ffffff;
}

.sidebar-action-btn.primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* Dark Mode Switcher & Footer text */
.theme-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
}

.theme-toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.theme-toggle-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 48px;
    max-width: 1040px;
    transition: margin-left var(--transition-normal);
}

/* Header within Content Area */
.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.content-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

.content-actions {
    display: flex;
    gap: 8px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn:hover {
    background-color: var(--bg-tertiary);
}

.btn.btn-primary {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #ffffff;
}

.btn.btn-primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn.btn-danger {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--danger-color);
}

.btn.btn-danger:hover {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: #ffffff;
}

/* Article Styling (Markdown output styling) */
.wiki-article {
    font-size: 16px;
    color: var(--text-primary);
    line-height: 1.75;
}

.wiki-article h1 {
    font-size: 32px;
    margin-bottom: 24px;
    font-weight: 800;
    line-height: 1.25;
}

.wiki-article h2 {
    font-size: 22px;
    margin-top: 32px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
}

.wiki-article h3 {
    font-size: 18px;
    margin-top: 24px;
    margin-bottom: 12px;
    font-weight: 600;
}

.wiki-article p {
    margin-bottom: 18px;
}

.wiki-article ul, .wiki-article ol {
    margin-bottom: 18px;
    padding-left: 24px;
}

.wiki-article li {
    margin-bottom: 6px;
}

.wiki-article code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background-color: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent-color);
    transition: background-color var(--transition-normal);
}

.wiki-article pre {
    background-color: #1e293b; /* Keep code blocks dark for readability */
    color: #f8fafc;
    padding: 16px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.wiki-article pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    color: inherit;
    font-size: 13px;
}

.wiki-article blockquote {
    border-left: 4px solid var(--accent-color);
    padding: 12px 20px;
    background-color: var(--bg-tertiary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-style: italic;
}

.wiki-article table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    font-size: 15px;
}

.wiki-article th, .wiki-article td {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.wiki-article th {
    background-color: var(--bg-tertiary);
    font-weight: 600;
}

.wiki-article tr:nth-child(even) td {
    background-color: var(--bg-primary);
}

.wiki-article img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin-bottom: 18px;
    border: 1px solid var(--border-color);
}

.wiki-article hr {
    height: 1px;
    background-color: var(--border-color);
    border: none;
    margin: 32px 0;
}

/* Admin Login Page layout */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-primary);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.login-header {
    text-align: center;
}

.login-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

/* Admin Dashboard Table */
.admin-table-wrapper {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 24px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th, .admin-table td {
    padding: 14px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    background-color: var(--bg-primary);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table td {
    font-size: 14px;
}

.admin-table-actions {
    display: flex;
    gap: 8px;
}

/* Split-screen Editor Layout */
.editor-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: calc(100vh - 160px);
}

.editor-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
}

.editor-panels {
    display: flex;
    gap: 24px;
    flex: 1;
    min-height: 0; /* Important for flex child overflow */
}

.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.panel-header {
    background-color: var(--bg-tertiary);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-textarea {
    width: 100%;
    height: 100%;
    padding: 16px;
    border: none;
    resize: none;
    outline: none;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.5;
}

.preview-panel-content {
    padding: 16px;
    overflow-y: auto;
    height: 100%;
}

/* Empty search result and error UI */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--accent-color);
    opacity: 0.7;
}

/* Mobile responsive hamburger and overlay */
.mobile-header {
    display: none;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 110;
    align-items: center;
    justify-content: space-between;
}

.hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 90;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

/* Media Queries */
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    .main-content {
        margin-left: 0;
        padding: 24px;
    }

    .editor-panels {
        flex-direction: column;
        height: auto;
        min-height: 600px;
    }

    .editor-textarea {
        height: 300px;
    }

    .preview-panel-content {
        height: 300px;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}

/* Editor Quick Toolbar Styles */
.editor-toolbar {
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.toolbar-btn {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.toolbar-btn:hover {
    border-color: var(--accent-color);
    background-color: var(--accent-light);
    color: var(--accent-color);
}

.toolbar-separator {
    width: 1px;
    height: 18px;
    background-color: var(--border-color);
    margin: 0 4px;
    display: inline-block;
}

/* Layout adjustments for Editor view on Desktop */
@media (min-width: 769px) {
    body.admin-editor-active {
        height: 100vh;
        overflow: hidden;
    }

    body.admin-editor-active .app-container {
        height: 100vh;
        overflow: hidden;
    }

    body.admin-editor-active .main-content {
        height: 100vh;
        max-width: none; /* Full width */
        display: flex;
        flex-direction: column;
        padding: 24px 32px;
    }

    body.admin-editor-active .editor-form {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        gap: 12px;
    }

    body.admin-editor-active .editor-layout {
        flex: 1;
        min-height: 0;
        height: auto;
    }

    body.admin-editor-active .editor-panels {
        height: 100%;
        min-height: 0;
    }
}

/* Sidebar Nav Category Tree */
.nav-tree-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0;
}

.nav-folder {
    list-style: none;
    margin-bottom: 2px;
}

.folder-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    user-select: none;
}

.folder-title:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.folder-arrow {
    font-size: 9px;
    transition: transform var(--transition-normal);
}

.folder-content {
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px dashed var(--border-color);
    display: block;
    max-height: 2000px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, opacity 0.25s ease-in-out;
}

.nav-folder.collapsed .folder-content {
    max-height: 0;
    opacity: 0;
    border-left-color: transparent;
    pointer-events: none;
}

.nav-folder.collapsed .folder-arrow {
    transform: rotate(-90deg);
}

/* Home Hero Search Section */
.home-hero-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 130px 24px 60px 24px; /* 增加顶部边距，使内容在右侧空白区垂直居中 */
    text-align: center;
    background: none;
    border: none;
    box-shadow: none;
    margin-bottom: 0;
}

.home-hero-title {
    font-size: 44px;
    font-weight: 800;
    margin-bottom: 28px;
    background: linear-gradient(
        120deg,
        #6366f1,
        #ec4899,
        #3b82f6,
        #6366f1
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-move 6s linear infinite;
    letter-spacing: -0.03em;
}

@keyframes gradient-move {
    0% {
        background-position: 0% center;
    }
    50% {
        background-position: 100% center;
    }
    100% {
        background-position: 0% center;
    }
}

.home-search-form {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 580px;
}

.home-search-wrapper {
    position: relative;
    flex: 1;
}

.home-search-input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    border-radius: 9999px; /* Pill style */
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
    font-size: 16px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.home-search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px var(--accent-light);
}

.home-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 18px;
    pointer-events: none;
}

.home-search-btn {
    padding: 14px 28px;
    border-radius: 9999px; /* Pill style */
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

/* Homepage Centering Layout on Desktop */
@media (min-width: 769px) {
    body.home-active {
        overflow: hidden;
        height: 100vh;
    }
    
    body.home-active .app-container {
        height: 100vh;
        overflow: hidden;
    }

    body.home-active .main-content {
        max-width: none; /* Make it take the entire right side */
        height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center; /* Center vertically */
        align-items: center;    /* Center horizontally */
        padding: 0 48px;
    }
    
    body.home-active .home-hero-section {
        width: 100%;
        max-width: 800px;
        padding: 0;
        margin: 0;
        transform: translateY(-80px); /* 向上微调 80px，符合人类视觉的“视觉中心”（比物理中心偏上一点更自然） */
    }
}

/* ==========================================================================
   Sorting Page Custom Styles
   ========================================================================== */
.sorting-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 992px) {
    .sorting-container {
        grid-template-columns: 1fr;
    }
}

.sorting-card {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.sorting-card:hover {
    box-shadow: var(--shadow-md);
}

.sorting-card-header {
    background-color: var(--bg-primary);
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sorting-list-wrapper {
    overflow-x: auto;
}

.sorting-table {
    width: 100%;
    border-collapse: collapse;
}

.sorting-table th, .sorting-table td {
    padding: 14px 20px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.sorting-table th {
    background-color: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 10px 20px;
}

.sorting-table tbody tr:last-child td {
    border-bottom: none;
}

.sorting-table tr {
    transition: background-color var(--transition-fast);
}

.sorting-table tr:hover td {
    background-color: var(--bg-primary);
}

.btn-sort-move {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    transition: all var(--transition-fast);
}

.btn-sort-move:hover {
    background-color: var(--accent-color);
    color: #ffffff;
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

.btn-sort-move:active {
    transform: translateY(0);
}

.btn-sort-toggle {
    transition: all var(--transition-fast);
}

.btn-sort-toggle:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-sort-toggle:active {
    transform: translateY(0);
}

/* ==========================================================================
   Activity Log Badge Styles
   ========================================================================== */
.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.12);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.12);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-info {
    background-color: rgba(99, 102, 241, 0.12);
    color: var(--accent-color);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* ==========================================================================
   Folder Pages & Hierarchy Tree UI Adjustments
   ========================================================================== */

/* 当文件夹有关联页面时的容器排版样式 */
.folder-title.folder-has-page {
    padding: 0;
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 分类主页面超链接的展示样式 */
.folder-title.folder-has-page .folder-link-title {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    flex-grow: 1;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: color var(--transition-fast), background-color var(--transition-fast);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.folder-title.folder-has-page .folder-link-title:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* 独立的折叠/展开箭头点击区域样式 */
.folder-title.folder-has-page .folder-arrow {
    padding: 10px 16px;
    font-size: 9px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color var(--transition-fast), transform var(--transition-normal), background-color var(--transition-fast);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.folder-title.folder-has-page .folder-arrow:hover {
    background-color: var(--bg-tertiary);
    color: var(--accent-color);
}

/* 当文件夹关联页面被选中激活时的整行或局部高亮效果 */
.nav-folder.active > .folder-title.folder-has-page {
    background-color: var(--accent-light);
    border-radius: var(--radius-sm);
}

.nav-folder.active > .folder-title.folder-has-page .folder-link-title {
    color: var(--accent-color);
    font-weight: 600;
}

.nav-folder.active > .folder-title.folder-has-page .folder-link-title:hover {
    background-color: transparent;
}

.nav-folder.active > .folder-title.folder-has-page .folder-arrow {
    color: var(--accent-color);
}

.nav-folder.active > .folder-title.folder-has-page .folder-arrow:hover {
    background-color: rgba(99, 102, 241, 0.08);
}
