/* ── Переменные — светлая тема (по умолчанию) ────────────────────────────── */
:root {
  --bg: #F6F3EE;
  --surface: #FFFFFF;
  --surface2: #F0EDE6;
  --border: #E2DDD4;
  --accent: #8B6030;
  --accent-dim: #6B4820;
  --accent-hover: rgba(139,96,48,0.08);
  --text: #1A1A1A;
  --text-muted: #8A8680;
  --bot-bubble: #F7F4EF;
  --user-bubble: #8B6030;
  --user-text: #FFFFFF;
  --radius: 10px;
  --shadow-sm: 0 1px 6px rgba(0,0,0,0.07);
  --shadow: 0 4px 24px rgba(0,0,0,0.09);
  --font: 'Segoe UI', system-ui, sans-serif;
  --bg-pattern: url('/static/bg-pattern.svg');
  --icon-filter: opacity(0.55);
}

/* ── Тёмная тема ─────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg: #0e0e0e;
  --surface: #181818;
  --surface2: #242424;
  --border: #2e2e2e;
  --accent: #c9a96e;
  --accent-dim: #a07840;
  --accent-hover: rgba(201,169,110,0.1);
  --text: #e8e8e8;
  --text-muted: #888;
  --bot-bubble: #1e1e1e;
  --user-bubble: #c9a96e;
  --user-text: #111;
  --shadow-sm: 0 1px 6px rgba(0,0,0,0.4);
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
  --bg-pattern: url('/static/bg-pattern-dark.svg');
  --icon-filter: invert(1) opacity(0.75);
}

/* ── Системная тёмная тема ───────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0e0e0e;
    --surface: #181818;
    --surface2: #242424;
    --border: #2e2e2e;
    --accent: #c9a96e;
    --accent-dim: #a07840;
    --accent-hover: rgba(201,169,110,0.1);
    --text: #e8e8e8;
    --text-muted: #888;
    --bot-bubble: #1e1e1e;
    --user-bubble: #c9a96e;
    --user-text: #111;
    --shadow-sm: 0 1px 6px rgba(0,0,0,0.4);
    --shadow: 0 4px 24px rgba(0,0,0,0.5);
    --bg-pattern: url('/static/bg-pattern-dark.svg');
    --icon-filter: invert(1) opacity(0.75);
  }
}

/* ── Сброс и база ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background-color: var(--bg);
  background-image: var(--bg-pattern);
  background-repeat: repeat;
  background-size: 620px 480px;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Обёртка страницы ─────────────────────────────────────────────────────── */
.page-wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px 56px;
}

/* ── Шапка ────────────────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 36px;
}
.header-right {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
}
.logo {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  text-decoration: none;
}
.logo-text {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--accent);
}
.logo-sub {
  font-size: .68rem;
  color: var(--text-muted);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.tg-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: .82rem;
  color: var(--text);
  transition: border-color .2s, color .2s, box-shadow .2s;
}
.tg-badge:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 2px 10px rgba(139,96,48,0.15);
  text-decoration: none;
}

/* ── Переключатель темы ───────────────────────────────────────────────────── */
.theme-switcher {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  gap: 1px;
}
.theme-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  width: 30px;
  height: 26px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .18s, color .18s, box-shadow .18s;
}
.theme-btn:hover { color: var(--accent); }
.theme-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 5px rgba(0,0,0,0.1);
}

/* ── Герой ────────────────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  margin-bottom: 32px;
}
.hero h1 {
  font-size: clamp(1.55rem, 4vw, 2.25rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 12px;
  color: var(--text);
}
.hero h1 span { color: var(--accent); }
.hero-sub {
  font-size: .95rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ── Чат ─────────────────────────────────────────────────────────────────── */
.chat-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.chat-messages {
  min-height: 420px;
  max-height: 680px;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Сообщения */
.msg {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.msg.user { flex-direction: row-reverse; }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}
.msg.user .avatar { background: var(--surface2); color: var(--text-muted); }
.bubble {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: 16px 16px 16px 4px;
  background: var(--bot-bubble);
  font-size: .92rem;
  line-height: 1.6;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  color: var(--text);
}
.msg.user .bubble {
  background: var(--user-bubble);
  color: var(--user-text);
  border-radius: 16px 16px 4px 16px;
  border-color: transparent;
}
.bubble strong { font-weight: 600; }
.bubble em { font-style: italic; color: var(--text-muted); }

/* Информационные чипы приветствия */
.intro-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 0 12px 42px;
}
.intro-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: .82rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
  font-family: var(--font);
}
.intro-chip:hover {
  background: var(--accent-hover);
  border-color: var(--accent);
  color: var(--accent);
}

