/* Floating Chat Widget — Alderson Elite Painting */

/* =============== FLOATING BUTTON =============== */
.floating-chat__button {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #F0363D;
  color: #fff;
  border: 3px solid #F0363D;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(240, 54, 61, 0.3);
  transition: all 0.3s ease;
  padding: 0;
  overflow: hidden;
}

.floating-chat__button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(240, 54, 61, 0.4);
  border-color: #D92F36;
}

.floating-chat__button--open {
  background: #D92F36;
  border-color: #D92F36;
}

@media (max-width: 576px) {
  .floating-chat__button {
    width: 54px;
    height: 54px;
    bottom: 16px;
    left: 16px;
  }
}

.floating-chat__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* =============== PROMPT BUBBLE =============== */
.floating-chat__bubble {
  position: fixed;
  bottom: 94px;
  left: 24px;
  z-index: 9998;
  background: #fff;
  padding: 12px 36px 12px 16px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  animation: chatBubbleIn 0.3s ease;
  max-width: 260px;
}

.floating-chat__bubble::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 24px;
  width: 16px;
  height: 16px;
  background: #fff;
  transform: rotate(45deg);
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.05);
}

@media (max-width: 576px) {
  .floating-chat__bubble {
    bottom: 80px;
    left: 16px;
    max-width: 220px;
  }
}

.floating-chat__bubble-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 4px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.floating-chat__bubble-close:hover {
  opacity: 1;
}

.floating-chat__bubble-text {
  margin: 0;
  font-size: 14px;
  color: #111111;
  line-height: 1.4;
}

.floating-chat__bubble-highlight {
  color: #F0363D;
  font-weight: 600;
  display: inline-block;
  min-width: 140px;
  animation: chatFadeSwitch 0.3s ease;
}

/* =============== CHAT PANEL =============== */
.floating-chat__panel {
  position: fixed;
  bottom: 100px;
  left: 24px;
  z-index: 9998;
  width: 380px;
  max-width: calc(100vw - 32px);
  animation: chatSlideUp 0.3s ease;
}

@media (max-width: 576px) {
  .floating-chat__panel {
    bottom: 80px;
    left: 16px;
    right: 16px;
    width: auto;
  }
}

/* =============== CHAT WIDGET =============== */
.chat-widget {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 500px;
}

@media (max-width: 576px) {
  .chat-widget {
    max-height: calc(100vh - 160px);
  }
}

/* =============== HEADER =============== */
.chat-widget__header {
  background: #F0363D;
  color: #fff;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.chat-widget__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.chat-widget__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-widget__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.chat-widget__status {
  font-size: 12px;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-widget__status::before {
  content: "";
  width: 8px;
  height: 8px;
  background: #2a7d2e;
  border-radius: 50%;
}

.chat-widget__close {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.chat-widget__close:hover {
  opacity: 1;
}

/* =============== MESSAGES =============== */
.chat-widget__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 280px;
  max-height: 340px;
  background: #f5f5f5;
}

/* =============== MESSAGE BUBBLES =============== */
.chat-message {
  display: flex;
}

.chat-message--user {
  justify-content: flex-end;
}

.chat-message--user .chat-message__bubble {
  background: #F0363D;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-message--bot {
  justify-content: flex-start;
}

.chat-message--bot .chat-message__bubble {
  background: #fff;
  color: #111111;
  border-bottom-left-radius: 4px;
}

.chat-message__bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-message__bubble--loading {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 20px;
}

.chat-message__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: inherit;
}

/* =============== ACTION BUTTONS =============== */
.chat-message__action {
  margin-top: 12px;
}

.chat-message__actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-action-btn {
  display: inline-block;
  padding: 10px 20px;
  background: #F0363D;
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
}

.chat-action-btn:hover {
  background: #D92F36;
  color: #fff;
}

/* =============== QUICK REPLIES =============== */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.quick-reply-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  font-size: 14px;
  color: #111111;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-reply-btn:hover,
.quick-reply-btn:active,
.quick-reply-btn:focus {
  background: #F0363D;
  color: #fff;
  border-color: #F0363D;
}

.quick-reply-btn__icon {
  font-size: 16px;
  color: inherit;
}

.quick-reply-btn__label {
  font-weight: 500;
  color: inherit;
}

/* =============== LOADING DOTS =============== */
.chat-loading-dot {
  width: 8px;
  height: 8px;
  background: #f5908f;
  border-radius: 50%;
  animation: chatBounce 1.4s ease-in-out infinite both;
}

.chat-loading-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.chat-loading-dot:nth-child(2) {
  animation-delay: -0.16s;
}

/* =============== KEYFRAMES =============== */
@keyframes chatBubbleIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes chatSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chatFadeSwitch {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes chatBounce {
  0%,
  80%,
  100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}
