/* 左侧导航栏样式 */
.left-nav {
    width: 220px;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 70px);
    position: fixed;
    top: 70px;
    left: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-right: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    z-index: 1000;
    scrollbar-width: thin;
    scrollbar-color: #e0e0e0 transparent;
}

.left-nav::-webkit-scrollbar {
    width: 6px;
}

.left-nav::-webkit-scrollbar-thumb {
    background-color: #e0e0e0;
    border-radius: 3px;
}

.left-nav::-webkit-scrollbar-track {
    background-color: transparent;
}

/* 导航头部样式 */
.nav-header {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.nav-header h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
    font-weight: 600;
}

/* 搜索框样式 */
.search-box {
    display: flex;
    margin-bottom: 10px;
}

.search-box input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    outline: none;
    transition: border 0.3s;
}

.search-box input:focus {
    border-color: #4a90e2;
}

.search-box button {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 0 12px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: background 0.3s;
}

.search-box button:hover {
    background: #3a80d2;
}

/* 分类容器 */
.category-container {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: calc(100% - 70px); /* 减去nav-header的高度 */
    overflow-y: auto;
}

/* 动态计算导航项高度 */
.category-container.auto-height .nav-item {
    height: var(--nav-item-height, auto);
    margin-bottom: var(--nav-item-margin, 10px);
    display: flex;
    align-items: center;
    opacity: 0;
    transform: translateX(-10px);
    animation: fadeInLeft 0.5s forwards;
}

/* 导航项样式 */
.nav-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-item:hover {
    background-color: #f6f9ff;
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 导航图标样式 */
.nav-icon {
    width: 24px;
    height: 24px;
    margin-right: 12px;
    opacity: 0.8;
    transition: all 0.3s ease;
}

/* 导航文本样式 */
.nav-text {
    font-size: 15px;
    color: #555;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-item:hover .nav-text {
    color: #4a90e2;
}

/* 激活状态的导航项样式 */
.nav-item.active {
    background-color: #eef6ff;
    border-left: 3px solid #4a90e2;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15);
}

.nav-item.active .nav-text {
    color: #4a90e2;
    font-weight: 600;
}


.all-categories {
    color: #4a90e2;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.all-categories:hover {
    color: #3a80d2;
    text-decoration: underline;
}

/* 加载状态样式 */
.loading-spinner {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 14px;
    position: relative;
}

.loading-spinner::before {
    content: "";
    display: block;
    width: 30px;
    height: 30px;
    margin: 0 auto 10px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4a90e2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 错误消息样式 */
.error-message {
    text-align: center;
    padding: 20px;
    color: #e74c3c;
    font-size: 14px;
    background-color: #fef0f0;
    border-radius: 6px;
    margin: 10px;
}

/* 无结果样式 */
.no-results {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 14px;
    background-color: #f9f9f9;
    border-radius: 6px;
    margin: 10px;
}

/* 动画效果 */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 悬停效果增强 */
.nav-item:hover .nav-icon {
    transform: scale(1.1);
    opacity: 1;
}

/* 点击效果 */
.nav-item:active {
    transform: scale(0.98);
    background-color: #e8f1fd;
}

/* 平滑滚动 */
.category-container {
    scroll-behavior: smooth;
}

/* 波纹效果 */
.nav-ripple {
    position: absolute;
    background: rgba(74, 144, 226, 0.2);
    border-radius: 50%;
    width: 100px;
    height: 100px;
    margin-top: -50px;
    margin-left: -50px;
    transform: scale(0);
    animation: ripple 0.6s ease-out;
    pointer-events: none;
    z-index: 0;
}

@keyframes ripple {
    to {
        transform: scale(2);
        opacity: 0;
    }
}

/* 响应式调整 */
@media (max-height: 600px) {
    .nav-item {
        padding: 8px 12px;
    }
    .nav-header h3 {
        margin: 0 0 10px 0;
        font-size: 16px;
    }
}

/* 移动端适配：隐藏左侧导航栏 */
@media (max-width: 768px) {
    .left-nav {
        display: none;
    }
}