/* assistant.css — 平台助理浮動面板（v32）
   z-index 分配：sidebar 40 < 助理 90 < modal 100 < tour 150-152 < toast 200
   刻意低於 modal 與 tour：助理是常駐輔助工具，不應蓋住當前焦點操作或功能導引。 */

/* ── 側邊標籤（收合狀態）──
   原本是右下角浮動圓鈕，會蓋住頁面右下角的操作按鈕（例如精靈表單的「下一步」）。
   改為貼齊畫面右緣、垂直置中的側邊標籤，不佔用頁面下緣空間。 */
.asst-fab {
  position: fixed; right: 0; top: 50%; z-index: 90;
  transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 9px;
  background: var(--primary); color: var(--primary-foreground);
  border: none; border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  box-shadow: -3px 0 14px rgba(0, 0, 0, .18);
  cursor: pointer;
  transition: background .15s ease, padding-right .15s ease;
}
.asst-fab:hover { background: var(--primary-hover); padding-right: 13px; }
.asst-fab.hidden { display: none; }
.asst-fab-label {
  writing-mode: vertical-rl; text-orientation: mixed;
  font-size: 13px; font-weight: 700; letter-spacing: .1em;
}
.asst-fab-arrow { font-size: 10px; line-height: 1; opacity: .85; }

/* ── 面板 ── */
.asst-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 90;
  width: 400px; max-width: calc(100vw - 32px);
  height: 620px; max-height: calc(100vh - 48px);
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column; overflow: hidden;
  animation: asst-rise .18s ease;
}
.asst-panel.hidden { display: none; }
@keyframes asst-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.asst-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--sidebar-from) 0%, var(--sidebar-to) 100%);
  color: #fff; flex-shrink: 0;
}
.asst-header-title { font-weight: 600; font-size: 15px; }
.asst-header-sub { font-size: 11px; opacity: .75; margin-top: 1px; }
.asst-close { color: #fff; font-size: 20px; line-height: 1; padding: 0 4px; opacity: .8; }
.asst-close:hover { opacity: 1; }

/* ── 分頁切換 ── */
.asst-tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.asst-tab {
  flex: 1; padding: 9px 4px; font-size: 13px; color: var(--muted-foreground);
  border-bottom: 2px solid transparent; background: var(--muted);
}
.asst-tab:hover { background: var(--muted-hover); color: var(--foreground); }
.asst-tab.active {
  color: var(--primary); border-bottom-color: var(--primary);
  background: var(--card); font-weight: 600;
}

/* ── 內容區（三個分頁共用捲動容器）── */
.asst-body { flex: 1; overflow-y: auto; padding: 14px; }
.asst-pane.hidden { display: none; }

/* ── 訊息 ── */
.asst-msg { margin-bottom: 12px; display: flex; }
.asst-msg-user { justify-content: flex-end; }
.asst-bubble {
  max-width: 86%; padding: 9px 12px; border-radius: var(--radius);
  font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word;
}
.asst-msg-bot  .asst-bubble { background: var(--muted); color: var(--foreground); border: 1px solid var(--border); }
.asst-msg-user .asst-bubble { background: var(--primary); color: var(--primary-foreground); }

.asst-bubble-note {
  margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border);
  font-size: 11px; color: var(--muted-foreground);
}

/* 回答附帶的行動按鈕 */
.asst-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.asst-action-btn {
  font-size: 12px; padding: 5px 10px; border-radius: var(--radius-full);
  background: var(--primary-soft); color: var(--primary-hover);
  border: 1px solid var(--ring); font-weight: 500;
}
.asst-action-btn:hover { background: var(--primary); color: var(--primary-foreground); }

/* 打字中 */
.asst-typing { display: flex; gap: 4px; padding: 4px 2px; }
.asst-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong);
  animation: asst-blink 1.2s infinite;
}
.asst-typing span:nth-child(2) { animation-delay: .2s; }
.asst-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes asst-blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

