/* JSON Sidebar Styles */
.json-sidebar {
  background-color: var(--color-bg-light);
  border-left: 1px solid var(--color-border);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border);
  background-color: white;
  flex-shrink: 0;
}

.sidebar-header h3 {
  margin: 0;
  font-size: var(--font-size-lg);
  color: var(--color-text-primary);
}

.sidebar-toggle {
  background: none;
  border: none;
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--border-radius);
  transition: all var(--transition-fast);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover {
  background-color: var(--color-border);
  color: var(--color-text-primary);
}

.sidebar-content {
  flex: 1;
  overflow: auto;
  padding: var(--space-md);
}

/* JSON Display */
.json-display {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  padding: var(--spacing-md);
  margin: 0;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-x: auto;
  color: var(--text-primary);
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: var(--space-md);
}

/* JSON Action Buttons */
.json-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.json-action-btn {
  flex: 1;
  min-width: 100px;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.json-action-btn:hover {
  background: rgba(51, 255, 255, 0.8);
  transform: translateY(-1px);
}

.json-action-btn:active {
  transform: translateY(0);
}

.json-action-btn:disabled {
  background: var(--color-border);
  color: var(--color-text-secondary);
  cursor: not-allowed;
  transform: none;
}

/* JSON Syntax Highlighting */
.json-key {
  color: #0066CC;
  font-weight: var(--font-weight-medium);
}

.json-string {
  color: #008000;
}

.json-number {
  color: #FF6600;
}

.json-boolean {
  color: #0066CC;
  font-weight: var(--font-weight-medium);
}

.json-null {
  color: #999999;
  font-style: italic;
}

.json-bracket {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-bold);
}

/* Object List Panel Styles */
.object-list-panel {
  background-color: var(--color-bg-light);
  border-right: 1px solid var(--color-border);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border);
  background-color: white;
  flex-shrink: 0;
}

.panel-header h3 {
  margin: 0;
  font-size: var(--font-size-lg);
  color: var(--color-text-primary);
}

.panel-toggle {
  background: none;
  border: none;
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--border-radius);
  transition: all var(--transition-fast);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel-toggle:hover {
  background-color: var(--color-border);
  color: var(--color-text-primary);
}

.panel-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Search Container */
.search-container {
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border);
  background-color: white;
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  padding: var(--space-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  background-color: white;
  transition: border-color var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(51, 255, 255, 0.2);
}

.search-input::placeholder {
  color: var(--color-text-secondary);
}

/* Entity List */
.entity-list {
  flex: 1;
  overflow: auto;
  padding: var(--space-sm);
}

.entity-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: var(--space-xs);
  border: 1px solid transparent;
}

.entity-list-item:hover {
  background-color: rgba(51, 255, 255, 0.1);
  border-color: rgba(51, 255, 255, 0.3);
}

.entity-list-item.selected {
  background-color: rgba(51, 255, 255, 0.2);
  border-color: var(--color-primary);
}

.entity-info {
  flex: 1;
  min-width: 0; /* Allow text truncation */
}

.entity-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-type {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  text-transform: capitalize;
}

.entity-properties {
  font-size: 10px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.entity-actions {
  display: flex;
  gap: var(--space-xs);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.entity-list-item:hover .entity-actions {
  opacity: 1;
}

.entity-action-btn {
  background: none;
  border: none;
  padding: var(--space-xs);
  border-radius: calc(var(--border-radius) / 2);
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.entity-action-btn:hover {
  background-color: var(--color-error);
  color: white;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-xl);
  color: var(--color-text-secondary);
}

.empty-state p {
  margin: var(--space-xs) 0;
  font-size: var(--font-size-sm);
}

.empty-state p:first-child {
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
}

/* Color Indicators */
.entity-color-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  margin-left: var(--space-xs);
  flex-shrink: 0;
}

/* Room vs Object Indicators */
.entity-list-item[data-type="room"] {
  border-left: 3px solid #FFFFFF;
}

.entity-list-item[data-type="object"] {
  border-left: 3px solid transparent;
}

.entity-list-item[data-type="object"] .entity-color-indicator {
  border-width: 2px;
}

/* Collapsed Sidebar States */
.json-sidebar.collapsed {
  width: 0;
  min-width: 0;
  border: none;
  overflow: hidden;
}

.object-list-panel.collapsed {
  width: 0;
  min-width: 0;
  border: none;
  overflow: hidden;
}

/* Toggle Buttons for Collapsed State */
.sidebar-expand-btn,
.panel-expand-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--color-primary);
  color: white;
  border: none;
  padding: var(--space-sm);
  border-radius: var(--border-radius) 0 0 var(--border-radius);
  cursor: pointer;
  font-size: var(--font-size-sm);
  z-index: 90;
  transition: all var(--transition-fast);
}

.sidebar-expand-btn {
  right: 0;
}

.panel-expand-btn {
  left: 0;
}

.sidebar-expand-btn:hover,
.panel-expand-btn:hover {
  background-color: rgba(51, 255, 255, 0.8);
  transform: translateY(-50%) translateX(-2px);
}

.panel-expand-btn:hover {
  transform: translateY(-50%) translateX(2px);
}

/* Responsive Behavior */
@media (max-width: 1024px) {
  .object-list-panel {
    position: fixed;
    left: -250px;
    top: var(--toolbar-height);
    bottom: 0;
    width: var(--object-list-width);
    z-index: 80;
    transition: left var(--transition-fast);
    box-shadow: var(--shadow-lg);
  }
  
  .object-list-panel.open {
    left: 0;
  }
}

@media (max-width: 768px) {
  .json-sidebar {
    position: fixed;
    right: -300px;
    top: var(--toolbar-height);
    bottom: 0;
    width: var(--sidebar-width);
    z-index: 80;
    transition: right var(--transition-fast);
    box-shadow: var(--shadow-lg);
  }
  
  .json-sidebar.open {
    right: 0;
  }
  
  .search-container,
  .panel-content {
    padding: var(--space-sm);
  }
  
  .entity-list-item {
    padding: var(--space-sm) var(--space-xs);
  }
  
  .entity-name {
    font-size: 12px;
  }
  
  .entity-type,
  .entity-properties {
    font-size: 10px;
  }
}

/* Focus and Keyboard Navigation */
.entity-list-item:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.search-input:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .json-display {
    border-width: 2px;
  }
  
  .entity-list-item {
    border-width: 2px;
  }
  
  .entity-list-item.selected {
    background-color: var(--color-primary);
    color: white;
  }
}

/* Print Styles */
@media print {
  .object-list-panel,
  .json-sidebar {
    display: none;
  }
}
