/**
*源码文件：style.css
*@Author: 周仕军
*@Email: 17762826@qq.com
*@Since: 2026-11-19
*/

:root {
  --bg: #f5f6f8; --card: #fff; --line: #e2e5ea; --txt: #222; --sub: #777;
  --pri: #185FA5; --pri-dark: #0C447C; --ok: #2e8b57; --bad: #c0392b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font: 14px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--txt); }
button { cursor: pointer; font: inherit; }
.btn { background: var(--pri); color: #fff; border: none; border-radius: 6px; padding: 8px 16px; }
.btn:hover { background: var(--pri-dark); }
.btn.gray { background: #888; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.danger { background: var(--bad); }
input, select { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

/* 登录页 */
#login-view { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: var(--card); padding: 36px; border-radius: 12px; width: 320px; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.login-box h1 { font-size: 18px; margin-bottom: 20px; text-align: center; }
.login-box input { width: 100%; margin-bottom: 12px; }
.login-box button { width: 100%; }

/* 主布局 */
#main-view { display: none; }
#topbar { background: var(--card); border-bottom: 1px solid var(--line); padding: 0 24px; display: flex; align-items: center; height: 52px; gap: 24px; }
#topbar .logo { font-weight: 600; font-size: 15px; color: var(--pri); }
#topbar nav { display: flex; gap: 4px; flex: 1; }
#topbar nav a { padding: 6px 14px; border-radius: 6px; color: var(--sub); cursor: pointer; text-decoration: none; }
#topbar nav a.active, #topbar nav a:hover { background: #eef3f9; color: var(--pri); }
#topbar .who { color: var(--sub); font-size: 13px; }
#content { padding: 20px 24px; max-width: 1200px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }
h2 { font-size: 16px; margin-bottom: 14px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }

/* 卡片 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.card .title { font-weight: 600; margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.online { background: var(--ok); } .dot.offline { background: #bbb; }
.meta { color: var(--sub); font-size: 12.5px; line-height: 1.8; }
.paircode { font-size: 26px; letter-spacing: 6px; color: var(--pri); font-weight: 600; text-align: center; padding: 10px 0; }

/* 素材库 */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.media-item { background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.media-item img, .media-item video { width: 100%; height: 110px; object-fit: cover; display: block; background: #000; }
.media-item .info { padding: 8px; font-size: 12px; color: var(--sub); word-break: break-all; }
.dropzone { border: 2px dashed var(--line); border-radius: 10px; padding: 24px; text-align: center; color: var(--sub); margin-bottom: 16px; }
.dropzone.drag { border-color: var(--pri); background: #eef3f9; }

/* 场景编辑器 */
.editor-wrap { display: flex; gap: 16px; align-items: flex-start; }
#stage-box { flex: 1; min-width: 0; }
#stage { position: relative; background: #111; margin: 0 auto; overflow: hidden; border-radius: 4px; touch-action: none; }
.stage-item { position: absolute; border: 1.5px solid rgba(255,255,255,.5); background: rgba(30,80,140,.45); color: #fff;
  font-size: 12px; padding: 4px; overflow: hidden; cursor: move; display: flex; align-items: center; justify-content: center;
  touch-action: none; -webkit-user-select: none; user-select: none; }
.stage-item img, .stage-item video { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.stage-item .tag { pointer-events: none; }
.stage-item.selected { border-color: #f5a623; outline: 2px solid #f5a623; }
.stage-item .tag { position: absolute; top: 0; left: 16px; background: rgba(0,0,0,.6); font-size: 11px; padding: 1px 5px; }
.stage-item .multi-tick { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #f5a623; color: #111; font-size: 13px; font-weight: 700; display: none; align-items: center; justify-content: center; }
.stage-item.multisel .multi-tick { display: flex; }
#stage.multimode .stage-item { cursor: pointer; }
/* 选中组件右上角删除叉 */
.stage-item .item-del { position: absolute; top: 1px; right: 18px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--bad); color: #fff; font-size: 16px; line-height: 18px; text-align: center; font-weight: 700;
  display: none; z-index: 10002; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
#stage:not(.multimode) .stage-item.selected .item-del { display: block; }
.stage-item .item-del:hover { background: #e74c3c; }
/* 拖出画布删除：组件变红 + 画布红框提示 */
.stage-item.will-delete { outline: 2px solid #e94f4f !important; border-color: #e94f4f !important;
  background: rgba(233,79,79,.35) !important; opacity: .55; }
#stage.drag-out { outline: 3px dashed #e94f4f; outline-offset: -3px; }
.delete-hint { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 20000;
  background: var(--bad); color: #fff; padding: 10px 22px; border-radius: 8px; font-size: 15px; font-weight: 700;
  pointer-events: none; display: none; box-shadow: 0 3px 12px rgba(0,0,0,.5); white-space: nowrap; }
#stage.drag-out .delete-hint { display: block; }
/* 缩放/拉伸手柄：仅主选中组件显示，四角+四边（定位在组件内侧，避免被 overflow:hidden 裁剪） */
.resize-handle { position: absolute; display: none; background: #fff; border: 1.5px solid #f5a623; border-radius: 2px; z-index: 10000; }
#stage:not(.multimode) .stage-item.selected .resize-handle { display: block; }
.rh-nw { top:1px; left:1px; width:13px; height:13px; cursor:nwse-resize; }
.rh-ne { top:1px; right:1px; width:13px; height:13px; cursor:nesw-resize; }
.rh-sw { bottom:1px; left:1px; width:13px; height:13px; cursor:nesw-resize; }
.rh-se { bottom:1px; right:1px; width:13px; height:13px; cursor:nwse-resize; }
.rh-n  { top:1px; left:50%; transform:translateX(-50%); width:20px; height:9px; cursor:ns-resize; }
.rh-s  { bottom:1px; left:50%; transform:translateX(-50%); width:20px; height:9px; cursor:ns-resize; }
.rh-w  { left:1px; top:50%; transform:translateY(-50%); width:9px; height:20px; cursor:ew-resize; }
.rh-e  { right:1px; top:50%; transform:translateY(-50%); width:9px; height:20px; cursor:ew-resize; }
#stage.multimode .stage-item .resize-handle { display: none !important; }
.snap-guide { position: absolute; background: #e94f4f; pointer-events: none; z-index: 9999; display: none; }
.snap-guide.v { top: 0; bottom: 0; width: 1px; }
.snap-guide.h { left: 0; right: 0; height: 1px; }
.align-bar { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-bottom: 10px;
  padding: 8px; background: #eef3f9; border: 1px solid var(--line); border-radius: 8px; }
.align-bar .btn { padding: 4px 9px; font-size: 12px; }
#item-panel { width: 270px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
#item-panel label { display: block; font-size: 12px; color: var(--sub); margin: 10px 0 4px; }
#item-panel input, #item-panel select { width: 100%; }
.row2 { display: flex; gap: 8px; }
.row2 > div { flex: 1; }
.scene-list-item { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px;
  display: flex; justify-content: space-between; align-items: center; background: var(--card); }
.scene-list-item.active { border-color: var(--pri); }

/* 素材来源切换 */
.src-tabs { display: flex; gap: 0; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.src-tab { flex: 1; padding: 7px 4px; background: var(--card); border: none; cursor: pointer; font-size: 13px;
  color: var(--txt); }
.src-tab + .src-tab { border-left: 1px solid var(--line); }
.src-tab.active { background: var(--pri); color: #fff; }
#p-upload-file { width: 100%; font-size: 12px; }

/* 内容管理三 Tab（CHG-2026-11-26-01） */
.ct-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.ct-tabs a { padding: 9px 18px; color: var(--sub); cursor: pointer; border-bottom: 2px solid transparent; font-size: 14px; }
.ct-tabs a.active { color: var(--pri); border-color: var(--pri); font-weight: 600; }
.tpl-grid, .show-grid, .campaign-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tpl-card, .show-card, .campaign-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.tpl-card .tpl-name, .show-card .show-name, .campaign-card .campaign-name { font-weight: 600; margin-bottom: 6px; }
.tpl-card .meta, .show-card .meta, .campaign-card .meta { display: block; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.seg button { background: #fff; border: 1px solid var(--line); color: var(--txt); border-radius: 6px; padding: 5px 12px; font-size: 13px; }
.seg button.active { background: var(--pri); border-color: var(--pri); color: #fff; }
.tpl-images { display: flex; flex-wrap: wrap; gap: 8px; }
/* CHG-28-04：幻灯片素材缩略图卡片（缩略图+文件名+选中态） */
.tpl-images .chip-sel { position: relative; width: 96px; padding: 5px; border: 2px solid var(--line); border-radius: 8px; font-size: 12px; cursor: pointer; background: #fff; text-align: center; }
.tpl-images .chip-sel.on { border-color: var(--pri); background: #eef8f2; color: var(--txt); }
.tpl-images .chip-sel img { width: 100%; height: 70px; object-fit: cover; display: block; border-radius: 5px; background: #f5f7fa; }
.tpl-images .chip-sel .nm { display: block; margin-top: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tpl-images .chip-sel .ck { position: absolute; top: -2px; right: -2px; width: 18px; height: 18px; line-height: 18px; text-align: center; background: var(--pri); color: #fff; border-radius: 50%; font-size: 11px; }
.campaign-card .badge.live { background: #e2f3e8; color: var(--ok); }
.campaign-card .badge.ended { background: #eee; color: var(--sub); }

/* 下发 / 快捷投屏 */
.send-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.send-grid .card { flex: 1; min-width: 320px; }
.check-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.badge { font-size: 11px; background: #eee; border-radius: 10px; padding: 2px 8px; color: var(--sub); }
.badge.ok { background: #e2f3e8; color: var(--ok); }
.badge.warn { background: #fbeeea; color: var(--bad); }
table.cmds { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 10px; overflow: hidden; }
table.cmds th, table.cmds td { padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; text-align: left; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; }
.toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); background: #333; color: #fff;
  padding: 10px 20px; border-radius: 8px; display: none; z-index: 99; font-size: 13px; max-width: 90vw; text-align: center; }
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: none; align-items: center; justify-content: center; z-index: 50; padding: 12px; }
.modal { background: var(--card); border-radius: 12px; padding: 24px; width: 360px; max-width: 100%; max-height: 90vh; overflow-y: auto; }
.modal input { width: 100%; margin-bottom: 10px; }
.modal h3 { margin-bottom: 14px; font-size: 15px; }
.modal label { display: block; margin-top: 10px; }
.modal label.meta { font-size: 12px; }

/* ============ 响应式：手机/平板适配 ============ */
@media (max-width: 860px) {
  #topbar { height: auto; min-height: 52px; padding: 8px 12px; flex-wrap: wrap; gap: 8px 14px; }
  #topbar .logo { font-size: 14px; }
  #topbar .who { margin-left: auto; font-size: 12px; }
  #topbar nav { order: 3; flex-basis: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 2px; padding-bottom: 2px; }
  #topbar nav a { white-space: nowrap; padding: 6px 11px; font-size: 13px; }
  #content { padding: 12px; }
  h2 { font-size: 15px; }
  .login-box { width: min(320px, calc(100vw - 24px)); padding: 26px 20px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
  .card { padding: 12px; }
  .editor-wrap { flex-direction: column; }
  #stage-box { width: 100%; }
  #item-panel { width: 100%; }
  .send-grid .card { min-width: 0; width: 100%; }
  .paircode { font-size: 20px; letter-spacing: 4px; }
}
@media (max-width: 480px) {
  .grid, .media-grid { grid-template-columns: 1fr; }
  #topbar { gap: 6px 10px; }
  #topbar .who { display: none; }
  .login-box h1 { font-size: 16px; }
  .toolbar .btn { flex: 1 1 auto; }
  h2 { font-size: 14px; }
}
/* CHG-29-05：素材卡片四操作 + 详情弹窗 */
.asset-card { cursor: pointer; }
.asset-card:hover { border-color: var(--pri); }
.asset-meta-tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.asset-meta-tag { background: #eef3ff; color: #4a6fe3; border-radius: 4px; padding: 3px 8px; font-size: 12px; }
.asset-detail-body { background: #000; border-radius: 8px; min-height: 180px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.asset-detail-body img { max-width: 100%; max-height: 320px; display: block; }
.asset-detail-body video { width: 100%; max-height: 320px; }

/* CHG-29-05：投放编辑布局对齐小程序（名称同行 / 重复规则右对齐 / 选择器居中固定宽 / 字段级提示） */
.ce-row { display: flex; align-items: center; gap: 10px; margin: 8px 0 4px; }
.ce-row > .meta { flex: 0 0 72px; margin: 0; }
.ce-row > input { flex: 1; margin: 0; }
.ce-row > .check-item { margin: 0; }
.ce-rule-val { margin-left: auto; color: #4a6fe3; font-size: 12.5px; text-align: right; }
.ce-date-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 8px 0 2px; }
.ce-date-row input { width: 150px; flex: 0 0 150px; margin: 0; text-align: center; }
.ce-field-error { color: var(--bad); font-size: 12px; min-height: 4px; margin: 2px 0; }

/* CHG-30-01：投放屏幕/节目摘要行 + 同页两段选择弹窗 */
.ce-pick-row { display:flex; align-items:center; gap:8px; padding:9px 10px; border:1px solid var(--line); border-radius:6px; margin:8px 0 2px; cursor:pointer; }
.ce-pick-row:hover { border-color:var(--pri); }
.ce-pick-row > .meta { margin:0; flex:0 0 auto; }
.ce-pick-val { margin-left:auto; text-align:right; color:var(--pri); font-size:13px; }
.ce-pick-val.ph { color:var(--sub); }
.ce-arrow { color:var(--sub); font-size:16px; }
.pk-modal { width:560px; max-width:94vw; max-height:86vh; display:flex; flex-direction:column; padding:0; }
.pk-modal .pk-head { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:14px 18px; border-bottom:1px solid var(--line); flex:0 0 auto; }
.pk-modal .pk-head h3 { font-size:15px; margin:0; }
.pk-modal .pk-body { flex:1; overflow:auto; padding:0 18px 18px; }
.pk-sec-head { display:flex; align-items:center; justify-content:space-between; margin:14px 0 8px; font-size:13px; font-weight:600; }
.pk-sec-head .btn { font-size:12px; padding:3px 10px; }
.pk-cards { display:flex; flex-wrap:wrap; gap:10px; }
.pk-add { width:82px; height:100px; border:1px dashed var(--sub); border-radius:8px; display:flex; align-items:center; justify-content:center; font-size:26px; color:var(--sub); }
.pk-card { width:82px; height:100px; border:1px solid var(--line); border-radius:8px; padding:6px; position:relative; overflow:hidden; }
.pk-card-x { position:absolute; right:4px; top:0; color:var(--sub); font-size:15px; cursor:pointer; z-index:2; }
.pk-card-thumb { width:100%; height:48px; border-radius:5px; background:#f1f4f8; display:flex; align-items:center; justify-content:center; color:var(--sub); font-size:22px; object-fit:cover; }
.pk-card-name { display:block; font-size:11px; margin-top:4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pk-card-desc { display:block; font-size:10px; color:var(--sub); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pk-card-order { position:absolute; left:8px; top:7px; z-index:2; font-size:9px; color:#fff; background:rgba(0,0,0,.45); border-radius:3px; padding:1px 4px; }
.pk-list { display:flex; flex-direction:column; gap:6px; }
.pk-item { display:flex; align-items:center; flex-wrap:wrap; gap:6px; padding:8px 10px; border:1px solid var(--line); border-radius:6px; cursor:pointer; }
.pk-item:hover { border-color:var(--pri); }
.pk-item.on { border-color:var(--pri); background:#eef4fb; }
.pk-item.dis { opacity:.55; }
.pk-item-name { font-size:13px; flex:1; }
.pk-item-desc { font-size:11px; color:var(--sub); width:100%; padding-left:14px; }
.pk-mode { display:flex; gap:8px; margin:12px 0 8px; }

/* 输入框在 iOS 上防止缩放（字号≥16px） */
@media (max-width: 860px) {
  input, select, textarea { font-size: 16px; }
  #item-panel input, #item-panel select { font-size: 16px; }
}
