/* ==========================================================
   ChatGPT-like UI (light background)
   ========================================================== */

:root{
  /* Typography */
  --font-ui: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --font-display: Manrope, Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

  /* Dark (default) */
  --bg: #0B0D10;
  --surface: #0F1217;     /* used as soft background */
  --surface-2: #121723;   /* elevated */
  --overlay: rgba(11,13,16,0.72);

  --text: #F5F7FA;
  --text-2: rgba(245,247,250,0.92);
  --muted: #9AA4B2;
  --muted-2: #6B7380;

  --border: rgba(255,255,255,0.08);
  --border-2: rgba(255,255,255,0.12);

  /* Single accent */
  --accent: #3B82F6;
  --accent-hover: #3B82F6;
  --accent-soft: rgba(59,130,246,0.15);
  --accent-glow: rgba(59,130,246,0.35);

  /* Ambient (not UI) */
  --ambient-violet: rgba(168,85,247,0.12);

  /* Radii (keep legacy names) */
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;

  /* Layout */
  --sidebar-width: 320px;
  --content-width: 768px;

  /* Chat */
  --chat-max: 768px;
  --chat-gutter: 16px;
  --user-bg: rgba(255,255,255,0.06);
  --assistant-bg: rgba(255,255,255,0.03);
  --system-bg: var(--accent-soft);

  /* Sidebar semantic (legacy vars kept) */
  --sidebar-bg: #0F1217;
  --sidebar-border: var(--border);
  --sidebar-text: rgba(245,247,250,0.92);
  --sidebar-muted: rgba(154,164,178,0.85);

  /* Subtle depth */
  --shadow-soft: 0 0 0 1px var(--border), 0 18px 44px rgba(0,0,0,0.45);
  --t: 180ms;
  --ease: cubic-behtml[data-theme="light"]{
  --bg:#F7F8FB;
  --surface:#FFFFFF;
  --surface-2:#F1F4FA;
  --overlay: rgba(247,248,251,0.80);

  --text:#0B0D10;
  --text-2: rgba(11,13,16,0.86);
  --muted:#4B5563;
  --muted-2:#6B7280;

  --border: rgba(15,23,42,0.10);
  --border-2: rgba(15,23,42,0.14);

  --accent-soft: rgba(59,130,246,0.15);
  --accent-glow: rgba(59,130,246,0.22);

  --sidebar-bg: #0F1217;
  --sidebar-border: rgba(255,255,255,0.10);
  --sidebar-text: rgba(245,247,250,0.92);
  --sidebar-muted: rgba(154,164,178,0.85);

  --user-bg: rgba(15,23,42,0.04);
  --assistant-bg: rgba(15,23,42,0.02);
  --accent: #3B82F6;
  --accent-hover: #3B82F6;
  --t: 180ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-1: 0 0 0 1px var(--border), 0 18px 44px rgba(15,23,42,0.08);
  --shadow-2: 0 0 0 1px var(--border-2), 0 22px 54px rgba(15,23,42,0.10);
}bar-border: rgba(255,255,255,0.10);
  --sidebar-text: rgba(245,247,250,0.92);
  --sidebar-muted: rgba(154,164,178,0.85);

  --user-bg: rgba(15,23,42,0.04);
  --assistant-bg: rgba(15,23,42,0.02);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }
button, textarea, select { font: inherit; }

/* App shell */
.app-shell {
  height: 100vh;
  height: 100dvh;
  display: flex;
  overflow: hidden;
}

.app-shell--chatgpt {
  flex-direction: row;
}

/* ===================== Sidebar ===================== */
.sidebar.sidebar--app {
  width: var(--sidebar-width);
  flex-shrink: 0;
  height: 100%;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  overflow: hidden;
  position: relative;
  z-index: 100;
}

.sidebar-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

/* Обновленный брендинг с красивым логотипом */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background 0.2s ease;
}
.brand:hover { background: rgba(255, 255, 255, 0.06); }

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: white;
  font-weight: 800;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(59,130,246, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand:hover .brand-mark {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59,130,246, 0.4);
}

/* Альтернатива: логотип-изображение */
.brand-logo-img {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  object-fit: contain;
  background: rgba(255, 255, 255, 0.1);
  padding: 6px;
}

.brand-text { min-width: 0; }
.brand-name {
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.98);
  margin-bottom: 2px;
}
.brand-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.35;
  max-width: 200px;
}

