/**
 * Chat Buddy Widget - Apple-inspired, sleek, HIGH CONVERTING
 */

/* Floating button - smooth like Apple */
.clout-buddy-button {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.clout-buddy-button:hover {
  transform: scale(1.08) translateY(-2px);
}

.clout-buddy-button:active {
  transform: scale(0.98);
}

.buddy-avatar {
  width: 68px;
  height: 68px;
  background: #000000;
  border: 2px solid #00FF94;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 255, 148, 0.4),
              0 2px 8px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 2;
  overflow: hidden;
}

.clout-buddy-button:hover .buddy-avatar {
  box-shadow: 0 12px 32px rgba(0, 255, 148, 0.6),
              0 4px 12px rgba(0, 0, 0, 0.4);
  border-color: #00FF94;
}

.buddy-pulse {
  position: absolute;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #00FF94;
  opacity: 0.4;
  animation: pulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  z-index: 1;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.3);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .clout-buddy-button {
    bottom: 20px;
    right: 20px;
  }

  .buddy-avatar {
    width: 60px;
    height: 60px;
  }

  .buddy-pulse {
    width: 60px;
    height: 60px;
  }
}

/* Overlay - glassmorphism */
.chat-buddy-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.88);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  animation: fadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-buddy-overlay.active {
  display: flex;
}

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

/* Modal - Apple premium */
.chat-buddy-modal {
  background: #000000;
  border: 1.5px solid #00FF94;
  border-radius: 16px;
  width: 90vw;
  max-width: 420px;
  height: 75vh;
  max-height: 620px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 255, 148, 0.3),
              0 8px 24px rgba(0, 0, 0, 0.7);
  animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

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

/* Header */
.chat-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(0, 255, 148, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

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

.chat-header h3 {
  margin: 0;
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  font-family: 'Inter', -apple-system, sans-serif;
  letter-spacing: -0.02em;
}

.chat-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

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

.chat-close:active {
  transform: scale(0.92);
}

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 148, 0.2);
  border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 255, 148, 0.3);
}

/* Message bubbles - iMessage style */
.chat-message {
  display: flex;
  animation: messageIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

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

.message-bubble {
  max-width: 78%;
  padding: 11px 16px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.4;
  font-family: 'Inter', -apple-system, sans-serif;
  font-weight: 400;
  letter-spacing: -0.01em;
  word-wrap: break-word;
}

.chat-message.user .message-bubble {
  background: #00FF94;
  color: #000000;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.chat-message.assistant .message-bubble {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.95);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* CTA button - HIGH CONVERTING */
.chat-cta-button {
  display: inline-block;
  margin-top: 8px;
  padding: 13px 26px;
  background: #00FF94;
  color: #000000;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  text-align: center;
  font-family: 'Inter', -apple-system, sans-serif;
  letter-spacing: -0.01em;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px rgba(0, 255, 148, 0.35);
}

.chat-cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 255, 148, 0.5);
  background: #00ffa0;
}

.chat-cta-button:active {
  transform: translateY(0);
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  animation: typingDot 1.2s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

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

/* Input */
.chat-input-wrapper {
  padding: 16px;
  border-top: 1px solid rgba(0, 255, 148, 0.15);
  display: flex;
  gap: 10px;
  background: rgba(0, 0, 0, 0.4);
}

#chatInput {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 11px 14px;
  color: #ffffff;
  font-size: 15px;
  font-family: 'Inter', -apple-system, sans-serif;
  resize: none;
  max-height: 100px;
  transition: all 0.2s;
}

#chatInput:focus {
  outline: none;
  border-color: #00FF94;
  background: rgba(255, 255, 255, 0.08);
}

#chatInput::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.chat-send-btn {
  background: #00FF94;
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  color: #000000;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Inter', -apple-system, sans-serif;
}

.chat-send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 255, 148, 0.4);
  background: #00ffa0;
}

.chat-send-btn:active {
  transform: translateY(0);
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Mobile */
@media (max-width: 768px) {
  .chat-buddy-modal {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
    border-top: 2px solid #00FF94;
  }

  .message-bubble {
    max-width: 82%;
    font-size: 15px;
  }

  #chatInput {
    font-size: 16px; /* Prevent iOS zoom */
  }
}
