/* Filters Section */
.filters-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.filters-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-group input[type="text"] {
    padding: var(--spacing-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.filter-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-group input[type="text"]::placeholder {
    color: var(--text-muted);
}

.filter-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border);
}

.filter-actions label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.875rem;
    cursor: pointer;
}

.filter-actions input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

/* Results Summary */
.results-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

#results-count {
    font-weight: 500;
    color: var(--text-secondary);
}

/* Table Container */
.table-container {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead {
    background: var(--background);
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table th {
    text-align: left;
    padding: var(--spacing-md);
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

/* Column widths - optimized to fit all columns in viewport */
.data-table th:nth-child(1), /* External ID */
.data-table td:nth-child(1) {
    width: 110px;
    min-width: 110px;
    max-width: 110px;
}

.data-table th:nth-child(2), /* Product Tree Node */
.data-table td:nth-child(2) {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
}

.data-table th:nth-child(3), /* Product Text */
.data-table td:nth-child(3) {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
}

.data-table th:nth-child(4), /* Image */
.data-table td:nth-child(4) {
    width: 60px;
    min-width: 60px;
    max-width: 60px;
}

.data-table th:nth-child(5), /* Label */
.data-table td:nth-child(5) {
    width: 130px;
    min-width: 130px;
    max-width: 130px;
}

.data-table th:nth-child(6), /* CURRENT AI Values */
.data-table td:nth-child(6) {
    width: 140px;
    min-width: 140px;
}

.data-table th:nth-child(7), /* CURRENT AI Explanations */
.data-table td:nth-child(7) {
    width: 200px;
    min-width: 200px;
}

.data-table th:nth-child(8), /* NEW ORCHESTRATION Values */
.data-table td:nth-child(8) {
    width: 140px;
    min-width: 140px;
}

.data-table th:nth-child(9), /* NEW ORCHESTRATION Explanations */
.data-table td:nth-child(9) {
    width: 200px;
    min-width: 200px;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background: var(--background);
}

.data-table tbody tr.version-row {
    background: rgba(59, 130, 246, 0.02);
}

.data-table tbody tr.version-row.current {
    background: rgba(139, 92, 246, 0.02);
}

.data-table td {
    padding: var(--spacing-md);
    vertical-align: top;
}

/* Remove padding for cells with scrollable content */
.data-table td.product-text-cell {
    padding: 0;
}

.data-table td.clickable {
    cursor: pointer;
    color: var(--primary);
}

.data-table td.clickable:hover {
    text-decoration: underline;
}

/* Product cell */
.product-id-cell {
    font-weight: 500;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.8125rem;
}

.product-text-cell {
    display: block;
    width: 100%;
    max-height: 150px;
    overflow-y: auto;
    overflow-x: hidden;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    font-size: 0.8125rem;
    line-height: 1.5;
    padding: var(--spacing-sm);
    box-sizing: border-box;
}

.product-text-cell::-webkit-scrollbar {
    width: 6px;
}

.product-text-cell::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 3px;
}

.product-text-cell::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.product-text-cell::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Image cell */
.product-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* Value chips */
.value-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.value-chip {
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
}

.value-chip:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.value-chip.in-strategy {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--metric-61-80);
}

.value-chip.out-of-strategy {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--metric-0-20);
}

/* Explanations */
.explanation-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    width: 100%;
    max-height: 150px;
    overflow-x: hidden;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
    padding: var(--spacing-sm);
}

.explanation-text::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.explanation-text::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 3px;
}

.explanation-text::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.explanation-text::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
    .table-container {
        overflow-x: auto;
    }
    
    .data-table {
        min-width: 1000px;
    }
}