.sidebar-actions {
  display: flex;
  gap: 8px;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  user-select: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.10);
}
.ghost-btn:hover { 
  background: rgba(255, 255, 255, 0.10); 
  border-color: rgba(255, 255, 255, 0.16); 
}

.primary-btn {
  background: var(--accent);
  color: #fff;
  border-color: rgba(0,0,0,0);
}
.primary-btn:hover { background: var(--accent-hover); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--sidebar-text);
  background: rgba(59,130,246, 0.12);
  border: 1px solid rgba(59,130,246, 0.20);
  width: fit-content;
}
.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.sidebar-section {
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-lg);
  padding: 12px;
  background: transparent;
}

.sidebar-title { 
  font-size: 12px; 
  font-weight: 700; 
  color: rgba(255,255,255,0.86); 
  margin-bottom: 4px;
}
.sidebar-sub { 
  font-size: 12px; 
  color: var(--sidebar-muted); 
  line-height: 1.35; 
}

.chats-list { 
  margin-top: 10px; 
  display: flex; 
  flex-direction: column; 
  gap: 8px; 
}

.chat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.06);
  transition: all 0.2s ease;
  cursor: pointer;
}
.chat-item:hover { 
  background: rgba(255, 255, 255, 0.10); 
  border-color: rgba(255, 255, 255, 0.16); 
}
.chat-item.active { 
  background: rgba(59,130,246, 0.16); 
  border-color: rgba(59,130,246, 0.24); 
}

.chat-item.loading { opacity: 0.75; }

.item-content { 
  min-width: 0; 
  flex: 1;
}
.item-title { 
  font-size: 13px; 
  font-weight: 600; 
  color: rgba(255,255,255,0.92); 
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis; 
}
.chat-meta { 
  margin-top: 2px; 
  font-size: 11px; 
  color: rgba(255,255,255,0.62); 
  display: flex; 
  gap: 10px; 
}

.delete-chat-btn {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.14);
  color: rgba(255,255,255,0.90);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.delete-chat-btn:hover { background: rgba(239, 68, 68, 0.20); }

.geo-select {
  width: 100%;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  outline: none;
  cursor: pointer;
  font-size: 13px;
}
.geo-select:focus { 
  border-color: rgba(59,130,246, 0.55); 
  box-shadow: 0 0 0 3px rgba(59,130,246, 0.18); 
}

/* ===================== Новая секция: How to ask ===================== */
.sidebar-section--instructions {
  margin-top: 12px;
}

.instruction-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.instruction-pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.2;
}

/* ===================== Новая секция: Response mode ===================== */
.sidebar-section--mode {
  margin-top: 12px;
}

.mode-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.mode-btn {
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.16);
}

.mode-btn.active {
  background: rgba(59,130,246, 0.16);
  border-color: rgba(59,130,246, 0.24);
}

.mode-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 2px;
  color: rgba(255, 255, 255, 0.95);
}

.mode-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.3;
}

.sidebar-foot { 
  margin-top: auto; 
  padding-top: 12px; 
  border-top: 1px solid rgba(255, 255, 255, 0.10); 
}
.sidebar-foot-row { display: flex; }

.sidebar-links { 
  display: flex; 
  flex-direction: column; 
  gap: 6px; 
  margin-top: 10px; 
}
.footer-link {
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  font-size: 12px;
  padding: 6px 6px;
  border-radius: 10px;
  transition: all 0.2s ease;
}
.footer-link:hover { 
  background: rgba(255,255,255,0.06); 
  color: rgba(255,255,255,0.92); 
}

/* Remove the marketing bullets in the sidebar */
.trust-row { display: none !important; }

