/* site-bar — виджет-гид «Тропы».
   Цвета и шрифты берутся из дизайн-системы (tokens.css), чтобы виджет не жил
   в своей палитре и не выпадал из общего вида сайта. */
:root{
  --sb-olive:var(--accent, #E9863B); --sb-ink:var(--ink, #22333C); --sb-tm:var(--ink-soft, #5B6C75);
  --sb-bd:var(--line, #DCD4C4); --sb-bg:var(--card, #fff); --sb-gl:var(--milk, #F6F1E6);
  --sb-sand:var(--sand, #EFE7D3);
}

/* Плавающая кнопка */
.sb-fab{
  position:fixed; right:22px; bottom:22px; z-index:9998;
  display:flex; align-items:center; gap:9px;
  padding:11px 16px 11px 13px; border:none; border-radius:999px;
  background:var(--sb-olive); color:#fff; cursor:pointer;
  font:500 0.9rem/1 var(--body, system-ui, sans-serif);
  box-shadow:0 6px 22px rgba(40,42,34,0.26); transition:transform .15s, box-shadow .15s, opacity .2s;
}
.sb-fab:hover{ transform:translateY(-2px); box-shadow:0 9px 28px rgba(40,42,34,0.32); }
.sb-fab svg{ width:19px; height:19px; flex:none; }
.sb-fab.sb-hidden{ opacity:0; pointer-events:none; transform:scale(.85); }

/* Панель чата */
.sb-panel{
  position:fixed; right:22px; bottom:22px; z-index:9999;
  width:380px; max-width:calc(100vw - 32px); height:560px; max-height:calc(100vh - 44px);
  display:flex; flex-direction:column; overflow:hidden;
  background:var(--sb-bg); border:1px solid var(--sb-bd); border-radius:16px;
  box-shadow:0 18px 50px rgba(30,32,26,0.28);
  opacity:0; transform:translateY(14px) scale(.98); pointer-events:none;
  transition:opacity .2s, transform .2s;
}
.sb-panel.sb-open{ opacity:1; transform:none; pointer-events:auto; }

.sb-head{
  display:flex; align-items:center; gap:10px;
  padding:13px 14px; background:var(--sb-olive); color:#fff;
}
.sb-head-ic{ width:30px; height:30px; flex:none; display:flex; align-items:center; justify-content:center;
  background:rgba(255,255,255,.16); border-radius:8px; }
.sb-head-ic svg{ width:17px; height:17px; }
.sb-head-t{ font-family:var(--disp, system-ui); font-weight:500; font-size:1.05rem; line-height:1.05; }
.sb-head-s{ font-size:0.72rem; opacity:.82; letter-spacing:.02em; }
.sb-head-x{ margin-left:auto; background:none; border:none; color:#fff; opacity:.85; cursor:pointer;
  padding:4px; display:flex; border-radius:6px; }
.sb-head-x:hover{ opacity:1; background:rgba(255,255,255,.14); }
.sb-head-x svg{ width:18px; height:18px; }

/* Лента сообщений */
.sb-log{ flex:1; overflow-y:auto; padding:14px; display:flex; flex-direction:column; gap:11px;
  background:var(--sb-gl); scrollbar-width:thin; }
.sb-msg{ max-width:86%; padding:9px 12px; border-radius:13px; font-size:0.9rem; line-height:1.55;
  word-wrap:break-word; }
.sb-msg.sb-bot{ align-self:flex-start; background:#fff; border:1px solid var(--sb-bd); color:var(--sb-ink);
  border-bottom-left-radius:4px; }
.sb-msg.sb-user{ align-self:flex-end; background:var(--sb-olive); color:#fff; border-bottom-right-radius:4px; }
.sb-msg p{ margin:0 0 .5em; } .sb-msg p:last-child{ margin:0; }
.sb-msg strong{ font-weight:700; }
.sb-msg ul,.sb-msg ol{ margin:.3em 0; padding-left:1.2em; }
.sb-msg h4{ margin:.7em 0 .25em; font-size:.95em; font-weight:600; }
.sb-msg h4:first-child{ margin-top:0; }
.sb-msg a{ color:var(--sb-olive); text-decoration:underline; }
.sb-msg.sb-user a{ color:#fff; }

/* Приветствие + чипы-подсказки */
.sb-hint{ font-size:0.78rem; color:var(--sb-tm); padding:2px 2px 0; }
.sb-chips{ display:flex; flex-wrap:wrap; gap:7px; padding:2px; }
.sb-chip{ font-size:0.78rem; padding:6px 11px; border:1px solid var(--sb-sand); border-radius:999px;
  background:#fff; color:var(--sb-tm); cursor:pointer; transition:background .12s,color .12s,border-color .12s; }
.sb-chip:hover{ background:var(--sb-olive); color:#fff; border-color:var(--sb-olive); }

/* Индикатор «печатает» */
.sb-typing{ display:flex; gap:4px; padding:11px 13px; }
.sb-typing span{ width:6px; height:6px; border-radius:50%; background:var(--sb-tm); opacity:.5;
  animation:sb-bounce 1.1s infinite; }
.sb-typing span:nth-child(2){ animation-delay:.18s; } .sb-typing span:nth-child(3){ animation-delay:.36s; }
@keyframes sb-bounce{ 0%,60%,100%{ transform:translateY(0); opacity:.4; } 30%{ transform:translateY(-5px); opacity:.9; } }

/* Поле ввода */
.sb-form{ display:flex; gap:8px; align-items:flex-end; padding:11px; border-top:1px solid var(--sb-bd); background:#fff; }
.sb-input{ flex:1; resize:none; max-height:110px; min-height:38px; padding:9px 12px;
  border:1px solid var(--sb-bd); border-radius:11px; font:400 0.9rem/1.4 var(--body, system-ui, sans-serif);
  color:var(--sb-ink); outline:none; transition:border-color .15s; }
.sb-input:focus{ border-color:var(--sb-olive); }
.sb-send{ flex:none; width:38px; height:38px; border:none; border-radius:11px; background:var(--sb-olive);
  color:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:opacity .15s; }
.sb-send:disabled{ opacity:.4; cursor:default; }
.sb-send svg{ width:18px; height:18px; }
.sb-foot{ text-align:center; font-size:0.66rem; color:var(--sb-tm); padding:0 0 8px; background:#fff; opacity:.7; }

@media(max-width:480px){
  .sb-panel{ right:8px; bottom:8px; width:calc(100vw - 16px); height:calc(100vh - 80px); }
  .sb-fab{ right:14px; bottom:14px; }
}

/* Геолокация: чип «Рядом» и блок ближайших точек тропы. */
.sb-chip-geo{ border-color:var(--sb-olive); color:var(--sb-olive); font-weight:600; }
.sb-chip-geo:hover{ background:var(--sb-olive); color:#fff; }
.sb-nearby{ align-self:flex-start; max-width:86%; display:flex; flex-direction:column; gap:5px;
  margin:-2px 0 2px; }
.sb-nearby-t{ font-size:0.72rem; color:var(--sb-tm); padding-left:2px; }
.sb-nearby-link{ display:flex; justify-content:space-between; align-items:center; gap:10px;
  font-size:0.82rem; padding:8px 11px; border:1px solid var(--sb-sand); border-radius:11px;
  background:#fff; color:var(--sb-ink); text-decoration:none;
  transition:background .12s,border-color .12s; }
.sb-nearby-link:hover{ background:var(--sb-gl); border-color:var(--sb-olive); }
.sb-nearby-d{ flex:none; font-size:0.74rem; color:var(--sb-olive); font-weight:600; }
.sb-src{ margin-top:10px; padding-top:9px; border-top:1px solid var(--line,#DCD4C4); display:flex; flex-wrap:wrap; gap:6px; align-items:baseline; }
.sb-src-h{ width:100%; font-size:11.5px; text-transform:uppercase; letter-spacing:.05em; opacity:.65; margin-bottom:2px; }
.sb-src-i{ font-size:12px; line-height:1.35; padding:3px 8px; border-radius:999px; background:rgba(0,0,0,.05); text-decoration:none; color:inherit; }
a.sb-src-i:hover{ background:rgba(0,0,0,.1); text-decoration:underline; }
