/* PIC Cosmétique Chatbot Widget */
:root {
  --pic-black: #1A1A1A;
  --pic-gold: #C4A35A;
  --pic-cream: #F5F3EE;
  --pic-white: #FFFFFF;
  --pic-gray: #6B6B6B;
  --pic-light-gray: #E8E8E8;
}

#pic-chatbot-widget {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
}

/* Bouton flottant */
.pic-chatbot-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--pic-black);
  border: 2px solid var(--pic-gold);
  color: var(--pic-gold);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
  position: relative;
}

.pic-chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(196, 163, 90, 0.4);
}

.pic-chatbot-toggle.hidden {
  display: none;
}

/* Badge de notification */
.pic-chatbot-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 22px;
  height: 22px;
  background: #E53E3E;
  color: white;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--pic-white);
  animation: picBadgeIn 0.3s ease;
}

.pic-chatbot-badge.active {
  display: flex;
}

@keyframes picBadgeIn {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

/* Animation ping sur le bouton */
.pic-chatbot-toggle.ping {
  animation: picPing 1.5s ease-in-out infinite;
}

@keyframes picPing {
  0% { box-shadow: 0 0 0 0 rgba(196, 163, 90, 0.7); }
  70% { box-shadow: 0 0 0 20px rgba(196, 163, 90, 0); }
  100% { box-shadow: 0 0 0 0 rgba(196, 163, 90, 0); }
}

/* Fenêtre de chat */
.pic-chatbot-window {
  width: 380px;
  height: 550px;
  background: var(--pic-white);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: absolute;
  bottom: 80px;
  right: 0;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pic-chatbot-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.pic-chatbot-header {
  background: var(--pic-black);
  color: var(--pic-gold);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--pic-gold);
}

.pic-chatbot-header-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.pic-chatbot-header-subtitle {
  font-size: 11px;
  color: var(--pic-cream);
  opacity: 0.8;
  margin-top: 2px;
}

.pic-chatbot-close {
  background: none;
  border: none;
  color: var(--pic-gold);
  font-size: 22px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.pic-chatbot-close:hover {
  background: rgba(196, 163, 90, 0.15);
}

/* Messages */
.pic-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--pic-cream);
}

.pic-chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.pic-chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--pic-gold);
  border-radius: 3px;
}

/* Bulles */
.pic-chatbot-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: picMessageIn 0.3s ease;
}

@keyframes picMessageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.pic-chatbot-message.user {
  align-self: flex-end;
  background: var(--pic-black);
  color: var(--pic-gold);
  border-bottom-right-radius: 4px;
}

.pic-chatbot-message.bot {
  align-self: flex-start;
  background: var(--pic-white);
  color: var(--pic-black);
  border: 1px solid var(--pic-light-gray);
  border-bottom-left-radius: 4px;
}

.pic-chatbot-message.error {
  background: #FFF5F5;
  color: #C53030;
  border-color: #FC8181;
}

/* Boutons produits sous les messages bot */
.pic-chatbot-product-buttons {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pic-chatbot-product-card {
  background: var(--pic-cream);
  border: 1px solid var(--pic-light-gray);
  border-radius: 14px;
  padding: 12px;
}

.pic-chatbot-product-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--pic-black);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--pic-light-gray);
}

.pic-chatbot-product-actions {
  display: flex;
  gap: 8px;
}

.pic-chatbot-add-cart {
  flex: 1;
  background: var(--pic-black);
  color: var(--pic-gold);
  border: 2px solid var(--pic-gold);
  border-radius: 24px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  text-align: center;
}

.pic-chatbot-add-cart:hover {
  background: var(--pic-gold);
  color: var(--pic-black);
  transform: translateY(-1px);
}

.pic-chatbot-view-product {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  background: var(--pic-white);
  color: var(--pic-black);
  border: 1px solid var(--pic-light-gray);
  border-radius: 24px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  font-family: inherit;
  text-align: center;
}

.pic-chatbot-view-product:hover {
  border-color: var(--pic-gold);
  background: var(--pic-cream);
}

