* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
body {
  background: linear-gradient(135deg, #f5f7fa 0%, #e9edf5 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-x: hidden;
}

.site-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition:
    filter 0.3s ease,
    transform 0.3s ease;
  z-index: 1;
}
body.modal-active .site-wrapper {
  filter: blur(8px);
  transform: scale(0.98);
  pointer-events: none;
  user-select: none;
}

.main-content {
  text-align: center;
  color: #333;
  max-width: 600px;
  z-index: 1;
}
.main-content h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: #0074d9;
}
.main-content p {
  font-size: 1.2rem;
  color: #555;
  margin-bottom: 10px;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9998;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.modal-overlay.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.chat-icon {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 65px;
  height: 65px;
  border-radius: 50%;
  background: #0074d9;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 116, 217, 0.4);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
  border: 3px solid white;
}
.chat-icon:hover {
  transform: scale(1.1);
  background: #005bb5;
}

.assistant-container {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 400px;
  height: 600px;
  /* max-width: calc(100vw - 40px); */
  max-height: calc(100vh - 120px);
  z-index: 10000;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e0e4ed;
  opacity: 1;
  transform: scale(1);
  pointer-events: all;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease,
    box-shadow 0.3s,
    width 0.3s,
    height 0.3s,
    top 0.3s,
    left 0.3s;
  backdrop-filter: none;
}
.assistant-container.hidden {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  visibility: hidden;
}

.assistant-container.modal-mode {
  top: 50% !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%) !important;
  width: 800px !important;
  height: 650px !important;
  max-width: 90vw !important;
  max-height: 90vh !important;
  border-radius: 20px;
  border: 1px solid #0074d9;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.4);
  z-index: 10001;
}

@media (min-width: 769px) {
  .assistant-container:not(.modal-mode):not(.hidden) {
    cursor: grab;
  }
  .assistant-container.dragging {
    cursor: grabbing;
    box-shadow: 0 30px 80px rgba(0, 116, 217, 0.3);
    transition: none;
  }
  .resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 25px;
    height: 25px;
    cursor: nw-resize;
    z-index: 10002;
  }
  .resize-handle::after {
    content: "";
    position: absolute;
    top: 5px;
    left: 5px;
    width: 10px;
    height: 10px;
    border-left: 2px solid #ccc;
    border-top: 2px solid #ccc;
    transform: rotate(-45deg);
  }
}
@media (max-width: 768px) {
  .assistant-container:not(.modal-mode) {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 95vh;
    border-radius: 20px 20px 0 0;
  }
  .resize-handle {
    display: none;
  }
  .chat-icon {
    width: 55px;
    height: 55px;
    font-size: 22px;
  }
}

.assistant-header {
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #eaeef5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  user-select: none;
}
.assistant-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: #0074d9;
  font-size: 1.1rem;
}
.header-controls {
  display: flex;
  gap: 8px;
}
.header-btn {
  background: none;
  border: none;
  color: #889;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}
.header-btn:hover {
  background: #f0f3fa;
  color: #0074d9;
}
.header-btn.clear-btn:hover {
  color: #dc3545;
  background: #fff0f0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8fafd;
  scroll-behavior: smooth;
  user-select: text;
}
.message {
  display: flex;
  align-items: flex-start;
  max-width: 85%;
  animation: fadeIn 0.3s ease;
}
.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.message.assistant {
  align-self: flex-start;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin: 0 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: white;
  border: 1px solid #e0e4ed;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.message.user .avatar {
  background: #0074d9;
  border-color: #0074d9;
}
.message.user .avatar i {
  color: white;
}
.message.assistant .avatar {
  /* background: #10b981;
  border-color: #10b981; */
  background-image: url("assets/ann.png");
  background-size: cover;
  background-position: center;
}
.message.assistant .avatar i {
  color: white;
}
.message-content {
  padding: 12px 16px;
  border-radius: 12px;
  background: white;
  color: #333;
  word-break: break-word;
  line-height: 1.6;
  font-size: 0.95rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  overflow-wrap: break-word;
}

.message-content p {
  text-align: left;
}
.message.user .message-content {
  background: #0074d9;
  color: white;
}

.message-content p {
  margin-bottom: 8px;
}
.message-content p:last-child {
  margin-bottom: 0;
}
.message-content pre {
  background: #2d2d2d;
  color: #ccc;
  padding: 10px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 8px 0;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 0.85rem;
}
.message-content code {
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 4px;
  border-radius: 4px;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 0.9em;
}
.message.user .message-content code {
  background: rgba(255, 255, 255, 0.2);
}
.message-content ul,
.message-content ol {
  margin-left: 20px;
  margin-bottom: 8px;
}
.message-content blockquote {
  border-left: 3px solid #0074d9;
  padding-left: 10px;
  color: #666;
  margin: 8px 0;
  font-style: italic;
}
.message-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
}
.message-content th,
.message-content td {
  border: 1px solid #ddd;
  padding: 6px;
  font-size: 0.9rem;
}
.message-content th {
  background: #f0f0f0;
}
.message.user .message-content th {
  background: rgba(255, 255, 255, 0.2);
}

.input-area-wrapper {
  border-top: 1px solid #eaeef5;
  background: white;
  padding: 12px;
  flex-shrink: 0;
}
.chat-input-area {
  display: flex;
  gap: 10px;
  align-items: center;
}
#questionInput {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e0e4ed;
  border-radius: 24px;
  background: #f8fafd;
  color: #333;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s;
  user-select: text;
}
#questionInput:focus {
  border-color: #0074d9;
  background: white;
}
#sendButton {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #0074d9;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
#sendButton:hover:not(:disabled) {
  transform: scale(1.05);
  background: #005bb5;
}
#sendButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.typing-indicator {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: white;
  border-radius: 12px;
  align-self: flex-start;
  margin-left: 42px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  margin-bottom: 10px;
}
.typing-indicator.active {
  display: flex;
}
.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #aaa;
  animation: typing 1.4s infinite;
}
.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-5px);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Внешний CSS: https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css */
