.console-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--color-bg-base);
  position: relative;
}

.console-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-border-default);
  flex-shrink: 0;
  gap: 8px;
}

.console-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.console-toolbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.console-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.console-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.console-search {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  max-width: 300px;
  background: var(--color-bg-inset);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  color: var(--color-text-tertiary);
}

.console-search:focus-within {
  border-color: var(--color-primary);
  color: var(--color-text-primary);
}

.console-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text-primary);
  font-size: var(--font-size-xs);
  font-family: var(--font-family-mono);
}

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

.console-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--font-size-xs);
  font-weight: 500;
  transition: all var(--transition-fast);
  opacity: 0.5;
}

.console-filter-btn:hover {
  opacity: 1;
  background: var(--color-bg-hover);
}

.console-filter-btn.active {
  opacity: 1;
  border-color: currentColor;
  background: rgba(255, 255, 255, 0.05);
}

.console-filter-btn:nth-child(1) {
  color: #10b981;
}

.console-filter-btn:nth-child(1).active {
  color: #34d399;
  border-color: #10b981;
}

.console-filter-btn:nth-child(2) {
  color: #858585;
}

.console-filter-btn:nth-child(2).active {
  color: #a0a0a0;
  border-color: #858585;
}

.console-filter-btn:nth-child(3) {
  color: #4a9eff;
}

.console-filter-btn:nth-child(3).active {
  color: #6eb3ff;
  border-color: #4a9eff;
}

.console-filter-btn:nth-child(4) {
  color: #ffc107;
}

.console-filter-btn:nth-child(4).active {
  color: #ffd54f;
  border-color: #ffc107;
}

.console-filter-btn:nth-child(5) {
  color: #f44336;
}

.console-filter-btn:nth-child(5).active {
  color: #ef5350;
  border-color: #f44336;
}

.console-filter-btn span {
  font-size: var(--font-size-xs);
  font-family: var(--font-family-mono);
}

.console-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: var(--font-family-mono);
  font-size: var(--font-size-xs);
  line-height: 1.4;
}

.console-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-text-tertiary);
  gap: 8px;
}

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

.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--color-border-subtle);
  transition: background-color var(--transition-fast);
}

.log-entry:hover {
  background: rgba(255, 255, 255, 0.02);
}

.log-entry-icon {
  display: flex;
  align-items: center;
  padding-top: 2px;
  flex-shrink: 0;
}

.log-entry-time {
  color: var(--color-text-tertiary);
  font-size: var(--font-size-xs);
  white-space: nowrap;
  padding-top: 2px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.log-entry-source {
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs);
  white-space: nowrap;
  padding-top: 2px;
  flex-shrink: 0;
  opacity: 0.7;
}

.log-entry-source.source-remote {
  color: #4a9eff;
  opacity: 1;
  font-weight: 600;
}

.log-entry-client {
  color: #10b981;
  font-size: calc(var(--font-size-xs) - 2px);
  white-space: nowrap;
  padding: 1px 6px;
  flex-shrink: 0;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-family: var(--font-family-mono);
}

.log-entry-remote {
  border-left: 2px solid #4a9eff;
  background: rgba(74, 158, 255, 0.05);
}

.log-entry-expander {
  display: flex;
  align-items: center;
  padding-top: 2px;
  cursor: pointer;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.log-entry-expander:hover {
  color: var(--color-text-primary);
}

.log-entry-expanded {
  flex-direction: column;
  align-items: flex-start;
}

.log-entry-expanded .log-entry-message {
  padding-left: 22px;
  width: 100%;
}

.log-entry-message {
  flex: 1;
  color: var(--color-text-primary);
  word-break: break-word;
  padding-top: 2px;
}

.log-message-container {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.log-message-preview {
  opacity: 0.9;
  flex: 1;
}

.log-open-json-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  opacity: 0.7;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.log-open-json-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

.log-message-json {
  margin: 4px 0 0 0;
  padding: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-default);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-xs);
  line-height: 1.5;
  overflow: auto;
  white-space: pre;
  color: #a0e7a0;
  max-height: 400px;
}

.log-message-json::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.log-message-json::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.log-message-json::-webkit-scrollbar-thumb {
  background: rgba(160, 231, 160, 0.3);
  border-radius: 4px;
}

.log-message-json::-webkit-scrollbar-thumb:hover {
  background: rgba(160, 231, 160, 0.5);
}

.log-entry-debug {
  color: var(--color-text-tertiary);
}

.log-entry-debug .log-entry-icon {
  color: #858585;
}

.log-entry-info .log-entry-icon {
  color: #4a9eff;
}

.log-entry-warn {
  background: rgba(255, 193, 7, 0.05);
}

.log-entry-warn .log-entry-icon {
  color: #ffc107;
}

.log-entry-error {
  background: rgba(244, 67, 54, 0.05);
}

.log-entry-error .log-entry-icon {
  color: #f44336;
}

.console-scroll-to-bottom {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
  z-index: 10;
}

.console-scroll-to-bottom:hover {
  background: var(--color-primary-hover);
  transform: translateX(-50%) translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.console-scroll-to-bottom:active {
  transform: translateX(-50%) translateY(0);
}

/* Scrollbar */
.console-content::-webkit-scrollbar {
  width: 10px;
}

.console-content::-webkit-scrollbar-track {
  background: var(--color-bg-elevated);
}

.console-content::-webkit-scrollbar-thumb {
  background: var(--color-border-default);
  border-radius: 5px;
}

.console-content::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-secondary);
}

@media (prefers-reduced-motion: reduce) {
  .console-btn,
  .console-filter-btn,
  .log-entry,
  .console-scroll-to-bottom {
    transition: none;
  }
}
