/* SVS Chatbot Widget Styles */

:root {
  --svs-primary-bg: #0a0a0f;
  --svs-secondary-bg: rgba(20, 20, 30, 0.8);
  --svs-accent: #00d4ff;
  --svs-accent-glow: rgba(0, 212, 255, 0.3);
  --svs-text-primary: #ffffff;
  --svs-text-secondary: #a0a0a0;
  --svs-border: rgba(255, 255, 255, 0.1);
  --svs-glass-bg: rgba(20, 20, 30, 0.7);
  --svs-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* Скрываем виджет по умолчанию */
.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: linear-gradient(135deg, var(--svs-accent), #0099cc);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--svs-shadow), 0 0 20px var(--svs-accent-glow);
  transition: all 0.3s ease;
  position: relative;
}

.svs-chat-button:hover {
  transform: scale(1.1);
  box-shadow: var(--svs-shadow), 0 0 30px var(--svs-accent-glow);
}

.svs-chat-button svg {
  width: 28px;
  height: 28px;
  fill: white;
  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);
  backdrop-filter: blur(20px);
  border: 1px solid var(--svs-border);
  border-radius: 20px;
  box-shadow: var(--svs-shadow);
  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: rgba(0, 0, 0, 0.3);
  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: linear-gradient(135deg, var(--svs-accent), #0099cc);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px var(--svs-accent-glow);
}

.svs-chat-avatar svg {
  width: 24px;
  height: 24px;
  fill: white;
}

.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: rgba(255, 255, 255, 0.1);
  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: rgba(255, 255, 255, 0.05);
  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: linear-gradient(135deg, var(--svs-accent), #0099cc);
  box-shadow: 0 0 10px var(--svs-accent-glow);
}

.svs-message.user .svs-message-avatar {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.svs-message-avatar svg {
  width: 18px;
  height: 18px;
  fill: white;
}

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

.svs-message.bot .svs-message-bubble {
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.3);
}

.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: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.3);
  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: linear-gradient(135deg, #0088cc, #006699);
  color: white;
  text-decoration: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0, 136, 204, 0.3);
}

.svs-telegram-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 136, 204, 0.4);
}

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

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

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

.svs-chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  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: auto;
  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: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px var(--svs-accent-glow);
}

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

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

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

.svs-chat-send {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--svs-accent), #0099cc);
  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: 0 0 20px var(--svs-accent-glow);
}

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

.svs-chat-send svg {
  width: 20px;
  height: 20px;
  fill: white;
}

/* Мобильная адаптация */
@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;
}
