/**
 * 侧边栏样式
 * 用于分类页和详情页的右侧边栏
 *
 * @package GoodBase
 * @since 1.0.0
 */

/* 内容包装器 - 用于详情页 */
.content-wrapper {
    display: flex !important;
    flex-direction: row !important;
    gap: 16px !important;
    align-items: flex-start !important;
	margin-top: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.content-main {
    flex: 1;
    min-width: 0;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.01px;
    background: #fff;
    box-sizing: border-box;
    overflow: hidden;
}

/* 分类页内容包装器 */
.category-content-wrapper {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.category-main-content {
    flex: 1;
    min-width: 0;
}

/* 图片分类页主内容区域特殊样式 - 高优先级 */
.image-category-page .category-content-wrapper {
    display: flex !important;
    gap: 2rem !important;
    align-items: flex-start;
    margin-top: 2rem !important;
}

.image-category-page .category-main-content,
.image-category-page .category-content-wrapper .category-main-content {
    flex: 1 !important;
    min-width: 0 !important;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%) !important;
    border-radius: 20px !important;
    padding: 2rem !important;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.06),
        0 2px 8px rgba(0, 0, 0, 0.04) !important;
    position: relative !important;
    overflow: hidden !important;
}

.image-category-page .category-main-content::before,
.image-category-page .category-content-wrapper .category-main-content::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 4px !important;
    background: linear-gradient(90deg, 
        #667eea 0%, 
        #764ba2 25%, 
        #f093fb 50%, 
        #4facfe 75%, 
        #00f2fe 100%) !important;
    background-size: 400% 100% !important;
    animation: gradientShift 20s ease infinite !important;
    z-index: 1;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* 侧边栏基础样式 */
.content-sidebar {
    width: 300px;
    flex-shrink: 0;
    flex-grow: 0;
    position: sticky;
    align-self: flex-start;
    z-index: 10;
    transition: top 0.3s ease;
    box-sizing: border-box;
    display: block;
    visibility: visible;
    opacity: 1;
}

/* 默认状态：主导航栏显示时 */
/* 如果有通知栏：主导航栏在 25px 位置，高度 60px，所以侧边栏应该在 85px + 20px = 105px */
body.has-notice-bar .content-sidebar {
    top: 3px;
}

/* 如果没有通知栏：主导航栏在 0px 位置，高度 60px，所以侧边栏应该在 60px + 20px = 80px */
body:not(.has-notice-bar) .content-sidebar {
    top: 80px;
}

/* 当主导航栏隐藏时，侧边栏往上移动 */
/* 有通知栏：侧边栏应该在通知栏下方 25px + 20px = 45px */
body.has-notice-bar .site-header.header-hidden ~ .site-content .content-wrapper .content-sidebar,
body.has-notice-bar .site-header.header-hidden ~ .site-content .category-content-wrapper .content-sidebar {
    top: 8px;
}

/* 无通知栏：侧边栏应该在页面顶部 0px + 20px = 20px */
body:not(.has-notice-bar) .site-header.header-hidden ~ .site-content .content-wrapper .content-sidebar,
body:not(.has-notice-bar) .site-header.header-hidden ~ .site-content .category-content-wrapper .content-sidebar {
    top: 20px;
}

/* 侧边栏中的卖家信息 */
.sidebar-seller-info {
    margin-bottom: 1.5rem;
}

.sidebar-seller-info .seller-info-section {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 侧边栏小部件 */
.sidebar-widget {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.sidebar-widget:last-child {
    margin-bottom: 0;
}

/* 小部件标题 */
.widget-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 1.25rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.widget-title i {
    color: #ff6600;
    font-size: 1rem;
}

/* 热门文章列表 */
.popular-posts-list,
.recent-posts-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.popular-post-item,
.recent-post-item {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.popular-post-item:last-child,
.recent-post-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.popular-post-item .post-link,
.recent-post-item .post-link {
    display: flex;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

.popular-post-item .post-link:hover,
.recent-post-item .post-link:hover {
    opacity: 0.8;
}

.post-thumbnail-small {
    width: 80px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
    position: relative;
}

.post-thumbnail-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 侧边栏标签徽章 */
.post-thumbnail-small .post-tag-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 10;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(4px);
    pointer-events: none;
    white-space: nowrap;
}

/* 热门标签样式 */
.post-thumbnail-small .post-tag-badge.post-tag-hot {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
}

/* 独家标签样式 */
.post-thumbnail-small .post-tag-badge.post-tag-exclusive {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
}

/* 推荐标签样式 */
.post-thumbnail-small .post-tag-badge.post-tag-recommended {
    background: linear-gradient(135deg, #feca57 0%, #ff9ff3 100%);
}

/* 精品标签样式 */
.post-thumbnail-small .post-tag-badge.post-tag-premium {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
}

.post-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.post-title-small {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-meta-small {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.25rem;
}

.post-meta-small .post-date {
    color: #999;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.post-meta-small .post-date i {
    font-size: 0.7rem;
    color: #ff6600;
}

.post-meta-small .post-views {
    color: #999;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.post-meta-small .post-views i {
    font-size: 0.7rem;
    opacity: 0.8;
}

/* 分类列表 */
.widget-categories .categories-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.widget-categories .category-item {
    margin-bottom: 0.5rem;
}

.widget-categories .category-item:last-child {
    margin-bottom: 0;
}

/* 一级分类包装器 */
.widget-categories .category-parent-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 一级分类链接 */
.widget-categories .category-link-parent {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-decoration: none;
    color: #374151;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.widget-categories .category-link-parent::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.widget-categories .category-link-parent:hover,
.widget-categories .category-link-parent.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transform: translateX(4px);
}

.widget-categories .category-link-parent:hover::before,
.widget-categories .category-link-parent.active::before {
    transform: scaleY(1);
}

.widget-categories .category-link-parent.active {
    font-weight: 600;
}

/* 一级分类图标 */
.widget-categories .category-icon {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.widget-categories .category-link-parent:hover .category-icon,
.widget-categories .category-link-parent.active .category-icon {
    transform: scale(1.1);
}

/* 一级分类名称 */
.widget-categories .category-link-parent .category-name {
    font-size: 0.95rem;
    font-weight: 500;
    flex: 1;
}

/* 一级分类数量 */
.widget-categories .category-link-parent .category-count {
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.widget-categories .category-link-parent:hover .category-count,
.widget-categories .category-link-parent.active .category-count {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* 二级分类列表 */
.widget-categories .category-children-list {
    list-style: none;
    margin: 0.5rem 0 0 0;
    padding: 0;
    padding-left: 1rem;
}

/* 二级分类项 */
.widget-categories .category-item-child {
    margin-bottom: 0.4rem;
}

.widget-categories .category-item-child:last-child {
    margin-bottom: 0;
}

/* 二级分类链接 */
.widget-categories .category-link-child {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-decoration: none;
    color: #374151;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    font-size: 0.9rem;
}

.widget-categories .category-link-child::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.widget-categories .category-link-child:hover,
.widget-categories .category-link-child.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transform: translateX(4px);
}

.widget-categories .category-link-child:hover::before,
.widget-categories .category-link-child.active::before {
    transform: scaleY(1);
}

.widget-categories .category-link-child.active {
    font-weight: 600;
}

/* 二级分类图标 */
.widget-categories .category-link-child .category-icon {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    transition: transform 0.3s ease;
}

.widget-categories .category-link-child:hover .category-icon,
.widget-categories .category-link-child.active .category-icon {
    transform: scale(1.1);
}

/* 二级分类名称 */
.widget-categories .category-link-child .category-name {
    font-size: 0.9rem;
    font-weight: 500;
    flex: 1;
}

/* 二级分类数量 */
.widget-categories .category-link-child .category-count {
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.2rem 0.45rem;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.widget-categories .category-link-child:hover .category-count,
.widget-categories .category-link-child.active .category-count {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* 二级分类展开/收起按钮 */
.widget-categories .category-toggle {
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    color: #6b7280;
    transition: all 0.3s ease;
}

.widget-categories .category-link-child:hover .category-toggle,
.widget-categories .category-link-child.active .category-toggle {
    color: #fff;
}

.widget-categories .category-item-child.expanded .category-toggle i {
    transform: rotate(180deg);
}

/* 三级分类列表（默认隐藏） */
.widget-categories .category-grandchildren-list {
    list-style: none;
    margin: 0.4rem 0 0 0;
    padding: 0;
    padding-left: 1rem;
    display: none;
    overflow: hidden;
}

.widget-categories .category-item-child.expanded .category-grandchildren-list {
    display: block;
}

/* 三级分类项 */
.widget-categories .category-item-grandchild {
    margin-bottom: 0.3rem;
}

.widget-categories .category-item-grandchild:last-child {
    margin-bottom: 0;
}

/* 三级分类链接 */
.widget-categories .category-link-grandchild {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-decoration: none;
    color: #374151;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    font-size: 0.85rem;
}

.widget-categories .category-link-grandchild::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.widget-categories .category-link-grandchild:hover,
.widget-categories .category-link-grandchild.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transform: translateX(4px);
}

.widget-categories .category-link-grandchild:hover::before,
.widget-categories .category-link-grandchild.active::before {
    transform: scaleY(1);
}

.widget-categories .category-link-grandchild.active {
    font-weight: 600;
}

/* 三级分类图标 */
.widget-categories .category-link-grandchild .category-icon {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.widget-categories .category-link-grandchild:hover .category-icon,
.widget-categories .category-link-grandchild.active .category-icon {
    transform: scale(1.1);
}

/* 三级分类名称 */
.widget-categories .category-link-grandchild .category-name {
    font-size: 0.85rem;
    font-weight: 500;
    flex: 1;
}

/* 三级分类数量 */
.widget-categories .category-link-grandchild .category-count {
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.15rem 0.4rem;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.widget-categories .category-link-grandchild:hover .category-count,
.widget-categories .category-link-grandchild.active .category-count {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* 标签云 */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    background: #f8f9fa;
    border-radius: 16px;
    text-decoration: none;
    color: #666;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.tag-link i {
    font-size: 0.7rem;
    color: #ff6600;
}

.tag-link:hover {
    background: #ff6600;
    color: #fff;
    transform: translateY(-1px);
}

.tag-link:hover i {
    color: #fff;
}

/* 空状态 */
.no-posts,
.no-categories,
.no-tags {
    color: #999;
    font-size: 0.9rem;
    text-align: center;
    padding: 1rem 0;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .content-sidebar {
        width: 280px;
    }
}

/* 侧边栏切换按钮 */
.sidebar-toggle-btn {
    position: fixed;
    right: 20px;
    bottom: 80px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.9;
}

.sidebar-toggle-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.sidebar-toggle-btn:active {
    transform: scale(0.95);
}

/* 侧边栏隐藏状态 */
.content-sidebar.sidebar-hidden {
    transform: translateX(100%);
    opacity: 0;
    visibility: hidden;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease, width 0.3s ease;
}

/* 侧边栏显示状态 */
.content-sidebar:not(.sidebar-hidden) {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease, width 0.3s ease;
}

/* 当侧边栏隐藏时，主内容区域占满宽度 */
.category-content-wrapper.sidebar-hidden .category-main-content {
    width: 100% !important;
    flex: 1 1 100% !important;
}

@media (max-width: 992px) {
    .content-wrapper,
    .category-content-wrapper {
        flex-direction: column;
    }
    
    .content-sidebar {
        width: 100%;
        position: relative;
        top: 0;
    }
    
    .content-sidebar.sidebar-hidden {
        transform: translateX(0);
        display: none;
    }
    
    .category-main-content {
        width: 100%;
    }
    
    .sidebar-toggle-btn {
        display: none;
    }
}

