/* Демо Telegram-бота для малого бизнеса — визуал под мессенджер */

@font-face {
  font-family: "Golos";
  src: url("../fonts/GolosText-400-cyrillic.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos";
  src: url("../fonts/GolosText-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Golos";
  src: url("../fonts/GolosText-500-cyrillic.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos";
  src: url("../fonts/GolosText-500-latin.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Golos";
  src: url("../fonts/GolosText-600-cyrillic.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos";
  src: url("../fonts/GolosText-600-latin.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --page: #07090d;
  --page-2: #0f1319;
  --phone: #0f1620;
  --phone-line: #1d2733;
  --header: #17212b;
  --bubble-bot: #182533;
  --bubble-user: #2b5278;
  --text: #e9eef4;
  --muted: #8b9dae;
  --muted-2: #63727f;
  --accent: #c56b3e;
  --radius: 18px;
  --shadow: 0 40px 120px rgba(0, 0, 0, 0.65);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(197, 107, 62, 0.16), transparent 60%),
    radial-gradient(800px 500px at 95% 110%, rgba(43, 82, 120, 0.22), transparent 60%),
    var(--page);
  color: var(--text);
  font: 400 16px/1.45 "Golos", -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- раскладка ---------- */

.app {
  display: grid;
  grid-template-columns: minmax(300px, 380px) auto;
  gap: 56px;
  align-items: center;
  justify-content: center;
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px;
  min-height: 100vh;
}

/* ---------- описательная колонка ---------- */

.side { max-width: 380px; }

.side__kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid rgba(197, 107, 62, 0.45);
  border-radius: 999px;
  color: #e3a884;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.side__kicker::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.side__title {
  margin: 20px 0 12px;
  font-size: clamp(28px, 3.4vw, 38px);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.side__text {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 15px;
}

.side__label {
  margin: 0 0 10px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 26px;
}

.chip {
  appearance: none;
  border: 1px solid var(--phone-line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.15s;
}
.chip:hover { border-color: rgba(255, 255, 255, 0.25); color: var(--text); }
.chip:active { transform: scale(0.97); }
.chip.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: #fff;
}

.side__list {
  margin: 0 0 28px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}
.side__list li {
  position: relative;
  padding-left: 26px;
  color: var(--muted);
  font-size: 14.5px;
}
.side__list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.85;
}

.side__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn--primary {
  background: var(--accent);
  color: #14100d;
}
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 85%, #fff); }
.btn--ghost {
  border-color: var(--phone-line);
  color: var(--text);
  background: transparent;
}
.btn--ghost:hover { border-color: rgba(255, 255, 255, 0.3); }

.side__hint {
  margin: 18px 0 0;
  color: var(--muted-2);
  font-size: 12.5px;
  line-height: 1.5;
}

/* ---------- телефон ---------- */

.phone {
  position: relative;
  width: 390px;
  height: min(820px, calc(100vh - 96px));
  min-height: 560px;
  background: var(--phone);
  border: 9px solid #05070a;
  border-radius: 42px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
}

.phone__notch {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 108px;
  height: 22px;
  border-radius: 999px;
  background: #05070a;
  z-index: 5;
}

.tg-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 34px 14px 12px;
  background: var(--header);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  z-index: 4;
}

.tg-back {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 4px 2px;
  cursor: pointer;
}

.tg-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: color-mix(in srgb, var(--accent) 30%, #17212b);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}

.tg-meta { min-width: 0; }
.tg-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}
.tg-status {
  font-size: 12px;
  color: var(--muted);
}
.tg-status--online { color: #6ab2f2; }

.tg-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}
.tg-icon {
  appearance: none;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.tg-icon:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }

/* ---------- чат ---------- */

.chat {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background:
    radial-gradient(600px 400px at 80% 0%, rgba(255, 255, 255, 0.025), transparent 70%),
    var(--phone);
  scrollbar-width: thin;
  scrollbar-color: #2a3644 transparent;
}
.chat::-webkit-scrollbar { width: 6px; }
.chat::-webkit-scrollbar-thumb { background: #2a3644; border-radius: 99px; }

/* сообщения прижимаются к низу, как в настоящем мессенджере */
.chat > :first-child { margin-top: auto; }

.chat__day {
  align-self: center;
  margin: 4px 0 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
}

.msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: pop 0.22s ease-out both;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.msg--bot { align-self: flex-start; }
.msg--user { align-self: flex-end; flex-direction: row-reverse; max-width: 82%; }

.msg__avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  margin-top: 2px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 15px;
  background: color-mix(in srgb, var(--accent) 28%, #17212b);
}

.bubble {
  position: relative;
  padding: 9px 12px 8px;
  border-radius: 14px;
  background: var(--bubble-bot);
  font-size: 14.6px;
  line-height: 1.42;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.msg--bot .bubble { border-bottom-left-radius: 5px; }
.msg--user .bubble {
  background: var(--bubble-user);
  border-bottom-right-radius: 5px;
}

.bubble__time {
  float: right;
  margin: 6px 0 -2px 10px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
  line-height: 1;
  user-select: none;
}

.bubble strong { font-weight: 600; color: #fff; }
.bubble em { font-style: normal; color: var(--muted); }

/* клавиатура под сообщением */
.kbd {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 2px;
  width: 86%;
  align-self: flex-start;
  animation: pop 0.22s ease-out both;
}
.kbd__btn {
  appearance: none;
  width: 100%;
  text-align: center;
  padding: 11px 14px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: #202b36;
  color: #d8e4ef;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, transform 0.1s;
}
.kbd__btn:hover { background: #263442; border-color: rgba(255, 255, 255, 0.14); }
.kbd__btn:active { transform: scale(0.985); }
.kbd__btn--accent {
  background: color-mix(in srgb, var(--accent) 22%, #202b36);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: #fff;
}
.kbd__btn--picked {
  background: color-mix(in srgb, var(--accent) 34%, #202b36);
  border-color: var(--accent);
  color: #fff;
}
.kbd__btn--picked::after {
  content: " ✓";
}

/* «печатает…» */
.typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 14px;
  border-radius: 14px;
  border-bottom-left-radius: 5px;
  background: var(--bubble-bot);
  animation: pop 0.18s ease-out both;
}
.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7f94a7;
  animation: blink 1.15s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.16s; }
.typing span:nth-child(3) { animation-delay: 0.32s; }

@keyframes blink {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

/* ---------- поле ввода ---------- */

.inputbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 16px;
  background: var(--header);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.inputbar__field {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  border-radius: 999px;
  background: #0f1620;
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  padding: 11px 15px;
  outline: none;
}
.inputbar__field::placeholder { color: #5f7183; }
.inputbar__field:focus { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent); }

.inputbar__send {
  appearance: none;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #14100d;
  font-size: 17px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: opacity 0.2s, transform 0.12s;
}
.inputbar__send:disabled { opacity: 0.35; cursor: default; }
.inputbar__send:not(:disabled):active { transform: scale(0.94); }

/* ---------- панель настройки демо ---------- */

.setup {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(4, 6, 9, 0.8);
  backdrop-filter: blur(6px);
}
.setup.is-open { display: grid; }

.setup__card {
  position: relative;
  width: min(420px, 100%);
  background: var(--page-2);
  border: 1px solid var(--phone-line);
  border-radius: 20px;
  padding: 26px;
  box-shadow: var(--shadow);
}
.setup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 14px;
}
.setup__title {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 600;
}
.setup__text {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13.5px;
}
.setup__label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.setup__input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid var(--phone-line);
  background: #0b0f15;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: none;
}
.setup__input:focus { border-color: var(--accent); }
.setup__row { display: flex; gap: 10px; margin-top: 20px; }
.setup__row .btn { flex: 1 1 0; justify-content: center; }

/* ---------- мобильная версия ---------- */

.mobile-bar { display: none; }

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
    max-width: none;
  }
  .side { display: none; }

  body { background: var(--page); }

  .mobile-bar {
    display: block;
    padding: 10px 12px 8px;
    background: var(--page);
    border-bottom: 1px solid var(--phone-line);
  }
  .mobile-bar .chips {
    margin: 0;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .mobile-bar .chips::-webkit-scrollbar { display: none; }
  .mobile-bar .chip { flex: 0 0 auto; padding: 7px 13px; font-size: 13px; }

  .phone {
    width: 100%;
    height: calc(100dvh - 56px);
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .phone__notch { display: none; }
  .tg-header { padding-top: 12px; }
  .chat { padding-bottom: 6px; }
  .inputbar { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.noscript {
  margin: 40px auto;
  max-width: 520px;
  padding: 20px;
  border: 1px solid var(--phone-line);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}
