/* ===========================================================================
   style.css — корзина в шапке (bitrix:sale.basket.basket.line, шаблон
   header), Битрикс подключает его сам. Сама кнопка — .header__action из
   ui.css; здесь всплывающий стикер о покупке (script.js).
   =========================================================================== */

@layer components {

  /* Стикер «Товар в корзине» (макет «Уведомление», UI 979:13462): под
     шапкой у правого края контента. Скрытый — прозрачная «пилюля» 64px,
     при показе растёт влево до ширины текста (ширину ставит script.js),
     ease-out 0.1s, как smart animate в макете; прячется так же обратно. */
  .basket-toast {
    --toast-edge: calc(max(0px, (100vw - var(--page-max)) / 2) + var(--page-gutter) + var(--container-pad));

    position: fixed;
    z-index: var(--z-dropdown);
    top: calc(10px + var(--header-h) + 16px); /* отступ шапки + шапка + 16px */
    right: var(--toast-edge);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 64px;
    max-width: calc(100vw - 2 * var(--toast-edge));
    padding: 8px 32px;
    overflow: hidden;
    border-radius: 18px;
    background: var(--color-chartreuse);
    box-shadow: 4px 4px 10px rgb(174 194 211 / 0.25); /* «Тень карточки» */
    color: var(--color-gray-900);
    font-size: var(--fs-text-m);
    line-height: 1.25;
    opacity: 0;
    pointer-events: none;
    transition: width 0.1s ease-out, opacity 0.1s ease-out;
  }

  .basket-toast.is-visible { opacity: 1; }

  .basket-toast__inner {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 8px;
  }

  .basket-toast__text {
    max-width: calc(100vw - 2 * var(--toast-edge) - 64px - 24px);
    text-align: right;
    white-space: nowrap;
  }

  .basket-toast__icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    background: url(images/check.svg) no-repeat 3px 5.5px / 9.5457px 7px;
  }

  /* Ошибка каталога: красный стикер без галочки, длинный текст переносится */
  .basket-toast--error {
    background: var(--color-red-900);
    color: var(--color-white);
  }

  .basket-toast--error .basket-toast__text { white-space: normal; }
  .basket-toast--error .basket-toast__icon { display: none; }

  @media (prefers-reduced-motion: reduce) {
    .basket-toast { transition: none; }
  }
}
