/**
 * Test Explorer Styles
 * Uses Atopile Design System variables for consistency
 */

/* Main container */
.te-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  overflow: hidden;
}

/* Toolbar */
.te-toolbar {
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--spacing-sm);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.te-toolbar-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.te-toolbar-secondary {
  display: flex;
  gap: var(--spacing-xs);
}

.te-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Inputs */
.te-input {
  flex: 1;
  min-width: 0;
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
}

.te-input:focus {
  outline: none;
  border-color: var(--ato-orange);
}

.te-input::placeholder {
  color: var(--text-muted);
}

.te-input-small {
  flex: 1;
  min-width: 80px;
  padding: var(--spacing-xs);
  font-size: var(--font-size-xs);
}

.te-search {
  flex: 1;
}

/* Buttons */
.te-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.te-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-default);
}

.te-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.te-btn-icon {
  padding: var(--spacing-xs);
}

.te-btn-primary {
  background: var(--ato-orange);
  border-color: var(--ato-orange);
  color: var(--bg-primary);
}

.te-btn-primary:hover:not(:disabled) {
  background: var(--ato-orange-hover);
  border-color: var(--ato-orange-hover);
}

.te-btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--ctp-blue);
  cursor: pointer;
  font-size: var(--font-size-xs);
  text-decoration: underline;
  margin-left: var(--spacing-xs);
}

.te-btn-link:hover {
  color: var(--ctp-lavender);
}

/* Spin animation */
.te-spin {
  animation: te-spin 1s linear infinite;
}

@keyframes te-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Connection status */
.te-connection-status {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.te-connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.te-connection-status.connected .te-connection-dot {
  background: var(--ctp-green);
}

.te-connection-status.disconnected .te-connection-dot {
  background: var(--ctp-yellow);
  animation: te-pulse 1s ease-in-out infinite;
}

@keyframes te-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.te-connection-label {
  color: inherit;
}

.te-connection-status.connected .te-connection-label {
  color: var(--ctp-green);
}

.te-connection-status.disconnected .te-connection-label {
  color: var(--ctp-yellow);
}

/* Selection info */
.te-selection-info {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.te-selection-count {
  color: var(--ato-orange);
  font-weight: 600;
}

/* Error display */
.te-error {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  background: rgba(243, 139, 168, 0.1);
  border-bottom: 1px solid var(--ctp-red);
  color: var(--ctp-red);
  font-size: var(--font-size-sm);
}

.te-error-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ctp-red);
  color: var(--bg-primary);
  font-weight: bold;
  font-size: var(--font-size-xs);
}

/* Collection errors */
.te-collection-errors {
  flex-shrink: 0;
  max-height: 150px;
  overflow-y: auto;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.te-collection-errors-header {
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--ctp-yellow);
  border-bottom: 1px solid var(--border-subtle);
}

.te-collection-error {
  border-bottom: 1px solid var(--border-subtle);
}

.te-collection-error summary {
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: var(--font-size-xs);
  color: var(--ctp-peach);
  cursor: pointer;
}

.te-collection-error summary:hover {
  background: var(--bg-hover);
}

.te-collection-error pre {
  padding: var(--spacing-sm);
  margin: 0;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--bg-tertiary);
  max-height: 100px;
  overflow-y: auto;
}

/* Tree view */
.te-tree {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-xs) 0;
}

/* Tree node */
.te-tree-node {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 3px 0;
  cursor: pointer;
  user-select: none;
}

.te-tree-node:hover {
  background: var(--bg-hover);
}

.te-tree-node.selected {
  background: rgba(203, 166, 247, 0.1);
}

/* Node toggle button */
.te-tree-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}

.te-tree-toggle:hover {
  color: var(--text-primary);
}

.te-tree-toggle-placeholder {
  width: 16px;
  flex-shrink: 0;
}

/* Checkbox */
.te-tree-checkbox {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--ato-orange);
}

/* Icons */
.te-tree-icon {
  flex-shrink: 0;
  color: var(--text-muted);
}

.te-tree-file .te-tree-icon {
  color: var(--ctp-blue);
}

.te-tree-class .te-tree-icon {
  color: var(--ctp-mauve);
}

.te-tree-test .te-tree-icon {
  color: var(--ctp-green);
}

/* Node name */
.te-tree-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.te-tree-file > .te-tree-name {
  color: var(--ctp-blue);
}

.te-tree-class > .te-tree-name {
  color: var(--ctp-mauve);
}

.te-tree-test > .te-tree-name {
  color: var(--text-primary);
}

/* Test count badge */
.te-tree-count {
  flex-shrink: 0;
  padding: 0 var(--spacing-xs);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

/* Loading state */
.te-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xl);
  gap: var(--spacing-md);
  color: var(--text-muted);
}

.te-loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--ato-orange);
  border-radius: 50%;
  animation: te-spin 0.8s linear infinite;
}

/* Empty state */
.te-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xl);
  color: var(--text-muted);
  font-style: italic;
}

/* Test Explorer Page Layout */
.te-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  background: var(--bg-primary);
  overflow: hidden;
}

.te-page-split {
  display: flex;
  flex: 1;
  min-height: 0;
}

.te-page-explorer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.te-page-logs {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.te-page-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  color: var(--text-muted);
  padding: var(--spacing-xl);
  text-align: center;
}

.te-page-placeholder-icon {
  font-size: 48px;
  opacity: 0.3;
}

/* Resize handle for split view */
.te-resize-handle {
  width: 4px;
  background: var(--border-subtle);
  cursor: col-resize;
  transition: background 0.15s;
  flex-shrink: 0;
  position: relative;
}

/* Wider hit area for easier grabbing */
.te-resize-handle::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -4px;
  right: -4px;
}

.te-resize-handle:hover,
.te-resize-handle:active {
  background: var(--ato-orange);
}