/* Индикатор печати */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
}
.typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: bounce 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: .2s; }
.typing-indicator span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .5; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* ── Зона загрузки фото ───────────────────────────────────────────────────── */
.upload-zone {
  border-top: 1px solid var(--border);
  padding: 0;
  background: var(--surface2);
  display: none;
}
.upload-zone.has-image { display: block; }
.upload-preview {
  position: relative;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 10px;
}
.upload-preview img {
  max-height: 80px;
  max-width: 100px;
  border-radius: 8px;
  object-fit: cover;
}
.remove-img {
  position: absolute;
  top: 4px;
  left: 100px;
  background: rgba(0,0,0,0.15);
  border: none;
  color: #333;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: .7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.remove-img:hover { background: rgba(0,0,0,0.28); }
.preview-doc-name {
  font-size: .8rem;
  color: var(--text2, #666);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: .8rem;
  color: var(--text-muted);
}

/* ── Поле ввода ───────────────────────────────────────────────────────────── */
.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.attach-btn, .send-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  transition: color .2s, background .2s;
  flex-shrink: 0;
}
.attach-btn:hover { color: var(--accent); background: var(--accent-hover); }
.send-btn {
  background: var(--accent);
  color: #fff;
  padding: 8px 10px;
  border-radius: 10px;
}
.send-btn:hover { background: var(--accent-dim); }
.send-btn:disabled { opacity: .35; cursor: not-allowed; }
.message-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: .93rem;
  resize: none;
  line-height: 1.5;
  max-height: 140px;
  overflow-y: auto;
}
.message-input::placeholder { color: var(--text-muted); }

/* ── Панель кнопок под чатом ────────────────────────────────────────────── */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.history-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: .88rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s, color .2s;
  letter-spacing: .02em;
  box-shadow: var(--shadow-sm);
}
.history-btn:hover { background: var(--accent); color: #fff; }

/* ── Быстрые подсказки ────────────────────────────────────────────────────── */
.quick-tips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 36px;
}
.tip-label { font-size: .8rem; color: var(--text-muted); }
.tip-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: .8rem;
  padding: 5px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .2s, color .2s, box-shadow .2s;
  box-shadow: var(--shadow-sm);
}
.tip-btn:hover { border-color: var(--accent); color: var(--accent); box-shadow: 0 2px 8px rgba(139,96,48,0.12); }

/* ── Почему мы ────────────────────────────────────────────────────────────── */
.benefits { margin-bottom: 44px; }
.benefits-title {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 26px;
}
.benefits-grid { display: flex; flex-direction: column; gap: 24px; }

.benefits-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto auto;
  column-gap: 20px;
}
.benefits-row--center {
  grid-template-columns: repeat(2, 1fr);
  width: 66%;
  margin: 0 auto;
}

.benefit {
  grid-row: span 2;
  display: grid;
  grid-template-columns: 20px 1fr;
  grid-template-rows: subgrid;
  column-gap: 10px;
}
.benefit-icon {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 20px;
  height: 20px;
  filter: var(--icon-filter);
  align-self: start;
  margin-top: 2px;
}
.benefit-body { display: contents; }
.benefit strong {
  grid-column: 2;
  grid-row: 1;
  display: block;
  font-size: .82rem;
  align-self: end;
  padding-bottom: 5px;
  color: var(--text);
}
.benefit p {
  grid-column: 2;
  grid-row: 2;
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
  align-self: start;
}

/* ── Футер ────────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  font-size: .82rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 24px;
}
.disclaimer {
  margin-top: 10px;
  font-size: .76rem;
  color: #BBB6AF;
}

/* ── Фото в чате ─────────────────────────────────────────────────────────── */
.bubble-img {
  padding: 4px;
  background: transparent;
  border: none;
}
.chat-img {
  max-width: 220px;
  max-height: 180px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
}

