/* ═══ CHAT WIDGET STYLES ═══ */

.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Bouton de chat (fermé) */
.chat-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1DB954;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 24px;
  line-height: 1;
}

.chat-toggle:hover {
  background: #1ed760;
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(29, 185, 84, 0.35);
}

.chat-toggle.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

/* Container de chat (fenêtre ouverte) */
.chat-container {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 550px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: scale(0.9) translateY(10px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-container.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

/* Header du chat */
.chat-header {
  background: linear-gradient(135deg, #121212 0%, #1a1a1a 100%);
  color: white;
  padding: 16px 20px;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.chat-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.chat-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  font-size: 0.75rem;
  opacity: 0.85;
}

.chat-status::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
}

.chat-status-online::before {
  background: #1db954;
}

.chat-status-offline::before {
  background: #999;
}

.chat-header-sub {
  display: block;
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 2px;
}

.chat-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s;
  font-size: 20px;
}

.chat-close:hover {
  opacity: 1;
}

/* Zone des messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: white;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.chat-messages::-webkit-scrollbar-track {
  background: #f5f5f5;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #d0d0d0;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Message utilisateur */
.message {
  display: flex;
  flex-direction: column;
  animation: slideIn 0.3s ease;
}

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

.message.user {
  align-items: flex-end;
}

.message.bot {
  align-items: flex-start;
}

.message-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.message.user .message-bubble {
  background: #1DB954;
  color: white;
  border-radius: 12px 4px 12px 12px;
}

.message.bot .message-bubble {
  background: #f0ede8;
  color: #171717;
  border-radius: 4px 12px 12px 12px;
}

.message-time {
  font-size: 0.7rem;
  opacity: 0.6;
  margin-top: 4px;
  padding: 0 4px;
}

/* Input de chat */
.chat-input-area {
  padding: 12px;
  border-top: 1px solid #f0ede8;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  background: white;
  border-radius: 0 0 12px 12px;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-email,
.chat-input {
  width: 100%;
}

.chat-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: none;
  max-height: 80px;
  transition: border-color 0.2s;
}

.chat-input:focus {
  outline: none;
  border-color: #1DB954;
  background: #fafaf8;
}

.chat-input::placeholder {
  color: #999;
}

.chat-send {
  background: #1DB954;
  color: white;
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send:hover:not(:disabled) {
  background: #1ed760;
  transform: scale(1.08);
}

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

/* État vide */
.chat-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #999;
  font-size: 0.9rem;
  text-align: center;
  padding: 20px;
}

/* Responsive */
@media (max-width: 480px) {
  .chat-widget {
    bottom: 16px;
    right: 16px;
  }

  .chat-container {
    width: calc(100vw - 32px);
    max-width: 380px;
    height: 70vh;
    max-height: 550px;
  }

  .chat-toggle {
    width: 50px;
    height: 50px;
  }
}
