.chat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1040;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: var(--brand-blue, #0095dd);
  color: #fff;
  font-size: 24px;
  box-shadow: 0 8px 24px rgba(0, 149, 221, 0.45);
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.chat-fab:hover,
.chat-fab:focus {
  transform: scale(1.05);
  background: var(--brand-red, #ea321e);
  color: #fff;
  outline: none;
}

.chat-fab.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1041;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.chat-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.chat-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 100%;
  height: 100%;
  z-index: 1042;
  background: #fff;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s ease;
}

.chat-sidebar.is-open {
  transform: translateX(0);
}

.chat-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: var(--brand-blue, #0095dd);
  color: #fff;
  flex-shrink: 0;
}

.chat-sidebar__title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-sidebar__title strong {
  display: block;
  font-size: 15px;
  text-transform: none;
}

.chat-sidebar__status {
  font-size: 11px;
  opacity: 0.85;
}

.chat-sidebar__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  padding: 4px;
}

.chat-sidebar__close {
  border: 0;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f7f9fb;
}

.chat-bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-bubble--user {
  align-self: flex-end;
  background: var(--brand-blue, #0095dd);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble--bot {
  align-self: flex-start;
  background: #fff;
  color: #333;
  border: 1px solid #e8ecef;
  border-bottom-left-radius: 4px;
}

.chat-bubble__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.chat-bubble__time {
  font-size: 10px;
  opacity: 0.65;
}

.chat-bubble__speak {
  border: 0;
  background: transparent;
  color: var(--brand-blue, #0095dd);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 14px;
  border-radius: 4px;
}

.chat-bubble__speak:hover {
  background: #eef6fb;
}

.chat-bubble__speak.is-speaking {
  color: var(--brand-red, #ea321e);
}

.chat-typing {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 12px;
  color: #888;
  background: #f7f9fb;
}

.chat-typing.is-visible {
  display: flex;
}

.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #aaa;
  animation: chat-typing-bounce 1.2s infinite ease-in-out;
}

.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes chat-typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.chat-input {
  padding: 12px 14px 14px;
  border-top: 1px solid #e8ecef;
  background: #fff;
  flex-shrink: 0;
}

.chat-input__row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input__field {
  flex: 1;
  border: 1px solid #d5dde5;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input__field:focus {
  border-color: var(--brand-blue, #0095dd);
}

.chat-input__btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #eef2f6;
  color: #555;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s, color 0.2s;
}

.chat-input__btn:hover {
  background: #e2e8ee;
}

.chat-input__btn--send {
  background: var(--brand-blue, #0095dd);
  color: #fff;
}

.chat-input__btn--send:hover {
  background: var(--brand-red, #ea321e);
}

.chat-input__btn.is-listening {
  background: var(--brand-red, #ea321e);
  color: #fff;
  animation: chat-pulse 1s infinite;
}

@keyframes chat-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(234, 50, 30, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(234, 50, 30, 0); }
}

.chat-input__hint {
  margin: 6px 0 0;
  font-size: 11px;
  color: #888;
  min-height: 16px;
}

@media (max-width: 480px) {
  .chat-sidebar {
    width: 100%;
  }

  .chat-fab {
    right: 16px;
    bottom: 16px;
  }
}
