/* ═══════════════════════════════════════════════════════════════
   FLORAL FANTASY — Chat Widget v2
   Dark theme, modern messaging UI. Scoped with .ff-chat- prefix.
   Z-index: bubble 9001 / panel 9002 (below gallery overlay 9999)
   ═══════════════════════════════════════════════════════════════ */

/* ── Bubble ─────────────────────────────────────────────────── */
.ff-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9001;
  will-change: transform;
  width: 56px;
  height: 56px;
  background: #C49A0C;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1),
              background 200ms cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 200ms cubic-bezier(0.16, 1, 0.3, 1),
              opacity 200ms cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
  box-shadow: 0 4px 16px rgba(196, 154, 12, 0.4),
              0 2px 6px rgba(0, 0, 0, 0.2);
}

.ff-chat-bubble:hover {
  transform: scale(1.08);
  background: #d4a812;
  box-shadow: 0 6px 24px rgba(196, 154, 12, 0.55),
              0 2px 8px rgba(0, 0, 0, 0.25);
}

.ff-chat-bubble:active {
  transform: scale(0.95);
}

.ff-chat-bubble:focus-visible {
  outline: 2px solid #C49A0C;
  outline-offset: 4px;
}

.ff-chat-bubble svg {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

/* Unread badge dot */
.ff-chat-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #ffffff;
  opacity: 0;
  transform: scale(0);
  transition: opacity 200ms, transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.ff-chat-badge.ff-badge-show {
  opacity: 1;
  transform: scale(1);
}

/* Hide bubble on mobile when panel is open */
@media (max-width: 640px) {
  .ff-chat-bubble.ff-bubble-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.7);
  }
}

/* Pulse — 2 cycles on load, then stops */
@keyframes ff-chat-pulse {
  0% {
    box-shadow: 0 4px 16px rgba(196, 154, 12, 0.4),
                0 0 0 0 rgba(196, 154, 12, 0.55);
  }
  60% {
    box-shadow: 0 4px 16px rgba(196, 154, 12, 0.4),
                0 0 0 16px rgba(196, 154, 12, 0);
  }
  100% {
    box-shadow: 0 4px 16px rgba(196, 154, 12, 0.4),
                0 0 0 0 rgba(196, 154, 12, 0);
  }
}

.ff-chat-bubble.ff-pulse {
  animation: ff-chat-pulse 750ms cubic-bezier(0.16, 1, 0.3, 1) 2;
}

/* ── Cycling label pill ─────────────────────────────────────── */
.ff-chat-label {
  position: fixed;
  /* Vertically centered with the 56px bubble sitting at bottom: 24px */
  bottom: 35px;
  /* bubble right(24) + bubble width(56) + gap(12) = 92 */
  right: 92px;
  z-index: 9001;
  background: #C49A0C;
  border: none;
  border-radius: 24px;
  padding: 9px 18px;
  cursor: pointer;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(12px);
  box-shadow: 0 2px 12px rgba(196, 154, 12, 0.35),
              0 1px 4px rgba(0, 0, 0, 0.15);
  transition: opacity 280ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 280ms cubic-bezier(0.16, 1, 0.3, 1),
              background 150ms ease,
              box-shadow 150ms ease;
}

.ff-chat-label.ff-label-show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.ff-chat-label:hover {
  background: #d4a812;
  box-shadow: 0 4px 18px rgba(196, 154, 12, 0.5),
              0 1px 6px rgba(0, 0, 0, 0.18);
}

.ff-chat-label:active {
  transform: scale(0.97) translateX(0);
}

.ff-chat-label:focus-visible {
  outline: 2px solid #C49A0C;
  outline-offset: 3px;
}

.ff-chat-label-text {
  font-family: 'Libre Franklin', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: #FFFFFF;
  line-height: 1;
  display: block;
  /* Default transition for the text swap animation */
  transition: opacity 200ms ease, transform 200ms ease;
}

/* Hide pill entirely on mobile */
@media (max-width: 640px) {
  .ff-chat-label {
    display: none;
  }
}

/* ── Panel ──────────────────────────────────────────────────── */
.ff-chat-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 9002;
  will-change: transform, opacity;
  width: 400px;
  height: 560px;
  background: #1A1A1A;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  pointer-events: none;
  transition: opacity 300ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55),
              0 12px 32px rgba(0, 0, 0, 0.35),
              0 0 0 1px rgba(255, 255, 255, 0.06);
}

.ff-chat-panel.ff-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header ─────────────────────────────────────────────────── */
.ff-chat-header {
  background: #1A1A1A;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.ff-chat-online-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  flex-shrink: 0;
  animation: ff-online-pulse 2.5s ease-in-out infinite;
}

@keyframes ff-online-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.45); }
  50%       { box-shadow: 0 0 0 5px rgba(74, 222, 128, 0); }
}

.ff-chat-header-title {
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.01em;
  color: #FFFFFF;
}

.ff-chat-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms, background 150ms;
  padding: 0;
  border-radius: 50%;
  margin-right: -8px;
  flex-shrink: 0;
}

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

