/*
THIS FILE IS PART OF XLEAN.AI xLeanOS PROJECT

It is prohibited to use it for other business
activities before it is allowed.

Copyright (c) 2026 xLean Robotics Co., Ltd.
*/

:root {
  color-scheme: dark;
  --bg: #10141a;
  --panel: #171d26;
  --panel-border: #2a3340;
  --text: #e6edf3;
  --muted: #8b98a8;
  --accent: #2f81f7;
  --accent-strong: #1f6feb;
  --danger: #ff7b72;
  --ok: #3fb950;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  padding: 0.5rem 0.85rem;
}

button:hover:not(:disabled) {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button.secondary {
  background: transparent;
  border-color: var(--panel-border);
  color: var(--text);
}

button.secondary:hover:not(:disabled) {
  background: #222b36;
}

input {
  background: #0d1117;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.55rem 0.65rem;
  width: 100%;
}

input:focus,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.topbar {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  min-height: 56px;
  padding: 0.65rem 1rem;
}

.user {
  color: var(--muted);
  margin-left: 0.75rem;
}

.layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(250px, 340px) minmax(0, 1fr);
  height: calc(100% - 56px);
  padding: 1rem;
}

.devices-panel,
.terminal-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  min-height: 0;
}

.devices-panel {
  display: flex;
  flex-direction: column;
  padding: 1rem;
}

.panel-heading,
.terminal-toolbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.panel-heading h1 {
  font-size: 1.1rem;
  margin: 0;
}

.search-label {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0.9rem 0 0.35rem;
}

.device-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.75rem;
  overflow-y: auto;
}

.device {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text);
  padding: 0.6rem 0.7rem;
  text-align: left;
  width: 100%;
}

.device:hover {
  background: #222b36;
}

.device.selected {
  background: rgba(47, 129, 247, 0.16);
  border-color: var(--accent);
}

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

.terminal-toolbar {
  border-bottom: 1px solid var(--panel-border);
  gap: 0.75rem;
  padding: 0.8rem 1rem;
}

.terminal-actions {
  display: flex;
  gap: 0.5rem;
}

.status {
  color: var(--muted);
  font-size: 0.85rem;
  min-height: 2.2rem;
  padding: 0.6rem 1rem;
}

.status.ok {
  color: var(--ok);
}

.status.error {
  color: var(--danger);
}

.terminal {
  flex: 1;
  min-height: 0;
  padding: 0 0.9rem 0.9rem;
}

.terminal .xterm {
  height: 100%;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.empty {
  color: var(--muted);
  padding: 0.75rem 0;
}

.error {
  color: var(--danger);
  min-height: 1.2rem;
}

.login-page {
  align-items: center;
  display: flex;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  max-width: 380px;
  padding: 1.5rem;
  width: 100%;
}

.login-card h1 {
  font-size: 1.3rem;
  margin-top: 0;
}

.login-card label {
  display: block;
  font-size: 0.85rem;
  margin: 0.9rem 0 0.35rem;
}

.login-card button {
  margin-top: 1rem;
  width: 100%;
}

@media (max-width: 760px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(180px, 30vh) minmax(0, 1fr);
  }

  .terminal-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}
