/* AI Assistant Widget Styles with Animated Owl */

/* Плавающая кнопка AI-ассистента */
.ai-assistant-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #9575C4 0%, #8063B2 100%);
  box-shadow: 0 8px 24px rgba(128, 99, 178, 0.35), 0 4px 12px rgba(128, 99, 178, 0.25);
  cursor: pointer;
  z-index: 999;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.ai-assistant-fab:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 32px rgba(128, 99, 178, 0.45), 0 6px 16px rgba(128, 99, 178, 0.3);
}

.ai-assistant-fab:active {
  transform: translateY(-2px) scale(1.02);
}

/* SVG Сова в кнопке */
.ai-assistant-fab .owl-icon {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
}

/* Анимация моргания для совы */
@keyframes owl-blink {
  0%, 90%, 100% { opacity: 1; }
  95% { opacity: 0; }
}

.ai-assistant-fab .owl-eye-left,
.ai-assistant-fab .owl-eye-right {
  animation: owl-blink 4s infinite;
}

/* Анимация пульсации кнопки */
@keyframes pulse-ring {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

.ai-assistant-fab::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, #9575C4 0%, #8063B2 100%);
  opacity: 0;
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Индикатор непрочитанных сообщений */
.ai-assistant-fab__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #FF4757;
  border-radius: 50%;
  border: 3px solid white;
  font-size: 11px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Панель чата */
.ai-assistant-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 140px);
  background: white;
  border-radius: 24px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 998;
  overflow: hidden;
  border: 1px solid rgba(16, 18, 35, 0.08);
}

.ai-assistant-panel.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Заголовок панели */
.ai-assistant-panel__header {
  background: linear-gradient(135deg, #9575C4 0%, #8063B2 100%);
  color: white;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 24px 24px 0 0;
  flex-shrink: 0;
}

.ai-assistant-panel__header-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
}

.ai-assistant-panel__header-icon .owl-eye-left,
.ai-assistant-panel__header-icon .owl-eye-right {
  animation: owl-blink 4s infinite;
}

.ai-assistant-panel__header-text {
  flex: 1;
}

.ai-assistant-panel__title {
  font-weight: 800;
  font-size: 18px;
  margin: 0 0 2px 0;
}

.ai-assistant-panel__status {
  font-size: 13px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-assistant-panel__status-dot {
  width: 8px;
  height: 8px;
  background: #4ADE80;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

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

.ai-assistant-panel__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.ai-assistant-panel__close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Область сообщений */
.ai-assistant-panel__messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #F9FAFB;
}

.ai-assistant-panel__messages::-webkit-scrollbar {
  width: 6px;
}

.ai-assistant-panel__messages::-webkit-scrollbar-track {
  background: transparent;
}

.ai-assistant-panel__messages::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  border-radius: 3px;
}

.ai-assistant-panel__messages::-webkit-scrollbar-thumb:hover {
  background: #9CA3AF;
}

/* Сообщение */
.ai-message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: slideIn 0.3s ease-out;
}

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

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

.ai-message__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  background: linear-gradient(135deg, #9575C4 0%, #8063B2 100%);
  overflow: hidden;
}

.ai-message__avatar svg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.1));
}

.ai-message__avatar svg .owl-eye-left,
.ai-message__avatar svg .owl-eye-right {
  animation: owl-blink 4s infinite;
}

