:root {
  --chat-primary: #198754;
  --chat-primary-dark: #145c32;
  --chat-accent: #ffc107;
  --chat-bg: rgba(255, 255, 255, 0.95);
  --chat-glass: rgba(255, 255, 255, 0.85);
  --chat-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  --chat-radius: 24px;
}

/* Launcher Button */
.chat-launcher {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 65px;
  height: 65px;
  background: var(--chat-primary);
  color: white;
  border-radius: 50%;
  border: none;
  box-shadow: 0 8px 24px rgba(25, 135, 84, 0.3);
  cursor: pointer;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-launcher:hover {
  transform: scale(1.1) rotate(5deg);
  background: var(--chat-primary-dark);
  box-shadow: 0 12px 32px rgba(25, 135, 84, 0.4);
}

.chat-launcher i {
  transition: transform 0.4s;
}

.chat-launcher.active {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.5);
}

/* Chat Container */
.chat-container {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 400px;
  max-width: calc(100vw - 40px);
  height: calc(100vh - 200px);
  max-height: 700px;
  background: var(--chat-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--chat-radius);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: var(--chat-shadow);
  display: flex;
  flex-direction: column;
  z-index: 2000;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(40px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Header */
.chat-header {
  background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-dark) 100%);
  color: white;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.chat-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.chat-title-group {
  display: flex;
  align-items: center;
  gap: 15px;
}

.bot-avatar {
  width: 45px;
  height: 45px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.chat-title-text h5 {
  margin: 0;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  opacity: 0.8;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 10px #4ade80;
}

/* Body */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: radial-gradient(circle at top right, rgba(25, 135, 84, 0.05), transparent);
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

.chat-body::-webkit-scrollbar {
  width: 5px;
}

.chat-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Messages */
.message {
  max-width: 85%;
  padding: 12px 18px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.6;
  position: relative;
  animation: messageSlide 0.4s ease-out forwards;
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

.message.bot {
  background: white;
  color: #333;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.message.user {
  background: var(--chat-primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 8px 20px rgba(25, 135, 84, 0.2);
}

.message-time {
  font-size: 0.7rem;
  opacity: 0.5;
  margin-top: 5px;
  display: block;
  text-align: right;
}

.message.bot .message-time {
  text-align: left;
}

/* Quick Replies */
.quick-replies-container {
  padding: 10px 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  background: rgba(255, 255, 255, 0.5);
}

.quick-reply-btn {
  background: white;
  border: 1px solid rgba(25, 135, 84, 0.15);
  color: var(--chat-primary);
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.quick-reply-btn:hover {
  background: var(--chat-primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(25, 135, 84, 0.15);
}

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

.dot {
  width: 6px;
  height: 6px;
  background: var(--chat-primary);
  border-radius: 50%;
  opacity: 0.4;
  animation: typing 1.4s infinite;
}

.dot:nth-child(2) {
  animation-delay: 0.2s;
}

.dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {

  0%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  50% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Footer */
.chat-footer {
  padding: 20px;
  background: white;
}

.chat-input-wrapper {
  background: #f8fafc;
  border-radius: 100px;
  padding: 5px 5px 5px 20px;
  display: flex;
  align-items: center;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

.chat-input-wrapper:focus-within {
  background: white;
  border-color: var(--chat-primary);
  box-shadow: 0 0 0 4px rgba(25, 135, 84, 0.1);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 10px 0;
  font-size: 0.95rem;
  color: #334155;
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  background: var(--chat-primary);
  color: white;
  border: none;
  outline: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(25, 135, 84, 0.2);
}

.chat-send-btn i {
  font-size: 1.2rem;
  margin-left: 2px;
}

.chat-send-btn:hover {
  background: var(--chat-primary-dark);
  transform: scale(1.05);
}

/* Responsive Design for all devices */
@media (max-width: 768px) {
  .chat-container {
    right: 20px;
    bottom: 90px;
    width: calc(100vw - 40px);
    height: calc(100vh - 150px);
  }

  .chat-launcher {
    bottom: 100px;
    right: 20px;
    width: 55px;
    height: 55px;
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .chat-container {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  /* When full screen on mobile, we need a slight padding at the top for status bar */
  .chat-header {
    padding-top: max(24px, env(safe-area-inset-top));
  }

  .chat-launcher {
    bottom: 95px;
    right: 20px;
  }
}