.chat-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2000;
  font-family: 'Barlow', Arial, sans-serif;
}

.chat-toggle {
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #005f99, #02a4df);
  color: white;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(1, 64, 109, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 16px 32px rgba(1, 64, 109, 0.35);
}

.chat-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: min(360px, calc(100vw - 22px));
  background: #ffffff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 28, 48, 0.18);
  border: 1px solid rgba(0,95,153,0.08);
  display: none;
}

.chat-panel.open {
  display: block;
}

.chat-header {
  background: linear-gradient(135deg, #003f6e, #005f99);
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header h3 {
  margin: 0;
  font-size: 0.95rem;
  color: white;
}

.chat-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.9);
}

.chat-status-dot {
  width: 8px;
  height: 8px;
  background: #52d980;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(82, 217, 128, 0.18);
}

.chat-messages {
  max-height: 340px;
  overflow-y: auto;
  background: #f5f9fc;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-bubble {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.91rem;
  line-height: 1.5;
  word-break: break-word;
}

.chat-bubble.bot {
  align-self: flex-start;
  background: white;
  border: 1px solid rgba(0, 95, 153, 0.08);
  color: #1d2c3b;
}

.chat-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #02a4df, #005f99);
  color: white;
}

.chat-wa-action {
  margin-top: 8px;
  display: inline-block;
}

.chat-wa-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #25D366;
  color: white !important;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 7px 12px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
  transition: transform 0.15s ease, background 0.15s ease;
}

.chat-wa-action-btn:hover {
  background: #20ba59;
  transform: translateY(-1px);
}

.typing-indicator {
  opacity: 0.72;
  font-style: italic;
  position: relative;
}

.typing-indicator::after {
  content: '...';
  display: inline-block;
  width: 18px;
  animation: typingDots 1.2s steps(3, end) infinite;
  margin-left: 6px;
}

@keyframes typingDots {
  0%, 20% { content: '.'; }
  33%, 53% { content: '..'; }
  66%, 100% { content: '...'; }
}

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  border-top: 1px solid rgba(0,95,153,0.08);
  padding: 10px 12px 12px;
}

.chat-input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(0,95,153,0.2);
  background: #f9fbfd;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.9rem;
  outline: none;
}

.chat-input:focus {
  border-color: rgba(2, 164, 223, 0.7);
  box-shadow: 0 0 0 3px rgba(2, 164, 223, 0.12);
}

.chat-submit {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #005f99, #02a4df);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
}

.chat-handoff {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 20px);
  margin: 0 10px 10px;
  border: 0;
  border-radius: 999px;
  padding: 10px 12px;
  background: #25D366;
  color: white;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
  transition: background 0.15s ease;
}

.chat-handoff:hover {
  background: #20ba59;
}

@media (max-width: 640px) {
  .chat-widget {
    right: 12px;
    bottom: 12px;
  }

  .chat-toggle {
    width: 58px;
    height: 58px;
    font-size: 1.3rem;
  }
}
