:root {
    --bg-primary: #000000; 
    --bg-secondary: #000000; 
    --bg-tertiary: #1a1a1a;
    --text-primary: #ffffff; 
    --text-secondary: #71767b;
    --border-color: #2f3336; 
    --accent-color: #5c68fc;
    --header-height: 60px; 
    --sidebar-width: 260px;
}

[data-theme="light"] {
    --bg-primary: #ffffff; 
    --bg-secondary: #ffffff; 
    --bg-tertiary: #f7f9fa;
    --text-primary: #0f1419; 
    --text-secondary: #536471;
    --border-color: #eff3f4;
}

*, *::before, *::after { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

html, body { 
    height: 100%; 
    width: 100%; 
    max-width: 100vw; 
    overflow: auto; 
    margin: 0;
}

body { 
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif; 
    background-color: var(--bg-primary); 
    color: var(--text-primary); 
    -webkit-tap-highlight-color: transparent;
}

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

.site-wrapper { 
    display: flex; 
    flex-direction: column; 
    height: 100%; 
    width: 100%; 
}

/* Header */
.site-header {
    height: var(--header-height); 
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    padding: 0 24px; 
    width: 100%; 
    z-index: 1000;
    background-color: var(--bg-primary); 
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.header-left { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
}

.logo-link img { 
    height: 32px; 
    width: 32px; 
}

.site-title { 
    font-size: 18px; 
    font-weight: 600; 
}

.header-right { 
    display: flex; 
    align-items: center; 
    gap: 16px; 
}

.theme-switcher {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-switcher:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--accent-color);
}

.theme-switcher .icon-moon { display: block; }
.theme-switcher .icon-sun { display: none; }

[data-theme="light"] .theme-switcher .icon-moon { display: none; }
[data-theme="light"] .theme-switcher .icon-sun { display: block; }

/* Column Slider */
.column-slider-container { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    background-color: var(--bg-secondary); 
    border: 1px solid var(--border-color);
    border-radius: 24px; 
    padding: 8px 16px; 
    height: 38px;
}

.column-slider-container svg { 
    color: var(--text-secondary); 
}

input[type=range].column-slider { 
    -webkit-appearance: none; 
    appearance: none; 
    width: 80px; 
    height: 6px; 
    background: var(--border-color); 
    cursor: pointer; 
    border-radius: 3px; 
    outline: none;
}

input[type=range].column-slider::-webkit-slider-thumb { 
    -webkit-appearance: none; 
    appearance: none; 
    width: 18px; 
    height: 18px; 
    background: var(--accent-color); 
    border-radius: 50%; 
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 0 2px var(--bg-secondary);
}

input[type=range].column-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 8px rgba(92, 104, 246, 0.1);
}

/* Layout */
.page-container { 
    flex: 1; 
    display: flex; 
    overflow: hidden; 
    height: 100%; 
}

/* Sidebar */
.sidebar-nav {
    width: var(--sidebar-width); 
    height: 100%; 
    background-color: var(--bg-secondary); 
    border-right: 1px solid var(--border-color);
    padding: 16px 0 0 0; 
    overflow-y: auto; 
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-nav details { margin-bottom: 4px; }

.sidebar-nav summary, .sidebar-nav a { 
    display: flex; 
    align-items: center; 
    padding: 12px 20px; 
    color: var(--text-primary); 
    text-decoration: none; 
    cursor: pointer; 
    outline: none; 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
    border-radius: 24px;
    position: relative;
    overflow: hidden;
}

.sidebar-nav summary::before, .sidebar-nav a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), rgba(92, 104, 246, 0.3));
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

.sidebar-nav summary:hover::before, .sidebar-nav a:hover::before {
    width: 100%;
}

.sidebar-nav summary { 
    justify-content: space-between; 
}

.sidebar-nav summary::after { 
    content: '▸'; 
    transition: transform 0.2s; 
    margin-left: 8px;
}

.sidebar-nav details[open] > summary::after { 
    transform: rotate(90deg); 
}

