/**
 * chatbot.css — assistant « Une question ? » (bouton flottant + panneau).
 * Sous la Bottom Sheet du panier (z-floating-cart < z-bottom-sheet) :
 * le panier garde toujours la priorité visuelle.
 */

.chatbot {
  position: fixed;
  right: var(--space-5);
  bottom: var(--space-5);
  z-index: var(--z-floating-cart);
  display: flex;
  /* column-reverse : le panneau (2e dans le DOM) s'empile AU-DESSUS du bouton */
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: var(--space-3);
}

/* --- Bouton flottant --- */

.chatbot__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: none;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-accent-orange), var(--color-accent-yellow));
  color: var(--color-text-on-accent);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard);
}

.chatbot__toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* --- Panneau --- */

.chatbot__panel {
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100vw - 2 * var(--space-5)));
  max-height: min(520px, 70vh);
  overflow: hidden;
  border: 1px solid var(--color-bg-surface-raised);
  border-radius: var(--radius-lg);
  background-color: var(--color-bg-surface);
  box-shadow: var(--shadow-lg);
  animation: chatbot-pop var(--duration-base) var(--ease-out-soft) both;
}

@keyframes chatbot-pop {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot__panel {
    animation: none;
  }
}

.chatbot__header {
  position: relative;
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(135deg, var(--color-accent-orange), var(--color-accent-yellow));
  color: var(--color-text-on-accent);
}

.chatbot__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
}

.chatbot__subtitle {
  font-size: var(--text-xs);
  opacity: 0.85;
}

.chatbot__close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-full);
  background-color: rgba(20, 16, 13, 0.15);
  color: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}

.chatbot__close:hover {
  background-color: rgba(20, 16, 13, 0.3);
}

/* --- Fil de discussion --- */

.chatbot__messages {
  flex: 1 1 auto;
  min-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-2);
}

.chatbot__bubble {
  max-width: 85%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.chatbot__bubble--bot {
  align-self: flex-start;
  border-radius: var(--radius-md) var(--radius-md) var(--radius-md) var(--radius-sm);
  background-color: var(--color-bg-surface-raised);
  color: var(--color-text-primary);
}

.chatbot__bubble--user {
  align-self: flex-end;
  border-radius: var(--radius-md) var(--radius-md) var(--radius-sm) var(--radius-md);
  background: linear-gradient(135deg, var(--color-accent-orange), var(--color-accent-yellow));
  color: var(--color-text-on-accent);
}

.chatbot__link {
  display: inline-block;
  margin-top: var(--space-2);
  color: var(--color-accent-yellow);
  font-weight: 600;
  text-decoration: underline;
}

/* --- Questions rapides : un élément du fil, elles défilent avec lui --- */

.chatbot__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  flex-shrink: 0;
}

.chatbot__chip {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-accent-yellow);
  border-radius: var(--radius-full);
  background: none;
  color: var(--color-accent-yellow);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
}

.chatbot__chip:hover {
  background-color: var(--color-accent-yellow);
  color: var(--color-text-on-accent);
}

/* --- Saisie libre --- */

.chatbot__form {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4) var(--space-4);
}

.chatbot__input {
  flex: 1 1 auto;
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-bg-surface-raised);
  border-radius: var(--radius-full);
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
}

.chatbot__input:focus-visible {
  outline: 2px solid var(--color-accent-yellow);
  outline-offset: 1px;
}

.chatbot__send {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-full);
  background-color: var(--color-accent-yellow);
  color: var(--color-text-on-accent);
  cursor: pointer;
}

.chatbot__send svg {
  width: 18px;
  height: 18px;
}

.chatbot__send:hover {
  background-color: var(--color-accent-yellow-hover);
}

/* --- Mobile : bouton compact, panneau bord à bord --- */

@media (max-width: 599px) {
  .chatbot {
    right: var(--space-4);
    bottom: var(--space-4);
  }

  .chatbot__toggle-label {
    display: none;
  }

  .chatbot__toggle {
    width: 52px;
    height: 52px;
    justify-content: center;
    padding: 0;
    font-size: var(--text-lg);
  }

  .chatbot__panel {
    width: calc(100vw - 2 * var(--space-4));
    max-height: 65vh;
  }
}
