/* ============================================================
   AI CHAT — (tách từ style.css, dòng 2902-2966)
   ============================================================ */

/* ---------- AI chat panel ---------- */
.ai-panel {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(3,5,9,0.72);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 1px 0;
}
.ai-panel[hidden], .ai-panel.hidden { display: none !important; }
.ai-card {
  width: min(420px, 100vw);
  height: calc(100vh - 76px);
  background: var(--bg-deep);
  border: 1px solid rgba(126,166,224,0.28);
  border-radius: 18px 18px 0 0;
  box-shadow: none;
  display: flex; flex-direction: column;
  overflow: hidden;
}
html[data-theme="light"] .ai-card { background: #f8f2e1; border-color: rgba(111,88,48,0.16); }
.ai-head {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 16px; border-bottom: 1px solid rgba(126,166,224,0.18);
  background: rgba(255,255,255,0.03);
}
.ai-title { font-weight: 800; font-size: 14.5px; color: var(--text-main); letter-spacing: .3px; flex: 1; }
.ai-close { background: rgba(244,63,94,.12); border: 1px solid rgba(244,63,94,.3); color: #fb7185; width: 30px; height: 30px; border-radius: 9px; cursor: pointer; font-size: 14px; }
html[data-theme="light"] .ai-close { background: rgba(220,38,38,.08); color: #dc2626; }
.ai-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-msg {
  max-width: 85%; padding: 9px 13px; border-radius: 13px;
  font-size: 13.5px; line-height: 1.55; word-break: break-word; white-space: pre-wrap;
}
.ai-msg-bot { align-self: flex-start; background: rgba(126,166,224,0.12); color: var(--text-main); border-bottom-left-radius: 4px; }
.ai-msg-user { align-self: flex-end; background: rgba(113,112,255,0.16); color: var(--text-main); border-bottom-right-radius: 4px; }
.ai-msg-typing { align-self: flex-start; color: var(--text-dim); font-style: italic; }
.ai-attachments { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 8px; }
.ai-attachments:empty { padding: 0; display: none; }
.ai-att-chip { display: inline-flex; align-items: center; gap: 5px; background: rgba(113,112,255,.12); border: 1px solid rgba(113,112,255,.3); color: var(--cyan); border-radius: 999px; padding: 4px 10px; font-size: 11.5px; font-weight: 700; }
.ai-att-chip button { background: none; border: none; color: inherit; cursor: pointer; font-size: 12px; padding: 0; }
.ai-input-row { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid rgba(126,166,224,0.18); align-items: flex-end; background: rgba(6,11,20,0.6); }
html[data-theme="light"] .ai-input-row { background: rgba(241,245,249,0.8); }
.ai-attach-btn { flex-shrink: 0; width: 40px; height: 40px; border-radius: 11px; background: rgba(113,112,255,.12); border: 1px solid rgba(113,112,255,.3); color: var(--cyan); font-size: 17px; cursor: pointer; }
.ai-input {
  flex: 1; min-width: 0; resize: none; max-height: 100px;
  background: rgba(15,22,38,0.9); color: var(--text-main);
  border: 1px solid rgba(76,110,160,0.45); border-radius: 11px;
  padding: 10px 13px; font-size: 14px; font-family: var(--font);
  outline: none; transition: border-color .15s;
}
.ai-input:focus { border-color: var(--cyan); }
html[data-theme="light"] .ai-input { background: #faf5e6; border-color: rgba(111,88,48,0.22); }
.ai-send { flex-shrink: 0; width: 44px; height: 40px; border-radius: 11px; border: none; background: var(--cyan); color: #fff; font-size: 16px; cursor: pointer; }
.ai-send:disabled { opacity: .5; cursor: wait; }

/* AI: nút session + giới hạn chiều cao khung chat */
.ai-sess-btn {
  background: rgba(113,112,255,.10); border: 1px solid rgba(113,112,255,.32);
  color: var(--cyan); border-radius: 999px; padding: 4px 11px;
  font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.ai-sess-btn:active { transform: scale(.95); }
html[data-theme="light"] .ai-sess-btn { color: #0369a1; border-color: rgba(3,105,161,.35); }
.ai-card { max-height: 514px; height: 514px; }
.ai-messages { max-height: calc(514px - 170px); }

