/* 🟢 FLOAT BUTTON CONTAINER 🟢 */
.wa-float-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: auto;
}

/* 🟢 GLOWING TRIGGER BUTTON 🟢 */
.wa-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1e3a6e);
  border: 1px solid rgba(96, 165, 250, 0.25);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(59, 130, 246, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.2);
  cursor: pointer;
  position: relative;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: pulse-ring 2.5s ease infinite;
}

.wa-btn:hover {
  transform: scale(1.08) rotate(5deg);
  box-shadow: 0 10px 32px rgba(11, 99, 230, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.3);
  background: linear-gradient(135deg, #25d366, #128c7e); /* Smooth switch to WA colors on hover */
  border-color: rgba(37, 211, 102, 0.3);
}

.wa-btn:active {
  transform: scale(0.95);
}

/* Icon Switch Animation */
.wa-icon-wrapper {
  position: relative;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wa-icon {
  width: 26px;
  height: 26px;
  transition: all 0.3s ease;
  fill: currentColor;
}

/* Hover transitions for icons */
.wa-btn:hover .wa-icon-chat {
  opacity: 0;
  transform: scale(0.5) rotate(-45deg);
}

.wa-btn:hover .wa-icon-wa {
  display: block !important;
  opacity: 1;
  transform: scale(1.1);
}

/* Badge (Unread Counter) */
.wa-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0a1628;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
  animation: badge-scale 2s infinite ease-in-out;
  pointer-events: none;
  z-index: 10;
}

@keyframes badge-scale {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* 🟢 TOOLTIP 🟢 */
.wa-tooltip {
  position: absolute;
  right: 75px;
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  background: #0f172a;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
}

.wa-tooltip::after {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: #0f172a;
}

.wa-btn:hover .wa-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.55); }
  70% { box-shadow: 0 0 0 14px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* 🟢 CHAT PANEL 🟢 */
.chat-panel {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 360px;
  max-width: calc(100vw - 56px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: rgba(10, 22, 40, 0.95); /* Deep dark blue theme */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff;
  border-radius: 20px;
  border: 1px solid rgba(59, 130, 246, 0.2);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}

/* Show/Hide State with aria-hidden */
.chat-panel[aria-hidden="true"] {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85) translateY(30px);
}

.chat-panel[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1) translateY(0);
}

/* Header */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

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

.chat-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-avatar img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.chat-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background-color: #25d366;
  border: 2px solid #0a1628;
  border-radius: 50%;
}

.chat-header-text {
  display: flex;
  flex-direction: column;
}

.chat-bot-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.chat-bot-sub {
  font-size: 0.75rem;
  color: #25d366;
  font-weight: 500;
}

.chat-close-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* Chat Messages Body */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Scrollbar styling for chat-body */
.chat-body::-webkit-scrollbar {
  width: 6px;
}
.chat-body::-webkit-scrollbar-track {
  background: transparent;
}
.chat-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
.chat-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Message Bubbles */
.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.45;
  animation: msg-fade-in 0.3s ease forwards;
}

@keyframes msg-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg.bot {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.04);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  color: #f1f5f9;
}

.chat-msg.bot a.chat-wa-inline-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #25d366;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  margin-top: 8px;
  font-size: 0.8rem;
  transition: background 0.2s;
}

.chat-msg.bot a.chat-wa-inline-btn:hover {
  background: #128c7e;
}

.chat-msg.user {
  background: #3b82f6;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

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

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out;
}

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

@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* Suggestion Chips */
.chat-quick {
  padding: 10px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.chat-quick-btn {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-quick-btn:hover {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

/* Input Form */
.chat-form {
  padding: 14px 20px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 4px 4px 4px 16px;
  transition: all 0.3s;
}

.chat-input-wrapper:focus-within {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(96, 165, 250, 0.5);
  box-shadow: 0 0 14px rgba(96, 165, 250, 0.15);
}

.chat-form input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.9rem;
  padding: 8px 0;
}

.chat-form input::placeholder {
  color: #64748b;
}

.chat-form button {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.chat-form button:hover {
  transform: scale(1.05) translateY(-1px);
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  box-shadow: 0 6px 14px rgba(59, 130, 246, 0.45);
}

.chat-form button svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s;
}

.chat-form button:hover svg {
  transform: translate(2px, -2px) scale(1.1);
}

/* Responsiveness */
@media (max-width: 480px) {
  .chat-panel {
    right: 16px;
    left: 16px;
    width: auto;
    bottom: 90px;
    height: calc(100vh - 110px);
    max-height: 520px;
  }
  .wa-float-container {
    bottom: 20px;
    right: 20px;
  }
}
