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

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Microsoft YaHei", sans-serif;
    line-height: 1.6;
    background: #000;
    color: #fff;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    position: relative;
    z-index: 1000;
    margin-bottom: 30px;
    padding: 60px 0 40px;
}

.search {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

#search {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 20px;
    font-size: 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    backdrop-filter: blur(10px);
}

#search:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

#search::placeholder {
    color: rgba(255, 255, 255, 0.8);
}

/* 主布局样式 */
main {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 30px;
    transition: all 0.3s ease;
}

/* 导航栏样式 */
.category-list {
    width: 200px;
    flex-shrink: 0;
    transition: all 0.3s ease;
    will-change: transform;
    transform: translateZ(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-item {
    padding: 10px 15px;
    margin-bottom: 5px;
    cursor: pointer;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.category-item:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.category-item.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

/* 书签内容区域 */
.bookmark-content {
    flex: 1;
    transition: all 0.3s ease;
}

.bookmark-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 20px;
    justify-content: center;
    contain: content;
    will-change: transform;
}

.bookmark-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    color: #fff;
    width: 100px;
    height: 100px;
    padding: 15px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.bookmark-item:hover {
    transform: translateY(-2px);
}

.bookmark-item img {
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
    border-radius: 8px;
}

.bookmark-item span {
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    line-height: 1.2;
}

/* 导航切换按钮 */
.nav-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.nav-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* 右侧导航样式 */
main.nav-right {
    flex-direction: row-reverse;
}

/* 响应式布局 */
@media (max-width: 1024px) {
    .bookmark-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 15px;
    }
}

/* 小屏幕移动设备 (<=480px) */
@media (max-width: 480px) {
    header {
        padding: 30px 0 20px;
    }

    .search-wrapper {
        height: 40px;
    }

    .bookmark-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 12px;
    }

    .bookmark-item {
        width: 90px;
        height: 90px;
        padding: 12px;
    }

    .bookmark-item img {
        width: 32px;
        height: 32px;
    }

    .bookmark-item span {
        font-size: 12px;
    }
}

/* 桌面端样式 */
@media (min-width: 769px) {
    .category-list {
        position: relative;
        transform: none !important; /* 确保不受移动端transform影响 */
        width: 200px;
        height: auto;
        background: none;
        border: none;
        padding: 0;
        box-shadow: none;
    }

    main.nav-right {
        flex-direction: row-reverse;
    }
}

.search-wrapper {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    gap: 12px;
    align-items: stretch;
    height: 48px;
}

.select-wrapper {
    width: 120px;
    flex-shrink: 0;
    position: relative;
}

.select-trigger {
    width: 100%;
    height: 100%;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    user-select: none;
}

.select-trigger:hover {
    background: rgba(255, 255, 255, 0.15);
}

.arrow-icon {
    transition: transform 0.2s;
}

.select-wrapper.active .arrow-icon {
    transform: rotate(180deg);
}

.select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 140px;
    border-radius: 12px;
    padding: 6px;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 9999;
}

.select-wrapper.active .select-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.select-option {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 15px;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s;
}

.select-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.select-option.selected {
    background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 640px) {
    header {
        padding: 40px 0 30px;
    }

    .search-wrapper {
        height: 44px;
        gap: 8px;
    }

    .select-wrapper {
        width: 100px;
    }

    .select-trigger {
        font-size: 14px;
    }

    .select-dropdown {
        min-width: 110px;
    }

    .select-option {
        padding: 8px 12px;
        font-size: 14px;
    }
}

.select-trigger,
.select-option {
    transition: all 0.2s ease;
}

.select-dropdown {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 搜索框包装器样式 */
.search-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

/* 搜索输入框样式调整 */
#search {
    width: 100%;
    padding-right: 40px; /* 为按钮留出空间 */
}

/* 搜索按钮样式 */
.search-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.search-button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* 优化动画性能 */
.bookmark-item {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* 优化滚动性能 */
.category-list {
    will-change: transform;
    transform: translateZ(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 优化渲染性能 */
.bookmark-grid {
    contain: content;
    will-change: transform;
}

/* 优化背景模糊性能 */
.bookmark-item,
.category-item,
.search-wrapper {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
