/* ui-panels.css — 群信息面板、设置页控件、提示条与弹层；手机端组件差异（由 components.css 按顺序拆出，层叠顺序不变） */
/* ---------- 群信息面板 ---------- */
.info-head {
  height: var(--head-h); flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  padding: env(safe-area-inset-top) 8px 0;
  box-sizing: content-box;
  border-bottom: 1px solid var(--border);
}
.info-head h2 { flex: 1; font-size: 17px; font-weight: 600; }
.info-profile { display: flex; flex-direction: column; align-items: center; padding: 24px 16px 18px; text-align: center; }
.info-profile h3 { margin-top: 14px; font-size: 20px; font-weight: 600; }
.info-profile p { margin-top: 2px; font-size: 14px; color: var(--text-2); }
.info-rows { padding: 0 8px 8px; border-bottom: 8px solid var(--bg-soft); }
.info-row { display: flex; align-items: center; gap: 18px; min-height: 56px; padding: 8px 12px; border-radius: var(--radius); }
.info-row > .ti { color: var(--text-2); }
.info-row > div { flex: 1; min-width: 0; }
.ir-sub { font-size: 13px; color: var(--text-2); }
.toggle-row { cursor: pointer; }
.toggle-row:hover { background: var(--bg-hover); }

.switch {
  appearance: none; -webkit-appearance: none;
  width: 38px; height: 22px; margin: 0; flex-shrink: 0;
  border-radius: 11px; background: var(--badge-muted);
  position: relative; cursor: pointer; transition: background .15s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .15s;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.switch:disabled { opacity: .5; cursor: not-allowed; }

.tabs {
  position: sticky; top: 0; z-index: 2;
  display: flex; overflow-x: auto;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1; flex-shrink: 0; white-space: nowrap; height: 48px; padding: 0 14px; position: relative; color: var(--text-2); font-weight: 500; font-size: 14px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); }
.tab.active::after { content: ""; position: absolute; left: 20%; right: 20%; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.tab-panel { display: none; padding: 6px 8px 12px; }
.tab-panel.active { display: block; }

.member-list li, .file-list li {
  display: flex; align-items: center; gap: 14px;
  min-height: 60px; padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
}
.member-list li:hover, .file-list li:hover { background: var(--bg-hover); }
.m-body { flex: 1; min-width: 0; }
.m-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-sub { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-sub.online { color: var(--accent); }
:root[data-online="off"] .m-sub.online { color: var(--text-2); }
.role { font-size: 13px; color: var(--text-2); flex-shrink: 0; }
.bot-tag {
  display: inline-block; margin-left: 4px; padding: 0 6px;
  font-size: 11px; line-height: 18px; font-weight: 600;
  border-radius: 4px; color: var(--accent); background: var(--accent-soft);
  vertical-align: 2px;
}
.file-list .file-icon { width: 44px; height: 44px; border-radius: 10px; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding-top: 2px; }
.mg { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 4px; color: rgba(255, 255, 255, .85); overflow: hidden; }
.mg img { width: 100%; height: 100%; object-fit: cover; }
.mg .ti { font-size: 26px; }
.m1 { background: #5d97cc; } .m2 { background: #4f9e85; } .m3 { background: #d1994d; } .m4 { background: #7d8d9c; }

/* ---------- 设置页 ---------- */
.set-head {
  height: var(--head-h); flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  padding: env(safe-area-inset-top) 8px 0;
  box-sizing: content-box;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.set-head h2 { flex: 1; font-size: 17px; font-weight: 600; padding-left: 4px; }
.set-cat {
  width: 100%; min-height: 52px; padding: 0 12px;
  display: flex; align-items: center; gap: 14px;
  border-radius: var(--radius); text-align: left;
}
.set-cat > .ti:first-child {
  width: 32px; height: 32px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); color: #fff; font-size: 19px;
}
.set-cat span { flex: 1; font-weight: 500; }
.set-cat .chev { color: var(--text-3); font-size: 18px; }
.set-cat:hover { background: var(--bg-hover); }
.set-cat.active { background: var(--accent-soft); }
.set-cat.active span { color: var(--accent); }
.set-foot {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-3);
}

.set-group { background: var(--bg); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.set-group-title { font-size: 13px; font-weight: 600; color: var(--accent); padding: 14px 16px 2px; }
.set-group-note { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); padding: 2px 16px 6px; }
.set-group-note .ti { font-size: 14px; }
.set-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px;
  min-height: 56px; padding: 10px 16px;
}
.set-row + .set-row { border-top: 1px solid var(--border); }
.set-row.stack { flex-direction: column; align-items: stretch; }
.sr-label { flex: 1; min-width: 140px; }
.sr-label small { display: block; font-size: 12px; color: var(--text-2); margin-top: 1px; }
.set-row.link { cursor: pointer; }
.set-row.link:hover { background: var(--bg-hover); }
.set-row.link > .ti:last-child { color: var(--text-3); font-size: 18px; }
.set-row > .ti:first-child { color: var(--text-2); }
.set-row select, .set-row .time-input {
  height: 36px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); outline: none;
}
.set-row select:focus, .set-row .time-input:focus { border-color: var(--accent); }
.set-row :disabled { opacity: .5; }
.time-input { width: 76px; text-align: center; font-variant-numeric: tabular-nums; }
.row-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 分段选择 */
.seg {
  display: inline-flex; flex-shrink: 0;
  padding: 3px; gap: 2px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.set-row.stack .seg { display: flex; }
.set-row.stack .seg button { flex: 1; }
.seg button {
  height: 32px; padding: 0 12px;
  border-radius: 6px;
  font-size: 14px; color: var(--text-2);
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.seg button:hover:not(:disabled) { color: var(--text); }
.seg button.active { background: var(--bg); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
:root[data-theme="dark"] .seg button.active { background: var(--bg-hover); }
.seg.locked { opacity: .55; }

/* 主色色块 */
.swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.swatches button {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--sw);
  box-shadow: inset 0 0 0 2px var(--bg), 0 0 0 2px transparent;
  transition: box-shadow .12s;
}
.swatches button.active { box-shadow: inset 0 0 0 3px var(--bg), 0 0 0 2px var(--sw); }
.color-pick {
  position: relative; height: 32px; padding: 0 10px 0 4px;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-2); cursor: pointer;
}
.color-pick input { width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; }
.color-pick.active { border-color: var(--accent); color: var(--accent); }

/* 聊天背景 */
.bg-tiles { display: flex; flex-wrap: wrap; gap: 12px; }
.bg-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-2); cursor: pointer;
}
.bg-tile .sw {
  width: 64px; height: 64px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  background-color: var(--chat-bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  background-size: auto;
}
.bg-tile.active .sw { border-color: var(--accent); }
.bg-tile.active { color: var(--accent); font-weight: 600; }
.bg-tile .sw.p-dots { background-image: url("../assets/bg/dots.svg"); }
.bg-tile .sw.p-grid { background-image: url("../assets/bg/grid.svg"); }
.bg-tile .sw.p-waves { background-image: url("../assets/bg/waves.svg"); }
.bg-tile .sw.p-upload { background-size: cover; background-position: center; border-style: dashed; border-color: var(--border-strong); }
.bg-tile.active .sw.p-upload { border-style: solid; border-color: var(--accent); }

/* 滑块 */
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type="range"] { flex: 1; min-width: 0; height: 24px; }
.range-row output { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--accent); font-weight: 600; }
.range-row .r-min, .range-row .r-max { font-size: 12px; color: var(--text-3); }