/* Toast notification */
.pic-chatbot-toast {
  position: fixed;
  bottom: 90px;
  right: 20px;
  background: var(--pic-black);
  color: var(--pic-gold);
  padding: 14px 24px;
  border-radius: 12px;
  border: 2px solid var(--pic-gold);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10000;
}

.pic-chatbot-toast.active {
  opacity: 1;
  transform: translateY(0);
}

/* Message de bienvenue promo */
.pic-chatbot-welcome {
  width: 100%;
}

.pic-chatbot-welcome-promo {
  background: linear-gradient(135deg, var(--pic-black) 0%, #2D2D2D 100%);
  color: var(--pic-cream);
  padding: 16px;
  border-radius: 16px;
  border: 2px solid var(--pic-gold);
  font-size: 14px;
  line-height: 1.6;
}

.pic-chatbot-welcome-promo strong {
  color: var(--pic-gold);
  font-weight: 600;
}

.pic-chatbot-welcome-text {
  background: var(--pic-white);
  color: var(--pic-black);
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--pic-light-gray);
  font-size: 14px;
  line-height: 1.6;
}

/* Quick Replies */
.pic-chatbot-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 18px 6px;
  background: var(--pic-white);
  border-top: 1px solid var(--pic-light-gray);
}

.pic-chatbot-quick-reply {
  background: var(--pic-cream);
  border: 1px solid var(--pic-gold);
  color: var(--pic-black);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.pic-chatbot-quick-reply:hover {
  background: var(--pic-gold);
  color: var(--pic-black);
  transform: translateY(-1px);
}

/* Indicateur de frappe */
.pic-chatbot-typing {
  display: none;
  align-self: flex-start;
  background: var(--pic-white);
  border: 1px solid var(--pic-light-gray);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  padding: 14px 18px;
  margin: 0 20px;
}

.pic-chatbot-typing.active {
  display: flex;
  gap: 5px;
}

.pic-chatbot-typing span {
  width: 8px;
  height: 8px;
  background: var(--pic-gold);
  border-radius: 50%;
  animation: picTyping 1.4s infinite ease-in-out both;
}

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

@keyframes picTyping {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input area */
.pic-chatbot-input-area {
  padding: 12px 18px 14px;
  background: var(--pic-white);
  border-top: 1px solid var(--pic-light-gray);
  display: flex;
  gap: 10px;
  align-items: center;
}

.pic-chatbot-input {
  flex: 1;
  border: 1px solid var(--pic-light-gray);
  border-radius: 24px;
  padding: 10px 18px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.pic-chatbot-input:focus {
  border-color: var(--pic-gold);
}

.pic-chatbot-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--pic-black);
  border: 2px solid var(--pic-gold);
  color: var(--pic-gold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.pic-chatbot-send:hover:not(:disabled) {
  background: var(--pic-gold);
  color: var(--pic-black);
}

.pic-chatbot-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Bouton fermer mobile (caché en desktop) */
.pic-chatbot-mobile-close {
  display: none;
}

/* Responsive */
@media (max-width: 480px) {
  .pic-chatbot-window {
    width: calc(100vw - 40px);
    height: calc(100vh - 120px);
    right: 0;
    bottom: 80px;
  }
  
  #pic-chatbot-widget {
    right: 15px;
    bottom: 15px;
  }

  .pic-chatbot-header {
    padding: 14px 16px;
  }

  .pic-chatbot-close {
    width: 40px;
    height: 40px;
    font-size: 26px;
  }

  .pic-chatbot-mobile-close {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px;
    background: var(--pic-cream);
    border: none;
    border-top: 1px solid var(--pic-light-gray);
    color: var(--pic-gray);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
  }

  .pic-chatbot-mobile-close:hover {
    background: var(--pic-light-gray);
    color: var(--pic-black);
  }

  .pic-chatbot-quick-replies {
    padding: 8px 14px 4px;
    gap: 6px;
  }

  .pic-chatbot-quick-reply {
    padding: 6px 10px;
    font-size: 11px;
  }

  .pic-chatbot-toast {
    right: 15px;
    bottom: 85px;
    left: 15px;
    text-align: center;
  }

  .pic-chatbot-product-card {
    flex-direction: column;
  }

  .pic-chatbot-add-cart,
  .pic-chatbot-view-product {
    width: 100%;
  }
}
