/* ============================================================
 * RC-MVP 控制台样式 style.css
 * ============================================================ */
* { box-sizing: border-box; }
body {
  margin: 0; background: #f4f5f7; color: #222;
  font: 14px/1.5 -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}
.hidden { display: none !important; }
h2 { margin: 0 0 12px; font-size: 18px; }
h3 { margin: 0 0 8px; font-size: 14px; color: #555; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px; background: #1f2937; color: #fff;
}
.brand { font-weight: 600; }
.conn { display: flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-off  { background: #9ca3af; }
.dot-on   { background: #22c55e; }
.dot-warn { background: #f59e0b; }

/* ---------- 面板 ---------- */
.panel {
  max-width: 1200px; margin: 20px auto; padding: 20px;
  background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
#loginPanel { max-width: 380px; }
#loginPanel label { display: block; margin-bottom: 12px; }
#loginPanel input { display: block; width: 100%; margin-top: 4px; }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; flex: 1; }

input, textarea {
  padding: 8px; border: 1px solid #d1d5db; border-radius: 6px; font: inherit;
}
textarea { width: 100%; resize: vertical; margin-bottom: 8px; }
.error { color: #dc2626; margin: 8px 0 0; }

/* ---------- 按钮 ---------- */
.btn {
  padding: 6px 14px; border: 1px solid #d1d5db; border-radius: 6px;
  background: #fff; cursor: pointer; font: inherit;
}
.btn:hover { background: #f3f4f6; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* ---------- 设备列表 ---------- */
.device-table { width: 100%; border-collapse: collapse; }
.device-table th, .device-table td {
  padding: 8px 10px; border-bottom: 1px solid #e5e7eb; text-align: left;
}
.device-table th { background: #f9fafb; font-weight: 600; }
.device-table tr.empty td { text-align: center; color: #9ca3af; }
.device-table tr.offline td { color: #9ca3af; }

/* ---------- 状态徽章（列表和控制窗口共用） ---------- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 12px; background: #e5e7eb; color: #374151;
}
.badge-ok     { background: #dcfce7; color: #166534; }
.badge-warn   { background: #fef3c7; color: #92400e; }
.badge-err    { background: #fee2e2; color: #991b1b; }
.badge-locked { background: #e0e7ff; color: #3730a3; }

/* ---------- 单台控制窗口 ---------- */
.ctrl-body { display: flex; gap: 20px; align-items: flex-start; }
.screen-wrap {
  position: relative; flex: 0 0 auto;
  background: #000; border-radius: 8px; overflow: hidden;
  min-width: 240px; min-height: 420px;
  display: flex; align-items: center; justify-content: center;
}
/* video 不用 object-fit，保持原始比例：元素边框 = 画面边框，
   app.js 用 getBoundingClientRect 换算 0~1 坐标才准确 */
#remoteVideo {
  display: block; max-width: 100%; max-height: 78vh;
  touch-action: none; user-select: none; cursor: crosshair;
}
.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #9ca3af; background: rgba(0,0,0,.6); pointer-events: none;
}
.ctrl-side { flex: 1; min-width: 260px; }
.group { margin-bottom: 18px; }
.group > .btn { margin-right: 6px; }
.key-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

.ctrl-log {
  list-style: none; margin: 0; padding: 8px; height: 180px; overflow-y: auto;
  background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 6px;
  font: 12px/1.6 Consolas, monospace;
}
.ctrl-log li.err { color: #dc2626; }

/* ---------- 弹窗与提示 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-box { background: #fff; padding: 20px; border-radius: 8px; min-width: 300px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  padding: 10px 18px; background: rgba(17,24,39,.9); color: #fff;
  border-radius: 6px; z-index: 200;
}

/* ---------- 窄屏：画面和操作区上下排 ---------- */
@media (max-width: 800px) {
  .ctrl-body { flex-direction: column; }
  .screen-wrap { width: 100%; }
  .device-table { font-size: 12px; }
}
