/* files/style.css - "Refined Minimalist" 主题 (v15 - Final Complete Version) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-base: #f7f8fc;
    --bg-sidebar: #eff1f7;
    --bg-card: #ffffff;
    --border-color: #e2e5f1;
    --text-primary: #1a202e;
    --text-secondary: #718096;
    --accent-primary: #4a72ff;
    --accent-red: #e53e3e;
    --accent-gradient: linear-gradient(135deg, #4a72ff 0%, #8c72ff 100%);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --bg-sticky-header: rgba(247, 248, 252, 0.65); 
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

.page-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden; /* 防止body滚动 */
}

/* --- 侧边栏 --- */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 1000;
}
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 16px;
}
.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    flex-grow: 1;
}
.logo { width: 32px; height: 32px; }
.logo-shape-1 { fill: #c5d3ff; }
.logo-shape-2 { fill: var(--accent-primary); }
.sidebar-nav {
    flex-grow: 1;
    overflow-y: auto;
}
.sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sidebar-nav .sidebar-submenu {
    padding-left: 0;
    margin-top: 4px;
}
.nav-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 12px;
}
.sidebar-details {}
.sidebar-summary {
    list-style: none;
    cursor: pointer;
    position: relative;
}
.sidebar-summary::-webkit-details-marker {
    display: none;
}
.sidebar-summary::after {
    /*content: '›';*/
    content: none !important; /* 使用 !important 确保覆盖所有情况 */
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: transform 0.2s ease-in-out;
    pointer-events: none;
}
.sidebar-details[open] > .sidebar-summary::after {
    transform: translateY(-50%) rotate(90deg);
}
.sidebar-summary > .sidebar-link {
    width: 100%;
    box-sizing: border-box;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}
.sidebar-link.level-1 { padding-left: 36px !important; }
.sidebar-link.level-2 { padding-left: 60px !important; }
.sidebar-link.level-3 { padding-left: 84px !important; }
.sidebar-link i { width: 16px; text-align: center; }
.sidebar-link:hover {
    color: var(--text-primary);
    background-color: rgba(0, 0, 0, 0.05);
}
.sidebar-link.active {
    color: #fff;
    background: var(--accent-gradient);
    box-shadow: 0 4px 10px -2px rgba(74, 114, 255, 0.4);
}
.sidebar-link .count-badge {
    margin-left: auto;
    background-color: #e2e8f0;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}
.sidebar-link.active .count-badge {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.sidebar-footer .footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.sidebar-footer .footer-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}
.sidebar-footer .footer-link span {
    font-size: 0.9rem;
}
.sidebar-toggle-expand-btn {
    border: none;
    background-color: transparent;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
}
.sidebar-toggle-expand-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

/* --- 主内容区 --- */
.main-content-wrapper {
    flex-grow: 1;
    overflow-y: auto;
    height: 100vh;
}
.main-content {
    padding-top: 0;
}
/*.sticky-header-container {
    position: sticky;
    top: 0;
    z-index: 900;
    background-color: var(--bg-base);
    /*padding: 24px 32px;/
    padding: 24px 32px 12px 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0);
    transition: box-shadow 0.2s ease-in-out;
}*/
.sticky-header-container {
    position: sticky;
    top: 0;
    z-index: 900;
    
    /* 1. 设置半透明背景色 */
    background-color: var(--bg-sticky-header);

    /* 2. 添加磨砂效果 */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px); /* 兼容 Safari */
    
    padding: 15px 32px;
    /* 3. 我们不再需要依赖JS来添加阴影，让玻璃边缘一直都有一点效果 */
    border-bottom: 1px solid rgba(0,0,0,0.05); 
    transition: box-shadow 0.2s ease-in-out;
}

.sticky-header-container.is-stuck {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}
.main-header {
    display: grid;
    grid-template-columns: 1fr;
}
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}
#search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 48px 14px 52px;
    border-radius: 12px;
    border: none;
    background-color: var(--bg-card);
    font-size: 1rem;
    box-shadow: var(--shadow);
    outline: none;
    transition: all 0.2s ease;
}
#search-input:focus {
    box-shadow: 0 0 0 3px var(--accent-primary);
}
#search-clear-btn {
    position: absolute;
    right: 18px;
    top: 50%;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background-color: var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50%) scale(0.5);
}
#search-clear-btn:hover {
    background-color: var(--accent-red);
    color: white;
}
.search-wrapper.has-content #search-clear-btn {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) scale(1);
}
.content-area {
    padding: 12px 32px 32px 32px;
}
.bookmarks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}
.bookmark-card {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 14px 16px;
    text-decoration: none;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease, visibility 0.3s;
    display: none;
    opacity: 0;
    visibility: hidden;
}
.bookmark-card.is-visible {
    display: flex;
    opacity: 1;
    visibility: visible;
}
.bookmark-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}
.favicon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    flex-shrink: 0;
}
.title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#no-results-message {
    text-align: center;
    margin-top: 4rem;
    color: var(--text-secondary);
}

/* --- 响应式设计 --- */
.hamburger-btn { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 992px) {
    .page-wrapper { overflow: auto; }
    .hamburger-btn {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        width: 44px;
        height: 44px;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        cursor: pointer;
        padding: 10px;
        box-shadow: var(--shadow);
        flex-shrink: 0;
    }
    .hamburger-btn span {
        width: 100%;
        height: 2px;
        background: var(--text-secondary);
        border-radius: 1px;
        transition: all 0.3s ease-in-out;
    }
    .hamburger-btn.is-active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    .hamburger-btn.is-active span:nth-child(2) { opacity: 0; }
    .hamburger-btn.is-active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }
    .sidebar.is-open { transform: translateX(0); box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1); }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0; visibility: hidden;
        transition: opacity 0.3s ease;
    }
    .sidebar-backdrop.is-visible { opacity: 1; visibility: visible; }
    
    .main-content-wrapper { height: auto; }
    .sticky-header-container { padding: 12px 16px; }
    .content-area { padding: 16px; }
    
    .main-header {
        display: flex;
        align-items: center;
        gap: 16px;
    }
    .search-wrapper { flex-grow: 1; }
}
/* [核心改动] 新增：移动端关闭按钮样式 */
.sidebar-close-btn {
    display: none; /* 桌面端默认隐藏 */
    position: absolute;
    top: 12px;
    right: 16px;
    width: 36px; height: 36px;
    border: none;
    background-color: transparent;
    color: var(--text-secondary);
    font-size: 1.8rem; /* 增大 "×" 符号 */
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}
.sidebar-close-btn:hover {
    background-color: rgba(0,0,0,0.05);
    color: var(--text-primary);
}

@media (max-width: 992px) {
    .sidebar-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}