/* Compaction Visualization Styles */

.compaction-section {
    height: 100%;
    overflow-y: auto;
}

.compaction-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.compaction-item {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;

    &:hover {
        border-color: var(--primary-color);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    &.core {
        border-left: 4px solid #007bff;
    }

    &.active {
        border-left: 4px solid #28a745;
    }

    &.idle {
        border-left: 4px solid #ffc107;
    }

    &.archived {
        border-left: 4px solid #6c757d;
    }

    &.ephemeral {
        border-left: 4px solid #17a2b8;
    }
}

.compaction-header {
    padding: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    transition: background-color 0.2s ease;

    &:hover {
        background: var(--hover-bg);
    }
}

.compaction-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;

    .expand-icon {
        font-size: 0.8rem;
        color: var(--text-secondary);
        transition: transform 0.2s ease;
    }

    .topic-name {
        font-weight: 600;
        color: var(--text-primary);
    }

    .topic-type {
        font-size: 0.75rem;
        padding: 0.125rem 0.5rem;
        border-radius: 12px;
        background: var(--badge-bg);
        color: var(--badge-color);
    }
}

.compaction-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);

    .message-count,
    .token-count {
        display: flex;
        align-items: center;
        gap: 0.25rem;
    }
}

.compaction-visualization {
    padding: 1rem;
    background: var(--bg-primary);
}

.compaction-bar-container {
    margin-bottom: 1.5rem;
}

.compaction-bar {
    width: 100%;
    height: 24px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    background: var(--bg-secondary);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.retained-section,
.compacted-section {
    height: 100%;
    transition: width 0.3s ease;
}

.compaction-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.75rem;

    .retained-label {
        color: #4CAF50;
    }

    .compacted-label {
        color: var(--text-secondary);
    }
}

.compaction-visual {
    .folder-comparison {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 2rem;
        padding: 1rem;
    }

    .folder {
        text-align: center;
        transition: all 0.3s ease;

        .folder-icon {
            font-size: 3rem;
            margin-bottom: 0.5rem;
            transition: font-size 0.3s ease;
        }

        .folder-size {
            font-size: 0.875rem;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 0.25rem;
        }

        .folder-label {
            font-size: 0.75rem;
            color: var(--text-secondary);
        }

        &.compacted {
            .folder-icon {
                filter: hue-rotate(180deg);
            }
        }
    }

    .arrow {
        font-size: 1.5rem;
        color: var(--text-secondary);
        animation: slide 1s ease-in-out infinite;
    }
}

@keyframes slide {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(5px);
    }
}

.compaction-details {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.compaction-info {
    margin-bottom: 1.5rem;

    h4 {
        margin: 0 0 0.75rem 0;
        color: var(--text-primary);
        font-size: 1rem;
    }

    .strategy-description {
        color: var(--text-secondary);
        line-height: 1.5;
        margin-bottom: 1rem;
    }
}

.compaction-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;

    .metric {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;

        .metric-label {
            font-size: 0.75rem;
            color: var(--text-secondary);
            text-transform: uppercase;
        }

        .metric-value {
            font-weight: 600;
            color: var(--text-primary);
        }
    }
}

.compaction-preview {
    h4 {
        margin: 0 0 0.75rem 0;
        color: var(--text-primary);
        font-size: 1rem;
    }

    .preview-note {
        background: var(--code-bg);
        padding: 1rem;
        border-radius: 6px;
        border: 1px solid var(--border-color);

        p {
            margin: 0;
            color: var(--text-secondary);
            line-height: 1.5;
        }
    }
}

/* Empty state specific to compaction */
.compaction-section .empty-state {
    .empty-icon {
        font-size: 3rem;
        margin-bottom: 1rem;
    }
}