/* 全新：YunYi 纯桌面 GUI 伪装级 CSS (Web Client Emulator) */

:root {
  --bg-deep: #050505;
  /* 极暗的外部系统背景 */
  --win-bg: #111115;
  /* 客户端窗体主背景 (极暗灰偏蓝) */
  --win-border: #1e1e24;
  /* 窗体边框 */
  --panel-bg: rgba(22, 22, 30, 0.6);
  /* 内部面板玻璃感黑 */

  --accent-base: #3b82f6;
  /* 品牌主蓝 */
  --accent-hover: #2563eb;
  /* 按钮悬停蓝 */
  --accent-glow: rgba(59, 130, 246, 0.4);

  --text-main: #e2e8f0;
  --text-dim: #8b949e;

  --term-font: 'Fira Code', 'Consolas', monospace;
  --term-success: #10b981;
  --term-warn: #eab308;
  --term-info: #60a5fa;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  background-color: var(--bg-deep);
  color: var(--text-main);
  /* 在背景铺设一层极弱的渐变光晕，突出桌面中央的窗口 */
  background-image: radial-gradient(circle at 50% 10%, rgba(59, 130, 246, 0.08) 0%, transparent 60%);
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* 这里是客户端，不需要全局网页滚动 */
}

/* --- 容器与窗口骨架 --- */
.desktop-environment {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.app-window {
  width: 100%;
  max-width: 1100px;
  height: 85vh;
  max-height: 750px;
  background-color: var(--win-bg);
  border-radius: 12px;
  border: 1px solid var(--win-border);
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  /* 入场微小动画 */
  animation: winOpen 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes winOpen {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* --- 标题栏 (完全复刻原生 UI) --- */
.title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  height: 40px;
  background: linear-gradient(180deg, #1a1a20, #131317);
  border-bottom: 1px solid var(--win-border);
  user-select: none;
}

.title-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-icon {
  font-size: 14px;
}

.app-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.title-bar-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Mac/Win 风格红黄绿小巧系统按钮模拟 */
.sys-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--win-border);
  cursor: pointer;
  transition: all 0.2s;
}

.sys-btn:hover {
  filter: brightness(1.5);
}

.sys-btn.close {
  background: #ef4444;
}

.sys-btn.maximize {
  background: #eab308;
}

.sys-btn.minimize {
  background: #22c55e;
}


/* --- 侧/横向导航 (Tabs) --- */
.app-body {
  flex: 1;
  min-height: 0;
  /* 切断向上的 Flex 无限高度传递 */
  display: flex;
  flex-direction: column;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.01) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.01) 1px, transparent 1px);
  background-size: 40px 40px;
}

.nav-tabs {
  display: flex;
  padding: 0 20px;
  background: #15151a;
  border-bottom: 1px solid var(--win-border);
}

.tab {
  padding: 14px 20px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab.active {
  color: var(--text-main);
  border-bottom-color: var(--accent-base);
  background: rgba(255, 255, 255, 0.02);
}

.tab:not(.active):hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
}

.tab-icon {
  width: 16px;
  height: 16px;
}

/* --- 主内容区 (Tab Content) --- */
.tab-content {
  flex: 1;
  min-height: 0;
  /* 绝对核心：切断日志面板对其父容器的撑开 */
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
  /* 防止内层炸表 */
}

.section-heading {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.panel-glass {
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

/* --- 顶部控制面板 --- */
.control-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}

.input-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.input-group label {
  color: var(--text-dim);
  font-size: 14px;
}

.mock-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.mock-pwd-input {
  background: #0f0f13;
  border: 1px solid var(--win-border);
  color: #fff;
  padding: 8px 36px 8px 12px;
  border-radius: 4px;
  width: 280px;
  font-family: monospace;
  font-size: 14px;
  letter-spacing: 2px;
  outline: none;
}

.pwd-eye {
  position: absolute;
  right: 12px;
}

.action-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-dim);
  user-select: none;
}