.ai-message.user .ai-message__avatar {
  background: linear-gradient(135deg, #1E54FF 0%, #2B1E4F 100%);
}

.ai-message__content {
  max-width: 75%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-message__bubble {
  background: white;
  padding: 12px 16px;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  font-size: 15px;
  line-height: 1.6;
  color: #1F2937;
  border: 1px solid rgba(16, 18, 35, 0.06);
}

.ai-message.user .ai-message__bubble {
  background: linear-gradient(135deg, #1E54FF 0%, #2B1E4F 100%);
  color: white;
  border: none;
}

.ai-message__bubble strong {
  font-weight: 700;
  color: #8063B2;
}

.ai-message.user .ai-message__bubble strong {
  color: white;
}

.ai-message__bubble ul,
.ai-message__bubble ol {
  margin: 8px 0;
  padding-left: 20px;
}

.ai-message__bubble li {
  margin: 4px 0;
}

.ai-message__bubble p {
  margin: 0 0 8px 0;
}

.ai-message__bubble p:last-child {
  margin-bottom: 0;
}

.ai-message__bubble code {
  background: rgba(128, 99, 178, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
}

.ai-message.user .ai-message__bubble code {
  background: rgba(255, 255, 255, 0.2);
}

.ai-message__time {
  font-size: 12px;
  color: #9CA3AF;
  padding: 0 4px;
}

/* Быстрые действия */
.ai-message__quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.ai-quick-action {
  background: white;
  border: 2px solid #E5E7EB;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: #6B7280;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-quick-action:hover {
  background: #F9FAFB;
  border-color: #9575C4;
  color: #8063B2;
  transform: translateY(-1px);
}

/* Индикатор печатания */
.ai-message__typing {
  background: white;
  padding: 12px 16px;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  display: flex;
  gap: 4px;
  align-items: center;
  border: 1px solid rgba(16, 18, 35, 0.06);
}

.ai-message__typing-dot {
  width: 8px;
  height: 8px;
  background: #9CA3AF;
  border-radius: 50%;
  animation: typing 1.4s ease-in-out infinite;
}

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

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

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

/* Форма ввода */
.ai-assistant-panel__input-area {
  padding: 16px 20px;
  background: white;
  border-top: 1px solid #E5E7EB;
  flex-shrink: 0;
}

.ai-assistant-panel__input-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.ai-assistant-panel__input-wrapper {
  flex: 1;
  position: relative;
}

.ai-assistant-panel__input {
  width: 100%;
  min-height: 44px;
  max-height: 120px;
  padding: 12px 16px;
  border: 2px solid #E5E7EB;
  border-radius: 14px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: #1F2937;
  background: white;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}

.ai-assistant-panel__input:focus {
  border-color: #9575C4;
}

.ai-assistant-panel__input::placeholder {
  color: #9CA3AF;
}

.ai-assistant-panel__send {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #9575C4 0%, #8063B2 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(128, 99, 178, 0.25);
}

.ai-assistant-panel__send:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(128, 99, 178, 0.35);
}

.ai-assistant-panel__send:active {
  transform: translateY(0);
}

.ai-assistant-panel__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Приветственное сообщение */
.ai-welcome {
  text-align: center;
  padding: 40px 20px;
  color: #6B7280;
}

.ai-welcome__icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  filter: drop-shadow(0 4px 12px rgba(128, 99, 178, 0.2));
}

.ai-welcome__icon .owl-eye-left,
.ai-welcome__icon .owl-eye-right {
  animation: owl-blink 4s infinite;
}

.ai-welcome__title {
  font-size: 20px;
  font-weight: 700;
  color: #1F2937;
  margin: 0 0 8px 0;
}

.ai-welcome__text {
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 20px 0;
}

.ai-welcome__suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

.ai-welcome__suggestion {
  background: white;
  border: 2px solid #E5E7EB;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #6B7280;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.ai-welcome__suggestion:hover {
  background: #F9FAFB;
  border-color: #9575C4;
  color: #8063B2;
  transform: translateX(4px);
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
  .ai-assistant-fab {
    bottom: 80px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  .ai-assistant-fab .owl-icon {
    width: 40px;
    height: 40px;
  }

  .ai-assistant-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: calc(100vh - 72px);
    max-height: calc(100vh - 72px);
    border-radius: 24px 24px 0 0;
  }

  .ai-assistant-panel.active ~ .ai-assistant-fab {
    display: none;
  }

  .ai-message__content {
    max-width: 85%;
  }
}

/* Скрытие кнопки при открытой панели на десктопе */
@media (min-width: 769px) {
  .ai-assistant-panel.active ~ .ai-assistant-fab {
    opacity: 0.3;
    pointer-events: none;
  }
}

