/* ============================================================
   鹅日历 · 共享 Agent 浮层（全站同一套）
   - 上浮在主页面之上，可手指上下拖动伸缩
   - 默认只占 1/5 屏；点右下角小鹅 Logo 循环升降
     1/5 → 2/5 → 3/5 → 4/5 → 3/5 → 2/5 → 1/5 → …
   - 多轮对话 agent 模式
   - 输入框左侧 📎 = 上传（菜单只有「上传文件」「上传图片」）
   ============================================================ */

/* 浮层遮罩（上传菜单用） */
.overlay { position: absolute; inset: 0; }

/* 浮层表面变量（深色外观下整体反转） */
:root { --as-sheet-bg: rgba(255, 255, 255, .97); }
[data-theme="dark"] { --as-sheet-bg: rgba(28, 28, 32, .92); }

/* ============ 底部 Agent 浮层 ============ */
.agent-sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 84px;
  background: var(--as-sheet-bg);
  -webkit-backdrop-filter: saturate(180%) blur(26px);
  backdrop-filter: saturate(180%) blur(26px);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-agent, 0 -8px 34px rgba(14, 17, 51, .14));
  z-index: 200;
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: height .34s cubic-bezier(.32, .72, 0, 1);
  will-change: height;
}
.agent-sheet.dragging { transition: none; }