.sidebar-nav summary:hover, .sidebar-nav a:hover { 
    color: var(--text-primary); 
    transform: translateX(4px);
}

.sidebar-nav a.active { 
    color: #fff; 
    background: linear-gradient(90deg, var(--accent-color), rgba(92, 104, 246, 0.8));
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(92, 104, 246, 0.3);
}

.sidebar-nav .level-1 > summary, .sidebar-nav .level-1 > a { font-weight: 600; }
.sidebar-nav .level-2 { padding-left: 20px; }
.sidebar-nav .level-3 { padding-left: 40px; }

/* Main Content */
.main-content { 
    flex: 1; 
    padding: 24px 24px 0 24px; 
    display: flex; 
    flex-direction: column; 
    height: 100%; 
    overflow-y: auto; 
    overflow-x: hidden;
    scroll-behavior: smooth; 
    background-color: var(--bg-primary); 
}

.content-header {
    margin-bottom: 20px;
    padding: 16px;
    background-color: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.sort-filter-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.sort-container, .view-mode-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sort-container label, .view-mode-container label {
    color: var(--text-secondary);
    font-size: 15px;
}

/* Dropdowns */
.sort-dropdown, .view-mode-dropdown {
    position: relative;
    display: inline-block;
}

.sort-dropdown-toggle, .view-mode-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 8px 16px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 150px;
    height: 38px;
}

.sort-dropdown-toggle:hover, .view-mode-toggle:hover {
    border-color: var(--accent-color);
}

.sort-dropdown-toggle .material-icons, .view-mode-toggle .material-icons {
    font-size: 18px;
    margin-left: auto;
    transition: transform 0.2s;
}

.sort-dropdown.open .sort-dropdown-toggle .material-icons,
.view-mode-dropdown.open .view-mode-toggle .material-icons {
    transform: rotate(180deg);
}

.sort-dropdown-menu, .view-mode-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    margin-top: 8px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px;
}

.sort-dropdown.open .sort-dropdown-menu,
.view-mode-dropdown.open .view-mode-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sort-dropdown-item, .view-mode-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    border-radius: 8px;
}

.sort-dropdown-item:hover, .view-mode-item:hover,
.sort-dropdown-item.active, .view-mode-item.active {
    background-color: var(--accent-color);
    color: white;
}

/* Grid */
.case-grid { 
    column-count: var(--columns, 5);
    column-gap: 20px;
    width: 100%;
}

.case-item { 
    background-color: var(--bg-secondary); 
    border-radius: 16px; 
    overflow: hidden; 
    position: relative; 
    margin-bottom: 20px;
    break-inside: avoid;
    display: inline-block;
    width: 100%;
    cursor: pointer;
}

.case-item img { 
    width: 100%; 
    height: auto; 
    display: block; 
    user-select: none; 
    -webkit-user-drag: none; 
    transition: transform 0.3s ease;
}

.case-item:hover img {
    transform: scale(1.02);
}

.case-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 30px 16px 16px;
    background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.8));
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    display: flex;
    align-items: flex-end;
}

.case-item:hover .case-overlay {
    opacity: 1;
}

.file-name {
    color: white;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* Pagination */
.pagination { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    margin-top: auto; 
    padding-top: 40px; 
    padding-bottom: 60px;
    gap: 8px; 
    user-select: none; 
    flex-wrap: wrap; 
}

.pagination a, .pagination span { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    min-width: 38px; 
    height: 38px; 
    padding: 0 8px; 
    border-radius: 50%; 
    color: var(--text-secondary); 
    background-color: var(--bg-secondary); 
}

.pagination a { cursor: pointer; }
.pagination a:hover { background-color: var(--bg-tertiary); }
.pagination a.active { background-color: var(--accent-color); color: white; font-weight: 600; }

.pagination-jump { 
    display: flex;
    align-items: center;
    gap: 8px; 
}


.pagination-jump input { 
    width: 50px; 
    height: 38px; 
    text-align: center; 
    border: 1px solid var(--border-color); 
    background-color: var(--bg-secondary); 
    color: var(--text-primary); 
    border-radius: 50%; 
    margin: 0 4px;
    -moz-appearance: textfield; 
    appearance: textfield;      
}

.pagination-jump input::-webkit-outer-spin-button,
.pagination-jump input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}



