/* SVS Chatbot Widget Styles */

:root {
  --svs-primary-bg: #FFFFFF;
  --svs-secondary-bg: #F5F6F7;
  --svs-accent: #0AB6FF;
  --svs-accent-glow: transparent;
  --svs-text-primary: #0D0D0D;
  --svs-text-secondary: #5B5F66;
  --svs-border: #E2E4E8;
  --svs-glass-bg: #FFFFFF;
  --svs-shadow: none;
}

/* Скрываем виджет по умолчанию */
.svs-chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Кнопка открытия чата */
.svs-chat-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--svs-accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: all 0.3s ease;
  position: relative;
}

.svs-chat-button:hover {
  transform: scale(1.1);
  box-shadow: none;
}

.svs-chat-button svg {
  width: 28px;
  height: 28px;
  fill: #0D0D0D;
  font-weight: bold;
}

.svs-chat-button svg text {
  user-select: none;
  -webkit-user-select: none;
}

.svs-chat-avatar svg text,
.svs-message-avatar svg text {
  user-select: none;
  -webkit-user-select: none;
}

/* Пульсирующий индикатор */
.svs-chat-button::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--svs-accent);
  animation: svs-pulse 2s ease-out infinite;
  z-index: -1;
}

@keyframes svs-pulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.2);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

/* Панель чата */
.svs-chat-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 400px;
  height: 600px;
  background: var(--svs-glass-bg);
  border: 1px solid var(--svs-border);
  border-radius: 20px;
  box-shadow: none;
  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);
}

.svs-chat-panel.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

/* Заголовок */
.svs-chat-header {
  padding: 20px;
  border-bottom: 1px solid var(--svs-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #F5F6F7;
  border-radius: 20px 20px 0 0;
}

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

.svs-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--svs-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}

.svs-chat-avatar svg {
  width: 24px;
  height: 24px;
  fill: #0D0D0D;
}

.svs-chat-title {
  color: var(--svs-text-primary);
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.svs-chat-subtitle {
  color: var(--svs-text-secondary);
  font-size: 13px;
  margin: 0;
}

.svs-chat-close {
  background: none;
  border: none;
  color: var(--svs-text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s;
}

.svs-chat-close:hover {
  background: #F5F6F7;
  color: var(--svs-text-primary);
}

/* Тело чата */
.svs-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.svs-chat-body::-webkit-scrollbar {
  width: 6px;
}

.svs-chat-body::-webkit-scrollbar-track {
  background: #F5F6F7;
  border-radius: 3px;
}

.svs-chat-body::-webkit-scrollbar-thumb {
  background: var(--svs-accent);
  border-radius: 3px;
}

/* Сообщения */
.svs-message {
  display: flex;
  gap: 12px;
  animation: svs-message-appear 0.3s ease-out;
}

@keyframes svs-message-appear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.svs-message.bot {
  flex-direction: row;
}

.svs-message.user {
  flex-direction: row-reverse;
}

.svs-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.svs-message.bot .svs-message-avatar {
  background: var(--svs-accent);
  box-shadow: none;
}

.svs-message.user .svs-message-avatar {
  background: #E2E4E8;
}

.svs-message-avatar svg {
  width: 18px;
  height: 18px;
  fill: #0D0D0D;
}

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

.svs-message.bot .svs-message-bubble {
  background: #E6F7FF;
  border: 1px solid #B8E6FA;
}

.svs-message.user .svs-message-bubble {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.svs-message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  color: var(--svs-text-primary);
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

/* Индикатор "печатает" */
.svs-typing-indicator {
  display: flex;
  gap: 12px;
  padding: 12px 0;
}

.svs-typing-dots {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #E6F7FF;
  border: 1px solid #B8E6FA;
  border-radius: 16px;
}

.svs-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--svs-accent);
  animation: svs-typing 1.4s ease-in-out infinite;
}

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

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

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

/* Кнопка Telegram */
.svs-telegram-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  margin-top: 8px;
  background: #0D0D0D;
  color: white;
  text-decoration: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  box-shadow: none;
}

.svs-telegram-button:hover {
  transform: translateY(-2px);
  box-shadow: none;
}

.svs-telegram-button svg {
  width: 18px;
  height: 18px;
  fill: #FFFFFF;
}

/* Футер с полем ввода */
.svs-chat-footer {
  padding: 20px;
  border-top: 1px solid var(--svs-border);
  background: #F5F6F7;
  border-radius: 0 0 20px 20px;
}

.svs-message-bubble a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}

.svs-chat-note {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--svs-text-secondary);
}

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

.svs-chat-input {
  flex: 1;
  background: #F5F6F7;
  border: 1px solid var(--svs-border);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--svs-text-primary);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  outline: none;
  transition: all 0.2s;
  resize: none;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  min-height: 44px;
  max-height: 150px;
}

.svs-chat-input::placeholder {
  color: var(--svs-text-secondary);
}

.svs-chat-input:focus {
  border-color: var(--svs-accent);
  background: #FFFFFF;
  box-shadow: none;
}

.svs-chat-input::-webkit-scrollbar {
  display: none;
}

.svs-chat-send {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--svs-accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.svs-chat-send:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: none;
}

.svs-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.svs-chat-send svg {
  width: 20px;
  height: 20px;
  fill: #0D0D0D;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
  .svs-chat-widget {
    bottom: 10px;
    right: 10px;
  }

  .svs-chat-button {
    width: 56px;
    height: 56px;
  }

  .svs-chat-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    margin: 0;
  }

  .svs-chat-header {
    border-radius: 0;
  }

  .svs-chat-footer {
    border-radius: 0;
  }
}

/* Скрытие элементов */
.svs-hidden {
  display: none !important;
}
