/**
 * ZINGERINC AI CHATBOT STYLES
 * Custom branded chatbot widget
 */

/* ========================================
   CHATBOT CONTAINER
   ======================================== */

.chatbot-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  font-family: var(--font-body);
}

/* ========================================
   TOGGLE BUTTON
   ======================================== */

.chatbot-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF6B5E 0%, #F5A623 100%);
  border: none;
  box-shadow: 0 8px 24px rgba(255, 107, 94, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(255, 107, 94, 0.5);
}

.chatbot-toggle:active {
  transform: scale(0.95);
}

.chatbot-toggle svg {
  width: 28px;
  height: 28px;
  color: white;
  transition: all 0.3s ease;
}

.chat-icon {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.close-icon {
  opacity: 0;
  transform: scale(0) rotate(90deg);
  position: absolute;
}

.chatbot-widget.open .chat-icon {
  opacity: 0;
  transform: scale(0) rotate(-90deg);
}

.chatbot-widget.open .close-icon {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* Notification Badge */
.chatbot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #FF3B30;
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0A1628;
  animation: pulse-badge 2s ease-in-out infinite;
}

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

/* ========================================
   CHAT WINDOW
   ======================================== */

.chatbot-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 600px;
  background: var(--color-bg-primary);
  border-radius: 1rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: scale(0.9) translateY(20px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-widget.open .chatbot-window {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

/* ========================================
   HEADER
   ======================================== */

.chatbot-header {
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, #FF6B5E 0%, #F5A623 100%);
  border-radius: 1rem 1rem 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.chatbot-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  backdrop-filter: blur(10px);
}

.chatbot-name {
  font-weight: 700;
  font-size: 1.125rem;
  color: white;
  font-family: var(--font-heading);
}

.chatbot-status {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #34C759;
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.chatbot-clear,
.chatbot-minimize {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.chatbot-clear:hover,
.chatbot-minimize:hover {
  background: rgba(255, 255, 255, 0.25);
}

.chatbot-clear:active,
.chatbot-minimize:active {
  transform: scale(0.95);
}

.chatbot-clear svg,
.chatbot-minimize svg {
  width: 18px;
  height: 18px;
  color: white;
}

.chatbot-clear svg {
  width: 16px;
  height: 16px;
}

/* ========================================
   MESSAGES AREA
   ======================================== */

.chatbot-messages {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--color-bg-primary);
}

/* Custom scrollbar */
.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 107, 94, 0.5);
  border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 107, 94, 0.7);
}

/* ========================================
   MESSAGES
   ======================================== */

.chat-message {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  animation: messageSlideIn 0.3s ease;
}

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

/* Bot Message */
.bot-message {
  flex-direction: row;
}

.bot-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #FF6B5E 0%, #F5A623 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.message-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 75%;
}

.bot-message .message-content {
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
  padding: 0.875rem 1rem;
  border-radius: 0.75rem 0.75rem 0.75rem 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  line-height: 1.6;
  font-size: 0.9375rem;
}

.bot-message .message-content strong {
  color: var(--color-accent-primary);
  font-weight: 600;
}

.bot-message .message-content a {
  color: var(--color-accent-primary);
  text-decoration: underline;
  transition: opacity 0.2s ease;
}

.bot-message .message-content a:hover {
  opacity: 0.8;
}

/* User Message */
.user-message {
  flex-direction: row-reverse;
  align-self: flex-end;
}

.user-message .message-content {
  background: linear-gradient(135deg, #FF6B5E 0%, #F5A623 100%);
  color: white;
  padding: 0.875rem 1rem;
  border-radius: 0.75rem 0.75rem 0.25rem 0.75rem;
  max-width: 75%;
  line-height: 1.6;
  font-size: 0.9375rem;
}

/* Message Time */
.message-time {
  font-size: 0.75rem;
  color: var(--color-text-tertiary);
  padding: 0 0.25rem;
}

.user-message .message-time {
  text-align: right;
}

/* ========================================
   TYPING INDICATOR
   ======================================== */

.typing-indicator {
  animation: messageSlideIn 0.3s ease;
}

.typing-dots {
  background: var(--color-bg-elevated);
  padding: 0.875rem 1rem;
  border-radius: 0.75rem 0.75rem 0.75rem 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 0.375rem;
  align-items: center;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--color-accent-primary);
  border-radius: 50%;
  animation: typingDot 1.4s ease-in-out infinite;
}

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

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

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

/* ========================================
   INPUT AREA
   ======================================== */

.chatbot-input-wrapper {
  padding: 1rem 1.5rem;
  background: var(--color-bg-secondary);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-shrink: 0;
}

.chatbot-input {
  flex: 1;
  background: var(--color-bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  color: var(--color-text-primary);
  font-size: 0.9375rem;
  font-family: var(--font-body);
  transition: all 0.2s ease;
}

.chatbot-input:focus {
  outline: none;
  border-color: var(--color-accent-primary);
  box-shadow: 0 0 0 3px rgba(255, 107, 94, 0.1);
}

.chatbot-input::placeholder {
  color: var(--color-text-tertiary);
}

.chatbot-send {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #FF6B5E 0%, #F5A623 100%);
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chatbot-send:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 94, 0.4);
}

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

.chatbot-send svg {
  width: 20px;
  height: 20px;
  color: white;
}

/* ========================================
   FOOTER
   ======================================== */

.chatbot-footer {
  padding: 0.75rem;
  background: var(--color-bg-secondary);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-tertiary);
  border-radius: 0 0 1rem 1rem;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
  .chatbot-widget {
    bottom: 1rem;
    right: 1rem;
  }

  .chatbot-window {
    width: calc(100vw - 2rem);
    max-width: 380px;
    height: calc(100vh - 160px);
    max-height: 600px;
  }

  .chatbot-toggle {
    width: 56px;
    height: 56px;
  }

  .chatbot-toggle svg {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 480px) {
  .chatbot-window {
    bottom: 70px;
    width: calc(100vw - 1.5rem);
    height: calc(100vh - 140px);
    right: -0.25rem;
  }

  .chatbot-header {
    padding: 1rem 1.25rem;
  }

  .chatbot-messages {
    padding: 1rem;
  }

  .chatbot-input-wrapper {
    padding: 0.875rem 1rem;
  }

  .message-wrapper {
    max-width: 85%;
  }

  .user-message .message-content {
    max-width: 85%;
  }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

.chatbot-toggle:focus,
.chatbot-minimize:focus,
.chatbot-send:focus {
  outline: 2px solid var(--color-accent-primary);
  outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .chatbot-toggle,
  .chatbot-window,
  .chat-message,
  .typing-dots span,
  .status-dot,
  .chatbot-badge {
    animation: none;
    transition: none;
  }
}
