:root {
  --primary: #4a6bff;
  --secondary: #9c27b0;
  /* Зміна кольорів: тепер повідомлення користувача матимуть фон ШІ, а ШІ – фон користувача */
  --user-bubble: #f3e5f5;
  --ai-bubble: #e3f2fd;
  --background: #f5f5f5;
  --text: #333;
  --bubbleShadow: rgba(0, 0, 0, 0.1);
  --headerBg: #5c7cfa;
  --sidebarBg: #f0f0f0;
  --maxChatWidth: 600px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Roboto', 'Arial', sans-serif;
}

body {
  background-color: var(--background);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Контейнер для десктопної версії: sidebar + центрований чат */
.container {
  display: flex;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
}

/* Бокова панель (для десктопу) */
.sidebar {
  background-color: var(--sidebarBg);
  width: 220px;
  padding: 10px;
  border-right: 1px solid #ddd;
  overflow-y: auto;
}

.sidebar .section-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-btn {
  background: white;
  border: none;
  border-radius: 20px;
  padding: 8px 15px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.9rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.section-btn.active {
  background: var(--primary);
  color: white;
}

.section-btn:hover:not(.active) {
  background: #f0f0f0;
}

/* Область чату */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: var(--maxChatWidth);
  margin: 0 auto;
  background: white;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

header {
  background: var(--headerBg);
  color: white;
  padding: 15px 20px;
  text-align: center;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Гамбургер для мобільної версії */
.hamburger {
  display: none;
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
}

.hamburger span {
  display: block;
  width: 25px;
  height: 3px;
  margin: 4px 0;
  background: white;
  transition: all 0.3s;
}

h1 {
  font-size: 1.6rem;
  margin-bottom: 5px;
}

.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  scroll-behavior: smooth;
  background: #fff;
}

.message {
  display: flex;
  margin-bottom: 15px;
  max-width: 90%;
}

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

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--primary);
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  font-weight: bold;
  margin: 0 10px;
  flex-shrink: 0;
}

.user .avatar {
  background-color: var(--secondary);
}

.bubble {
  padding: 12px 15px;
  border-radius: 18px;
  background-color: var(--ai-bubble);
  box-shadow: 0 1px 2px var(--bubbleShadow);
  position: relative;
}

.user .bubble {
  background-color: var(--user-bubble);
  border-top-right-radius: 4px;
}

.ai .bubble {
  border-top-left-radius: 4px;
}

.bubble p {
  margin-bottom: 8px;
}

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

.bubble img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.navigation {
  display: flex;
  justify-content: space-between;
  padding: 10px 20px;
  background: #f0f0f0;
}

.nav-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 30px;
  padding: 8px 20px;
  cursor: pointer;
  transition: background 0.3s;
  font-weight: bold;
}

.nav-btn:disabled {
  background: #cccccc;
  cursor: not-allowed;
}

.nav-btn:hover:not(:disabled) {
  background: #3a59cc;
}

.cover-image {
  width: 100%;
  object-fit: contain;
  margin: 10px 0;
}

/* Мобільна версія (до 768px) */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }
  .sidebar {
    display: none;
  }
  .hamburger {
    display: block;
  }
  .chat-area {
    max-width: 100%;
    margin: 0;
    box-shadow: none;
  }
}

/* Мобільне меню (накладка) */
.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 75%;
  max-width: 300px;
  height: 100%;
  background: var(--sidebarBg);
  box-shadow: 2px 0 5px rgba(0,0,0,0.3);
  padding: 20px;
  z-index: 2000;
  overflow-y: auto;
}

.mobile-menu .section-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-menu .section-btn {
  width: 100%;
}

.close-menu {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  margin-bottom: 20px;
}
