/**
 * BLDR Chat Widget Styles
 */

/* Container */
.bldr-chat-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Tooltip */
.bldr-chat-tooltip {
  position: absolute;
  bottom: 76px;
  right: 0;
  background: white;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-width: 280px;
  font-size: 14px;
  color: #374151;
  border: 1px solid #e5e7eb;
  animation: bldr-fade-in 0.3s ease;
}

/* Chat Window */
.bldr-chat-window {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: bldr-slide-up 0.3s ease;
}

/* Header */
.bldr-chat-header {
  background: linear-gradient(135deg, #428BCA 0%, #357ebd 100%);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.bldr-chat-header-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.bldr-chat-header-text {
  flex: 1;
}

.bldr-chat-header-text h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: white;
}

.bldr-chat-header-text p {
  margin: 2px 0 0 0;
  font-size: 13px;
  opacity: 0.9;
  color: rgba(255, 255, 255, 0.9);
}

.bldr-chat-lang-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.bldr-chat-lang-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.bldr-chat-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
  line-height: 1;
}

.bldr-chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Body */
.bldr-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f9fafb;
}

/* Messages */
.bldr-chat-message {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  animation: bldr-fade-in 0.3s ease;
}

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

.bldr-chat-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #428BCA 0%, #357ebd 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.bldr-chat-message-content {
  max-width: 75%;
}

.bldr-chat-bubble {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #f3f4f6;
}

.bldr-chat-bubble-user {
  background: #428BCA;
  color: white;
  border: none;
}

/* Typing Indicator */
.bldr-chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px;
}

.bldr-typing-dot {
  width: 8px;
  height: 8px;
  background: #9ca3af;
  border-radius: 50%;
  animation: bldr-bounce 1.4s infinite ease-in-out both;
}

.bldr-typing-dot:nth-child(1) { animation-delay: 0s; }
.bldr-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.bldr-typing-dot:nth-child(3) { animation-delay: 0.3s; }

/* Quick Actions */
.bldr-chat-actions {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bldr-chat-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
}

.bldr-chat-action-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  transform: translateY(-1px);
}

.bldr-chat-action-icon {
  font-size: 16px;
}

/* Feature Card */
.bldr-chat-feature-card {
  margin-top: 12px;
  background: linear-gradient(135deg, #eff6ff 0%, white 100%);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 16px;
}

.bldr-chat-feature-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.bldr-chat-feature-icon {
  font-size: 18px;
}

.bldr-chat-feature-title {
  font-weight: 700;
  color: #1e40af;
  font-size: 14px;
}

.bldr-chat-feature-desc {
  font-size: 13px;
  color: #4b5563;
  margin: 0 0 12px 0;
  line-height: 1.6;
}

.bldr-chat-feature-link {
  color: #428BCA;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.2s;
}

.bldr-chat-feature-link:hover {
  gap: 8px;
}

/* Footer */
.bldr-chat-footer {
  padding: 16px;
  border-top: 1px solid #e5e7eb;
  background: white;
}

.bldr-chat-input-row {
  display: flex;
  gap: 8px;
}

#bldr-chat-input {
  flex: 1;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  resize: none;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#bldr-chat-input:focus {
  border-color: #428BCA;
  box-shadow: 0 0 0 3px rgba(66, 139, 202, 0.1);
}

.bldr-send-btn {
  width: 44px;
  height: 44px;
  background: #428BCA;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bldr-send-btn:hover {
  background: #357ebd;
}

.bldr-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Email Form */
.bldr-email-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bldr-email-row {
  display: flex;
  gap: 8px;
}

#bldr-email-input {
  flex: 1;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#bldr-email-input:focus {
  border-color: #428BCA;
  box-shadow: 0 0 0 3px rgba(66, 139, 202, 0.1);
}

.bldr-email-btn {
  width: 44px;
  height: 44px;
  background: #428BCA;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s;
}

.bldr-email-btn:hover {
  background: #357ebd;
}

.bldr-email-back {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.bldr-email-back:hover {
  color: #374151;
}

/* Chat Toggle Button */
.bldr-chat-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #428BCA 0%, #357ebd 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
  box-shadow: 0 4px 16px rgba(66, 139, 202, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.bldr-chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(66, 139, 202, 0.5);
}

.bldr-chat-toggle-open {
  background: #4b5563;
}

.bldr-chat-toggle-open:hover {
  background: #374151;
}

.bldr-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #22c55e;
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bldr-pulse 2s infinite;
}

/* Animations */
@keyframes bldr-slide-up {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes bldr-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bldr-bounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

@keyframes bldr-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .bldr-chat-container {
    bottom: 16px;
    right: 16px;
  }

  .bldr-chat-window {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    max-width: 100vw;
    bottom: 0;
    right: -16px;
    border-radius: 0;
    position: fixed;
  }

  .bldr-chat-tooltip {
    right: 60px;
    bottom: 0;
    max-width: 200px;
  }
}

