/* Chat Icon */
.chat-icon {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background-color: #d3b464;
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  font-size: 28px;
  font-weight: bolder;
  transition: transform 0.2s ease, background-color 0.3s ease;
  animation: slideInUp 0.6s ease forwards;
}

.chat-icon:hover {
  transform: scale(1.1);
  background-color: #e2c670;
}

.chat-icon.clicked {
  animation: wiggle 0.3s ease;
}

@keyframes slideInUp {
  0% {
    transform: translateY(80px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes wiggle {
  0% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(3deg);
  }
  50% {
    transform: rotate(-3deg);
  }
  75% {
    transform: rotate(3deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

/* Chat Sidebar */
.chat-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 90%;
  height: 100%;
  background: #383838;
  z-index: 10000;
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.5);
  transform: translateX(100%);
  transition: transform 0.4s ease;
  display: flex;
  flex-direction: column;
}

.chat-sidebar.show {
  transform: translateX(0%);
  animation: sidebarIn 0.4s ease;
}

@keyframes sidebarIn {
  0% {
    transform: translateX(100%) scale(0.95);
    opacity: 0;
  }
  100% {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

/* Overlay */
.chat-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backdrop-filter: blur(3px);
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 9998;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.chat-overlay.show {
  display: block;
  opacity: 1;
}

/* Chat Header */
.chat-header {
  padding: 1rem;
  font-weight: 600;
  font-size: 18px;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #555;
  background-color: #2f2f2f;
}

.chat-bot-profile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-bot-profile img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

/* Close Button */
.close-btn {
  background: none;
  border: none;
  font-size: 26px;
  cursor: pointer;
  color: #d3b464;
  transition: transform 0.2s ease;
}

.close-btn:hover {
  transform: rotate(90deg);
}

/* Chat History */
.chat-history {
  flex-grow: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  animation: fadeInUp 0.5s ease;
}

/* Chat Bubbles */
.chat-bubble {
  max-width: 75%;
  padding: 0.6rem 1rem;
  border-radius: 1rem;
  line-height: 1.4;
  font-size: 14px;
  white-space: pre-wrap;
  animation: bubbleFade 0.4s ease;
}

@keyframes bubbleFade {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chat-bubble code {
  background-color: #eee;
  padding: 2px 4px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 13px;
}

/* Bot Bubble */
.chat-bubble.bot {
  background-color: #4a4a4a;
  color: #f5f5f5;
  padding: 10px 14px;
  border-radius: 16px;
  align-self: flex-start;
  margin: 4px 0;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-bubble.bot code {
  background-color: #2a2a2a;
  color: #fff;
}

/* User Bubble */
.user {
  background-color: #d3b464;
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 0;
}

/* Typing Dots */
.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: flex-start;
  padding: 4px 6px;
}

.typing-dots span {
  width: 5px;
  height: 5px;
  background-color: #d3b464;
  border-radius: 50%;
  display: inline-block;
  animation: bounce 1.2s infinite ease-in-out, float 2s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: 0s;
}
.typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}
.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-4px);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

/* Chat Input */
.chat-input-wrapper {
  display: flex;
  padding: 0.75rem;
  background-color: #2f2f2f;
  border-top: 1px solid #555;
  gap: 0.5rem;
}

.chat-input-wrapper input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #ccc;
  color: white;
  border-radius: 6px;
  font-size: 14px;
  background-color: #444;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.chat-input-wrapper input::placeholder {
  color: #aaa;
}

.chat-input-wrapper input:focus {
  outline: none;
  border-color: #d3b464;
  box-shadow: 0 0 0 2px rgba(211, 180, 100, 0.4);
}

.chat-input-wrapper button {
  padding: 0.5rem 0.75rem;
  border: 1px solid #666;
  background-color: #d3b464;
  color: #1c1c1c;
  font-weight: bolder;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s ease;
}

.chat-input-wrapper button:hover {
  background-color: #e2c670;
}

.clear-btn {
  background-color: #dc3545 !important;
  color: #fff;
}
