/* Стили для элементов */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

h1 {
  font-size: 1.5rem; /* 1.5 rem = 24px при стандартном размере шрифта браузера 16px */
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: #f5f5f5;
}

header {
  background: #6200ea;
  color: white;
  padding: 15px;
  font-size: 24px;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.sidebar {
  width: 250px;
  background: #ffffff;
  padding: 15px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e0e0e0;
}

#chat-list {
  flex: 1;
  overflow-y: auto;
  margin-top: 15px;
}

#chat-list button {
  width: 100%;
  text-align: left;
  padding: 10px;
  margin: 5px 0;
  background: transparent;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s;
}

#chat-list button:hover {
  background: #f0f0f0;
}

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 15px;
  background: #ffffff;
}

#chat-box {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 5px;
  margin-bottom: 5px;
}

.message {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
}

.message.user {
  align-items: flex-end;
}

.message.assistant {
  align-items: flex-start;
}

.sender {
  font-weight: bold;
  margin-bottom: 5px;
  color: #6200ea;
}

.content {
  padding: 10px 15px;
  border-radius: 18px;
  /*max-width: 80%;*/
  word-wrap: break-word;
}

.message.user .content {
  background: #6200ea;
  color: white;
  border-bottom-right-radius: 5px;
}

.message.assistant .content {
  background: #f0f0f0;
  color: #333;
  border-bottom-left-radius: 5px;
}

pre {
  white-space: pre-wrap; /* Сохраняет переводы строк */
  word-wrap: break-word; /* Переносит длинные строки */
  padding: 1em;
  background: #f5f5f5;
  border-radius: 4px;
  tab-size: 4;
  overflow-x: auto;
}

pre code {
  display: block;
  white-space: pre-wrap; /* Сохраняет переводы строк */
  font-family: "Courier New", monospace;
  line-height: 1.5;
}

code {
  font-family: "Courier New", monospace;
  background: #f5f5f5;
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

#question-container {
  display: flex;
  margin-top: auto;
}

#question {
  flex: 0.3;
  padding: 12px 15px;
  border: 1px solid #e0e0e0;
  border-radius: 25px;
  resize: none;
  font-size: 16px;
  outline: none;
  transition: border 0.2s;
}

#question:focus {
  border-color: #6200ea;
}

#send-question {
  height: 35px;
  margin-top: 5px;
  margin-left: 10px;
  padding: 0 20px;
  background: #6200ea;
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: background 0.2s;
}

#send-question:hover {
  background: #5b00d1;
}

.ad-sidebar {
  width: 250px;
  background: #ffffff;
  padding: 15px;
  border-left: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.typing-indicator {
  display: inline-block;
}

.typing-indicator::after {
  content: "...";
  animation: typing 1.5s infinite;
  display: inline-block;
  width: 20px;
  text-align: left;
}

@keyframes typing {
  0% {
    content: ".";
  }
  33% {
    content: "..";
  }
  66% {
    content: "...";
  }
}

/* Кнопка-гамбургер */
.menu-button {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  color: white;
  cursor: pointer;
  margin-right: 10px;
}
@media (max-width: 768px) {
  .ad-sidebar {
    /*display: flex;*/
    display: none;
    width: 250px;
    background: #ffffff;
    padding: 15px;
    border-left: 1px solid #e0e0e0;

    flex-direction: column;
    justify-content: space-between;
  }
  .menu-button {
    display: inline-block;
  }
  .menu-button a {
    background: none;
    border: none;
    font-size: 24px;
    color: white;
    cursor: pointer;
    margin-right: 10px;
  }
  .menu-button a:hover {
    background-color: #40009a;
  }
  .sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    width: 280px;
    height: calc(100vh - 60px);
    background: #fff;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
  }

  body.sidebar-open {
    overflow: hidden;
  }
}

input {
  transition: all 0.3s ease;
}

table,
th,
td {
  border: 1px solid #ddd;
  border-collapse: collapse;
  padding: 8px;
  text-align: left;
}
table {
  width: 100%;
}