/* 快速提問建議 */
.asst-suggests { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.asst-suggest {
  font-size: 12px; padding: 6px 10px; border-radius: var(--radius-full);
  background: var(--card); border: 1px solid var(--border); color: var(--muted-foreground);
  text-align: left;
}
.asst-suggest:hover { border-color: var(--primary); color: var(--primary); }

/* ── 輸入區 ── */
.asst-input-row {
  display: flex; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--border); background: var(--card); flex-shrink: 0;
}
.asst-input {
  flex: 1; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 13.5px; max-height: 90px; min-height: 38px;
}
.asst-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.asst-send {
  padding: 0 16px; border-radius: var(--radius-sm);
  background: var(--primary); color: var(--primary-foreground); font-size: 13px; font-weight: 600;
}
.asst-send:hover:not(:disabled) { background: var(--primary-hover); }
.asst-send:disabled { background: var(--border-strong); }

/* ── 表單（回報問題）── */
.asst-field { margin-bottom: 12px; }
.asst-label { display: block; font-size: 12px; font-weight: 600; color: var(--foreground); margin-bottom: 4px; }
.asst-label .asst-req { color: var(--danger); margin-left: 2px; }
.asst-control {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 13px; background: var(--card);
}
.asst-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
textarea.asst-control { min-height: 110px; line-height: 1.6; }
.asst-hint { font-size: 11px; color: var(--muted-foreground); margin-top: 3px; line-height: 1.5; }
.asst-radio-row { display: flex; gap: 8px; }
.asst-radio {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--muted-foreground); background: var(--card);
}
.asst-radio:hover { border-color: var(--primary); }
.asst-radio.active {
  border-color: var(--primary); background: var(--primary-soft);
  color: var(--primary-hover); font-weight: 600;
}

/* 附件來源按鈕（擷取畫面 / 選擇檔案）*/
.asst-attach-row { display: flex; gap: 6px; }
.asst-attach-btn {
  flex: 1; padding: 9px 8px; font-size: 13px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  background: var(--card); color: var(--muted-foreground);
}
.asst-attach-btn:hover { border-color: var(--primary); border-style: solid; color: var(--primary); background: var(--primary-soft); }

.asst-files { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.asst-file {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; padding: 5px 8px; background: var(--muted);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.asst-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asst-file-del { color: var(--danger); font-size: 14px; line-height: 1; flex-shrink: 0; }

.asst-submit {
  width: 100%; padding: 10px; border-radius: var(--radius-sm);
  background: var(--primary); color: var(--primary-foreground); font-weight: 600; font-size: 14px;
}
.asst-submit:hover:not(:disabled) { background: var(--primary-hover); }
.asst-submit:disabled { background: var(--border-strong); }

/* ── 我的回報清單 ── */
.asst-report-item {
  width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card);
}
.asst-report-item:hover { border-color: var(--primary); background: var(--muted-hover); }
.asst-report-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.asst-report-no { font-size: 11px; color: var(--muted-foreground); font-family: ui-monospace, monospace; }
.asst-report-title { font-size: 13px; font-weight: 600; margin-top: 3px; line-height: 1.5; }
.asst-report-reply {
  margin-top: 6px; padding: 6px 8px; background: var(--primary-soft);
  border-radius: var(--radius-sm); font-size: 12px; line-height: 1.6; white-space: pre-wrap;
}
.asst-badge {
  font-size: 11px; padding: 2px 8px; border-radius: var(--radius-full);
  font-weight: 600; flex-shrink: 0;
}
.asst-badge-open        { background: #FEF3C7; color: #92400E; }
.asst-badge-in_progress { background: var(--primary-soft); color: var(--primary-hover); }
.asst-badge-resolved    { background: var(--success-soft); color: var(--success); }
.asst-badge-wont_fix    { background: var(--muted); color: var(--muted-foreground); }
.asst-badge-duplicate   { background: var(--muted); color: var(--muted-foreground); }

.asst-empty { text-align: center; color: var(--muted-foreground); font-size: 13px; padding: 32px 12px; line-height: 1.7; }

/* ── 小螢幕：面板改為近全螢幕 ── */
@media (max-width: 520px) {
  .asst-panel {
    right: 8px; left: 8px; bottom: 8px; width: auto;
    height: calc(100vh - 16px); max-height: none;
  }
  .asst-fab { padding: 12px 7px; gap: 6px; }
  .asst-fab-label { font-size: 12px; }
}