/* ── Быстрые кнопки-ответы (quick replies) ───────────────────────────────── */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 16px 54px;
}
.qr-btn {
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: .82rem;
  padding: 6px 15px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.qr-btn:hover { background: var(--accent); color: #fff; }

/* ── Форма ввода размеров ─────────────────────────────────────────────────── */
.dim-form {
  padding: 14px 20px 18px 54px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dim-fields {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.dim-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 90px;
}
.dim-field span {
  font-size: .75rem;
  color: var(--text-muted);
}
.dim-field input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .9rem;
  padding: 7px 10px;
  outline: none;
  width: 100%;
  transition: border-color .2s, box-shadow .2s;
}
.dim-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139,96,48,0.1); }
.dim-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.dim-submit {
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: .88rem;
  font-weight: 600;
  padding: 8px 20px;
  cursor: pointer;
  transition: background .2s;
}
.dim-submit:hover { background: var(--accent-dim); }
.dim-standard {
  background: transparent;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  color: var(--accent);
  font-size: .88rem;
  font-weight: 600;
  padding: 8px 20px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.dim-standard:hover { background: var(--accent); color: #fff; }

/* ── Кнопка обратной связи ───────────────────────────────────────────────── */
.feedback-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .8rem;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
  box-shadow: var(--shadow-sm);
}
.feedback-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Модалка обратной связи ───────────────────────────────────────────────── */
.feedback-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.feedback-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.14);
}
.feedback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}
.feedback-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color .2s, background .2s;
}
.feedback-close:hover { color: var(--text); background: var(--surface2); }
.feedback-desc {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.feedback-textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: .9rem;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  line-height: 1.55;
  transition: border-color .2s, box-shadow .2s;
}
.feedback-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139,96,48,0.1); }
.feedback-actions { display: flex; justify-content: flex-end; }
.feedback-submit {
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: .88rem;
  font-weight: 600;
  padding: 9px 24px;
  cursor: pointer;
  transition: background .2s;
}
.feedback-submit:hover { background: var(--accent-dim); }
.feedback-submit:disabled { opacity: .4; cursor: not-allowed; }

/* ── Блок «Получить переписку» ───────────────────────────────────────────── */
.history-offer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 42px;
}
.history-offer-title {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.history-offer-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.history-offer-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: .82rem;
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.history-offer-btn:hover { border-color: var(--accent); color: var(--accent); }
.history-email-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.history-email-form input[type="email"] {
  flex: 1;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .9rem;
  padding: 7px 10px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.history-email-form input[type="email"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,96,48,0.1);
}

/* ── Адаптив ──────────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .chat-messages { min-height: 360px; max-height: 560px; }
}
@media (max-width: 640px) {
  .page-wrap { padding: 0 16px 48px; }
  .benefits-row { grid-template-columns: 1fr; grid-template-rows: none; row-gap: 20px; }
  .benefits-row--center { width: 100%; grid-template-columns: 1fr; }
  .benefit { grid-row: auto; grid-template-rows: none; display: flex; align-items: flex-start; gap: 12px; }
  .benefit-icon { grid-row: auto; grid-column: auto; flex-shrink: 0; }
  .benefit-body { display: flex; flex-direction: column; gap: 4px; }
  .benefit strong { grid-row: auto; grid-column: auto; padding-bottom: 0; }
  .benefit p { grid-row: auto; grid-column: auto; }
  .chat-messages { min-height: 320px; max-height: 480px; }
}
@media (max-width: 520px) {
  .hero-sub br { display: none; }
  .bubble { max-width: 90%; }
}

/* ── Каталог: кнопка «Показать наши примеры» и карточки ───────────────────── */
.catalog-btn-wrap {
  padding: 0 20px 16px 54px;
}
.catalog-btn {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  font-size: .85rem;
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s, box-shadow .2s, opacity .2s;
  box-shadow: var(--shadow-sm);
}
.catalog-btn:hover { background: var(--accent-dim); }
.catalog-btn:disabled { opacity: .6; cursor: default; }

.catalog-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  padding: 0 20px 18px 54px;
}
.catalog-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.catalog-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(139,96,48,0.18);
  transform: translateY(-2px);
  text-decoration: none;
}
.catalog-card-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background-size: cover;
  background-position: center;
  background-color: var(--surface2);
}
.catalog-card-body { padding: 10px 12px; }
.catalog-card-name {
  font-size: .82rem;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
}
.catalog-card-price {
  font-size: .85rem;
  font-weight: 600;
  color: var(--accent);
}
.catalog-card-lead {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 2px;
}
@media (max-width: 520px) {
  .catalog-gallery { padding-left: 20px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .catalog-btn-wrap { padding-left: 20px; }
}
