/* 侧边栏组件样式 */    
.sidebar {    
    grid-area: sidebar;    
    background: var(--surface-color);    
    border-right: 1px solid var(--border-color);    
    overflow-y: auto;    
    z-index: 50;    
    transition: all 0.3s ease;    
}    
    
.nav-menu {    
    list-style: none;    
    padding: 20px 0;    
}    
    
.nav-item {    
    margin: 0;    
}    
    
.nav-link {    
    display: flex;    
    align-items: center;    
    gap: 12px;    
    padding: 12px 20px;    
    color: var(--text-secondary);    
    text-decoration: none;    
    transition: background-color 0.15s ease, color 0.15s ease, border-left-color 0.15s ease;    
    border-left: 3px solid transparent;    
}    
    
.nav-link:hover {    
    background: rgba(var(--primary-color-rgb), 0.08);    
    color: var(--text-primary);    
    border-left-color: var(--primary-color);    
}    
    
.nav-link.active {    
    background: rgba(var(--primary-color-rgb), 0.12);    
    color: var(--primary-color);    
    border-left-color: var(--primary-color);    
    font-weight: 500;    
}    
    
.nav-icon {    
    width: 20px;    
    height: 20px;    
    fill: currentColor;    
}    

/* 任务列表菜单项的运行中任务数徽标 */
.nav-task-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: auto;
    border-radius: 9px;
    background: var(--primary-color);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.nav-task-badge[hidden] {
    display: none;
}
    
/* 二级菜单样式 */    
.nav-item-expandable .nav-arrow {    
    width: 16px;    
    height: 16px;    
    margin-left: auto;    
    transition: transform 0.2s ease;    
}    
    
.nav-arrow {    
    width: 16px;    
    height: 16px;    
    margin-left: auto;    
    transition: transform 0.2s ease;    
    fill: currentColor;    
    stroke: currentColor;    
    stroke-width: 2;    
}    
    
.nav-item-expandable.expanded .nav-arrow {    
    transform: rotate(90deg);    
}    
    
.nav-submenu {    
    max-height: 0;    
    overflow: hidden;    
    overflow-y: auto;    
    transition: max-height 0.3s ease;    
    background: rgba(0, 0, 0, 0.1);    
}    
    
.nav-item-expandable.expanded .nav-submenu {    
    max-height: min(420px, calc(100vh - 220px));    
}    
    
.nav-sublink {    
    display: flex;    
    align-items: center;    
    padding: 8px 16px 8px 48px;    
    color: var(--text-secondary);    
    text-decoration: none;    
    font-size: 14px;    
    transition: all 0.2s ease;    
    border-left: 3px solid transparent;    
}    
    
.nav-sublink:hover {    
    background: rgba(var(--primary-color-rgb), 0.06);    
    color: var(--text-primary);    
    border-left-color: var(--primary-color);    
}    
    
.nav-sublink.active {    
    background: rgba(var(--primary-color-rgb), 0.1);    
    color: var(--primary-color);    
    border-left-color: var(--primary-color);    
    font-weight: 500;    
}    
    
.config-required {    
    color: var(--error-color);    
    font-size: 12px;    
    margin-left: 4px;    
}

/* ===================== 生成任务监控面板 ===================== */
.sidebar-task-panel {
    list-style: none;
    margin: 8px 0;
    padding: 10px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.sidebar-task-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border-radius: 6px;
    padding: 2px 4px;
    margin: -2px -4px;
    transition: background 0.15s;
}

.sidebar-task-header:hover {
    background: var(--bg-hover, rgba(0, 0, 0, 0.04));
}

.sidebar-task-header.active {
    background: var(--primary-color-soft, rgba(59, 130, 246, 0.12));
}

.sidebar-task-header:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
}

.sidebar-task-header-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.sidebar-task-enter {
    width: 14px;
    height: 14px;
    color: var(--text-muted, #8a94a6);
    opacity: 0.6;
    transition: opacity 0.15s, transform 0.15s;
}

.sidebar-task-header:hover .sidebar-task-enter {
    opacity: 1;
    transform: translateX(2px);
}

.sidebar-task-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.sidebar-task-icon {
    width: 15px;
    height: 15px;
    stroke: var(--primary-color);
}

.sidebar-task-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--primary-color);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.sidebar-task-badge[hidden] {
    display: none;
}

.sidebar-task-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 38vh;
    overflow-y: auto;
}

.sidebar-task-empty {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.7;
    text-align: center;
    padding: 8px 0;
}

.sidebar-task-card {
    background: rgba(var(--primary-color-rgb, 37, 99, 235), 0.04);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.sidebar-task-card.clickable {
    cursor: pointer;
}

.sidebar-task-card.clickable:hover {
    background: rgba(var(--primary-color-rgb, 37, 99, 235), 0.10);
    border-color: var(--primary-color);
}

.sidebar-task-card.clickable:active {
    transform: scale(0.99);
}

.sidebar-task-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-task-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-secondary);
}

.sidebar-task-card.running .sidebar-task-dot,
.sidebar-task-card.queued .sidebar-task-dot {
    background: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb, 37, 99, 235), 0.18);
}

.sidebar-task-card.queued .sidebar-task-dot {
    background: var(--warning-color, #e0a800);
    box-shadow: 0 0 0 3px rgba(224, 168, 0, 0.18);
}

.sidebar-task-card.completed .sidebar-task-dot {
    background: var(--success-color, #28a745);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.18);
}

.sidebar-task-card.failed .sidebar-task-dot {
    background: var(--error-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.18);
}

.sidebar-task-card.stopped .sidebar-task-dot {
    background: var(--text-secondary);
}

.sidebar-task-topic {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.sidebar-task-status {
    font-size: 11px;
    color: var(--text-secondary);
    align-self: flex-start;
}

.sidebar-task-card.running .sidebar-task-status,
.sidebar-task-card.queued .sidebar-task-status {
    color: var(--primary-color);
}

.sidebar-task-card.completed .sidebar-task-status {
    color: var(--success-color, #28a745);
}

.sidebar-task-card.failed .sidebar-task-status {
    color: var(--error-color);
}

.sidebar-task-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    align-items: center;
}

.sidebar-task-meta.error {
    color: var(--error-color);
}

.sidebar-task-meta.muted {
    opacity: 0.75;
}

.sidebar-task-meta.loaded {
    color: var(--text-primary);
}

.sidebar-task-score,
.sidebar-task-reads {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sidebar-task-score {
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-task-reads {
    color: var(--success-color, #28a745);
    font-weight: 600;
}
