/* Chat Quiz Widget Styles */
#chat-quiz-widget {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  font-family: 'Manrope', sans-serif;
}

#chat-quiz-btn {
  width: 60px;
  height: 60px;
  background-color: #ff9600;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(255, 150, 0, 0.4);
  transition: transform 0.3s ease;
  position: relative;
}

#chat-quiz-btn:hover {
  transform: scale(1.1);
}

.chat-pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 150, 0, 0.7);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(255, 150, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 150, 0, 0);
  }
}

.chat-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: #ff3b30;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  display: none;
}

#chat-quiz-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 360px;
  height: 550px;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transition: all 0.3s ease;
  border: 1px solid #eaeaea;
}

#chat-quiz-window.active {
  display: flex;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.chat-header {
  background-color: #2b2b2b;
  color: #fff;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  position: relative;
}

.chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  position: relative;
  margin-right: 15px;
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.chat-avatar .online-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background-color: #4cd964;
  border-radius: 50%;
  border: 2px solid #2b2b2b;
}

.chat-title {
  flex-grow: 1;
}

.chat-name {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 2px;
  line-height: 16px;
}

.chat-role {
  font-size: 12px;
  color: #aaa;
  line-height: 12px;
  margin-top: 5px;
}

.chat-close {
  font-size: 24px;
  cursor: pointer;
  color: #aaa;
  transition: color 0.3s;
}

.chat-close:hover {
  color: #fff;
}

.chat-messages {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  background-color: #f7f7f7;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.chat-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  animation: fadeIn 0.3s ease;
}

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

.chat-msg.bot {
  background-color: #fff;
  color: #333;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.chat-msg.user {
  background-color: #ff9600;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 5px rgba(255, 150, 0, 0.2);
}

.chat-typing {
  display: flex;
  gap: 4px;
  padding: 15px 16px;
  background-color: #fff;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  display: none;
}

.chat-typing.active {
  display: flex;
}

.chat-typing span {
  width: 6px;
  height: 6px;
  background-color: #aaa;
  border-radius: 50%;
  animation: typing 1s infinite alternate;
}

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

@keyframes typing {
  0% {
    transform: translateY(0);
    opacity: 0.5;
  }
  100% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.chat-input-area {
  padding: 15px 20px;
  background-color: #fff;
  border-top: 1px solid #eaeaea;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-option-btn {
  background-color: #f0f0f0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px 15px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  font-family: inherit;
}

.chat-option-btn:hover {
  background-color: #ff9600;
  color: #fff;
  border-color: #ff9600;
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-form input {
  padding: 12px 15px;
  border: 1px solid #d7d5cf;
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
}

.chat-form input:focus {
  border-color: #ff9600;
}

.chat-form button {
  background-color: #ff9600;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 15px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.2s;
}

.chat-form button:hover {
  background-color: #e58226;
}

/* Mobile */
@media screen and (max-width: 700px) {
  #chat-quiz-widget {
    bottom: 15px !important;
    right: 15px !important;
  }
  #chat-quiz-window {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  #chat-quiz-widget {
    bottom: 20px;
    right: 20px;
  }

  #chat-quiz-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  #chat-quiz-btn svg {
    width: 22px;
    height: 22px;
  }
}
