/* ============================================
   BELLA CHAT WIDGET
   Floating AI assistant for StyleForth
   ============================================ */

/* --- Chat Bubble (Trigger) --- */
.bella-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  background: #fff;
  border: 3px solid #9B052A;
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(155, 5, 42, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9990;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  padding: 0;
  overflow: hidden;
}

.bella-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(155, 5, 42, 0.45);
}

.bella-bubble__img {
  width: 160%;
  height: 160%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
}

/* --- Chat Panel --- */
.bella-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 560px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  z-index: 9991;
  overflow: hidden;
}

.bella-panel.bella-panel--open {
  display: flex;
}

/* --- Panel Header --- */
.bella-header {
  background: #9B052A;
  color: #fff;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.bella-header__info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bella-header__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.bella-header__name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}

.bella-header__label {
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  opacity: 0.85;
  margin: 0;
  letter-spacing: 0.5px;
}

.bella-header__close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.bella-header__close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* --- Messages Area --- */
.bella-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

/* --- Message Bubble --- */
.bella-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: bellaFadeIn 0.25s ease;
}

.bella-msg--bella {
  align-self: flex-start;
}

.bella-msg--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.bella-msg__avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  object-position: center top;
}

div.bella-msg__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  background: #F0F0F0;
  color: #333;
}

.bella-msg__text {
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  line-height: 1.55;
  padding: 10px 14px;
  border-radius: 14px;
  word-break: break-word;
}

.bella-msg--bella .bella-msg__text {
  background: #F5F5F5;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
}

.bella-msg--user .bella-msg__text {
  background: #9B052A;
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Links inside Bella's messages */
.bella-msg--bella .bella-msg__text a {
  color: #9B052A;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.bella-msg--bella .bella-msg__text a:hover {
  color: #7B0420;
}

/* Booking link buttons — higher specificity to override link styles */
.bella-msg--bella .bella-msg__text a.bella-book-btn {
  display: inline-block;
  background: #9B052A;
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  margin-top: 8px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.bella-msg--bella .bella-msg__text a.bella-book-btn:hover {
  background: #7B0420;
  color: #fff;
}

/* --- Typing Indicator --- */
.bella-typing {
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: 88%;
  animation: bellaFadeIn 0.25s ease;
}

.bella-typing__dots {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #F5F5F5;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}

.bella-typing__dot {
  width: 7px;
  height: 7px;
  background: #999;
  border-radius: 50%;
  animation: bellaPulse 1.4s infinite;
}

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

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

/* --- Input Area --- */
.bella-input {
  border-top: 1px solid #E5E5E5;
  padding: 12px;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  background: #fff;
}

.bella-input__field {
  flex: 1;
  border: 1px solid #E0E0E0;
  border-radius: 22px;
  padding: 10px 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  resize: none;
  min-height: 42px;
  max-height: 100px;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.15s ease;
}

.bella-input__field:focus {
  border-color: #9B052A;
}

.bella-input__field::placeholder {
  color: #999;
}

.bella-input__send {
  width: 42px;
  height: 42px;
  background: #9B052A;
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease;
  padding: 0;
}

.bella-input__send:hover {
  background: #7B0420;
}

.bella-input__send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.bella-input__send svg {
  width: 18px;
  height: 18px;
}

/* --- Animations --- */
@keyframes bellaFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bellaPulse {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  30% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* --- Variant B: clean pre-cropped avatar (no zoom needed) --- */
.bella-bubble--clean .bella-bubble__img {
  width: 100%;
  height: 100%;
  object-position: center center;
}

/* --- Bubble attention animation --- */
.bella-bubble--nudge {
  animation: bellaNudge 0.6s ease;
}

.bella-bubble__hint {
  position: absolute;
  right: 72px;
  bottom: 50%;
  transform: translateY(50%);
  background: #fff;
  color: #1a1a1a;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.bella-bubble__hint--visible {
  opacity: 1;
}

.bella-bubble__hint::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: #fff;
  border-right: none;
}

@keyframes bellaNudge {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.15); }
  50% { transform: scale(0.95); }
  75% { transform: scale(1.05); }
}

/* --- Mobile (full-screen panel) --- */
@media (max-width: 767px) {
  .bella-bubble {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
  }

  .bella-bubble svg {
    width: 24px;
    height: 24px;
  }

  .bella-panel {
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: -webkit-fill-available;
    border-radius: 0;
  }

  .bella-input {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .bella-input__field {
    font-size: 16px; /* Prevents iOS auto-zoom on focus */
  }
}
