/* ==========================================================================
   ASSISTANT DE COMMANDE GUIDÉE — Smart Distribution
   Feuille de style dédiée (n'affecte que les éléments #assistant-*),
   séparée de smr.css pour ne pas alourdir davantage ce fichier.
   ========================================================================== */

#assistant-launcher {
  position: fixed;
  left: 20px;
  bottom: 30px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 20px 0 16px;
  border: none;
  border-radius: 30px;
  background: linear-gradient(135deg, #45B5F6, #2ba1e6);
  color: #ffffff;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(69, 181, 246, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#assistant-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(69, 181, 246, 0.5);
}

#assistant-launcher svg {
  width: 26px;
  height: 26px;
  fill: #ffffff;
  flex-shrink: 0;
}

#assistant-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(44, 50, 66, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  backdrop-filter: blur(2px);
}

/* L'attribut HTML "hidden" repose sur display:none, sans !important selon
   les navigateurs : notre display:flex ci-dessus l'emportait et laissait
   l'overlay plein écran actif (et donc bloquant tous les clics) même une
   fois "fermé". Cette règle garantit que hidden gagne toujours. */
#assistant-overlay[hidden] {
  display: none !important;
}

#assistant-panel {
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  background: #ffffff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  font-family: "Plus Jakarta Sans", sans-serif;
  animation: assistantFadeIn 0.18s ease;
}

/* Un simple fondu (pas de décalage de position) : évite qu'une capture ou
   un coup d'œil pendant l'animation ne donne l'impression d'un panneau
   tronqué ou affiché "à moitié" pendant qu'il glisse depuis l'extérieur
   de l'écran. */
@keyframes assistantFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (min-width: 560px) {
  #assistant-overlay {
    align-items: center;
  }
  #assistant-panel {
    border-radius: 24px;
    max-height: 85vh;
  }
}

#assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #f0f2f5;
  flex-shrink: 0;
}

#assistant-title {
  font-size: 17px;
  font-weight: 800;
  color: #2c3242;
}

#assistant-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#assistant-mute,
#assistant-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #f0f2f5;
  color: #2c3242;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

#assistant-mute:hover,
#assistant-close:hover {
  background: #e4e8ee;
}

#assistant-close {
  font-size: 22px;
  font-weight: 700;
}

#assistant-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

#assistant-message {
  font-size: 17px;
  font-weight: 700;
  color: #2c3242;
  line-height: 1.4;
  margin-bottom: 18px;
}

#assistant-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.assistant-loading {
  text-align: center;
  color: #8a90a1;
  font-size: 14px;
  padding: 20px 0;
}

/* Bouton de choix générique (catégorie, niveau, produit, option) */
.assistant-choice {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 60px;
  padding: 10px 16px;
  border: 2px solid #e9ecef;
  border-radius: 16px;
  background: #f9fafc;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
  font-family: "Plus Jakarta Sans", sans-serif;
}

.assistant-choice:hover,
.assistant-choice:active {
  border-color: #45B5F6;
  background: #eef7fe;
  transform: translateY(-1px);
}

.assistant-choice__img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #e9ecef;
  flex-shrink: 0;
}

.assistant-choice__emoji {
  font-size: 30px;
  flex-shrink: 0;
  width: 46px;
  text-align: center;
}

.assistant-choice__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.assistant-choice__text strong {
  font-size: 15px;
  color: #2c3242;
  overflow-wrap: break-word;
}

.assistant-choice__text small {
  font-size: 13px;
  color: #68ad81;
  font-weight: 700;
}

/* Grande option "catégorie" (2 colonnes, plus visuelle) */
.assistant-choice--big {
  min-height: 70px;
}

.assistant-choice--big .assistant-choice__emoji {
  font-size: 34px;
}

.assistant-choice--big .assistant-choice__text strong {
  font-size: 16px;
}

/* Bouton d'action principale (valider / confirmer) */
.assistant-choice--confirm {
  background: linear-gradient(135deg, #25D366, #1ebd57);
  border-color: transparent;
  justify-content: center;
}

.assistant-choice--confirm .assistant-choice__text strong {
  color: #ffffff;
  font-size: 16px;
}

.assistant-choice--confirm:hover {
  border-color: transparent;
  background: linear-gradient(135deg, #21c25c, #18a94c);
}

/* Bouton discret (retour) */
.assistant-choice--ghost {
  background: transparent;
  border: none;
  min-height: 44px;
  justify-content: center;
  opacity: 0.7;
}

.assistant-choice--ghost .assistant-choice__emoji {
  font-size: 18px;
  width: auto;
}

.assistant-choice--ghost .assistant-choice__text strong {
  font-size: 13px;
  font-weight: 600;
  color: #8a90a1;
}

.assistant-choice--ghost:hover {
  opacity: 1;
  transform: none;
  background: transparent;
  border-color: transparent;
}

/* Sélecteur de quantité */
.assistant-qty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 20px 0;
}

.assistant-qty__btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: #f0f2f5;
  color: #2c3242;
  font-size: 26px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.assistant-qty__btn:hover {
  background: #45B5F6;
  color: #ffffff;
  transform: scale(1.05);
}

.assistant-qty__value {
  font-size: 32px;
  font-weight: 800;
  color: #2c3242;
  min-width: 50px;
  text-align: center;
}

/* Formulaire coordonnées */
#assistant-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

#assistant-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #2c3242;
}

#assistant-form input,
#assistant-form textarea {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 15px;
  font-weight: 400;
  padding: 12px 14px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  background: #f9fafc;
  color: #2c3242;
  box-sizing: border-box;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

#assistant-form input:focus,
#assistant-form textarea:focus {
  outline: none;
  border-color: #45B5F6;
  background: #ffffff;
}

#assistant-form textarea {
  min-height: 70px;
  resize: vertical;
}

/* Récapitulatif de commande */
.assistant-recap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.assistant-recap__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: #f9fafc;
  border-radius: 14px;
}

.assistant-recap__row img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #e9ecef;
  flex-shrink: 0;
}

.assistant-recap__label {
  flex: 1;
  font-size: 14px;
  color: #2c3242;
  min-width: 0;
  overflow-wrap: break-word;
}

.assistant-recap__label small {
  color: #8a90a1;
  font-weight: 600;
}

.assistant-recap__remove {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: #fdecec;
  color: #e5484d;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.assistant-recap__remove:hover {
  background: #e5484d;
  color: #ffffff;
}

.assistant-recap__total {
  text-align: right;
  font-size: 16px;
  font-weight: 800;
  color: #2c3242;
  padding: 8px 4px 0 4px;
}

#assistant-cart-hint {
  padding: 10px 20px;
  background: #f0f2f5;
  color: #2c3242;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  flex-shrink: 0;
}

#assistant-cart-hint[hidden] {
  display: none;
}

/* Mobile : plein écran pour un vrai confort tactile */
@media (max-width: 480px) {
  #assistant-launcher {
    left: 12px;
    bottom: 16px;
    height: 50px;
    padding: 0 16px 0 14px;
    font-size: 14px;
  }

  #assistant-launcher span {
    display: none;
  }

  #assistant-panel {
    max-height: 96vh;
    border-radius: 20px 20px 0 0;
  }

  #assistant-body {
    padding: 16px;
  }

  #assistant-message {
    font-size: 16px;
  }
}
