/* Boutons flottants + assistant IA (site Devio Inc.) */

#di-fab-stack {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
  pointer-events: none;
}

#di-fab-stack > button {
  pointer-events: auto;
}

.di-fab {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 9999px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 10px 40px -12px hsl(0 0% 0% / 0.25);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease;
}

.di-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 44px -10px hsl(0 0% 0% / 0.3);
}

.di-fab:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

#di-scroll-top-btn {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  width: 3.5rem;
  height: 3.5rem;
  border-width: 2px;
}

#di-scroll-top-btn.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(220 70% 42%) 100%);
  color: hsl(var(--primary-foreground));
  border-color: transparent;
  box-shadow: 0 4px 14px hsl(220 70% 38% / 0.45), 0 14px 40px -10px hsl(0 0% 0% / 0.35);
}

#di-chat-launch-btn {
  background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(220 70% 42%) 100%);
  color: hsl(var(--primary-foreground));
  border-color: transparent;
}

#di-chat-panel {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  pointer-events: none;
}

#di-chat-panel[hidden] {
  display: none;
}

#di-chat-panel.is-open {
  pointer-events: auto;
}

#di-chat-backdrop {
  position: absolute;
  inset: 0;
  background: hsl(0 0% 0% / 0.45);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

#di-chat-panel.is-open #di-chat-backdrop {
  opacity: 1;
}

#di-chat-window {
  position: relative;
  width: min(100%, 22rem);
  max-height: min(32rem, 72vh);
  display: flex;
  flex-direction: column;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  box-shadow: 0 24px 80px -20px hsl(0 0% 0% / 0.35);
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

#di-chat-panel.is-open #di-chat-window {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.di-chat-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
  border-radius: 1rem 1rem 0 0;
  background: hsl(var(--muted) / 0.35);
}

.di-chat-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0;
}

.di-chat-close {
  border: none;
  background: transparent;
  padding: 0.35rem;
  border-radius: 0.375rem;
  cursor: pointer;
  color: hsl(var(--foreground));
  line-height: 0;
}

.di-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 10rem;
}

.di-chat-bubble {
  max-width: 92%;
  padding: 0.55rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.di-chat-bubble--user {
  align-self: flex-end;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.di-chat-bubble--assistant {
  align-self: flex-start;
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.di-chat-footnote {
  padding: 0 1rem 0.5rem;
  font-size: 0.7rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.35;
}

.di-chat-form {
  flex-shrink: 0;
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem 0.85rem;
  border-top: 1px solid hsl(var(--border));
}

.di-chat-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.875rem;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.di-chat-form button[type='submit'] {
  flex-shrink: 0;
  padding: 0.5rem 0.85rem;
  border-radius: 0.5rem;
  border: none;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

#di-cookie-banner {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 9997;
  max-width: 36rem;
  margin: 0 auto;
  padding: 1rem 1.15rem;
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  background: hsl(var(--surface) / 0.97);
  box-shadow: 0 16px 48px -16px hsl(0 0% 0% / 0.28);
  backdrop-filter: blur(8px);
}

#di-cookie-banner[hidden] {
  display: none;
}

#di-cookie-banner p {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: hsl(var(--text-secondary));
}

#di-cookie-banner .di-cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

#di-cookie-banner button,
#di-cookie-banner a.di-cookie-link {
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 0.5rem;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  text-decoration: none;
}

#di-cookie-accept {
  border: none;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

#di-cookie-reject {
  border: 1px solid hsl(var(--border));
  background: transparent;
  color: hsl(var(--foreground));
}

#di-cookie-more,
a.di-cookie-link {
  color: hsl(var(--primary));
}

#di-cookie-banner.is-with-fabs {
  bottom: 5.5rem;
}