/* 实时预览 */
.preview-box {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 12px; margin: 0 16px 14px;
  border-radius: var(--radius-sm);
  background-color: var(--chat-bg);
  background-image: var(--chat-pattern);
}
.preview-box .bubble { max-width: 80%; }

/* 存储条 */
.storage-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--bg-soft); }
.storage-bar i { display: block; height: 100%; }
.storage-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-2); }
.storage-legend span { display: inline-flex; align-items: center; gap: 6px; }
.storage-legend b { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.s-img { background: var(--accent); } .s-file { background: var(--c3); } .s-cache { background: var(--c4); }

/* 设备 */
.device { display: flex; align-items: center; gap: 14px; }
.device > .ti { width: 40px; height: 40px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); background: var(--bg-soft); color: var(--text-2); }
.device .m-sub .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--online); margin-right: 5px; vertical-align: 1px; }
.device .now { color: var(--online); }

.file-chip { font-size: 12px; color: var(--text-2); max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 提示条 / 弹层 ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 100;
  transform: translate(-50%, 10px);
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: rgba(20, 28, 36, .92); color: #fff; font-size: 14px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.modal {
  width: min(360px, calc(100vw - 32px));
  padding: 20px; border: 0;
  border-radius: var(--radius);
  background: var(--bg); color: var(--text);
  box-shadow: var(--shadow);
}
.modal::backdrop { background: var(--overlay); }
.modal h3 { font-size: 17px; margin-bottom: 8px; }
.modal p { font-size: 14px; color: var(--text-2); margin-bottom: 18px; line-height: 1.6; }
.modal .modal-actions { display: flex; justify-content: flex-end; }

/* ==========================================================
   手机（< 900px）组件差异
   ========================================================== */
@media (width < 900px) {
  .chat-head { padding: env(safe-area-inset-top) 4px 0; }
  .back-btn { display: inline-flex; }
  .chat-title { padding: 0 2px; gap: 10px; }
  .head-actions .icon-btn:first-child { display: none; }

  .bubble { max-width: 80%; }
  .bubble.media { width: 80%; }
  .bubble.media.gif { width: 56%; }

  .composer { padding: 6px 8px 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); gap: 4px; }
  .composer > .icon-btn, .send-btn { width: 46px; height: 46px; }
  .composer-input { min-height: 46px; }
  .composer-input textarea { height: 46px; padding: 12px 0; }
  .composer-input .icon-btn { margin-bottom: 5px; }
  .send-hint { display: none; }

  /* 面板：底部抽屉——占据键盘位置，把输入栏顶上去，按钮始终可点 */
  .composer-wrap { display: flex; flex-direction: column; }
  .composer-wrap .composer { order: 1; }
  .picker {
    position: static; order: 2;
    width: auto; height: 50vh; height: 50dvh;
    border-radius: var(--radius) var(--radius) 0 0;
    border-width: 1px 0 0;
    box-shadow: none;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .composer-wrap:has(.picker.open) .composer { padding-bottom: 8px; }

  .set-row.stack-m { flex-direction: column; align-items: stretch; }
  .set-row.stack-m .seg { display: flex; }
  .set-row.stack-m .seg button { flex: 1; }
  .bg-tiles { gap: 8px; justify-content: space-between; }
  .bg-tile .sw { width: 56px; height: 56px; }
  .set-cat { min-height: 56px; }
}
/* 群文件页（chat/shared.js） */
.mg { position: relative; background: var(--bg-hover, rgba(0,0,0,.05)); }
.mg .mg-play { position: absolute; font-size: 26px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.4); }
.shared-more { display: block; margin: 10px auto; }
.shared-empty { text-align: center; padding: 32px 16px; color: var(--text-2, #707579); font-size: 14px; }
.file-list li .icon-btn { margin-left: auto; flex-shrink: 0; }