/* ===================== Main chat ===================== */
.main.main--chat {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-container.chat-container--centered {
  height: 100%;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: transparent;
  position: relative;
}

.chat-head {
  padding: 12px var(--chat-gutter);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.mobile-menu-btn {
  display: none;
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  z-index: 11;
}
.mobile-menu-btn:hover {
  background: rgba(255,255,255,0.04);
}

.chat-title {
  text-align: center;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 20px;
}

.chat-title-label {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
}

.chat-title-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.chat-content { 
  position: relative; 
  flex: 1; 
  overflow: hidden; 
  background: var(--bg);
}

.chat-messages {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 16px var(--chat-gutter) 160px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Контейнер для сообщений - центрирование */
.message-wrapper {
  width: 100%;
  max-width: var(--chat-max);
  margin: 0 auto;
  display: flex;
}

.message-wrapper.user {
  justify-content: flex-end;
}

.message-wrapper.system {
  justify-content: center;
}

/* Message styling - КОМПАКТНО как в ChatGPT */
.message {
  display: block;
  width: 100%;
  max-width: 100%;
}

.message-content {
  max-width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  font-size: 14px; /* Уменьшен с 15px */
  line-height: 1.5; /* Уменьшен с 1.6 */
  color: var(--text);
  word-break: break-word;
  overflow-wrap: break-word;
  box-shadow: none;
}

/* Ассистент (бот) - слева, белый фон */
.message.assistant .message-content {
  background: var(--assistant-bg);
  border-color: var(--border);
}

/* Пользователь - справа, серый фон */
.message.user .message-content {
  background: var(--user-bg);
  border-color: var(--border);
  margin-left: auto;
  max-width: min(640px, 100%);
}

/* Системное сообщение - по центру */
.message.system .message-content {
  background: var(--system-bg);
  border-color: rgba(59,130,246, 0.18);
  color: var(--accent);
  text-align: center;
  font-size: 12px; /* Уменьшен с 13px */
  padding: 8px 16px;
  max-width: fit-content;
  margin: 0 auto;
}

/* Message content styling - КОМПАКТНО */
.message-content p { 
  margin: 0 0 6px 0; /* Уменьшен с 8px */
  line-height: 1.5;
}
.message-content p:last-child { 
  margin-bottom: 0; 
}

.message-content h1,
.message-content h2,
.message-content h3 {
  margin: 0 0 6px 0; /* Уменьшен с 8px */
  line-height: 1.25;
}
.message-content h1 { font-size: 16px; /* Уменьшен с 18px */ }
.message-content h2 { font-size: 15px; /* Уменьшен с 16px */ }
.message-content h3 { font-size: 14px; /* Уменьшен с 15px */ }

.message-content ul,
.message-content ol {
  margin: 6px 0 6px 20px; /* Уменьшен с 8px */
  padding: 0;
}
.message-content li { 
  margin: 3px 0; /* Уменьшен с 4px */
  line-height: 1.4; /* Уменьшен с 1.5 */
}

.message-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 10px 0; /* Уменьшен с 12px */
}

.message-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(59,130,246, 0.35);
}
.message-content a:hover { 
  border-bottom-color: rgba(59,130,246, 0.60); 
}

/* Code blocks */
.message-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em; /* Уменьшен с 0.92em */
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  padding: 1px 4px; /* Уменьшен с 2px 6px */
  border-radius: 4px; /* Уменьшен с 6px */
}

.message-content pre {
  margin: 6px 0; /* Уменьшен с 8px */
  padding: 10px; /* Уменьшен с 12px */
  overflow: auto;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px; /* Уменьшен с 14px */
  line-height: 1.4;
}
.message-content pre code {
  background: transparent;
  border: none;
  padding: 0;
}

/* Offers - ВСЕГДА ПОД ОТВЕТОМ, отдельным блоком */
.offer-links-container {
  width: 100%;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed rgba(255,255,255,0.10);
  clear: both;
}

.offer-links-container strong {
  display: block;
  margin-bottom: 10px; /* Уменьшен с 12px */
  font-size: 12px; /* Уменьшен с 13px */
  color: var(--muted);
  font-weight: 600;
}

.offers-grid {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  width: 100%;
}

.offer-card {
  flex: 0 0 auto;
  width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s ease;
}
.offer-card:hover { 
  border-color: var(--border-2); 
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px var(--border), 0 18px 44px rgba(0,0,0,0.35);
}
.offer-title { 
  font-weight: 650; 
  font-size: 12px; /* Уменьшен с 13px */
  margin-bottom: 4px; /* Уменьшен с 6px */
  line-height: 1.3;
}
.offer-description { 
  font-size: 11px; /* Уменьшен с 12px */
  color: var(--muted); 
  line-height: 1.4; 
  margin-bottom: 6px; /* Уменьшен с 8px */
}
.offer-meta { 
  margin-top: 8px; /* Уменьшен с 10px */
  display: flex; 
  justify-content: space-between; 
  align-items: center;
  font-size: 11px; /* Уменьшен с 12px */
  color: var(--muted); 
}
.offer-price { 
  font-weight: 700; 
  color: var(--text-2); 
}

