/* ============================================================
   Business PC V2 — TOAST (витрина) (PHASE 3)
   Уведомления снизу страницы с таймером исчезновения.
   Тот же паттерн, что в админке (admin.css .toast), но на токенах
   и для клиентских страниц. Тексты вставляются через textContent —
   ESC не нужен.
   Подключать после ui/tokens.css, ui/icons.css.
   ============================================================ */

#toast-root {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 24px;
    z-index: 120;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.toast {
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    max-width: min(92vw, 440px);
    padding: 12px 20px 16px;
    background: var(--color-text);
    color: var(--color-bg);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-modal);
    font-size: 0.88rem;
    line-height: 1.45;
    text-align: center;
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    transition:
        opacity 0.28s ease,
        transform 0.28s ease;
    pointer-events: auto;
}

.toast.is-shown { opacity: 1; transform: translateY(0) scale(1); }
.toast.is-leaving { opacity: 0; transform: translateY(8px); }

.toast--error { background: var(--toast-error-bg, #7d1414); }
.toast--success { background: var(--toast-success-bg, #123d1e); }

/* «Ползунок» времени до исчезновения */
.toast-bar {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    transform-origin: left;
    transition: transform linear;
}
.toast--success .toast-bar { background: rgba(205, 255, 216, 0.85); }
.toast--error .toast-bar { background: rgba(255, 205, 205, 0.85); }

/* ---------- Добавлено в корзину: тёмный компакт с галочкой ----------
   Та же геометрия/тень сайта, без новых зависимостей. */
.toast--cart {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: min(92vw, 300px);
    padding: 12px 14px 15px;
    background: #101114;
    color: #ffffff;
    text-align: left;
}
.toast-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    color: #101114;
    background: #3ddc74;
    border-radius: 50%;
}
.toast-check svg { width: 16px; height: 16px; }
.toast-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
}
.toast-title { font-size: 0.88rem; font-weight: 700; }
.toast-sub {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.72);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 52vw;
}
.toast-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.6);
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
.toast-close:hover { color: #ffffff; background: rgba(255, 255, 255, 0.08); }
.toast--cart .toast-bar { background: rgba(61, 220, 116, 0.7); }

/* ---------- Перелёт в корзину: точка от кнопки к шапке ---------- */
.fx-fly-dot {
    position: fixed;
    z-index: 200;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    background: #101114;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    transition: transform 0.55s cubic-bezier(0.3, 0.7, 0.4, 1), opacity 0.55s ease;
}

/* ---------- Кнопка в момент добавления: чуть прижата, клики игнорятся ---------- */
.is-busy { opacity: 0.75; }
.is-busy:active { transform: scale(0.985); }

/* ---------- Без анимаций: всё то же, но мгновенно ---------- */
@media (prefers-reduced-motion: reduce) {
    .toast { transition: none; transform: none; }
    .toast.is-shown, .toast.is-leaving { transform: none; }
    .fx-fly-dot { display: none; }
}

/* ---------- Мобильные: toast во всю ширину с полями ---------- */
@media (max-width: 560px) {
    #toast-root { left: 12px; right: 12px; bottom: 12px; }
    .toast--cart { width: 100%; max-width: none; }
    .toast-sub { max-width: none; }
}
