/* ==========================================================================
   Amsatou Store — Widget Chat IA & Réassurance Client (Amsa IA)
   Aesthetically designed with Glassmorphism, Micro-animations & Responsiveness
   ========================================================================== */

:root {
  --amsatou-gold: #d4af37;
  --amsatou-gold-light: #f4e5a9;
  --amsatou-gold-dark: #b89320;
  --amsatou-navy: #1a1a2e;
  --amsatou-navy-light: #252542;
  --amsatou-bg-light: #f8fafc;
  --amsatou-text-dark: #0f172a;
  --amsatou-text-muted: #64748b;
  --amsatou-online-green: #10b981;
  --amsatou-whatsapp-green: #25d366;
  --amsatou-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --amsatou-shadow-glow: 0 10px 30px rgba(212, 175, 55, 0.35);
  --amsatou-radius-lg: 20px;
  --amsatou-radius-md: 14px;
}

/* ══ FLOATING BUTTON ══ */
.amsatou-chat-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amsatou-navy) 0%, #16213e 100%);
  border: 2px solid var(--amsatou-gold);
  color: #ffffff;
  box-shadow: var(--amsatou-shadow-glow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.amsatou-chat-trigger:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 35px rgba(212, 175, 55, 0.5);
}

.amsatou-chat-trigger:active {
  transform: scale(0.95);
}

.amsatou-chat-trigger .trigger-icon {
  font-size: 26px;
  transition: transform 0.3s ease;
}

.amsatou-chat-trigger.open .trigger-icon {
  transform: rotate(90deg);
}

/* Badge "En ligne" & Notification */
.amsatou-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background-color: var(--amsatou-online-green);
  border: 3px solid #ffffff;
  border-radius: 50%;
  animation: amsatou-pulse 2s infinite;
}

@keyframes amsatou-pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Bulle d'invitation pro-active */
.amsatou-chat-tooltip {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 99998;
  background: #ffffff;
  color: var(--amsatou-text-dark);
  padding: 12px 18px;
  border-radius: 16px;
  box-shadow: var(--amsatou-shadow-lg);
  border-left: 4px solid var(--amsatou-gold);
  font-size: 13px;
  font-weight: 500;
  max-width: 260px;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.amsatou-chat-tooltip.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.amsatou-chat-tooltip-close {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--amsatou-text-muted);
  cursor: pointer;
  padding: 0 0 0 4px;
}

/* ══ FENÊTRE PRINCIPALE DU CHAT ══ */
.amsatou-chat-window {
  position: fixed;
  bottom: 98px;
  right: 24px;
  z-index: 99999;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--amsatou-radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(212, 175, 55, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.amsatou-chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.amsatou-chat-header {
  background: linear-gradient(135deg, var(--amsatou-navy) 0%, #16213e 100%);
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--amsatou-gold);
}

.amsatou-chat-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.amsatou-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--amsatou-gold-light) 0%, var(--amsatou-gold) 100%);
  color: var(--amsatou-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.amsatou-chat-title h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #ffffff;
}

.amsatou-chat-title span {
  font-size: 11px;
  color: var(--amsatou-gold-light);
  display: flex;
  align-items: center;
  gap: 4px;
}

.amsatou-chat-title span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  background-color: var(--amsatou-online-green);
  border-radius: 50%;
}

.amsatou-chat-actions button {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.amsatou-chat-actions button:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Bannière de Réassurance */
.amsatou-reassurance-bar {
  background: linear-gradient(90deg, #fffbeb 0%, #fef3c7 100%);
  border-bottom: 1px solid #fde68a;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  font-size: 11px;
  font-weight: 600;
  color: #92400e;
}

.amsatou-reassurance-bar span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Zone des Messages */
.amsatou-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: var(--amsatou-bg-light);
  scroll-behavior: smooth;
}

/* Bulle de Message */
.amsatou-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: amsatou-fade-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes amsatou-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.amsatou-msg.bot {
  align-self: flex-start;
}

.amsatou-msg.user {
  align-self: flex-end;
}

.amsatou-msg-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}

.amsatou-msg.bot .amsatou-msg-bubble {
  background: #ffffff;
  color: var(--amsatou-text-dark);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
}

.amsatou-msg.user .amsatou-msg-bubble {
  background: linear-gradient(135deg, var(--amsatou-navy) 0%, #252542 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(26, 26, 46, 0.2);
}

.amsatou-msg-time {
  font-size: 10px;
  color: var(--amsatou-text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.amsatou-msg.user .amsatou-msg-time {
  align-self: flex-end;
}

/* Typing Indicator */
.amsatou-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #ffffff;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  border: 1px solid #e2e8f0;
  width: fit-content;
}

.amsatou-typing span {
  width: 6px;
  height: 6px;
  background-color: var(--amsatou-gold);
  border-radius: 50%;
  animation: amsatou-bounce 1.4s infinite ease-in-out both;
}

.amsatou-typing span:nth-child(1) { animation-delay: -0.32s; }
.amsatou-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes amsatou-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Puces de Suggestions Rapides */
.amsatou-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.amsatou-suggestion-chip {
  background: #ffffff;
  border: 1px solid var(--amsatou-gold);
  color: var(--amsatou-navy);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.amsatou-suggestion-chip:hover {
  background: var(--amsatou-gold);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(212, 175, 55, 0.3);
}

/* Bouton WhatsApp direct */
.amsatou-whatsapp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--amsatou-whatsapp-green);
  color: #ffffff;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 12px;
  text-decoration: none;
  margin-top: 8px;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.amsatou-whatsapp-btn:hover {
  background-color: #20bd5a;
  transform: translateY(-2px);
  color: #ffffff;
}

/* Zone de Saisie */
.amsatou-chat-input-area {
  padding: 12px 16px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.amsatou-chat-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.amsatou-chat-input:focus {
  border-color: var(--amsatou-gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.amsatou-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amsatou-navy) 0%, #16213e 100%);
  border: none;
  color: var(--amsatou-gold);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease;
}

.amsatou-send-btn:hover {
  transform: scale(1.05);
  background: var(--amsatou-gold);
  color: var(--amsatou-navy);
}

/* Footer crédits */
.amsatou-chat-footer {
  text-align: center;
  font-size: 10px;
  color: var(--amsatou-text-muted);
  padding: 4px 0 8px 0;
  background: #ffffff;
}

/* ══ RESPONSIVE MOBILE ══ */
@media (max-width: 480px) {
  .amsatou-chat-window {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
  .amsatou-chat-trigger {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }
}
