/* =========================================================
   EduINFrance Chat Widget
   ========================================================= */

#eduChatWidget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99999;
  font-family: Arial, Helvetica, sans-serif;
}

/* =========================================================
   Floating button
   ========================================================= */

#eduChatButton {
  width: 62px;
  height: 62px;
  border: none;
  border-radius: 50%;
  background: #1d4ed8;
  color: #ffffff;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 27px;

  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);

  position: relative;

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

#eduChatButton:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.chat-icon {
  line-height: 1;
}

/* Unread badge */

.chat-unread {
  display: none;

  position: absolute;
  top: -3px;
  right: -3px;

  min-width: 21px;
  height: 21px;

  padding: 0 5px;

  background: #dc2626;
  color: #ffffff;

  border-radius: 50%;

  font-size: 11px;
  font-weight: bold;

  align-items: center;
  justify-content: center;

  border: 2px solid #ffffff;
}

/* =========================================================
   Chat window
   ========================================================= */

.edu-chat-window {
  position: absolute;
  right: 0;
  bottom: 76px;

  width: 370px;
  max-width: calc(100vw - 30px);

  height: 550px;
  max-height: calc(100vh - 120px);

  background: #ffffff;

  border-radius: 16px;

  overflow: hidden;

  display: none;
  flex-direction: column;

  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.18);

  border: 1px solid #e5e7eb;
}

.edu-chat-window.active {
  display: flex;
}

/* =========================================================
   Header
   ========================================================= */

.edu-chat-header {
  min-height: 72px;

  background: #1d4ed8;
  color: #ffffff;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 12px 16px;
}

.edu-chat-agent {
  display: flex;
  align-items: center;
  gap: 10px;
}

.edu-chat-avatar {
  width: 42px;
  height: 42px;

  border-radius: 50%;

  background: #ffffff;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 21px;
}

.edu-chat-agent strong {
  display: block;
  font-size: 14px;
}

.edu-chat-agent span {
  display: block;
  margin-top: 3px;

  font-size: 11px;

  opacity: 0.9;
}

.edu-chat-close {
  border: none;
  background: transparent;

  color: #ffffff;

  font-size: 28px;

  cursor: pointer;

  width: 35px;
  height: 35px;

  line-height: 30px;
}

/* =========================================================
   Messages
   ========================================================= */

.edu-chat-messages {
  flex: 1;

  overflow-y: auto;

  padding: 18px;

  background: #f8fafc;
}

.edu-chat-welcome {
  text-align: center;

  padding: 10px 0 15px;
}

.welcome-icon {
  font-size: 38px;
  margin-bottom: 8px;
}

.edu-chat-welcome h4 {
  margin: 0 0 6px;

  color: #111827;

  font-size: 17px;
}

.edu-chat-welcome p {
  margin: 0 0 15px;

  color: #6b7280;

  font-size: 13px;
}

/* =========================================================
   Quick options
   ========================================================= */

.chat-quick-options {
  display: flex;
  flex-direction: column;

  gap: 8px;

  text-align: left;
}

.chat-quick-options button {
  width: 100%;

  border: 1px solid #dbeafe;

  background: #ffffff;

  color: #1d4ed8;

  border-radius: 8px;

  padding: 10px 12px;

  font-size: 13px;

  text-align: left;

  cursor: pointer;

  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.chat-quick-options button:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

/* =========================================================
   Message bubbles
   ========================================================= */

.chat-message {
  display: flex;

  margin-bottom: 12px;
}

.chat-message.customer {
  justify-content: flex-end;
}

.chat-message.admin {
  justify-content: flex-start;
}

.chat-bubble {
  max-width: 78%;

  padding: 10px 13px;

  border-radius: 13px;

  font-size: 13px;

  line-height: 1.45;

  word-wrap: break-word;
}

.chat-message.customer .chat-bubble {
  background: #1d4ed8;

  color: #ffffff;

  border-bottom-right-radius: 4px;
}

.chat-message.admin .chat-bubble {
  background: #ffffff;

  color: #1f2937;

  border: 1px solid #e5e7eb;

  border-bottom-left-radius: 4px;
}

.chat-message-time {
  display: block;

  margin-top: 4px;

  font-size: 9px;

  opacity: 0.65;
}

/* =========================================================
   Typing indicator
   ========================================================= */

.edu-chat-typing {
  display: none;

  padding: 6px 16px;

  align-items: center;

  gap: 3px;

  background: #f8fafc;
}

.edu-chat-typing span {
  width: 5px;
  height: 5px;

  border-radius: 50%;

  background: #6b7280;

  animation: chatTyping 1.2s infinite;
}

.edu-chat-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.edu-chat-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

.edu-chat-typing label {
  margin-left: 6px;

  font-size: 10px;

  color: #6b7280;
}

@keyframes chatTyping {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  30% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

/* =========================================================
   Input
   ========================================================= */

.edu-chat-input-area {
  display: flex;

  align-items: flex-end;

  gap: 8px;

  padding: 10px;

  background: #ffffff;

  border-top: 1px solid #e5e7eb;
}

#eduChatInput {
  flex: 1;

  resize: none;

  min-height: 38px;
  max-height: 100px;

  border: 1px solid #d1d5db;

  border-radius: 10px;

  padding: 10px 12px;

  font-family: inherit;
  font-size: 13px;

  outline: none;
}

#eduChatInput:focus {
  border-color: #1d4ed8;
}

#eduChatSend {
  width: 40px;
  height: 40px;

  border: none;

  border-radius: 10px;

  background: #1d4ed8;

  color: #ffffff;

  cursor: pointer;

  font-size: 18px;
}

#eduChatSend:hover {
  background: #1e40af;
}

#eduChatSend:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 480px) {
  #eduChatWidget {
    right: 15px;
    bottom: 15px;
  }

  .edu-chat-window {
    right: -5px;
    bottom: 72px;

    width: calc(100vw - 30px);

    height: calc(100vh - 100px);

    max-height: none;

    border-radius: 14px;
  }

  #eduChatButton {
    width: 56px;
    height: 56px;
  }
}
