
/* ── Variables ── */
:root {
  --ha-primary: #4f46e5;
  --ha-primary-light: #6366f1;
  --ha-primary-pale: #e0e7ff;
  --ha-dark: #0f172a;
  --ha-warm: #1e293b;
  --ha-surface: #334155;
  --ha-border: rgba(79,70,229,0.15);
  --ha-text: #f1f5f9;
  --ha-muted: rgba(241,245,259,0.55);
  --ha-radius: 16px;
}

* {
  box-sizing: border-box;
}

/* ── Bouton flottant ── */
#ha-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(145deg, #4f46e5 0%, #4338ca 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(79,70,229,0.45);
  z-index: 9998;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s;
  color: #fff;
  font-size: 24px;
}

#ha-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 10px 32px rgba(79,70,229,0.6);
}

/* ── Fenêtre principale ── */
#ha-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 380px;
  height: 580px;
  background: var(--ha-dark);
  border-radius: var(--ha-radius);
  border: 1px solid var(--ha-border);
  box-shadow: 0 24px 60px rgba(0,0,0,0.45), 0 8px 20px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity .28s ease, transform .28s cubic-bezier(.34,1.2,.64,1);
}

#ha-window.ha-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── En-tête ── */
#ha-header {
  background: var(--ha-warm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--ha-border);
  flex-shrink: 0;
}

#ha-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ha-primary) 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

#ha-header-info {
  flex: 1;
}

#ha-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ha-primary-light);
}

#ha-status {
  font-size: 11px;
  color: var(--ha-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

#ha-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  animation: ha-pulse 2.4s ease-in-out infinite;
}

@keyframes ha-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

#ha-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ha-muted);
  padding: 4px;
  border-radius: 6px;
  font-size: 18px;
  transition: color .15s;
}

#ha-close-btn:hover {
  color: var(--ha-text);
}

/* ── Chips ── */
#ha-chips {
  padding: 9px 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--ha-border);
  background: var(--ha-surface);
  flex-shrink: 0;
  overflow-y: auto;
  max-height: 80px;
}

.ha-chip {
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--ha-border);
  background: transparent;
  color: var(--ha-primary-light);
  cursor: pointer;
  transition: background .18s, border-color .18s;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}

.ha-chip:hover {
  background: rgba(79,70,229,0.12);
  border-color: var(--ha-primary);
}

/* ── Messages ── */
#ha-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  scroll-behavior: smooth;
}

.ha-msg {
  display: flex;
  gap: 8px;
  animation: ha-fadeup 0.28s ease both;
}

@keyframes ha-fadeup {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.ha-msg.ha-bot {
  align-self: flex-start;
  max-width: 90%;
}

.ha-msg.ha-user {
  align-self: flex-end;
  max-width: 86%;
  flex-direction: row-reverse;
}

.ha-msg-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ha-primary), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 2px;
}

.ha-bubble {
  padding: 9px 13px;
  font-size: 13.5px;
  line-height: 1.58;
  color: var(--ha-text);
}

.ha-msg.ha-bot .ha-bubble {
  background: rgba(79,70,229,0.08);
  border: 1px solid var(--ha-border);
  border-radius: 4px 13px 13px 13px;
}

.ha-msg.ha-user .ha-bubble {
  background: rgba(79,70,229,0.18);
  border: 1px solid rgba(79,70,229,0.3);
  border-radius: 13px 4px 13px 13px;
  color: var(--ha-primary-pale);
}

/* ── Input Area ── */
#ha-input-area {
  padding: 10px 12px;
  border-top: 1px solid var(--ha-border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--ha-warm);
  flex-shrink: 0;
}

#ha-input {
  flex: 1;
  background: var(--ha-surface);
  border: 1px solid var(--ha-border);
  border-radius: 10px;
  padding: 9px 13px;
  color: var(--ha-text);
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  resize: none;
  outline: none;
  min-height: 40px;
  max-height: 88px;
  line-height: 1.45;
  transition: border-color .2s;
}

#ha-input:focus {
  border-color: rgba(79,70,229,0.5);
}

#ha-input::placeholder {
  color: var(--ha-muted);
}

#ha-send {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--ha-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .18s, transform .15s;
  flex-shrink: 0;
  color: #fff;
  font-size: 16px;
}

#ha-send:hover {
  background: var(--ha-primary-light);
}

#ha-send:active {
  transform: scale(0.95);
}

#ha-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ── Footer ── */
#ha-footer {
  text-align: center;
  font-size: 10.5px;
  color: var(--ha-muted);
  padding: 6px 12px 9px;
  background: var(--ha-warm);
  border-top: 1px solid var(--ha-border);
  flex-shrink: 0;
}

#ha-footer a {
  color: var(--ha-primary);
  text-decoration: none;
  cursor: pointer;
}

#ha-footer a:hover {
  text-decoration: underline;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  #ha-window {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 92vh;
    border-radius: 20px 20px 0 0;
  }
  #ha-toggle {
    bottom: 20px;
    right: 20px;
  }
}





