/**
 * Common Styles
 * 公共样式
 */

/* === 全局样式 === */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === 根容器 === */
#root {
  min-height: 100vh;
}

/* === 登录页面样式 === */
body.login-page {
  background: var(--gradient-purple);
  min-height: 100vh;
}

body.login-page #root {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-medium);
  padding: var(--spacing-xl);
  width: var(--login-container-width);
  max-width: 90%;
}

.login-title {
  text-align: center;
  margin-bottom: var(--spacing-lg);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
}

/* === Dashboard样式 === */
.dashboard-container {
  min-height: 100vh;
  background: var(--bg-light);
}

.dashboard-header {
  background: var(--bg-white);
  padding: 0 var(--spacing-md);
  box-shadow: var(--shadow-small);
}

.dashboard-content {
  padding: var(--spacing-md);
}

/* === 统计卡片 === */
.stat-card {
  text-align: center;
}

.stat-value {
  font-size: var(--font-size-xxl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
}

/* === 终端容器 === */
.terminal-container {
  background: var(--bg-black);
  padding: 10px;
  border-radius: var(--radius-sm);
  height: var(--terminal-height);
}

/* === SSH/SFTP容器 === */
.ssh-container {
  height: 100vh;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 让 Tabs 根元素撑满剩余高度并成为 flex 容器 */
.ssh-container > .cb-tabs-root {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Tabs 标签栏固定高度 */
.cb-tabs-header {
  flex-shrink: 0;
}

/* Tabs 内容区域：撑满剩余高度 */
.cb-tabs-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 每个 Tab 面板的包裹容器（Tabs 组件会 inline 设置 display:flex；此处固定方向为 column） */
.cb-tabs-pane {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
}

/* SSH 终端宿主：严格填满 tab 面板，xterm 在其内部自行铺开。
 * 必须 position:relative，让 xterm 的内部层（.xterm-viewport / .xterm-screen /
 * .xterm-selection-layer / 辅助 textarea 等 `position:absolute` 元素）
 * 以此容器为定位基准。
 * 若此处不加 position，xterm 的 offsetParent 会回溯到更外层的
 * `.ssh-container`（它 `position:relative`），导致鼠标坐标换算时多出
 * Tab 栏高度的偏移，表现为"选中行与鼠标点击行错位"。
 * 同理不要加 padding / border / transform。
 *
 * 把 line-height/letter-spacing 复位到 normal/0：Tailwind preflight 给
 * :host/html 设了 line-height:1.5，这会继承进 xterm 内部 DOM renderer 的每行
 * 字符 <div>，让行高变成 21px，而 xterm 内部字符度量仍按字体自然行高（~17px）
 * 计算，两者不一致就会出现"鼠标点 A 行、选中 B 行"的错位。 */
.ssh-terminal-host,
.ssh-terminal-host * {
  line-height: normal;
}
.ssh-terminal-host {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  background: #1e1e1e;
  letter-spacing: 0;
}

/* 让 xterm 自身的根容器占满父元素 */
.ssh-terminal-host > .terminal,
.ssh-terminal-host > .xterm {
  width: 100%;
  height: 100%;
}

/* SSH Tab 关闭按钮优化 */
.ssh-container .ant-tabs-tab-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: 8px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.45);
  transition: all 0.2s;
  cursor: pointer;
  border-radius: 4px;
}

.ssh-container .ant-tabs-tab-remove:hover {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.08);
}

/* === 设备在线状态圆点（统一规范：中圆点 10px）=== */
.device-status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.device-status-dot.online {
  background: #22c55e;
}
.device-status-dot.offline {
  background: #6b7280;
}

/* 带圆点的设备名称行（圆点 + 别名横排） */
.device-name-with-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
