/* Flylisted chat widget styles. Scoped under #flylisted-chat to avoid colliding with Squarespace. */

#flylisted-chat-launcher,
#flylisted-chat-panel,
#flylisted-chat-notification,
#flylisted-chat-launcher *,
#flylisted-chat-panel *,
#flylisted-chat-notification * {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ─── Floating launcher button ─── */
#flylisted-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #1a1a1a;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  z-index: 999998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#flylisted-chat-launcher:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
}
#flylisted-chat-launcher svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* Unread counter badge on launcher */
#flylisted-chat-unread {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #e74c3c;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  border: 2px solid #fff;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
#flylisted-chat-launcher.has-unread #flylisted-chat-unread {
  opacity: 1;
  transform: scale(1);
}

/* Launcher wiggle when notification appears */
@keyframes fl-wiggle {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(-12deg); }
  30% { transform: rotate(10deg); }
  45% { transform: rotate(-8deg); }
  60% { transform: rotate(6deg); }
  75% { transform: rotate(-3deg); }
}
#flylisted-chat-launcher.wiggle {
  animation: fl-wiggle 0.9s ease-in-out;
}

/* ─── Notification chip (peek above launcher) ─── */
#flylisted-chat-notification {
  position: fixed;
  bottom: 100px;
  right: 24px;
  max-width: 320px;
  padding: 12px 40px 12px 12px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  z-index: 999997;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
#flylisted-chat-notification.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  animation: fl-notif-bump 0.6s ease-out;
}
@keyframes fl-notif-bump {
  0% { transform: translateY(12px) scale(0.96); }
  60% { transform: translateY(-4px) scale(1.02); }
  100% { transform: translateY(0) scale(1); }
}
#flylisted-chat-notification:hover {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}
.fl-notif-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fl-notif-body { flex: 1; min-width: 0; }
.fl-notif-name {
  font-size: 12px;
  font-weight: 600;
  color: #999;
  margin-bottom: 2px;
}
.fl-notif-text {
  font-size: 14px;
  line-height: 1.4;
  color: #1a1a1a;
  font-weight: 500;
}
.fl-notif-close {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #999;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}
.fl-notif-close:hover { background: #f4f4f5; color: #1a1a1a; }

/* ─── Chat panel ─── */
#flylisted-chat-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 20px 60px rgba(0, 0, 0, 0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 999999;
}
#flylisted-chat-panel.open { display: flex; }

#flylisted-chat-header {
  padding: 16px 20px;
  background: #1a1a1a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#flylisted-chat-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
#flylisted-chat-header p {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.7;
}
#flylisted-chat-close {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  padding: 4px 8px;
  line-height: 1;
}

#flylisted-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f7f7f8;
}

.fl-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.fl-msg.user {
  background: #1a1a1a;
  color: #fff;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}
.fl-msg.bot {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #e5e5e7;
  border-bottom-left-radius: 4px;
}
.fl-msg.bot strong { font-weight: 600; }
.fl-msg.bot a {
  color: #1a1a1a;
  text-decoration: underline;
}
.fl-typing {
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
}
.fl-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #999;
  animation: fl-bounce 1.2s infinite ease-in-out;
}
.fl-typing span:nth-child(2) { animation-delay: 0.15s; }
.fl-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes fl-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

#flylisted-chat-input-area {
  padding: 12px;
  border-top: 1px solid #e5e5e7;
  background: #fff;
  display: flex;
  gap: 8px;
}
#flylisted-chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #d1d1d6;
  border-radius: 22px;
  font-size: 14px;
  outline: none;
  resize: none;
  font-family: inherit;
  max-height: 100px;
}
#flylisted-chat-input:focus { border-color: #1a1a1a; }
#flylisted-chat-send {
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#flylisted-chat-send:disabled { opacity: 0.4; cursor: not-allowed; }
#flylisted-chat-send svg { width: 18px; height: 18px; fill: currentColor; }

#flylisted-chat-footer {
  padding: 6px 12px;
  text-align: center;
  font-size: 10px;
  color: #999;
  border-top: 1px solid #f0f0f0;
  background: #fff;
}

@media (max-width: 480px) {
  #flylisted-chat-panel {
    bottom: 80px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    height: calc(100vh - 100px);
  }
  #flylisted-chat-notification {
    bottom: 80px;
    right: 12px;
    left: 12px;
    max-width: none;
  }
  #flylisted-chat-launcher { bottom: 16px; right: 16px; }
}