/* 劫持强化的网络按钮伪装 */
.cyber-btn {
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-primary {
  background: var(--accent-base);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

/* 分隔线与文字 */
.status-divider {
  display: flex;
  align-items: center;
  gap: 12px;
}

.div-text {
  font-size: 13px;
  color: var(--text-dim);
}

.div-line {
  flex: 1;
  height: 1px;
  background: var(--win-border);
}

/* --- 下方并排面板 (列表与日志) --- */
.split-view {
  display: flex;
  gap: 20px;
  flex: 1;
  min-height: 0;
  /* 允许内部元素垂直溢出处理 */
}

/*设备列表*/
.device-list {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  min-height: 0;
  /* 防止内容撑爆布局 */
}

/* 自定义原生感滚动条 */
.device-list::-webkit-scrollbar,
.term-body::-webkit-scrollbar {
  width: 6px;
}

.device-list::-webkit-scrollbar-track,
.term-body::-webkit-scrollbar-track {
  background: transparent;
}

.device-list::-webkit-scrollbar-thumb,
.term-body::-webkit-scrollbar-thumb {
  background: #2a2a35;
  border-radius: 4px;
}

.list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.device-item {
  background: #16161c;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border 0.2s, background 0.2s;
}

.device-item:hover {
  background: #1b1b23;
  border-color: rgba(255, 255, 255, 0.05);
}

.dev-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
}

.dev-info .dev-icon {
  width: 20px;
  height: 20px;
  color: var(--text-dim);
}

.dev-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--term-success);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background: var(--term-success);
  border-radius: 50%;
  animation: p 1.5s infinite;
}

@keyframes p {
  0% {
    opacity: 1;
    box-shadow: 0 0 4px var(--term-success)
  }

  50% {
    opacity: 0.4;
    box-shadow: none
  }

  100% {
    opacity: 1;
    box-shadow: 0 0 4px var(--term-success)
  }
}

/* --- 右侧硬件终端 --- */
.log-terminal {
  flex: 1;
  background: #09090b;
  /* 更深的纯黑代表终端 */
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0, 0, 0, 0.5);
  min-height: 0;
  /* 打断无限伸长，强制局部滚动生效 */
  overflow: hidden;
}

.term-header {
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 12px;
}

.term-title {
  color: var(--text-dim);
}

.term-clear {
  color: #52525b;
  cursor: not-allowed;
}

.term-body {
  padding: 12px 16px;
  flex: 1;
  overflow-y: auto;
  font-family: var(--term-font);
  font-size: 12.5px;
  line-height: 1.6;
}

.log-line {
  margin-bottom: 4px;
  word-wrap: break-word;
}

.log-line.normal {
  color: var(--text-dim);
}

.log-line.success {
  color: var(--term-success);
}

.log-line.warning {
  color: var(--term-warn);
}

.log-line.highlight {
  color: var(--term-info);
}


/* --- 伪软件 Footer --- */
.app-footer {
  height: 36px;
  background: #141418;
  border-top: 1px solid var(--win-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 12px;
  color: var(--text-dim);
}

.status-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* --- 仿生 Toast 通知 --- */
#cyber-toast {
  position: fixed;
  top: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9999;
}

#cyber-toast.toast-show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-content {
  background: #1e1e24;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  padding: 12px 20px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
}

/* --- 移动端容错 (Mobile Fallback) --- */
@media (max-width: 850px) {
  body {
    overflow: auto;
    /* 允许手机用户随意滑动查看全局画面 */
    align-items: flex-start;
  }

  .desktop-environment {
    min-width: 1000px;
    /* 强制维持桌面排版宽度，由浏览器处理缩放 */
    transform: scale(0.85);
    transform-origin: top left;
  }
}

@media (max-width: 500px) {
  .desktop-environment {
    transform: scale(0.5);
    /* 手机端暴力等比缩小，保证能看完全局 */
  }
}