/* ═══════════════════════════════════════════════════════════════════
   CONTACT FORM MODAL STYLES
   ═══════════════════════════════════════════════════════════════════ */

.contact-form-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 10001;
  animation: fadeIn 0.3s ease;
}

.contact-form-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.contact-form-container {
  background: var(--bg-primary, #ffffff);
  border-radius: 20px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border-color, #e5e7eb);
}

:root:not(.light) .contact-form-container {
  background: #0f1419;
  border-color: #1f2937;
}

.contact-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

:root:not(.light) .contact-form-header {
  border-bottom-color: #374151;
}

.contact-form-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary, #1f2937);
}

:root:not(.light) .contact-form-header h3 {
  color: #f9fafb;
}

.contact-form-close {
  background: none;
  border: none;
  font-size: 32px;
  color: var(--text-secondary, #6b7280);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: all 0.2s ease;
  line-height: 1;
}

.contact-form-close:hover {
  background: var(--hover-bg, rgba(0, 0, 0, 0.05));
  color: var(--text-primary, #1f2937);
}

.contact-form {
  padding: 28px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary, #1f2937);
}

:root:not(.light) .form-group label {
  color: #e5e7eb;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-primary, #1f2937);
  background: var(--bg-primary, #ffffff);
  transition: border-color 0.2s ease;
}

:root:not(.light) .form-group input,
:root:not(.light) .form-group textarea {
  background: #1a1f2e;
  border-color: #374151;
  color: #e5e7eb;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.contact-submit {
  width: 100%;
  margin-top: 10px;
}

.contact-form-note {
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary, #9ca3af);
  margin-top: 16px;
  margin-bottom: 0;
}

:root:not(.light) .contact-form-note {
  color: #6b7280;
}

/* Ссылка в наводящих вопросах */
.follow-up-content a {
  color: #059669;
  font-weight: 600;
  text-decoration: underline;
  font-style: normal;
}

.follow-up-content a:hover {
  color: #10b981;
}

/* ═══════════════════════════════════════════════════════════════════
   AI CHAT MODAL STYLES
   ═══════════════════════════════════════════════════════════════════ */

.ai-chat-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.ai-chat-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ai-chat-container {
  background: var(--bg-primary, #ffffff);
  border-radius: 24px;
  width: 100%;
  max-width: 700px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border-color, #e5e7eb);
  position: relative;
  overflow: hidden;
}

/* Темная тема */
:root:not(.light) .ai-chat-container {
  background: #0f1419;
  border-color: #1f2937;
}

/* Светлая тема */
:root.light .ai-chat-container {
  background: #ffffff;
  border-color: #e5e7eb;
}

.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  background: var(--bg-secondary, #f9fafb);
  border-radius: 24px 24px 0 0;
}

.ai-chat-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Темная тема */
:root:not(.light) .ai-chat-header {
  background: #1a1f2e;
  border-bottom-color: #1f2937;
}

/* Светлая тема */
:root.light .ai-chat-header {
  background: #f9fafb;
  border-bottom-color: #e5e7eb;
}

.ai-chat-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary, #1f2937);
}

:root:not(.light) .ai-chat-header h3 {
  color: #f9fafb;
}

:root.light .ai-chat-header h3 {
  color: #1f2937;
}

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

.ai-status {
  font-size: 13px;
  font-weight: 500;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 6px;
}

:root:not(.light) .ai-status {
  color: #34d399;
}

.ai-message-counter {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary, #9ca3af);
  padding: 4px 10px;
  background: var(--bg-primary, #ffffff);
  border-radius: 12px;
  border: 1px solid var(--border-color, #e5e7eb);
}

:root:not(.light) .ai-message-counter {
  background: #0f1419;
  border-color: #374151;
  color: #9ca3af;
}

:root.light .ai-message-counter {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #6b7280;
}

.ai-message-counter.warning {
  color: #f59e0b;
  border-color: #f59e0b;
}

.ai-message-counter.limit {
  color: #ef4444;
  border-color: #ef4444;
  font-weight: 600;
}

.ai-chat-reset {
  background: none;
  border: none;
  color: var(--text-secondary, #6b7280);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  transition: all 0.2s ease;
}

:root:not(.light) .ai-chat-reset {
  color: #9ca3af;
}

:root.light .ai-chat-reset {
  color: #6b7280;
}

.ai-chat-reset:hover {
  background: var(--hover-bg, rgba(0, 0, 0, 0.05));
  color: var(--text-primary, #1f2937);
  transform: rotate(-180deg);
}

:root:not(.light) .ai-chat-reset:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f9fafb;
}

:root.light .ai-chat-reset:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #1f2937;
}

.ai-chat-close {
  background: none;
  border: none;
  font-size: 32px;
  color: var(--text-secondary, #6b7280);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: all 0.2s ease;
  line-height: 1;
}

:root:not(.light) .ai-chat-close {
  color: #9ca3af;
}

:root.light .ai-chat-close {
  color: #6b7280;
}

.ai-chat-close:hover {
  background: var(--hover-bg, rgba(0, 0, 0, 0.05));
  color: var(--text-primary, #1f2937);
  transform: scale(1.1);
}

:root:not(.light) .ai-chat-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f9fafb;
}

:root.light .ai-chat-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #1f2937;
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 300px;
  max-height: calc(80vh - 180px);
  background: var(--bg-primary, #ffffff);
}

/* Темная тема */
:root:not(.light) .ai-chat-messages {
  background: #0f1419;
}

/* Светлая тема */
:root.light .ai-chat-messages {
  background: #ffffff;
}

.ai-chat-messages::-webkit-scrollbar {
  width: 8px;
}

.ai-chat-messages::-webkit-scrollbar-track {
  background: var(--bg-secondary, #f9fafb);
  border-radius: 4px;
}

:root:not(.light) .ai-chat-messages::-webkit-scrollbar-track {
  background: #1a1f2e;
}

:root.light .ai-chat-messages::-webkit-scrollbar-track {
  background: #f9fafb;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-color, #d1d5db);
  border-radius: 4px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary, #9ca3af);
}

:root:not(.light) .ai-chat-messages::-webkit-scrollbar-thumb {
  background: #374151;
}

:root:not(.light) .ai-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #4b5563;
}

.ai-message,
.user-message {
  display: flex;
  gap: 12px;
  animation: messageSlide 0.3s ease;
}

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

.ai-avatar,
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.user-avatar {
  background: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
}

.ai-message-content,
.user-message-content {
  background: var(--bg-secondary, #f9fafb);
  padding: 14px 18px;
  border-radius: 16px;
  max-width: 75%;
  color: var(--text-primary, #1f2937);
  line-height: 1.6;
  font-size: 15px;
  border: 1px solid var(--border-color, #e5e7eb);
}

/* Темная тема для сообщений ИИ */
:root:not(.light) .ai-message-content {
  background: #1a1f2e;
  color: #e5e7eb;
  border-color: #374151;
}

/* Светлая тема для сообщений ИИ */
:root.light .ai-message-content {
  background: #f9fafb;
  color: #1f2937;
  border-color: #e5e7eb;
}

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

/* Наводящие вопросы */
.ai-follow-up {
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
}

.follow-up-content {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
  border: 1.5px dashed var(--border-color, #e5e7eb);
  font-style: italic;
  font-size: 14px;
}

:root:not(.light) .follow-up-content {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
  border-color: #4b5563;
}

:root.light .follow-up-content {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
  border-color: #d1d5db;
}

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

.ai-message-content.loading {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Быстрые ответы */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding: 0 12px;
  animation: quickRepliesSlide 0.6s ease 0.4s both;
}

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

.quick-reply {
  background: var(--bg-secondary, #f9fafb);
  border: 1.5px solid var(--border-color, #e5e7eb);
  color: var(--text-primary, #1f2937);
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  overflow: hidden;
  font-family: inherit;
}

.quick-reply::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
}

.quick-reply:hover::before {
  width: 300px;
  height: 300px;
}

:root:not(.light) .quick-reply {
  background: #1a1f2e;
  border-color: #374151;
  color: #e5e7eb;
}

:root.light .quick-reply {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #1f2937;
}

.quick-reply:hover {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border-color: transparent;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.quick-reply:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.quick-replies.hidden {
  display: none;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary, #9ca3af);
  animation: typingBounce 1.4s infinite;
}

:root:not(.light) .typing-indicator span {
  background: #6b7280;
}

:root.light .typing-indicator span {
  background: #9ca3af;
}

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

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

.ai-chat-input-wrapper {
  padding: 20px 28px;
  border-top: 1px solid var(--border-color, #e5e7eb);
  display: flex;
  gap: 12px;
  align-items: flex-end;
  background: var(--bg-secondary, #f9fafb);
  border-radius: 0 0 24px 24px;
}

/* Темная тема */
:root:not(.light) .ai-chat-input-wrapper {
  background: #1a1f2e;
  border-top-color: #374151;
}

/* Светлая тема */
:root.light .ai-chat-input-wrapper {
  background: #f9fafb;
  border-top-color: #e5e7eb;
}

.ai-chat-input {
  flex: 1;
  background: var(--bg-primary, #ffffff);
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 15px;
  color: var(--text-primary, #1f2937);
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 150px;
  transition: border-color 0.2s ease, height 0.1s ease;
  overflow-y: auto;
  line-height: 1.5;
}

/* Темная тема */
:root:not(.light) .ai-chat-input {
  background: #0f1419;
  color: #e5e7eb;
  border-color: #374151;
}

/* Светлая тема */
:root.light .ai-chat-input {
  background: #ffffff;
  color: #1f2937;
  border-color: #d1d5db;
}

.ai-chat-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ai-chat-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--bg-secondary, #f9fafb);
}

:root:not(.light) .ai-chat-input:disabled {
  background: #1a1f2e;
}

:root.light .ai-chat-input:disabled {
  background: #f3f4f6;
}

.ai-chat-input::placeholder {
  color: var(--text-tertiary, #9ca3af);
}

:root:not(.light) .ai-chat-input::placeholder {
  color: #6b7280;
}

:root.light .ai-chat-input::placeholder {
  color: #9ca3af;
}

.ai-chat-input::-webkit-scrollbar {
  width: 6px;
}

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

.ai-chat-input::-webkit-scrollbar-thumb {
  background: var(--border-color, #d1d5db);
  border-radius: 3px;
}

.ai-chat-input::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary, #9ca3af);
}

:root:not(.light) .ai-chat-input::-webkit-scrollbar-thumb {
  background: #374151;
}

:root:not(.light) .ai-chat-input::-webkit-scrollbar-thumb:hover {
  background: #4b5563;
}

.ai-chat-send {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  color: white;
}

.ai-chat-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.ai-chat-send:active {
  transform: scale(0.95);
}

.ai-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Анимации */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

/* Форматирование текста в сообщениях */
.ai-message-content p {
  margin: 0;
  padding: 0;
}

.ai-message-content p + p {
  margin-top: 12px;
}

.ai-message-content strong {
  font-weight: 600;
  color: inherit;
}

.ai-message-content em {
  font-style: italic;
}

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

:root:not(.light) .ai-message-content code {
  background: rgba(255, 255, 255, 0.1);
}

:root.light .ai-message-content code {
  background: rgba(0, 0, 0, 0.08);
}

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

.ai-message-content li {
  margin: 4px 0;
  line-height: 1.5;
}

.ai-message-content a {
  color: #6366f1;
  text-decoration: underline;
  transition: color 0.2s;
}

.ai-message-content a:hover {
  color: #8b5cf6;
}

.ai-message-content br {
  display: block;
  content: "";
  margin-top: 8px;
}

/* Адаптивность */
@media (max-width: 768px) {
  .ai-chat-container {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 20px;
  }

  .ai-chat-header {
    padding: 16px 20px;
  }

  .ai-chat-header h3 {
    font-size: 16px;
  }

  .ai-status {
    font-size: 12px;
  }

  .ai-chat-reset {
    width: 32px;
    height: 32px;
  }

  .ai-chat-reset svg {
    width: 16px;
    height: 16px;
  }

  .ai-chat-messages {
    padding: 20px;
  }

  .ai-chat-input-wrapper {
    padding: 16px 20px;
  }

  .ai-message-content,
  .user-message-content {
    max-width: 85%;
    font-size: 14px;
  }

  .quick-replies {
    padding: 0 8px;
    gap: 6px;
  }

  .quick-reply {
    font-size: 13px;
    padding: 8px 12px;
    flex: 1 1 auto;
    min-width: calc(50% - 3px);
    justify-content: center;
  }
}
