/* Omnio AI — Chatbot Widget */

#omnio-chat-widget * { box-sizing:border-box; font-family:system-ui, -apple-system, sans-serif; }

/* Bouton flottant */
#omnio-fab {
  position:fixed; bottom:24px; right:24px; z-index:9998;
  width:56px; height:56px; border-radius:50%;
  background:var(--omnio-primary, #1a1a2e); color:#fff; border:none; cursor:pointer;
  box-shadow:0 4px 16px rgba(0,0,0,.3); font-size:24px;
  display:flex; align-items:center; justify-content:center;
  transition:transform .2s, box-shadow .2s;
}
#omnio-fab:hover { transform:scale(1.08); box-shadow:0 6px 20px rgba(0,0,0,.4); }
#omnio-fab[aria-expanded="true"] #omnio-fab-icon-open  { display:none; }
#omnio-fab[aria-expanded="false"] #omnio-fab-icon-close { display:none; }

/* Fenêtre chat */
#omnio-chat-window {
  position:fixed; bottom:90px; right:24px; z-index:9999;
  width:360px; max-width:calc(100vw - 48px);
  height:520px; max-height:calc(100vh - 120px);
  background:#fff; border-radius:12px;
  box-shadow:0 8px 32px rgba(0,0,0,.25);
  display:flex; flex-direction:column; overflow:hidden;
  transform:scale(.9) translateY(20px); opacity:0;
  transition:transform .25s ease, opacity .25s ease;
  pointer-events:none;
}
#omnio-chat-window.omnio-open {
  transform:scale(1) translateY(0); opacity:1; pointer-events:auto;
}

/* Header */
#omnio-chat-header {
  background:var(--omnio-primary, #1a1a2e); color:#fff; padding:12px 16px;
  display:flex; align-items:center; justify-content:space-between;
  flex-shrink:0;
}
#omnio-chat-header .omnio-agent-name { font-weight:600; font-size:15px; }
#omnio-chat-header .omnio-status { font-size:11px; color:#a0aec0; }
#omnio-chat-header-actions { display:flex; align-items:center; gap:2px; }
#omnio-chat-expand, #omnio-chat-close {
  background:transparent; border:none; color:#fff; cursor:pointer;
  font-size:15px; line-height:1; padding:4px 5px; border-radius:4px;
}
#omnio-chat-expand:hover, #omnio-chat-close:hover { background:rgba(255,255,255,.15); }

/* Fenêtre agrandie */
#omnio-chat-window.omnio-expanded {
  width:520px;
  height:calc(100vh - 120px);
}

/* Markdown dans les réponses agent */
.omnio-msg-agent ul, .omnio-msg-agent ol { margin:4px 0; padding-left:18px; }
.omnio-msg-agent li { margin:2px 0; }
.omnio-msg-agent pre { background:#f4f4f5; padding:8px 10px; border-radius:6px; overflow-x:auto; margin:4px 0; white-space:pre; }
.omnio-msg-agent pre code { font-size:12px; background:none; padding:0; font-family:monospace; }
.omnio-msg-agent code { background:#f0f0f5; padding:1px 5px; border-radius:3px; font-size:0.88em; font-family:monospace; }
.omnio-msg-agent a { color:var(--omnio-primary, #1a1a2e); text-decoration:underline; word-break:break-all; }
.omnio-msg-agent hr { border:none; border-top:1px solid #e0e0e5; margin:6px 0; }

/* Messages */
#omnio-chat-messages {
  flex:1; overflow-y:auto; padding:12px;
  display:flex; flex-direction:column; gap:8px;
  scroll-behavior:smooth;
}
#omnio-chat-messages::-webkit-scrollbar { width:4px; }
#omnio-chat-messages::-webkit-scrollbar-thumb { background:#ddd; border-radius:2px; }

.omnio-msg-bubble {
  max-width:80%; padding:10px 14px; border-radius:16px;
  font-size:14px; line-height:1.5; word-wrap:break-word;
}
.omnio-msg-user  { background:#e9f0fb; align-self:flex-end; border-bottom-right-radius:4px; }
.omnio-msg-agent { background:#f0f0f5; align-self:flex-start; border-bottom-left-radius:4px; }
.omnio-msg-system { background:#fffbe6; align-self:center; font-size:12px; color:#856404;
  border-radius:8px; padding:6px 12px; text-align:center; }

/* Typing indicator */
.omnio-typing { align-self:flex-start; }
.omnio-typing-dots { display:flex; gap:4px; padding:10px 14px; }
.omnio-typing-dots span {
  width:8px; height:8px; background:#aaa; border-radius:50%;
  animation:omnio-bounce .9s infinite ease-in-out;
}
.omnio-typing-dots span:nth-child(2) { animation-delay:.2s; }
.omnio-typing-dots span:nth-child(3) { animation-delay:.4s; }
@keyframes omnio-bounce { 0%,80%,100%{transform:translateY(0)} 40%{transform:translateY(-8px)} }

/* Input */
#omnio-chat-input-row {
  padding:7px 10px; border-top:1px solid #e8e8e8;
  display:flex; gap:8px; align-items:flex-end; flex-shrink:0;
}
#omnio-chat-input {
  flex:1; border:1px solid #c3c4c7; border-radius:16px;
  padding:5px 12px; font-size:13px; resize:none; max-height:70px;
  line-height:1.4; outline:none; transition:border-color .2s;
  color:#1a1a2e; background:#fff;
}
#omnio-chat-input:focus { border-color:var(--omnio-primary, #1a1a2e); }
#omnio-chat-send {
  width:30px; height:30px; border-radius:50%; background:var(--omnio-primary, #1a1a2e); color:#fff;
  border:none; cursor:pointer; font-size:14px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  transition:background .2s;
}
#omnio-chat-send:hover { background:#2d2d54; }
#omnio-chat-send:disabled { background:#aaa; cursor:not-allowed; }

/* Footer */
#omnio-chat-footer {
  padding:6px 12px; text-align:center; font-size:10px; color:#bbb;
  border-top:1px solid #f0f0f1; flex-shrink:0;
}

/* Mobile */
@media (max-width:480px) {
  #omnio-chat-window { width:100vw; max-width:100vw; right:0; bottom:0; border-radius:16px 16px 0 0; height:75vh; }
  #omnio-chat-window.omnio-expanded { width:100vw; height:100vh; bottom:0; right:0; border-radius:0; max-height:100vh; }
  #omnio-fab { bottom:16px; right:16px; }
}
