/* ============================================================
   Виджет поддержки — правый нижний угол (B2C)
   ============================================================ */

.support-widget {
  position: fixed;
  bottom: 24px;
  right: 20px;
  /* Ниже оверлеев/навигации/модалок (--z-overlay 300, --z-modal 400),
     чтобы FAB никогда не перекрывал важные элементы. Плюс JS-подавление
     (класс --suppressed) полностью прячет виджет пока открыты бургер-меню
     или любая модалка. */
  z-index: var(--z-sticky, 200);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none; /* только дочерние элементы кликабельны */
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.2s;
}

/* Скрыт пока открыто бургер-меню / модалка */
.support-widget--suppressed {
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.9);
  pointer-events: none;
}
.support-widget--suppressed .support-widget__btn,
.support-widget--suppressed .support-widget__bubble {
  pointer-events: none;
}

/* ── Пузырь с текстом ── */
.support-widget__bubble {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid rgba(13, 19, 32, 0.08);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  padding: 10px 14px;
  max-width: 220px;
  transform-origin: right center;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.support-widget__bubble--hidden {
  opacity: 0;
  transform: scale(0.88) translateX(8px);
  pointer-events: none;
}

.support-widget__bubble-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-gray-900, #0D1320);
  line-height: 1.4;
  flex: 1;
}

.support-widget__close {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(13, 19, 32, 0.06);
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(13, 19, 32, 0.4);
  transition: background 0.2s, color 0.2s;
  line-height: 1;
}

.support-widget__close:hover {
  background: rgba(13, 19, 32, 0.12);
  color: rgba(13, 19, 32, 0.7);
}

/* ── Основная кнопка (круглая) ── */
.support-widget__btn {
  position: relative;
  pointer-events: auto;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-brand-500, #0A6CFF);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(10, 108, 255, 0.4);
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
  text-decoration: none;
}

.support-widget__btn:hover {
  background: var(--color-accent-600, #00C99A);
  box-shadow: 0 6px 22px rgba(23, 233, 183, 0.45);
  transform: translateY(-2px);
}

.support-widget__btn:focus-visible {
  outline: none;
  box-shadow: 0 6px 22px rgba(23, 233, 183, 0.45);
}

.support-widget__btn:active {
  transform: scale(0.94);
}

/* ── Анимация появления ── */
@keyframes sw-pop-in {
  from { opacity: 0; transform: scale(0.7) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.support-widget__btn {
  animation: sw-pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: 0.8s;
  opacity: 0;
}

.support-widget__bubble {
  animation: sw-pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: 1.4s;
  opacity: 0;
}

/* Если пузырь скрыт изначально — без анимации */
.support-widget__bubble--hidden {
  animation: none;
  opacity: 0;
}

/* ── Анимация "звонок" на иконке телефона ── */
/* Цикл 5s: первые ~36% — встряска, остальное — пауза */
@keyframes sw-ring {
  0%   { transform: rotate(0deg); }
  4%   { transform: rotate(-18deg); }
  8%   { transform: rotate(18deg); }
  12%  { transform: rotate(-14deg); }
  16%  { transform: rotate(14deg); }
  20%  { transform: rotate(-8deg); }
  24%  { transform: rotate(8deg); }
  28%  { transform: rotate(-4deg); }
  32%  { transform: rotate(4deg); }
  36%  { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

.support-widget__btn svg {
  animation: sw-ring 5s ease-in-out 2.5s infinite;
  transform-origin: center;
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .support-widget__btn svg { animation: none; }
}

@media (max-width: 480px) {
  .support-widget {
    bottom: 16px;
    right: 14px;
  }

  .support-widget__bubble {
    max-width: 190px;
  }
}

/* ============================================================
   Модалка выбора отдела
   ============================================================ */
.support-modal {
  position: fixed;
  inset: 0;
  /* Собственная модалка виджета — поверх контента и шапки, но открывается
     только по клику на FAB (когда ничего другого не открыто). */
  z-index: var(--z-toast, 500);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0 20px 92px;
  visibility: hidden;
  pointer-events: none;
}

.support-modal.is-open {
  visibility: visible;
  pointer-events: auto;
}

.support-modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 20, 43, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.support-modal.is-open .support-modal__backdrop {
  opacity: 1;
}

.support-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(16, 20, 43, 0.28);
  overflow: hidden;
  transform: translateY(24px) scale(0.96);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
  transform-origin: bottom right;
}

.support-modal.is-open .support-modal__dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* ── Header ── */
.support-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px 20px;
  border-bottom: 1px solid rgba(13, 19, 32, 0.06);
}

.support-modal__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-gray-900, #0D1320);
  line-height: 1.25;
  margin: 0;
}

.support-modal__subtitle {
  font-size: 12.5px;
  color: var(--color-gray-400, #8A93A6);
  margin: 3px 0 0;
  line-height: 1.35;
}

.support-modal__close {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: none;
  background: rgba(13, 19, 32, 0.05);
  color: rgba(13, 19, 32, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.support-modal__close:hover {
  background: rgba(13, 19, 32, 0.1);
  color: rgba(13, 19, 32, 0.75);
}

/* ── Rows ── */
.support-modal__body {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.support-modal__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 13px;
  text-decoration: none;
  transition: background 0.15s;
}

.support-modal__row:hover {
  background: var(--color-accent-50, #E5FCF5);
}

.support-modal__row-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--color-gray-50, #F4F6FA);
  color: var(--color-brand-500, #0A6CFF);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.support-modal__row:hover .support-modal__row-icon {
  background: var(--color-accent-500, #17E9B7);
  color: #fff;
}

.support-modal__row-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.support-modal__row-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-gray-900, #0D1320);
  line-height: 1.25;
}

.support-modal__row-desc {
  font-size: 11.5px;
  color: var(--color-gray-400, #8A93A6);
  line-height: 1.3;
}

.support-modal__row-phone {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-brand-500, #0A6CFF);
  white-space: nowrap;
}

.support-modal__row-chevron {
  flex-shrink: 0;
  color: rgba(13, 19, 32, 0.22);
  display: flex;
  align-items: center;
  transition: transform 0.15s, color 0.15s;
}

.support-modal__row:hover .support-modal__row-chevron {
  color: var(--color-accent-600, #00C99A);
  transform: translateX(2px);
}

/* ── Footer ── */
.support-modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 13px 20px;
  border-top: 1px solid rgba(13, 19, 32, 0.06);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-gray-600, #5A6478);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

.support-modal__footer:hover {
  color: var(--color-brand-500, #0A6CFF);
  background: var(--color-gray-50, #F4F6FA);
}

.support-modal__footer svg {
  flex-shrink: 0;
  opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {
  .support-modal__dialog,
  .support-modal__backdrop {
    transition: opacity 0.15s ease;
  }
  .support-modal.is-open .support-modal__dialog {
    transform: none;
  }
}

@media (max-width: 480px) {
  .support-modal {
    padding: 0 12px 84px;
    align-items: flex-end;
  }
  .support-modal__dialog {
    max-width: 100%;
  }
  .support-modal__row-phone {
    display: none; /* на узких экранах номер прячем, оставляем название + стрелку */
  }
}
