/* ============================================
   CLAPPY - Chat Window
   Glassmorphism UI design
   ============================================ */

#clappy-chat {
  position: fixed;
  bottom: 160px;
  right: 16px;
  width: 300px;
  height: 420px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(60px) saturate(180%);
  -webkit-backdrop-filter: blur(60px) saturate(180%);
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    0 1px 0 rgba(255,255,255,0.15) inset;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99998;
  opacity: 0;
  transform: translateY(20px) scale(0.92);
  pointer-events: none;
  transition:
    opacity 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#clappy-chat.open {
  opacity: 1;
  transform: translateY(0px) scale(1);
  pointer-events: all;
}

/* === HEADER === */
#chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  flex-shrink: 0;
}

#chat-header-avatar {
  width: 36px;
  height: 36px;
  background: #e8c84a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

#chat-header-info {
  flex: 1;
}

#chat-header-name {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.2px;
}

#chat-header-status {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  font-size: 11px;
  color: #30d158;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

#chat-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #30d158;
  border-radius: 50%;
  display: inline-block;
}

#chat-close-btn {
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

#chat-close-btn:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

/* === MESSAGES AREA === */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

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

/* === MESSAGE BUBBLES === */
.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: msgPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes msgPop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chat-msg.clappy {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-msg.user {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 400;
}

.chat-msg.clappy .chat-bubble {
  background: rgba(255,255,255,0.12);
  color: #ffffff;
  border-bottom-left-radius: 5px;
  border: 1px solid rgba(255,255,255,0.1);
}

.chat-msg.user .chat-bubble {
  background: #e8c84a;
  color: #1a1a1a;
  border-bottom-right-radius: 5px;
  font-weight: 500;
}

/* === TYPING INDICATOR === */
#chat-typing {
  display: none;
  align-self: flex-start;
  padding: 10px 16px;
  background: rgba(255,255,255,0.1);
  border-radius: 18px;
  border-bottom-left-radius: 5px;
  gap: 4px;
  align-items: center;
  margin-left: 14px;
  margin-bottom: 4px;
}

#chat-typing.show {
  display: flex;
}

#chat-typing span {
  width: 6px;
  height: 6px;
  background: rgba(255,255,255,0.5);
  border-radius: 50%;
  animation: typingDot 1.2s ease-in-out infinite;
}

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

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

/* === SUGGESTIONS === */
#chat-suggestions {
  display: flex;
  gap: 7px;
  padding: 6px 14px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}

#chat-suggestions::-webkit-scrollbar { display: none; }

.chat-chip {
  white-space: nowrap;
  padding: 6px 13px;
  background: rgba(232,200,74,0.12);
  border: 1px solid rgba(232,200,74,0.3);
  border-radius: 20px;
  color: #e8c84a;
  font-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s, transform 0.15s;
  flex-shrink: 0;
}

.chat-chip:hover {
  background: rgba(232,200,74,0.22);
  transform: scale(1.04);
}

.chat-chip:active {
  transform: scale(0.97);
}

/* === INPUT BAR === */
#chat-input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 22px;
  padding: 10px 16px;
  color: #ffffff;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  outline: none;
  transition: border 0.2s, background 0.2s;
  height: 40px;
  line-height: 1.3;
}

#chat-input::placeholder {
  color: rgba(255,255,255,0.3);
}

#chat-input:focus {
  border-color: rgba(232,200,74,0.6);
  background: rgba(255,255,255,0.14);
}

#chat-send-btn {
  width: 36px;
  height: 36px;
  background: #e8c84a;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.18s, background 0.18s;
}

#chat-send-btn:hover {
  transform: scale(1.08);
  background: #f0d45a;
}

#chat-send-btn:active {
  transform: scale(0.94);
}

#chat-send-btn svg {
  width: 16px;
  height: 16px;
  fill: #1a1a1a;
                                }