/* Base Layout */
.chat-widget {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 384px;
  transform: translateY(120%);
  transition: transform 0.3s ease-in-out;
  opacity: 0;
  visibility: hidden;
  z-index: 9999;
}

.chat-widget.open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

/* Header Layout */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bot-avatar {
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bot-avatar i {
  width: 24px;
  height: 24px;
}

.close-button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.close-button i {
  width: 20px;
  height: 20px;
}

/* Messages Container */
.chat-messages {
  height: 384px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

/* Message Layout */
.message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 80%;
  margin-bottom: 16px;
  opacity: 0;
  transform: translateY(20px);
  animation: messageAppear 0.3s ease forwards;
}

@keyframes messageAppear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.message.user {
  flex-direction: row-reverse;
  align-self: flex-end;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-avatar i {
  width: 20px;
  height: 20px;
}

.message-content {
  background: #f3f4f6;
  padding: 12px 16px;
  border-radius: 16px;
  position: relative;
}

.message.user .message-content {
  background: #0ea5e9;
  color: white;
}

.message-timestamp {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: typing 1s infinite;
  display: inline-block;
}

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

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

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

/* Input Area Layout */
.chat-input {
  border-top-width: 1px;
  padding: 16px;
}

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

.input-container input {
  flex: 1;
  padding: 8px 16px;
  border-radius: 9999px;
  outline: none;
  transition: all 0.2s;
}

.input-container button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.input-container button i {
  width: 20px;
  height: 20px;
}

/* Forms */
.start-chat-form,
.review-form,
.thanks-message {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
}

.form-group input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
}

/* Quick Responses */
.quick-responses {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid;
}

.quick-response-button {
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

/* Chat Opener */
.chat-opener {
  position: fixed;
  bottom: 24px;
  right: 24px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-opener:hover {
  transform: scale(1.1);
}

.chat-opener i {
  width: 24px;
  height: 24px;
}

.chat-opener.hidden {
  display: none;
}

/* Content Area */
.chat-content {
  height: 480px;
  display: flex;
  flex-direction: column;
}

/* Rating */
.rating {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 24px 0;
}

.rating i {
  font-size: 32px;
  cursor: pointer;
  transition: transform 0.2s;
}

.rating i:hover {
  transform: scale(1.2);
}

/* Thanks Message */
.thanks-message {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.thanks-content {
  max-width: 300px;
}

.thanks-content i {
  font-size: 48px;
  margin-bottom: 16px;
}

.thanks-content h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.thanks-content p {
  margin-bottom: 24px;
}

.thanks-content .close-button {
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}

.thanks-content .close-button:hover {
  opacity: 0.9;
}