.offer-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
}

/* Typing indicator */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-lg);
  font-size: 13px;
  color: var(--muted);
  max-width: min(640px, 100%);
}

.typing-indicator .dots { 
  display: inline-flex; 
  gap: 4px; 
}
.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.55);
  animation: typing 1.4s infinite ease-in-out;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing {
  0%, 80%, 100% { transform: scale(0); opacity: 0.45; }
  40% { transform: scale(1); opacity: 1; }
}

/* ===================== Composer (упрощенный) ===================== */
.composer {
  position: sticky;
  bottom: 0;
  z-index: 10;
  padding: 12px var(--chat-gutter) 16px;
  border-top: 1px solid var(--border);
  background: var(--overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.composer > * {
  max-width: var(--chat-max);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.composer-row { 
  display: flex; 
  gap: 10px; 
  align-items: flex-end; 
}

.message-input {
  flex: 1;
  resize: none;
  padding: 12px 16px;
  min-height: 44px;
  max-height: 140px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-2);
  background: var(--surface);
  font-size: 14px; /* Уменьшен с 15px */
  line-height: 1.4; /* Уменьшен с 1.45 */
  color: var(--text);
  outline: none;
  font-family: var(--font-ui);
  transition: all 0.2s ease;
}
.message-input::placeholder { 
  color: var(--muted-2); 
}
.message-input:focus { 
  border-color: rgba(59,130,246, 0.55); 
  box-shadow: 0 0 0 3px rgba(59,130,246, 0.18); 
}

.send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  min-width: 92px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.send-btn:hover { 
  background: var(--accent-hover); 
}
.send-btn:disabled { 
  opacity: 0.60; 
  cursor: not-allowed; 
}

.composer-bottom { 
  margin-top: 12px; 
}

.fineprint {
  font-size: 11px; /* Уменьшен с 12px */
  color: var(--muted);
  line-height: 1.4; /* Уменьшен с 1.45 */
  text-align: center;
}

/* ===================== Welcome (template) ===================== */
.welcome {
  max-width: var(--chat-max);
  margin: 0 auto;
  padding: 32px var(--chat-gutter) 0; /* Уменьшен с 40px */
}

.welcome-title {
  font-size: 24px; /* Уменьшен с 28px */
  font-weight: 750;
  letter-spacing: -0.02em;
  text-align: center;
  margin-bottom: 10px; /* Уменьшен с 12px */
  line-height: 1.2;
}

.welcome-sub {
  margin: 0 auto;
  max-width: 44rem;
  text-align: center;
  color: var(--muted);
  line-height: 1.5; /* Уменьшен с 1.6 */
  font-size: 13px; /* Уменьшен с 14px */
}

.welcome-cards {
  margin-top: 20px; /* Уменьшен с 24px */
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px; /* Уменьшен с 12px */
}

.wcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px; /* Уменьшен с 16px */
  transition: all 0.2s ease;
}
.wcard:hover {
  border-color: var(--border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.wcard-title { 
  font-size: 13px; /* Уменьшен с 14px */
  font-weight: 700; 
  margin-bottom: 4px; /* Уменьшен с 6px */
}
.wcard-sub { 
  font-size: 11px; /* Уменьшен с 12px */
  color: var(--muted); 
  line-height: 1.4; /* Уменьшен с 1.45 */
}

.welcome-quickstarts { 
  margin-top: 20px; /* Уменьшен с 24px */
  padding-top: 20px; /* Уменьшен с 24px */
  border-top: 1px dashed rgba(255,255,255,0.10); 
}
.we-title { 
  text-align: center; 
  font-size: 12px; /* Уменьшен с 13px */
  font-weight: 700; 
  margin-bottom: 12px; /* Уменьшен с 16px */
  color: var(--text-2);
}

.prompt-grid { 
  margin-top: 10px; /* Уменьшен с 12px */
  display: grid; 
  gap: 8px; /* Уменьшен с 10px */
}
.prompt-btn {
  text-align: left;
  padding: 12px 14px; /* Уменьшен с 14px 16px */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text);
  font-size: 13px; /* Уменьшен с 14px */
  transition: all 0.2s ease;
  width: 100%;
}
.prompt-btn:hover { 
  border-color: var(--border-2); 
  background: var(--surface-2);
}

.mini-note {
  margin-top: 12px; /* Уменьшен с 16px */
  padding-top: 12px; /* Уменьшен с 16px */
  border-top: 1px dashed rgba(255,255,255,0.10);
  font-size: 11px; /* Уменьшен с 12px */
  color: var(--muted);
  text-align: center;
  line-height: 1.4; /* Уменьшен с 1.5 */
}

.welcome-examples {
  margin-top: 24px; /* Уменьшен с 32px */
  padding-top: 20px; /* Уменьшен с 24px */
  border-top: 1px dashed rgba(255,255,255,0.10);
}
.welcome-examples ul {
  margin: 10px 0 0 20px; /* Уменьшен с 12px */
  padding: 0;
  color: var(--muted);
  font-size: 13px; /* Уменьшен с 14px */
  line-height: 1.5; /* Уменьшен с 1.6 */
}
.welcome-examples li {
  margin: 6px 0; /* Уменьшен с 8px */
}

/* Mobile backdrop */
.mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 90;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ===================== Scrollbars ===================== */
*::-webkit-scrollbar { 
  width: 8px; 
  height: 8px; 
}
*::-webkit-scrollbar-track { 
  background: transparent; 
}
*::-webkit-scrollbar-thumb { 
  background: rgba(255,255,255,0.14); 
  border-radius: 8px; 
}
*::-webkit-scrollbar-thumb:hover { 
  background: rgba(255,255,255,0.22); 
}

/* ===================== Responsive ===================== */
@media (max-width: 920px) {
  .app-shell--chatgpt { 
    flex-direction: row;
  }

  .sidebar.sidebar--app {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 100;
    border-right: 1px solid var(--sidebar-border);
    border-bottom: none;
  }

  .sidebar.sidebar--app.open {
    transform: translateX(0);
  }

  .sidebar-scroll { 
    max-height: 100vh;
    overflow-y: auto;
  }

  .main.main--chat {
    width: 100%;
    height: 100vh;
  }

  .mobile-menu-btn {
    display: block;
  }

  .chat-title {
    padding: 0 40px;
  }

  .mobile-backdrop {
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .mobile-backdrop.active {
    opacity: 1;
    pointer-events: all;
  }

  .mode-selector {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .mode-btn {
    flex: 1;
    min-width: calc(50% - 4px);
  }
  
  .instruction-pills {
    justify-content: center;
  }

  .welcome-cards { 
    grid-template-columns: repeat(2, 1fr); 
    gap: 10px; /* Уменьшен с 12px */
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
    --chat-gutter: 12px;
  }

  .chat-head { 
    padding: 12px; 
  }
  
  .chat-messages { 
    padding: 16px var(--chat-gutter) 150px; 
    gap: 16px;
  }

  .message-content {
    padding: 10px 14px; /* Уменьшен с 12px 14px */
    font-size: 13.5px; /* Уменьшен с 14px */
    line-height: 1.45; /* Уменьшен с 1.5 */
  }

  .message.user .message-content {
    max-width: 90%;
  }

  .composer { 
    padding: 12px var(--chat-gutter); /* Уменьшен с 14px */
  }
  
  .send-btn { 
    min-width: 80px; 
    padding: 10px 16px;
  }

  .brand-sub { 
    display: none; 
  }

  .welcome-title {
    font-size: 22px; /* Уменьшен с 24px */
  }

  .welcome-sub {
    font-size: 12px; /* Уменьшен с 13px */
  }

  .offer-card {
    width: 200px;
  }

  .welcome-cards {
    grid-template-columns: 1fr;
  }

  .mode-btn {
    min-width: 100%;
  }
}

@media (max-width: 480px) {
  :root {
    --sidebar-width: 100%;
    --chat-gutter: 12px;
  }

  .chat-head { 
    padding: 10px 12px; 
  }
  
  .chat-messages { 
    padding: 14px var(--chat-gutter) 140px; 
    gap: 14px;
  }

  .message-content {
    padding: 10px 12px;
    font-size: 13.5px; /* Уменьшен с 14px */
  }

  .composer { 
    padding: 12px var(--chat-gutter); 
  }
  
  .send-btn { 
    min-width: 70px; 
    padding: 10px 14px;
    font-size: 12px; /* Уменьшен с 13px */
  }

  .welcome {
    padding: 24px var(--chat-gutter) 0; /* Уменьшен с 30px */
  }

  .welcome-title {
    font-size: 20px; /* Уменьшен с 22px */
  }

  .prompt-btn {
    padding: 10px 12px; /* Уменьшен с 12px 14px */
    font-size: 12px; /* Уменьшен с 13px */
  }

  /* FIX: Карточки оферов не сжимают ответ на мобильных */
  .offer-card {
    width: 180px;
    min-width: 180px;
    padding: 10px;
  }

  .offers-grid {
    display: flex;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  /* Обеспечиваем, чтобы сообщение не сжималось карточками */
  .message.assistant .message-content,
  .message.user .message-content {
    min-width: 0;
    width: auto;
  }
}

/* ===================== Print ===================== */
@media print {
  .sidebar, 
  .composer,
  .mobile-menu-btn,
  .mobile-backdrop { 
    display: none !important; 
  }
  body { 
    overflow: visible; 
  }
  .chat-messages { 
    position: static; 
    padding: 0 !important; 
  }
}

/* ===================== Toast Notifications ===================== */
.system-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 400px;
    width: 90%;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.system-toast.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-text {
    flex: 1;
}

.toast-text strong {
    display: block;
    font-size: 13px; /* Уменьшен с 14px */
    font-weight: 700;
    margin-bottom: 4px;
    color: rgba(255, 255, 255, 0.95);
}

.toast-text div {
    font-size: 12px; /* Уменьшен с 13px */
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.75);
}

/* Мобильная адаптация для тостов */
@media (max-width: 480px) {
    .system-toast {
        bottom: 120px;
        padding: 12px 16px;
        width: calc(100% - 32px);
    }
}

/* Streaming (typed) assistant output */
.message.assistant.streaming .message-content {
  white-space: normal;
}

.stream-cursor {
  display: inline-block;
  margin-left: 2px;
  opacity: 0.9;
  animation: rf-blink 1s steps(1, end) infinite;
}

@keyframes rf-blink {
  50% { opacity: 0; }
}

/* ===================== Legal Pages ===================== */
.legal-page {
  max-width: var(--chat-max);
  margin: 0 auto;
  padding: 20px 0;
  min-height: 0; /* Важно для flex-контейнера */
}

.legal-header {
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
}

.legal-title {
  font-size: 24px; /* Уменьшен с 28px */
  font-weight: 750;
  letter-spacing: -0.02em;
  margin: 0 0 8px 0;
  color: var(--text);
}

.legal-subtitle {
  font-size: 14px; /* Уменьшен с 16px */
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.legal-content {
  font-size: 14px; /* Уменьшен с 15px */
  line-height: 1.5; /* Уменьшен с 1.6 */
  color: var(--text);
  min-height: 0; /* Важно для flex-контейнера */
}

.legal-section {
  margin-bottom: 28px; /* Уменьшен с 32px */
  padding-bottom: 20px; /* Уменьшен с 24px */
  border-bottom: 1px solid var(--border);
}

.legal-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.legal-section h2 {
  font-size: 18px; /* Уменьшен с 20px */
  font-weight: 700;
  margin: 0 0 14px 0; /* Уменьшен с 16px */
  color: var(--text);
}

.legal-section h3 {
  font-size: 16px; /* Уменьшен с 17px */
  font-weight: 650;
  margin: 16px 0 10px 0; /* Уменьшен с 20px 0 12px */
  color: var(--text);
}

.legal-section p {
  margin: 0 0 14px 0; /* Уменьшен с 16px */
  font-size: 14px;
  line-height: 1.5;
}

.legal-section ul,
.legal-section ol {
  margin: 14px 0; /* Уменьшен с 16px */
  padding-left: 22px; /* Уменьшен с 24px */
}

.legal-section li {
  margin-bottom: 6px; /* Уменьшен с 8px */
  line-height: 1.4; /* Уменьшен с 1.5 */
  font-size: 14px;
}

.legal-section li:last-child {
  margin-bottom: 0;
}

.legal-section strong {
  color: var(--text);
  font-weight: 650;
}

.legal-footer {
  margin-top: 36px; /* Уменьшен с 40px */
  padding-top: 20px; /* Уменьшен с 24px */
  border-top: 1px solid var(--border);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--accent);
  color: white;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px; /* Уменьшен с 14px */
  transition: background-color 0.2s ease;
}

.back-link:hover {
  background: var(--accent-hover);
}

/* Sidebar для legal pages */
.sidebar.sidebar--legal {
  background: var(--sidebar-bg);
}

.sidebar.sidebar--legal .sidebar-scroll {
  padding: 16px 12px;
}

/* Стили для навигации в сайдбаре legal pages */
.sidebar-section .chats-list a.chat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.06);
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 8px;
}

.sidebar-section .chats-list a.chat-item:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.16);
}

