/* ============================================================
   VedaRishi — веб-чат (использует палитру styles.css)
   ============================================================ */

.chat-body { overflow: hidden; height: 100dvh; display: flex; flex-direction: column; }

.chat-header {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-strong);
  backdrop-filter: blur(8px);
}
.chat-header .brand { text-decoration: none; font-family: var(--serif); font-size: 20px; }

.chat-balance {
  font-size: 13.5px; color: var(--muted);
  border: 1px solid var(--line-soft); border-radius: 999px;
  padding: 6px 14px; background: var(--surface);
  display: inline-flex; align-items: center; gap: 10px;
}
.chat-balance b { color: var(--gold-deep); font-weight: 600; }
.chat-balance .bal { display: inline-flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.chat-balance .bal b { font-size: 15px; }
.chat-balance .bal i { font-style: normal; font-size: 12px; color: var(--muted); }
.chat-balance .bal-sep { opacity: 0.35; }

.chat-main {
  position: relative; z-index: 1;
  flex: 1; display: flex; gap: 20px;
  width: min(1120px, 100%); margin: 0 auto;
  padding: clamp(10px, 2vw, 22px);
  min-height: 0;
}

.chat-window {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  background: var(--surface-strong);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(90, 60, 20, 0.12);
  overflow: hidden;
}

.chat-messages {
  flex: 1; overflow-y: auto; padding: 22px clamp(14px, 3vw, 28px);
  display: flex; flex-direction: column; gap: 14px;
  scroll-behavior: smooth;
}

.msg {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 15.5px; line-height: 1.55;
  animation: msg-in 0.25s ease both;
}
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.msg.bot {
  align-self: flex-start;
  background: rgba(255, 252, 246, 0.94);
  border: 1px solid var(--line-soft);
  border-bottom-left-radius: 6px;
}
.msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #b07a35, #96652b);
  color: #fff8ee;
  border-bottom-right-radius: 6px;
}
.msg.bot b { color: var(--gold-deep); }
.msg.bot h4 { margin: 8px 0 4px; font-size: 15.5px; color: var(--gold-deep); }
.msg.bot p { margin: 6px 0; }
.msg.system {
  align-self: center; max-width: 90%;
  background: transparent; border: 1px dashed var(--line);
  color: var(--muted); font-size: 14px; text-align: center;
}
.msg.error { border-color: rgba(178, 58, 44, 0.4); color: #a33a2c; }
.msg.typing { color: var(--muted); font-style: italic; }
.msg.typing.progress { display: flex; align-items: center; gap: 10px; }
.progress-bar {
  width: 64px; height: 5px; border-radius: 4px;
  background: rgba(176, 122, 53, 0.18);
  overflow: hidden; position: relative; flex-shrink: 0;
}
.progress-bar::after {
  content: ""; position: absolute; top: 0; left: -40%;
  width: 40%; height: 100%;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold));
  border-radius: 4px;
  animation: progress-slide 1.4s ease-in-out infinite;
}
@keyframes progress-slide {
  to { left: 100%; }
}

