/* Chatbot B&L Gourmet — Style conforme au design du site */

/* === Couleurs et variables (mêmes que le site) === */
:root {
  --chat-ink: #0a0807;
  --chat-cream: #f6efe2;
  --chat-gold: #e2b866;
  --chat-gold-hi: #f6dc9a;
  --chat-gold-lo: #a9742f;
  --chat-line: rgba(226, 184, 102, 0.22);
  --chat-text: #f2ebdd;
  --chat-muted: #b9ae9b;
  --chat-text-dark: #2a211a;
  --chat-radius: 18px;
  --chat-shadow: 0 10px 30px -12px rgba(226, 184, 102, 0.7);
}

/* === Bouton flottant === */
.chatbot-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--chat-gold);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--chat-shadow);
  z-index: 1000;
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1), 
              box-shadow 0.25s cubic-bezier(0.2, 0.7, 0.2, 1),
              background 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
  color: #0a0807;
}

.chatbot-toggle:hover {
  background: var(--chat-gold-hi);
  transform: scale(1.08);
  box-shadow: 0 16px 34px -12px rgba(226, 184, 102, 0.85);
}

.chatbot-toggle:focus-visible {
  outline: 2px solid var(--chat-gold-hi);
  outline-offset: 4px;
}

.chatbot-toggle svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chatbot-toggle[aria-expanded="true"] {
  background: var(--chat-ink);
  color: var(--chat-gold);
}

.chatbot-toggle[aria-expanded="true"] svg {
  stroke: var(--chat-gold);
}

/* === Fenêtre de chat === */
.chatbot-container {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: min(94vw, 380px);
  max-height: 70vh;
  background: var(--chat-cream);
  border-radius: var(--chat-radius);
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--chat-line);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.3s cubic-bezier(0.2, 0.7, 0.2, 1),
              transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1),
              visibility 0.3s;
  overflow: hidden;
}

.chatbot-container.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* En-tête de la fenêtre */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--chat-line);
  background: linear-gradient(180deg, rgba(246, 239, 226, 0.98), rgba(246, 239, 226, 0.95));
}

.chatbot-header h3 {
  margin: 0;
  font: 500 1.1rem/1 var(--serif);
  color: var(--chat-text-dark);
  font-style: italic;
}

.chatbot-close {
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--chat-gold-lo);
  transition: background 0.2s, color 0.2s;
  padding: 0;
}

.chatbot-close:hover {
  background: rgba(169, 116, 47, 0.12);
  color: var(--chat-gold);
}

.chatbot-close:focus-visible {
  outline: 2px solid var(--chat-gold);
  outline-offset: 2px;
}

.chatbot-close svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Corps du chat */
.chatbot-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 48vh;
}

/* Messages */
.chatbot-message {
  padding: 14px 18px;
  border-radius: 14px;
  line-height: 1.5;
  font-size: 0.94rem;
  max-width: 86%;
  word-wrap: break-word;
}