.sidebar-section .chats-list a.chat-item.active {
  background: rgba(59,130,246, 0.16);
  border-color: rgba(59,130,246, 0.24);
}

.sidebar-section .chats-list a.chat-item:last-child {
  margin-bottom: 0;
}

/* ===================== Исправление скролла для legal pages ===================== */
.main.main--chat .chat-content[aria-label="Content"] {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: var(--bg);
}

.main.main--chat .chat-content[aria-label="Content"] .chat-messages {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 20px 16px;
  display: block; /* Изменено с flex на block */
}

/* Убираем стили из инлайна */
.chat-messages[style*="position: static"] {
  position: absolute !important;
  inset: 0 !important;
  padding: 20px 16px !important;
}

.chat-messages[style*="padding: 20px 16px"] {
  position: absolute !important;
  inset: 0 !important;
}

/* Мобильная адаптация для legal pages */
@media (max-width: 920px) {
  .sidebar.sidebar--app {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 100;
  }

  .sidebar.sidebar--app.open {
    transform: translateX(0);
  }

  .mobile-menu-btn {
    display: block;
  }

  .mobile-backdrop {
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .mobile-backdrop.active {
    opacity: 1;
    pointer-events: all;
  }

  .legal-title {
    font-size: 22px; /* Уменьшен с 24px */
  }

  .legal-subtitle {
    font-size: 13px; /* Уменьшен с 15px */
  }
}

@media (max-width: 768px) {
  .legal-page {
    padding: 16px 0;
  }

  .legal-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
  }

  .legal-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
  }

  .legal-title {
    font-size: 20px; /* Уменьшен с 22px */
  }

  .legal-section h2 {
    font-size: 17px; /* Уменьшен с 18px */
  }

  .main.main--chat .chat-content[aria-label="Content"] .chat-messages {
    padding: 16px 12px;
  }
}

