/* ============================================
   CHAT-WIDGET.CSS - Widget Chat flottant
   ============================================ */

.chat-widget-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0d9f6f, #0b8a5e);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(13, 159, 111, 0.4);
  z-index: 999;
  transition: transform 0.2s, box-shadow 0.2s;
}

.chat-widget-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(13, 159, 111, 0.5);
}

.chat-widget-btn.has-badge::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  background: #dc2626;
  border-radius: 50%;
  border: 2px solid #fff;
}

/* Chat Window */
.chat-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 500px;
  max-height: calc(100vh - 150px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
}

.chat-window.open {
  display: flex;
}

/* Chat Header */
.chat-header {
  background: linear-gradient(135deg, #0d9f6f, #0b8a5e);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-header-title span:first-child {
  font-size: 20px;
}

.chat-header-title h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.chat-header-title small {
  font-size: 11px;
  opacity: 0.8;
}

.chat-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f9fafb;
}

.chat-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
}

.chat-message.bot {
  background: #fff;
  border: 1px solid #e5e7eb;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-message.user {
  background: #0d9f6f;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-message.system {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #92400e;
  align-self: center;
  text-align: center;
  font-size: 13px;
}

/* Chat Input */
.chat-input-area {
  padding: 16px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
}

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

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: #0d9f6f;
}

.chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #0d9f6f;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.chat-send:hover {
  background: #0b8a5e;
}

.chat-send:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}

.chat-actions {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.chat-clear {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
}

.chat-clear:hover {
  color: #dc2626;
}

/* Locked State */
.chat-locked {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  background: #f9fafb;
}

.chat-locked-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.chat-locked-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #111827;
}

.chat-locked-desc {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 20px;
}

.chat-locked .btn {
  padding: 12px 24px;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #d1d5db;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

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

  .chat-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .chat-window.open {
    border-radius: 16px 16px 0 0;
    height: 85vh;
    bottom: 0;
  }
}