/* Assistant IA — widget flottant. */

.ai-bubble {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 0;
  background: var(--sk-accent-dark);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 28px rgba(0,0,0,.15), 0 2px 6px rgba(0,0,0,.10);
  z-index: 999;
  transition: transform .15s, box-shadow .15s;
}
.ai-bubble:hover { transform: scale(1.05); box-shadow: 0 10px 32px rgba(0,0,0,.20); }
.ai-bubble:active { transform: scale(.96); }
.ai-bubble svg { opacity: 0.95; }

.ai-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 380px;
  max-width: calc(100vw - 44px);
  height: 560px;
  max-height: calc(100vh - 44px);
  background: var(--sk-bg);
  border: 1px solid var(--sk-line-strong);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.18), 0 4px 12px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
  z-index: 999;
  overflow: hidden;
  font-family: var(--sk-font-ui);
}

.ai-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--sk-line);
  background: var(--sk-paper);
}
.ai-panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  font-size: 14px;
  color: var(--sk-ink);
}
.ai-panel-title svg { color: var(--sk-accent-dark); }
.ai-panel-model {
  color: var(--sk-muted);
  font-size: 11.5px;
  font-weight: 400;
}
.ai-panel-actions { display: flex; gap: 4px; }

.ai-icon-btn {
  width: 28px; height: 28px;
  border: 0;
  background: transparent;
  color: var(--sk-muted);
  cursor: pointer;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.ai-icon-btn:hover { background: var(--sk-paper-hover); color: var(--sk-ink); }

.ai-panel-thread {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-panel-empty {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  gap: 14px;
  color: var(--sk-muted);
}
.ai-panel-empty p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  max-width: 280px;
}

.ai-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
}
.ai-suggestion {
  background: var(--sk-paper);
  border: 1px solid var(--sk-line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--sk-ink);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.4;
}
.ai-suggestion:hover { background: var(--sk-paper-hover); border-color: var(--sk-line-strong); }

.ai-msg {
  display: flex;
  max-width: 90%;
}
.ai-msg-user { align-self: flex-end; }
.ai-msg-bot { align-self: flex-start; }
.ai-msg-content {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.ai-msg-user .ai-msg-content {
  background: var(--sk-accent-dark);
  color: #fff;
}
.ai-msg-bot .ai-msg-content {
  background: var(--sk-paper);
  color: var(--sk-ink);
  border: 1px solid var(--sk-line);
}

.ai-typing {
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  background: var(--sk-paper);
  border: 1px solid var(--sk-line);
  border-radius: 14px;
}
.ai-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--sk-muted);
  animation: ai-typing-bounce 1.2s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing span:nth-child(3) { animation-delay: 0.30s; }
@keyframes ai-typing-bounce {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-3px); }
}

.ai-panel-input {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--sk-line);
  background: var(--sk-bg);
}
.ai-textarea {
  flex: 1 1 auto;
  resize: none;
  border: 1px solid var(--sk-line);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  background: var(--sk-paper);
  color: var(--sk-ink);
  min-height: 36px;
  max-height: 140px;
  overflow-y: auto;
}
.ai-textarea:focus {
  outline: 2px solid var(--sk-accent-soft);
  border-color: var(--sk-accent);
}
.ai-panel-input button.btn {
  align-self: flex-end;
  height: 36px;
  padding: 0 14px;
}

@media (max-width: 720px) {
  .ai-panel {
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
    height: calc(100vh - 80px);
  }
  .ai-bubble { right: 12px; bottom: 12px; }
}
