/* ==========================================================================
   ОАО «Универмаг «Центральный» — плавающая кнопка Telegram-бота
   Файл: templates/section/css/fab.css
   Иконка встроена как векторный data-URI: тега <img> в модуле нет,
   вырезать текстовым фильтрам Joomla нечего.
   ========================================================================== */

.tsm-fab {
  --tsm-brand: #57071a;
  --tsm-accent: #b94a24;
  --tsm-accent-deep: #96381a;
  --tsm-ink: #201a1c;
  --tsm-muted: #6f6469;
  --tsm-line: #e7e1e2;
  --tsm-white: #fff;

  /* отступы от края экрана: поменяйте, если кнопка накрывает «наверх» */
  --tsm-fab-right: 22px;
  --tsm-fab-bottom: 88px;

  position: fixed;
  right: var(--tsm-fab-right);
  bottom: var(--tsm-fab-bottom);
  z-index: 9990;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-size: 15px;
  line-height: 1.45;
}

.tsm-fab *,
.tsm-fab *::before,
.tsm-fab *::after { box-sizing: border-box; }

.tsm-fab p { margin: 0; }

/* --- сама кнопка ---------------------------------------------------------------- */

.tsm-fab__btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--tsm-accent);
  box-shadow: 0 6px 20px -6px rgba(32, 26, 28, .55);
  text-decoration: none;
  transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.tsm-fab__btn::before {
  content: "";
  width: 30px;
  height: 30px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.tsm-fab__btn:hover,
.tsm-fab__btn:focus-visible {
  background: var(--tsm-accent-deep);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px -8px rgba(32, 26, 28, .6);
}

.tsm-fab__btn:focus-visible { outline: 3px solid rgba(185, 74, 36, .35); outline-offset: 3px; }

/* подпись только для программ чтения с экрана */
.tsm-fab__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* пульсирующее кольцо — только при самом первом показе */
.tsm-fab--first .tsm-fab__btn::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--tsm-accent);
  opacity: .5;
  animation: tsm-fab-pulse 2s ease-out infinite;
}

@keyframes tsm-fab-pulse {
  0%   { transform: scale(1);    opacity: .5; }
  70%  { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}

/* --- подсказка ------------------------------------------------------------------- */

/* По умолчанию подсказка скрыта средствами CSS. Атрибут hidden использовать
   нельзя: фильтры Joomla вырезают его из разметки, и облачко остаётся на виду
   даже когда скрипт не отработал. */
.tsm-fab__bubble { display: none; }

.tsm-fab--open .tsm-fab__bubble {
  display: block;
  position: relative;
  width: min(300px, calc(100vw - 44px));
  padding: 18px 20px 16px;
  border: 1px solid var(--tsm-line);
  border-radius: 16px 16px 4px 16px;
  background: var(--tsm-white);
  box-shadow: 0 12px 34px -14px rgba(32, 26, 28, .55);
  color: var(--tsm-ink);
  transform-origin: bottom right;
  animation: tsm-fab-in .28s ease-out both;
}

@keyframes tsm-fab-in {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.tsm-fab--open .tsm-fab__bubble--closing { animation: tsm-fab-out .22s ease-in both; }

@keyframes tsm-fab-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(8px) scale(.96); }
}

.tsm-fab__bubble-title {
  margin-bottom: 10px;
  padding-right: 20px;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
}

.tsm-fab__list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tsm-fab__list li {
  position: relative;
  padding-left: 20px;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--tsm-muted);
}

.tsm-fab__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .62em;
  width: 10px;
  height: 2px;
  border-radius: 1px;
  background: var(--tsm-accent);
}

.tsm-fab__bubble-cta {
  display: block;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--tsm-line);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--tsm-accent-deep);
}

.tsm-fab__close {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 8px;
  right: 10px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--tsm-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}

.tsm-fab__close:hover,
.tsm-fab__close:focus-visible {
  background: var(--tsm-line);
  color: var(--tsm-ink);
}

/* --- мелкие экраны ------------------------------------------------------------------ */

@media (max-width: 560px) {
  .tsm-fab {
    --tsm-fab-right: 14px;
    --tsm-fab-bottom: 76px;
  }

  .tsm-fab__btn { width: 54px; height: 54px; }
  .tsm-fab__btn::before { width: 27px; height: 27px; }
}

@media (prefers-reduced-motion: reduce) {
  .tsm-fab__btn,
  .tsm-fab__close { transition: none; }

  .tsm-fab--open .tsm-fab__bubble,
  .tsm-fab--open .tsm-fab__bubble--closing { animation: none; }

  .tsm-fab--first .tsm-fab__btn::after { animation: none; }
}

@media print {
  .tsm-fab { display: none !important; }
}

/* --- иконка -------------------------------------------------------------------------- */

.tsm-fab__btn::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.2 4.3 2.9 11.2c-.9.3-.9 1.6.1 1.9l4.6 1.4 1.7 5.2c.2.7 1.1.9 1.6.3l2.4-2.6 4.6 3.4c.6.4 1.4.1 1.6-.6l3-14.6c.2-.8-.6-1.5-1.3-1.3z'/%3E%3Cpath d='m7.6 14.5 10.9-7.6-7.2 8.4'/%3E%3C/svg%3E"); }

/* ==========================================================================
   ЗАЩИТА ОТ СТИЛЕЙ ШАБЛОНА
   Блок должен оставаться последним в файле.
   ========================================================================== */

.tsm-fab { display: flex !important; float: none !important; }
.tsm-fab .tsm-fab__btn { display: flex !important; float: none !important; text-transform: none !important; }
.tsm-fab .tsm-fab__list { display: grid !important; }

.tsm-fab .tsm-fab__list li {
  list-style: none !important;
  margin: 0 !important;
  padding-left: 20px !important;
  background-image: none !important;
}

.tsm-fab .tsm-fab__bubble-title,
.tsm-fab .tsm-fab__bubble-cta {
  display: block !important;
  text-align: left !important;
  text-indent: 0 !important;
}

.tsm-fab .tsm-fab__bubble { display: none !important; }
.tsm-fab.tsm-fab--open .tsm-fab__bubble { display: block !important; }
.tsm-fab .tsm-fab__close { display: flex !important; cursor: pointer; }