/* Loading */
.loading-spinner { 
    border: 4px solid var(--border-color); 
    border-top: 4px solid var(--accent-color); 
    border-radius: 50%; 
    width: 40px; 
    height: 40px; 
    animation: spin 1s linear infinite; 
    margin: 80px auto; 
}

@keyframes spin { 
    0% { transform: rotate(0deg); } 
    100% { transform: rotate(360deg); } 
}

/* Modal*/
.modal-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.85); 
    display: none; 
    align-items: center; 
    justify-content: center; 
    z-index: 2000; 
    backdrop-filter: blur(8px);
}

.modal-overlay.visible { display: flex; }

.media-modal-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 90vh;
}

#modal-media-img {
    max-width: 100%;
    max-height: calc(90vh - 60px);
    object-fit: contain;
    border-radius: 12px;
    user-select: none;
    -webkit-user-drag: none;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

/* 关闭按钮动画 */
.modal-close-fancy {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2001;
    backdrop-filter: blur(4px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.modal-close-fancy .material-icons {
    font-size: 24px;
    transition: transform 0.3s ease;
}

.modal-close-fancy:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    transform: scale(1.15);
    box-shadow: 0 0 20px rgba(92, 104, 246, 0.6);
}

.modal-close-fancy:hover .material-icons {
    transform: rotate(90deg);
}

.modal-badge {
    color: white;
    text-align: center;
    margin-top: 20px;
    font-size: 15px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 20px;
    border-radius: 24px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Footer */
.site-footer-bottom { 
    text-align: center; 
    padding: 24px; 
    background-color: var(--bg-primary); 
    border-top: 1px solid var(--border-color); 
    color: var(--text-secondary); 
    font-size: 13px; 
    flex-shrink: 0; 
    margin-top: auto; 
    width: 100%;
}

.site-footer-bottom a {
    color: inherit; 
    transition: color 0.2s ease; 
}

.site-footer-bottom a:hover {
    color: var(--accent-color); 
}



/* Back to top */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(92, 104, 246, 0.3);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(92, 104, 246, 0.4);
}

.back-to-top svg {
    width: 24px;
    height: 24px;
    fill: white;
}

/* Mobile Menu */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
    margin-right: 8px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; transition: background 0.2s; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* Mobile Responsive */
@media (max-width: 768px) {
    .site-header {
        height: auto;
        padding: 10px 16px;
    }
    
    .page-container {
        display: block; 
        width: 100%;
        overflow-x: hidden;
        height: auto; 
        overflow-y: visible; 
    }
    
    html, body { overflow: auto; height: auto; }
    .site-wrapper { height: auto; }
    .main-content { height: auto; overflow-y: visible; padding: 12px 8px; }
    
    .site-title { display: none; }
    .mobile-menu-toggle { display: block; padding: 0; margin-right: 4px; }
    
    .column-slider-container { display: none; }
    
    .sidebar-nav {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 2002;
        box-shadow: 4px 0 15px rgba(0,0,0,0.2);
        height: 100%;
        padding-top: 20px;
    }
    
    .sidebar-nav.open { transform: translateX(0); }
    .sidebar-overlay.active { display: block; }
    
    .case-grid {
        column-count: 2 !important;
        column-gap: 10px;
    }
    
    .case-item { margin-bottom: 10px; }
    
    .sort-filter-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .sort-container, .view-mode-container {
        width: 100%;
        justify-content: space-between;
    }
    
    .pagination-jump {
        width: 100%;
        margin-top: 10px;
        display: flex;
        justify-content: center;
    }

    /* 移动端模态框关闭按钮适配 */
    .modal-close-fancy {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        background: rgba(0, 0, 0, 0.6);
        border: none;
    }
    
    .modal-close-fancy .material-icons {
        font-size: 20px;
    }
}