@media (max-width: 480px) {
  .legal-title {
    font-size: 19px; /* Уменьшен с 20px */
  }

  .legal-subtitle {
    font-size: 12px; /* Уменьшен с 14px */
  }

  .legal-content {
    font-size: 13px; /* Уменьшен с 14px */
  }

  .back-link {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .main.main--chat .chat-content[aria-label="Content"] .chat-messages {
    padding: 14px 12px;
  }
}

/* ===================== NEW: Message Animations & Copy Button ===================== */
@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: messageAppear 0.3s ease-out forwards;
    opacity: 0;
}

.message.user {
    animation-delay: 0.1s;
}

.message.assistant {
    animation-delay: 0.05s;
}

.message.system {
    animation-duration: 0.2s;
}

/* Стили для кнопки копирования */
.message.assistant .message-content {
    position: relative;
    padding-right: 44px;
}

.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    opacity: 0;
    transition: all 0.2s ease;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted);
    font-size: 14px;
    flex-shrink: 0;
    z-index: 1;
}

.copy-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text);
}

.message.assistant:hover .copy-btn {
    opacity: 1;
}

.copy-btn.copied {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.copy-btn.copied::before {
    content: "✓";
}

.copy-btn:not(.copied)::before {
    content: "📋";
}

/* ===================== Thinking Indicator ===================== */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    background: var(--assistant-bg);
    border-radius: var(--radius-lg);
    max-width: min(640px, 100%);
    margin: 0 auto;
    opacity: 0;
    animation: fadeIn 0.2s ease-out forwards;
    min-height: 52px;
}

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

