/* Serial terminal utility — dark log, light chrome */

.serial-page {
  min-width: 0;
}

.serial-panel {
  font-family: "Inter", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 13rem);
  min-height: 22rem;
  max-height: calc(100vh - 13rem);
}

@media (max-width: 640px) {
  .serial-panel {
    height: calc(100vh - 11rem);
    max-height: calc(100vh - 11rem);
    min-height: 18rem;
  }
}

.serial-toolbar,
.serial-filter,
.serial-send {
  flex-shrink: 0;
  font-size: 0.75rem;
}

.serial-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: opacity 120ms ease, background 120ms ease;
}

.serial-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.serial-btn-connect {
  background: #15803d;
  color: #fff;
  min-width: 7.5rem;
}

.serial-btn-connect:hover:not(:disabled) {
  background: #166534;
}

.serial-btn-disconnect {
  background: #fff;
  color: #dc2626;
  border: 1px solid #fca5a5;
  min-width: 7.5rem;
}

.serial-btn-disconnect:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #f87171;
}

.serial-btn-muted {
  background: #e5e7eb;
  color: #374151;
}

.serial-btn-muted:hover:not(:disabled) {
  background: #d1d5db;
}

.serial-btn-primary {
  background: #2563eb;
  color: #fff;
}

.serial-btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
}

.serial-select {
  background: #fff;
  border: 1px solid #d1d5db;
  color: #374151;
  padding: 0.35rem 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-family: "JetBrains Mono", monospace;
}

.serial-mode-group {
  display: inline-flex;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid #d1d5db;
}

.serial-mode-btn {
  background: #fff;
  color: #6b7280;
  border: none;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.serial-mode-btn.active {
  background: #2563eb;
  color: #fff;
}

.serial-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #f3f4f6;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #6b7280;
}

.serial-led {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #9ca3af;
}

.serial-led.connected {
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

.serial-port-name {
  font-size: 0.7rem;
  color: #2563eb;
  font-family: "JetBrains Mono", monospace;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.serial-vidpid {
  color: #6b7280;
  font-weight: 500;
}

.serial-stats,
.serial-fps {
  font-size: 0.7rem;
  color: #6b7280;
  background: #f3f4f6;
  padding: 0.2rem 0.5rem;
  border-radius: 0.375rem;
  font-family: "JetBrains Mono", monospace;
}

.serial-fps {
  color: #2563eb;
}

.serial-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #6b7280;
  cursor: pointer;
  user-select: none;
}

.serial-filter-input {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
}

.serial-filter-input:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.serial-log-wrap {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.serial-log {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: #0a0a0f;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 0.75rem;
  line-height: 1.45;
}

.serial-line {
  padding: 0.1rem 1rem;
  white-space: pre-wrap;
  word-break: break-all;
  border-left: 2px solid transparent;
}

.serial-line:hover {
  background: #0d0d15;
  border-left-color: #2563eb;
}

.serial-line-rx {
  color: #e5e7eb;
}

.serial-line-hex {
  color: #a5d6ff;
}

.serial-line-tx {
  color: #86efac;
}

.serial-line-sys {
  color: #6b7280;
  font-style: italic;
}

.serial-ts {
  color: #6b7280;
  user-select: none;
}

.serial-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #4b5563;
}

.serial-send-input {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  padding: 0.5rem 0.65rem;
  resize: vertical;
  min-height: 3rem;
  background: #fff;
}

.serial-send-input:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.serial-send-input:disabled {
  background: #f3f4f6;
  color: #9ca3af;
}

.serial-log::-webkit-scrollbar {
  width: 6px;
}

.serial-log::-webkit-scrollbar-track {
  background: #0d0d12;
}

.serial-log::-webkit-scrollbar-thumb {
  background: #2a2a4a;
  border-radius: 3px;
}

@media (max-width: 640px) {
  .serial-toolbar-right {
    width: 100%;
    margin-left: 0 !important;
  }
}
