/* ─── Hoc-Tech Chatbot Widget ─── */

.ht-chatbot-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.35);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ht-chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px rgba(124, 58, 237, 0.5);
}

.ht-chatbot-toggle svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

.ht-chatbot-toggle .ht-icon-close {
  display: none;
}

.ht-chatbot-toggle.ht-active .ht-icon-chat {
  display: none;
}

.ht-chatbot-toggle.ht-active .ht-icon-close {
  display: block;
}

/* ─── Notification badge ─── */
.ht-chatbot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ht-pulse 2s infinite;
}

@keyframes ht-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ─── Fenêtre du chat ─── */
.ht-chatbot-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 560px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  z-index: 9998;
  display: none;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: bottom right;
}

.ht-chatbot-window.ht-active {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ─── Header ─── */
.ht-chatbot-header {
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
  color: #fff;
  padding: 20px;
  flex-shrink: 0;
}

.ht-chatbot-header-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.ht-chatbot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.ht-chatbot-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.ht-chatbot-status {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ht-chatbot-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  animation: ht-pulse-dot 1.5s infinite;
}

@keyframes ht-pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ─── Messages ─── */
.ht-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ht-chatbot-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  animation: ht-fade-in 0.3s ease;
}

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

.ht-chatbot-message.ht-bot {
  background: #fff;
  color: #1e293b;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.ht-chatbot-message.ht-user {
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* ─── Suggestions / Quick Replies ─── */
.ht-chatbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 8px;
  background: #f8fafc;
}

.ht-chatbot-suggestion-btn {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.ht-chatbot-suggestion-btn:hover {
  background: #7c3aed;
  color: #fff;
  border-color: #7c3aed;
}

/* ─── Input ─── */
.ht-chatbot-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.ht-chatbot-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.ht-chatbot-input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.ht-chatbot-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.ht-chatbot-send:hover {
  transform: scale(1.1);
}

.ht-chatbot-send svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ─── Loading dots ─── */
.ht-chatbot-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #fff;
  align-self: flex-start;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.ht-chatbot-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  animation: ht-bounce 1.4s infinite ease-in-out both;
}

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

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

/* ─── Email input ─── */
.ht-chatbot-email-prompt {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  background: #f1f5f9;
  border-top: 1px solid #e2e8f0;
}

.ht-chatbot-email-prompt label {
  font-size: 12px;
  color: #64748b;
}

.ht-chatbot-email-row {
  display: flex;
  gap: 6px;
}

.ht-chatbot-email-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
}

.ht-chatbot-email-input:focus {
  border-color: #7c3aed;
}

.ht-chatbot-email-btn {
  background: #7c3aed;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
  .ht-chatbot-window {
    right: 12px;
    bottom: 88px;
    width: calc(100vw - 24px);
    height: calc(100vh - 140px);
  }
  
  .ht-chatbot-toggle {
    bottom: 16px;
    right: 16px;
  }
}
