/**
 * Viktor Chat Widget Styles
 * Floating AI chat assistant for all Viktor sites
 */

/* Floating Chat Button */
.viktor-chat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 9999;
}

.viktor-chat-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(99, 102, 241, 0.5);
}

.viktor-chat-btn.active {
  transform: scale(0.9);
  opacity: 0.7;
}

.viktor-chat-btn .chat-icon {
  font-size: 28px;
  color: white;
}

/* Chat Container */
.viktor-chat-container {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 520px;
  max-height: calc(100vh - 150px);
  background: #111111;
  border: 1px solid #27272a;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s ease;
}

.viktor-chat-container.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.viktor-chat-container.minimized {
  height: 56px;
}

.viktor-chat-container.minimized .viktor-chat-messages,
.viktor-chat-container.minimized .viktor-chat-input-area {
  display: none;
}

/* Chat Header */
.viktor-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: #1a1a1a;
  border-bottom: 1px solid #27272a;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-title {
  font-weight: 600;
  font-size: 15px;
  color: #ffffff;
}

.chat-credits {
  font-size: 12px;
  color: #71717a;
  background: #27272a;
  padding: 4px 10px;
  border-radius: 12px;
}

.chat-header-actions {
  display: flex;
  gap: 4px;
}

.chat-action-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #71717a;
  cursor: pointer;
  border-radius: 6px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chat-action-btn:hover {
  background: #27272a;
  color: #ffffff;
}

/* Chat Messages */
.viktor-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Welcome Message */
.chat-welcome {
  text-align: center;
  padding: 40px 20px;
  color: #a1a1aa;
}

.chat-welcome .welcome-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.chat-welcome h3 {
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 8px;
}

.chat-welcome p {
  font-size: 14px;
}

/* Messages */
.chat-message {
  display: flex;
  max-width: 85%;
}

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

.chat-message.assistant {
  align-self: flex-start;
}

.message-content {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
}

.chat-message.user .message-content {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-content {
  background: #27272a;
  color: #e4e4e7;
  border-bottom-left-radius: 4px;
}

.message-content code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 13px;
}

.message-content pre {
  background: rgba(0, 0, 0, 0.4);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
}

.message-content pre code {
  background: transparent;
  padding: 0;
}

.message-content a {
  color: #818cf8;
  text-decoration: underline;
}

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

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #6366f1;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

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

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

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Input Area */
.viktor-chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid #27272a;
  background: #1a1a1a;
}

.chat-auth-required {
  text-align: center;
  padding: 12px;
}

.chat-auth-required p {
  font-size: 13px;
  color: #71717a;
  margin-bottom: 10px;
}

.btn-sign-in {
  background: #6366f1;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-sign-in:hover {
  background: #818cf8;
}

.chat-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
}

#viktor-chat-input {
  flex: 1;
  padding: 12px 16px;
  background: #27272a;
  border: 1px solid #3f3f46;
  border-radius: 12px;
  color: #ffffff;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

#viktor-chat-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

#viktor-chat-input::placeholder {
  color: #71717a;
}

#viktor-send-btn {
  width: 42px;
  height: 42px;
  border: none;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
}

#viktor-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

#viktor-send-btn:active {
  transform: scale(0.95);
}

/* Scrollbar */
.viktor-chat-messages::-webkit-scrollbar {
  width: 6px;
}

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

.viktor-chat-messages::-webkit-scrollbar-thumb {
  background: #3f3f46;
  border-radius: 3px;
}

.viktor-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #52525b;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .viktor-chat-btn {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
  }

  .viktor-chat-container {
    bottom: 86px;
    right: 12px;
    width: calc(100vw - 24px);
    height: calc(100vh - 120px);
  }
}