.chatbot-message.user {
  background: var(--chat-ink);
  color: var(--chat-text);
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.chatbot-message.bot {
  background: rgba(255, 255, 255, 0.4);
  color: var(--chat-text-dark);
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

.chatbot-message .typing-indicator {
  display: inline-block;
}

.chatbot-message .typing-indicator span {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--chat-gold);
  border-radius: 50%;
  margin: 0 2px;
  animation: typing-bounce 1.4s infinite ease-in-out;
}

.chatbot-message .typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.chatbot-message .typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
.chatbot-message .typing-indicator span:nth-child(3) { animation-delay: 0s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* Messages de bienvenue et suggestions */
.chatbot-welcome {
  text-align: center;
  padding: 12px 18px 16px;
}

.chatbot-welcome p {
  margin: 0;
  color: var(--chat-text-dark);
  font-size: 0.94rem;
}

.chatbot-quick-questions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 8px;
}

.chatbot-quick-question {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  background: var(--chat-ink);
  color: var(--chat-gold-hi);
  border-radius: 999px;
  font: 500 0.82rem/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, color 0.2s;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.chatbot-quick-question:hover {
  background: var(--chat-gold-lo);
  color: var(--chat-cream);
  transform: translateY(-2px);
}

.chatbot-quick-question:focus-visible {
  outline: 2px solid var(--chat-gold);
  outline-offset: 2px;
}

/* Zone de saisie */
.chatbot-footer {
  padding: 16px 18px 20px;
  border-top: 1px solid var(--chat-line);
  background: var(--chat-cream);
}

.chatbot-input-wrapper {
  display: flex;
  gap: 12px;
  align-items: center;
}

.chatbot-input {
  flex: 1;
  padding: 12px 18px;
  border: 1px solid var(--chat-line);
  border-radius: 999px;
  font: inherit;
  font-size: 0.94rem;
  color: var(--chat-text-dark);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.chatbot-input::placeholder {
  color: var(--chat-muted);
  opacity: 0.7;
}

.chatbot-input:focus {
  outline: none;
  border-color: var(--chat-gold);
  box-shadow: 0 0 0 3px rgba(226, 184, 102, 0.16);
}

.chatbot-send {
  background: var(--chat-gold);
  border: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--chat-ink);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.chatbot-send:hover {
  background: var(--chat-gold-hi);
  transform: scale(1.04);
}

.chatbot-send:disabled {
  background: var(--chat-line);
  color: var(--chat-muted);
  cursor: not-allowed;
  transform: none;
}

.chatbot-send:focus-visible {
  outline: 2px solid var(--chat-gold-hi);
  outline-offset: 2px;
}

.chatbot-send svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Backdrop pour fermer le chat */
.chatbot-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  transition: background 0.3s, opacity 0.3s;
}

.chatbot-backdrop.open {
  background: rgba(0, 0, 0, 0.4);
  opacity: 1;
  pointer-events: all;
}

/* === Responsive pour téléphone === */
@media (max-width: 500px) {
  .chatbot-container {
    width: min(96vw, 340px);
    bottom: 88px;
    right: 16px;
  }
  
  .chatbot-toggle {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }
  
  .chatbot-body {
    max-height: 52vh;
    padding: 16px;
  }
  
  .chatbot-message {
    font-size: 0.9rem;
    padding: 12px 14px;
  }
  
  .chatbot-header {
    padding: 14px 18px;
  }
  
  .chatbot-header h3 {
    font-size: 1rem;
  }
  
  .chatbot-footer {
    padding: 14px 16px 16px;
  }
  
  .chatbot-input {
    font-size: 0.9rem;
    padding: 10px 16px;
  }
  
  .chatbot-send {
    width: 40px;
    height: 40px;
  }
  
  .chatbot-quick-questions {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .chatbot-quick-question {
    font-size: 0.78rem;
    padding: 10px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot-container,
  .chatbot-toggle,
  .chatbot-message .typing-indicator span {
    animation: none !important;
    transition: none !important;
  }
}

/* === Accessibilité === */
@media (prefers-color-scheme: dark) {
  .chatbot-container {
    background: var(--chat-ink-2, #14100d);
    border-color: rgba(226, 184, 102, 0.18);
  }
  
  .chatbot-header {
    background: rgba(10, 8, 7, 0.98);
    border-color: rgba(226, 184, 102, 0.18);
  }
  
  .chatbot-body {
    background: var(--chat-ink-2, #14100d);
  }
  
  .chatbot-message.bot {
    background: rgba(0, 0, 0, 0.3);
    color: var(--chat-text);
  }
  
  .chatbot-input {
    background: var(--chat-ink-3, #1d1712);
    border-color: rgba(226, 184, 102, 0.28);
    color: var(--chat-text);
  }
  
  .chatbot-input::placeholder {
    color: var(--chat-muted);
  }
  
  .chatbot-footer {
    background: var(--chat-ink-2, #14100d);
    border-color: rgba(226, 184, 102, 0.18);
  }
  
  .chatbot-quick-question {
    background: var(--chat-ink-3, #1d1712);
    color: var(--chat-gold-hi);
    border: 1px solid rgba(226, 184, 102, 0.28);
  }
}