.thinking-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.thinking-text {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
}

.thinking-dots {
    display: flex;
    gap: 4px;
}

.thinking-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--muted);
    animation: thinkingPulse 1.5s infinite ease-in-out;
}

.thinking-dot:nth-child(1) { animation-delay: 0s; }
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinkingPulse {
    0%, 60%, 100% { 
        opacity: 0.4; 
        transform: scale(0.8); 
    }
    30% { 
        opacity: 1; 
        transform: scale(1); 
    }
}

/* Для адаптации на мобильных */
@media (max-width: 768px) {
    .thinking-indicator {
        padding: 10px 14px;
        min-height: 48px;
    }
    
    .thinking-text {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .message.assistant .message-content {
        padding-right: 36px;
    }
    
    .copy-btn {
        width: 24px;
        height: 24px;
        top: 8px;
        right: 8px;
    }
}

/* ===================== Premium ambient background ===================== */
body::before{
  content:"";
  position:fixed;
  inset:-120px;
  z-index:-1;
  pointer-events:none;
  background:
    radial-gradient(700px circle at 18% 18%, rgba(59,130,246,0.12), transparent 55%),
    radial-gradient(700px circle at 82% 78%, var(--ambient-violet), transparent 58%),
    radial-gradient(520px circle at 70% 22%, rgba(59,130,246,0.06), transparent 60%);
}

/* Make the main surfaces feel glassy */
.sidebar.sidebar--app,
.chat-head,
.composer{
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* Improve focus rings (single accent) */
:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.22);
  border-color: rgba(59,130,246,0.55);
}