.msg .city-options { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.city-btn {
  text-align: left; padding: 10px 14px;
  background: #fffaf2; border: 1px solid var(--line);
  border-radius: 12px; cursor: pointer;
  font-family: var(--sans); font-size: 15px; color: var(--text);
  transition: background 0.15s ease, transform 0.1s ease;
}
.city-btn:hover { background: #f7ead4; transform: translateX(2px); }

.choice-row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.choice-btn {
  padding: 10px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--gold); background: transparent;
  font-family: var(--sans); font-size: 15px; color: var(--gold-deep);
  transition: all 0.15s ease;
}
.choice-btn:hover { background: var(--gold); color: #fff8ee; }

.skip-btn { border-style: dashed; }

.chat-input {
  display: flex; gap: 10px; padding: 14px 16px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface);
}
.chat-input input {
  flex: 1; padding: 13px 18px;
  border: 1px solid var(--line); border-radius: 999px;
  background: #fffdf8; font-family: var(--sans); font-size: 15.5px; color: var(--text);
  outline: none; transition: border-color 0.15s ease;
}
.chat-input input:focus { border-color: var(--gold); }
.chat-input input:disabled { opacity: 0.55; }
.chat-input button {
  width: 50px; height: 50px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #b07a35, #96652b);
  color: #fff8ee; font-size: 20px;
  display: grid; place-items: center;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.chat-input button:hover { transform: scale(1.06); }
.chat-input button:disabled { opacity: 0.5; cursor: default; transform: none; }

/* --- боковая панель --- */
.chat-side {
  width: 300px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 16px;
  overflow-y: auto; padding: 2px;
}
.side-card {
  background: var(--surface-strong);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 10px 30px rgba(90, 60, 20, 0.1);
}
.side-card h3 { margin: 0 0 6px; font-family: var(--serif); font-size: 19px; display: flex; align-items: center; gap: 8px; }
.side-card p { margin: 6px 0 12px; font-size: 14.5px; color: var(--muted); }
.side-card code {
  background: rgba(176, 122, 53, 0.12); border-radius: 6px; padding: 1px 7px;
  color: var(--gold-deep); font-weight: 600;
}
.side-avatar {
  width: 84px; height: 84px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--gold-soft);
  margin-bottom: 12px; display: block;
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #b7a98f; display: inline-block; }
.status-dot.online { background: #6da85e; box-shadow: 0 0 0 3px rgba(109, 168, 94, 0.2); }

.side-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.button.small { padding: 9px 16px; font-size: 14px; }
.button.full { width: 100%; }

#login-form { display: flex; flex-direction: column; gap: 10px; }
.login-error { color: #a33a2c; font-size: 13.5px; margin: 4px 0 0; }
.login-hint { font-size: 13px; margin-top: 12px; }
.login-hint a { color: var(--gold-deep); }

.chat-footer {
  position: relative; z-index: 2;
  text-align: center; padding: 8px 16px;
  font-size: 12.5px; color: var(--muted);
  border-top: 1px solid var(--line-soft);
  background: var(--surface-strong);
}

/* --- адаптив --- */
@media (max-width: 900px) {
  .chat-body { overflow: auto; height: auto; min-height: 100dvh; }
  .chat-main { flex-direction: column-reverse; }
  .chat-side { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .side-card { flex: 1 1 260px; }
  .chat-window { min-height: 62dvh; }
  .chat-messages { min-height: 40dvh; }
}

@media (max-width: 560px) {
  .chat-balance { font-size: 12px; padding: 5px 10px; gap: 7px; }
  .chat-balance .bal b { font-size: 13.5px; }
  .chat-balance .bal i { font-size: 11px; }
}

/* --- авторизация --- */
.auth-tabs { display: flex; gap: 6px; margin-bottom: 14px; background: rgba(176, 122, 53, 0.08); border-radius: 999px; padding: 4px; }
.auth-tab {
  flex: 1; padding: 8px 0; border: none; border-radius: 999px; cursor: pointer;
  background: transparent; font-family: var(--sans); font-size: 14.5px; color: var(--muted);
  transition: all 0.15s ease;
}
.auth-tab.active { background: #fffaf2; color: var(--gold-deep); font-weight: 600; box-shadow: 0 2px 8px rgba(90, 60, 20, 0.12); }

#login-form, #register-form { display: flex; flex-direction: column; gap: 10px; }
#login-form[hidden], #register-form[hidden] { display: none; }
#login-form input, #register-form input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #fffdf8; font-family: var(--sans); font-size: 15px; color: var(--text);
  outline: none; transition: border-color 0.15s ease;
}
#login-form input:focus, #register-form input:focus { border-color: var(--gold); }
#login-form .button, #register-form .button { width: 100%; }

.bot-code-details { margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.bot-code-details summary { cursor: pointer; font-size: 14px; color: var(--gold-deep); }
.bot-code-details p { font-size: 13px; margin: 8px 0; }
.code-row { display: flex; gap: 8px; align-items: stretch; }
.code-row #login-code {
  flex: 1; min-width: 0; padding: 10px 8px; text-align: center; letter-spacing: 2px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #fffdf8; font-size: 14px; font-weight: 600;
  color: var(--gold-deep); text-transform: uppercase; outline: none;
  font-family: var(--sans);
}
#login-code:focus { border-color: var(--gold); }
#login-code::placeholder { letter-spacing: 0; font-size: 13px; font-weight: 400; color: var(--muted); }
.code-row .button { flex-shrink: 0; padding: 10px 18px; }
.login-error { color: #a33a2c; font-size: 13.5px; margin: 8px 0 0; }

/* --- подтверждение почты --- */
#verify-form { display: flex; flex-direction: column; gap: 10px; }
#verify-form[hidden] { display: none; }
.verify-hint { font-size: 14px; color: var(--muted); margin: 0 0 2px; line-height: 1.45; }
.verify-hint b { color: var(--gold-deep); }
#verify-code {
  padding: 13px 16px; text-align: center; letter-spacing: 8px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #fffdf8; font-size: 20px; font-weight: 700;
  color: var(--gold-deep); outline: none; font-family: var(--sans); width: 100%;
  box-sizing: border-box;
}
#verify-code:focus { border-color: var(--gold); }
#verify-code::placeholder { letter-spacing: 8px; font-weight: 400; color: var(--muted); }
.link-btn {
  background: none; border: none; cursor: pointer;
  font-family: var(--sans); font-size: 13.5px; color: var(--gold-deep);
  text-decoration: underline; padding: 2px 0;
}
.link-btn:hover { color: #8a5a1e; }

/* --- OAuth-кнопки --- */
.oauth-row { display: flex; gap: 8px; margin-bottom: 4px; }
.oauth-row[hidden] { display: none; }
.oauth-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 8px; border-radius: 12px; cursor: pointer; text-decoration: none;
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  border: 1px solid var(--line); background: #fffdf8; color: var(--text);
  transition: all 0.15s ease;
}
.oauth-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(90, 60, 20, 0.12); }
.oauth-ico {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; border-radius: 6px;
  font-size: 11px; font-weight: 700; color: #fff;
}
.oauth-btn.yandex .oauth-ico { background: #fc3f1d; border-radius: 50%; }
.oauth-btn.vk .oauth-ico { background: #0077ff; }
.oauth-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 0; color: var(--muted); font-size: 12.5px;
}
.oauth-divider[hidden] { display: none; }
.oauth-divider::before, .oauth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line-soft);
}

/* скроллбар */
.chat-messages::-webkit-scrollbar, .chat-side::-webkit-scrollbar { width: 8px; }
.chat-messages::-webkit-scrollbar-thumb, .chat-side::-webkit-scrollbar-thumb {
  background: rgba(176, 122, 53, 0.25); border-radius: 8px;
}

/* карточка «Моя карта» */
.side-note { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; line-height: 1.45; }
.chart-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 7px 0; border-bottom: 1px dashed var(--line-soft); font-size: 14px;
}
.chart-row:last-of-type { border-bottom: none; }
.chart-label { color: var(--muted); flex-shrink: 0; }
.chart-value { font-weight: 600; color: var(--gold-deep); text-align: right; }

/* кнопка «Тарифы» в шапке */
.chat-header-actions { display: flex; gap: 8px; align-items: center; }
.chat-header-actions[hidden], .chat-balance[hidden] { display: none; }
.tariffs-btn {
  cursor: pointer; font-weight: 600; color: var(--gold-deep); font-family: var(--sans);
  transition: background 0.15s ease;
}
.tariffs-btn:hover { background: #fff3dd; }

/* тарифы в чате */
.tariffs-msg { font-size: 14.5px; }
.tariff-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px dashed var(--line-soft);
}
.tariff-row:last-of-type { border-bottom: none; }
.tariff-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tariff-buy { text-decoration: none; white-space: nowrap; }
.tariff-note { font-size: 12px; color: var(--muted); margin-top: 8px; }

.chart-edit { margin-top: 10px; width: 100%; }

/* форма контакта перед оплатой (чек/поддержка) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(51, 41, 29, 0.45); backdrop-filter: blur(3px); padding: 16px;
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  background: var(--paper, #fffdf8); border: 1px solid var(--line, #e2c9a4); border-radius: 18px;
  padding: 22px 24px; max-width: 360px; width: 100%; box-shadow: 0 18px 50px rgba(51, 41, 29, 0.25);
}
.modal-card h3 { margin: 0 0 6px; font-size: 18px; color: var(--text, #33291d); }
.modal-hint { font-size: 13.5px; color: var(--muted, #7a6a52); line-height: 1.45; margin: 0 0 12px; }
.modal-card input {
  width: 100%; box-sizing: border-box; padding: 11px 14px; font-size: 15px;
  border: 1px solid var(--line, #e2c9a4); border-radius: 12px; background: #fff; color: var(--text, #33291d);
}
.modal-card input:focus { outline: none; border-color: var(--gold, #b07a35); }
.modal-error { font-size: 12.5px; color: #a4432c; margin: 8px 0 0; }
.modal-card .button { margin-top: 12px; }
.modal-card .link-btn { display: block; margin: 10px auto 0; }