.ff-chat-close svg {
  width: 18px;
  height: 18px;
}

/* ── Message area ───────────────────────────────────────────── */
.ff-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.ff-chat-messages::-webkit-scrollbar { width: 3px; }
.ff-chat-messages::-webkit-scrollbar-track { background: transparent; }
.ff-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

/* Message rows */
.ff-msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: ff-msg-in 200ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.ff-msg--bot  { align-self: flex-start; }
.ff-msg--user { align-self: flex-end; }

.ff-msg-bubble {
  padding: 10px 14px;
  font-family: 'Libre Franklin', sans-serif;
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
}

.ff-msg--bot .ff-msg-bubble {
  background: #2A2A2E;
  color: #E5E5E5;
  font-weight: 300;
  border-radius: 16px;
  border-top-left-radius: 4px;
}

.ff-msg--user .ff-msg-bubble {
  background: #C49A0C;
  color: #FFFFFF;
  font-weight: 400;
  border-radius: 16px;
  border-top-right-radius: 4px;
}

/* Tel link inside bot messages */
.ff-msg--bot .ff-msg-bubble a {
  color: #C49A0C;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 150ms;
}

.ff-msg--bot .ff-msg-bubble a:hover {
  opacity: 0.75;
  text-decoration: underline;
}

/* Typing indicator */
.ff-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 16px;
  background: #2A2A2E;
  border-radius: 16px;
  border-top-left-radius: 4px;
  align-self: flex-start;
  animation: ff-msg-in 200ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ff-typing span {
  width: 7px;
  height: 7px;
  background: rgba(229, 229, 229, 0.45);
  border-radius: 50%;
  display: block;
  animation: ff-dot 1.4s ease-in-out infinite;
}

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

@keyframes ff-dot {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.4; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Input area ─────────────────────────────────────────────── */
.ff-chat-input-wrap {
  flex-shrink: 0;
  padding: 12px 16px 16px;
  background: #1A1A1A;
}

.ff-chat-input-pill {
  display: flex;
  align-items: flex-end;
  background: #2A2A2E;
  border-radius: 24px;
  border: 1px solid rgba(196, 154, 12, 0.3);
  padding: 6px 6px 6px 16px;
  gap: 8px;
  transition: border-color 200ms;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.ff-chat-input-pill:focus-within {
  border-color: rgba(196, 154, 12, 0.65);
}

.ff-chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 300;
  font-size: 14px;
  color: #E5E5E5;
  resize: none;
  line-height: 1.55;
  max-height: 72px;
  min-height: 28px;
  overflow-y: auto;
  padding: 5px 0;
  scrollbar-width: none;
}

.ff-chat-input::-webkit-scrollbar { display: none; }

.ff-chat-input::placeholder {
  color: rgba(255, 255, 255, 0.32);
}

.ff-chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.22);
  transition: background 200ms cubic-bezier(0.16, 1, 0.3, 1),
              color 200ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ff-chat-send.ff-send-active {
  background: #C49A0C;
  color: #FFFFFF;
  cursor: pointer;
}

.ff-chat-send.ff-send-active:hover {
  background: #d4a812;
  transform: scale(1.07);
}

.ff-chat-send:active {
  transform: scale(0.9) !important;
}

.ff-chat-send svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .ff-chat-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    bottom: auto;
    right: auto;
    border-radius: 0;
    transform: translateY(100%);
    box-shadow: none;
  }

  .ff-chat-panel.ff-open {
    transform: translateY(0);
  }

  .ff-chat-header {
    padding: 20px 20px 16px;
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
  }

  .ff-chat-input-wrap {
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .ff-chat-bubble {
    bottom: 16px;
    right: 16px;
  }
}

/* ── FAQ quick-reply pills ─────────────────────────────────── */
.ff-faq-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px; /* adds to flex gap for ~12px spacing from last greeting */
  animation: ff-msg-in 200ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Fade out when dismissed */
.ff-faq-pills--out {
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}

.ff-faq-pill {
  background: transparent;
  border: 1px solid rgba(196, 154, 12, 0.4);
  border-radius: 20px;
  padding: 7px 14px;
  font-family: 'Libre Franklin', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  transition: background 150ms ease,
              border-color 150ms ease,
              color 150ms ease,
              transform 150ms ease;
}

.ff-faq-pill:hover {
  background: rgba(196, 154, 12, 0.15);
  border-color: #C49A0C;
  color: #FFFFFF;
}

.ff-faq-pill:active {
  background: rgba(196, 154, 12, 0.25);
  transform: scale(0.96);
}

.ff-faq-pill:focus-visible {
  outline: 2px solid rgba(196, 154, 12, 0.6);
  outline-offset: 2px;
}

/* Mobile: 44px touch targets + improved readability */
@media (max-width: 640px) {
  .ff-faq-pill {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    font-size: 13px;
  }
}

/* ── Dot separator: hide on mobile ────────────────────────── */
.lux-footer-phones span[aria-hidden] {
  display: none;
}
@media (min-width: 641px) {
  .lux-footer-phones span[aria-hidden] {
    display: inline;
  }
}
