﻿:root {
  --ink: #272036;
  --muted: #6b617f;
  --accent: #7152a8;
  --accent-soft: #8e72bb;
  --line: rgba(39, 32, 54, 0.12);
  --bot: #ffffff;
  --user: rgba(113, 82, 168, 0.18);
  --success: #2f8757;
  --error: #8b2a3b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: "Quicksand", "Segoe UI", sans-serif;
  color: var(--ink);
  background: transparent;
}

.app {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 18px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.92) 0%, rgba(249, 244, 255, 0.92) 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@keyframes rise {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.assistant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid rgba(39, 32, 54, 0.08);
  padding-bottom: 10px;
}

.assistant-head__identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.assistant-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2e1f53 0%, #6f53a8 100%);
  color: #f8f2ff;
  font-size: 1.25rem;
}

h1 {
  margin: 0;
  font-size: 1.24rem;
  line-height: 1.1;
}

.assistant-status {
  margin: 4px 0 0;
  font-size: 0.88rem;
  color: #4f4468;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.assistant-status span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3dbb67;
}

.assistant-secure {
  margin: 0;
  font-size: 0.82rem;
  color: #736989;
  font-weight: 600;
}

.chat {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.9) 0%, rgba(245, 241, 252, 0.9) 100%);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  min-height: 470px;
}

.chat__window {
  min-height: 336px;
  max-height: 52vh;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(126, 84, 168, 0.5) transparent;
}

.chat__window::-webkit-scrollbar {
  width: 8px;
}

.chat__window::-webkit-scrollbar-thumb {
  background: rgba(126, 84, 168, 0.42);
  border-radius: 999px;
}

.bubble {
  width: fit-content;
  max-width: 92%;
  padding: 12px 13px;
  border-radius: 14px;
  line-height: 1.45;
  font-size: 0.94rem;
  box-shadow: 0 12px 24px rgba(24, 21, 35, 0.08);
  animation: pop 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pop {
  from {
    transform: translateY(8px) scale(0.97);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.bubble--bot {
  background: var(--bot);
  border: 1px solid rgba(113, 82, 168, 0.12);
  align-self: flex-start;
}

.bubble--user {
  background: linear-gradient(140deg, rgba(113, 82, 168, 0.2) 0%, rgba(113, 82, 168, 0.12) 100%);
  border: 1px solid rgba(113, 82, 168, 0.24);
  align-self: flex-end;
}

.chat__input-area {
  border-top: 1px solid var(--line);
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: rgba(246, 242, 252, 0.9);
}

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.93rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-2px);
  outline: none;
}

.btn--option {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(113, 82, 168, 0.16);
  color: #32264b;
  text-align: left;
  width: 100%;
  display: block;
}

.btn--option:hover,
.btn--option:focus-visible {
  background: rgba(113, 82, 168, 0.14);
  border-color: rgba(113, 82, 168, 0.4);
  box-shadow: 0 8px 18px rgba(113, 82, 168, 0.18);
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 100%);
  color: #f7f3ff;
  border-color: rgba(113, 82, 168, 0.44);
  box-shadow: 0 12px 24px rgba(113, 82, 168, 0.3);
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background: linear-gradient(135deg, #64469b 0%, #886cb7 100%);
}

.field {
  flex: 1;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.94rem;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
}

.field:focus-visible {
  outline: 2px solid rgba(126, 84, 168, 0.45);
  border-color: rgba(126, 84, 168, 0.45);
}

textarea.field {
  min-height: 44px;
  height: 44px;
  resize: none;
  line-height: 1.2;
  overflow-y: auto;
}

.summary {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed rgba(113, 82, 168, 0.42);
  background: rgba(255, 255, 255, 0.86);
}

.summary h2 {
  margin: 0 0 10px;
  font-family: "Quicksand", "Segoe UI", sans-serif;
  font-size: 1.03rem;
}

.summary pre {
  margin: 0 0 12px;
  white-space: pre-wrap;
  font-family: "Quicksand", "Segoe UI", sans-serif;
  background: rgba(250, 247, 255, 0.88);
  border: 1px solid rgba(113, 82, 168, 0.22);
  padding: 10px;
  border-radius: 10px;
}

.app__footer {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.app__footer span {
  display: block;
  text-align: center;
  font-size: 0.8rem;
  color: #615776;
  border: 1px solid rgba(39, 32, 54, 0.12);
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.7);
}

.status {
  margin-top: 10px;
  min-height: 1.2em;
  font-weight: 600;
  font-size: 0.92rem;
}

.status--ok {
  color: var(--success);
}

.status--error {
  color: var(--error);
}

@media (max-width: 640px) {
  .app {
    padding: 14px;
  }

  .chat__window {
    min-height: 300px;
  }

  .assistant-secure {
    display: none;
  }

  .app__footer {
    grid-template-columns: 1fr;
  }

  .btn {
    font-size: 0.9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
