/* 侧边栏 - 移动优先 */
.app-sidebar {
    width: 100%;
    flex-shrink: 0;
    position: relative;
    order: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
}

.sidebar-section {
    background: var(--surface-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: none;
}

/* 移动设备上侧边栏不固定 */
.sidebar-section.fixed {
    position: static !important;
    width: 100% !important;
    z-index: auto !important;
    max-height: none !important;
    overflow-y: visible !important;
    top: auto !important;
}

.section-title {
    padding: var(--spacing-4) var(--spacing-5);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.tags-container {
    padding: var(--spacing-3);
    overflow-y: auto;
    flex-grow: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    width: 100%;
    box-sizing: border-box;
    /* 防止滚动时触发父元素的滚动事件 */
    overscroll-behavior: contain;
    /* 平滑滚动 */
    scroll-behavior: smooth;
}

@media (min-width: 768px) {
    .tags-container {
        padding: var(--spacing-4);
    }
}

/* 自定义滚动条样式 - Webkit浏览器 */
.tags-container::-webkit-scrollbar {
    width: 6px;
}

.tags-container::-webkit-scrollbar-track {
    background: transparent;
}

.tags-container::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

.tags-container::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-tertiary);
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-2);
    width: 100%;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    position: relative;
    flex: 0 1 auto;
    min-width: 0;
    /* 确保高度一致 - 使用固定高度 */
    height: 28px;
    line-height: 28px;
    box-sizing: border-box;
    vertical-align: middle;
    /* 微调垂直对齐，稍微下移 */
    margin-top: 1px;
}

@media (min-width: 480px) {
    .tag-item {
        padding: 0 11px;
        font-size: 13px;
        height: 30px;
        line-height: 30px;
    }
}

@media (min-width: 768px) {
    .tag-item {
        padding: 0 12px;
        font-size: 14px;
        height: 32px;
        line-height: 32px;
    }
}

.tag-item input[type="checkbox"] {
    display: none;
}

.tag-item:hover {
    background: rgba(37, 99, 235, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.tag-item.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.tag-item.active .tag-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* 标签计数样式 */
.tag-count {
    font-size: 10px;
    padding: 0 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-secondary);
    margin-left: 4px;
    transition: all 0.2s ease;
    white-space: nowrap;
    /* 确保计数标签与文字对齐 */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    height: 18px;
    vertical-align: middle;
}

@media (min-width: 480px) {
    .tag-count {
        height: 20px;
        line-height: 1.2;
    }
}

@media (min-width: 768px) {
    .tag-count {
        height: 22px;
        line-height: 1.2;
    }
}

@media (min-width: 480px) {
    .tag-count {
        font-size: 11px;
        padding: 2px 7px;
        min-width: 22px;
    }
}

@media (min-width: 768px) {
    .tag-count {
        font-size: 12px;
        padding: 2px 8px;
        min-width: 24px;
    }
}

/* 标签内容布局 */
.tag-content {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 100%;
    line-height: inherit;
    vertical-align: middle;
    /* 微调垂直对齐，稍微下移 */
    position: relative;
    top: 1px;
}

/* 新闻列表中的标签样式 */
.tag-link {
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    background: var(--background-color);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.tag-link:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
    border-color: var(--primary-color);
}

/* 更多标签按钮样式 */
.show-more-tags {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 12px;
    background: transparent;
    border: none;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    /* 确保高度和tag-item一致 */
    height: 28px;
    line-height: 28px;
    border-radius: 20px;
    box-sizing: border-box;
    vertical-align: middle;
}

@media (min-width: 480px) {
    .show-more-tags {
        font-size: 13px;
        padding: 0 12px;
        height: 30px;
        line-height: 30px;
    }
}

@media (min-width: 768px) {
    .show-more-tags {
        font-size: 13px;
        padding: 0 12px;
        height: 32px;
        line-height: 32px;
    }
}

.show-more-tags:hover {
    color: var(--primary-color);
}

.show-more-tags svg {
    transition: transform 0.2s ease;
}

.show-more-tags.active svg {
    transform: rotate(180deg);
}

/* 已选标签样式 */
.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: var(--surface-color);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 12px;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 13px;
}

.remove-tag {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    padding: 0;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.remove-tag:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 日期导航 */
.date-navigation {
    display: flex;
    margin-bottom: var(--spacing-6);
    background: var(--surface-color);
    border-radius: var(--radius-md);
    padding: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.date-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 60px;
    text-decoration: none;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    position: relative;
    transition: all 0.2s ease;
    padding: 0 8px;
    min-width: 60px;
}

.date-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

.date-number {
    font-size: 20px;
    font-weight: 500;
    line-height: 1;
    margin-bottom: 4px;
}

.date-weekday {
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.date-item.active {
    background: var(--primary-color);
    color: white;
}

.date-item.active::after {
    display: none;
}

.date-item.active + .date-item::after {
    display: none;
}

.date-item.active .date-weekday {
    color: rgba(255, 255, 255, 0.8);
}

.date-item:hover:not(.active) {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}