/* Links underline style */
.message-content a{
  border-bottom-color: rgba(59,130,246,0.35);
}
.message-content a:hover{
  border-bottom-color: rgba(59,130,246,0.60);
}

/* Copy button – premium dark */
.copy-btn{
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: rgba(245,247,250,0.75);
}
.copy-btn:hover{
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

/* ===================== Development warning (missing in original CSS) ===================== */
.development-warning-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms var(--ease, ease);
  z-index: 9998;
}
.development-warning-overlay.active{
  opacity: 1;
  pointer-events: all;
}

.development-warning{
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-46%);
  width: min(520px, calc(100% - 32px));
  background: rgba(18,23,35,0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  visibility: hidden;
  transition: opacity 250ms var(--ease, ease), transform 250ms var(--ease, ease), visibility 0ms linear 250ms;
  z-index: 9999;
}
.development-warning.visible{
  opacity: 1;
  visibility: visible;
  transform: translate(-50%,-50%);
  transition: opacity 250ms var(--ease, ease), transform 250ms var(--ease, ease), visibility 0ms;
}
.warning-header{
  display:flex;
  gap:12px;
  align-items:center;
  margin-bottom: 10px;
}
.warning-icon{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.20);
  color: var(--accent);
  flex-shrink:0;
}
.warning-icon svg{ width: 22px; height: 22px; }
.warning-title{
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--text);
}
.warning-message{
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.warning-actions{
  margin-top: 14px;
  display:flex;
  justify-content:flex-end;
}
.warning-btn{
  appearance:none;
  border: 1px solid rgba(59,130,246,0.25);
  background: rgba(59,130,246,0.14);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 650;
  cursor:pointer;
  transition: background 200ms var(--ease, ease), border-color 200ms var(--ease, ease), transform 200ms var(--ease, ease);
}
.warning-btn:hover{
  background: rgba(59,130,246,0.18);
  border-color: rgba(59,130,246,0.35);
  transform: translateY(-1px);
}

/* Corporate logo mark (same as landing) */
.brand-logo .mark{
  width: 14px;
  height: 14px;
  border-radius: 6px;
  background: var(--accent);
  box-shadow: 
    0 0 0 6px var(--accent-soft),
    0 0 24px var(--accent-glow);
  display: inline-block;
}



/* Display typography */
.brand-name, .chat-title-label, .welcome-title, .legal-title { font-family: var(--font-display); }

/* --- Unified motion + CTA polish (non-breaking) --- */
.btn, .primary-btn, .send-btn, .ghost-btn{
  transition: transform var(--t) var(--ease),
              background var(--t) var(--ease),
              border-color var(--t) var(--ease),
              color var(--t) var(--ease),
              box-shadow var(--t) var(--ease),
              opacity var(--t) var(--ease);
}

.primary-btn, .send-btn{
  box-shadow: 0 0 0 6px var(--accent-soft), var(--shadow-1);
}
.primary-btn:hover, .send-btn:hover{
  background: var(--accent-hover);
  box-shadow: 0 0 0 8px var(--accent-soft), var(--shadow-2);
}