/* 拖拽把手 */
.as-handle {
  height: 22px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: grab; touch-action: none;
}
.as-handle:active { cursor: grabbing; }
.as-handle span { width: 38px; height: 4.5px; border-radius: 3px; background: var(--divider-strong, #D3D6E0); }

/* 头部（1/5 屏时不占高度） */
.as-head {
  display: flex; align-items: center; gap: 9px;
  padding: 0 16px; height: 0; overflow: hidden; flex-shrink: 0;
  opacity: 0; transition: opacity .18s, height .24s;
}
.agent-sheet.expanded .as-head { height: 38px; padding-bottom: 8px; opacity: 1; }
.as-head .ah-name { font-size: 14.5px; font-weight: 750; letter-spacing: -.2px; }

/* 会话区 */
.as-conv {
  flex: 1; overflow-y: auto; padding: 2px 16px 8px;
  display: flex; flex-direction: column; gap: 10px;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.as-conv::-webkit-scrollbar { display: none; }

.msg { display: flex; gap: 8px; max-width: 100%; }
.msg.user { justify-content: flex-end; }
.msg .bubble {
  max-width: 78%; padding: 10px 13px; border-radius: 16px;
  font-size: 14px; line-height: 1.5; word-break: break-word;
  animation: msgIn .28s cubic-bezier(.2, .8, .3, 1);
}
@keyframes msgIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.msg.agent .bubble { background: var(--bg-primary, #F2F2F7); color: var(--text-primary); border-radius: 4px 16px 16px 16px; }
.msg.user .bubble { background: var(--primary); color: #fff; border-radius: 16px 4px 16px 16px; }
.msg .av {
  width: 28px; height: 28px; border-radius: 50%; background: var(--primary-10);
  display: flex; align-items: center; justify-content: center; color: var(--primary); flex-shrink: 0;
}
.msg .av svg { width: 15px; height: 18px; display: block; }

/* 本页动作按钮（小鹅消息卡片形态） */
.agent-acts {
  flex: 1; min-width: 0; max-width: 84%;
  display: flex; flex-direction: column; gap: 8px;
  animation: msgIn .3s cubic-bezier(.2, .8, .3, 1);
}
.agent-acts .rnd-btn.block { justify-content: center; text-align: center; font-size: 14px; }

/* agent 结果卡 */
.agent-card {
  background: var(--bg-secondary, #fff); border-radius: 14px; box-shadow: var(--shadow-sm, 0 1px 4px rgba(14, 17, 51, .07));
  padding: 12px 13px; max-width: 84%;
  animation: msgIn .3s cubic-bezier(.2, .8, .3, 1);
}
.agent-card .ac-head { display: flex; align-items: center; gap: 9px; }
.agent-card .ac-icon {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0;
}
.agent-card .ac-t { font-size: 14px; font-weight: 700; letter-spacing: -.15px; }
.agent-card .ac-s { font-size: 11.5px; color: var(--text-tertiary); margin-top: 2px; }
.agent-card .ac-grid {
  margin-top: 10px; padding-top: 10px; border-top: .5px solid var(--divider, rgba(60, 60, 67, .18));
  display: grid; grid-template-columns: 1fr 1fr; gap: 7px 10px;
}
.agent-card .ac-cell .k {
  font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: var(--text-tertiary);
}
.agent-card .ac-cell .v { font-size: 12.5px; font-weight: 600; margin-top: 1px; }
.agent-card .ac-actions { display: flex; gap: 7px; margin-top: 11px; }
.agent-card .ac-cell .v.wait { color: #9A9AA4; font-weight: 500; }
.agent-card .ac-note {
  margin-top: 10px; font-size: 11.5px; line-height: 1.45; color: var(--text-tertiary);
  background: rgba(120, 126, 148, .08); border-radius: 9px; padding: 7px 9px;
}
.agent-card .ac-note b { color: var(--primary); font-weight: 700; }

/* 输入区 */
.as-compose {
  flex-shrink: 0; display: flex; align-items: flex-end; gap: 7px;
  padding: 6px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: transparent;
}
.as-input {
  flex: 1; display: flex; align-items: center;
  background: var(--bg-primary, #F2F2F7); border-radius: 999px;
  padding: 10px 16px; min-height: 40px;
  transition: box-shadow .2s;
}
.as-input:focus-within { box-shadow: 0 0 0 2.5px var(--primary-15, rgba(10, 132, 255, .18)); background: var(--bg-tertiary, #fff); }
.as-input span { flex: 1; font-size: 14px; color: var(--text-placeholder); user-select: none; cursor: text; }
.as-input textarea {
  display: none; flex: 1; font-size: 14px; resize: none; max-height: 84px;
  line-height: 1.4; border: 0; outline: none; background: transparent; font-family: inherit;
}
.as-input.active span { display: none; }
.as-input.active textarea { display: block; }

.as-clip {
  width: 24px; height: 24px; flex-shrink: 0; margin-right: 8px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; cursor: pointer; padding: 0;
  color: var(--text-tertiary);
}
.as-clip svg { width: 17px; height: 17px; display: block; }
.as-clip:active { color: var(--primary); }
.as-clip:hover { color: var(--primary); }

/* 右下角小鹅 Logo：点一下循环升降对话窗口 */
.as-grow {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; padding: 7px;
  transition: transform .16s, background .2s;
  border: 0; cursor: pointer;
}
.as-grow:active { transform: scale(.93); }
.as-grow svg { width: 26px; height: 26px; display: block; }

.as-send {
  width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: #fff;
  display: none; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0;
  border: 0; cursor: pointer;
}
.as-compose.has-text .as-send { display: flex; }

/* 打字中 */
.typing { display: flex; gap: 5px; padding: 12px 14px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: #C2C6D2; animation: tp 1.2s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes tp { 0%, 80%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* 上传菜单（只有两项） */
#uploadMenu .rnd-row { cursor: pointer; }
#uploadMenu .rnd-row:active { background: var(--bg-tertiary); }

/* ============================================================
   浮层存在时：页面自身的底部固定栏跟随浮层高度避让
   （--agent-h 由 agent.js 实时写入，默认 1/5 屏）
   ============================================================ */
body.agent-on .bottom-dialog { bottom: var(--agent-h, 170px); }
body.agent-on .pl-footer { bottom: var(--agent-h, 170px); }
body.agent-on .wish-input-bar { margin-bottom: var(--agent-h, 170px); }
body.agent-on .pl-page,
body.agent-on .page-content { padding-bottom: calc(var(--agent-h, 170px) + 16px); }

#uploadMenu { bottom: calc(var(--agent-h, 170px) + 10px); }

/* 桌面端：收起态给出可展开提示 */
.agent-sheet::after {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: rgba(14, 17, 51, .06);
}
