/* ==========================================================================
   ZAMOK — Toast Notifications
   Премиальные плавающие уведомления (правый верхний угол).
   API: ZamokToast.success() / .error() / .show()
   ========================================================================== */

#toastContainer {
    position: fixed;
    top: calc(var(--header-height, 120px) + 16px);
    right: 24px;
    z-index: var(--z-toast, 9999);
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    width: min(380px, calc(100vw - 32px));
    max-width: 380px;
}

/* ───── Toast card ───── */
.toast {
    --toast-accent: #16A34A;
    --toast-accent-soft: rgba(22, 163, 74, 0.12);
    pointer-events: auto;
    position: relative;
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 14px 14px 14px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 14px;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.7) inset,
        0 12px 30px rgba(15, 23, 42, 0.12),
        0 4px 10px rgba(15, 23, 42, 0.06);
    transform: translateX(120%) scale(0.96);
    opacity: 0;
    transition:
        transform 420ms cubic-bezier(0.22, 1, 0.36, 1),
        opacity 320ms ease,
        box-shadow 320ms ease;
    overflow: hidden;
    isolation: isolate;
}

/* Тонкая акцент-полоса слева */
.toast::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--toast-accent);
    border-radius: 14px 0 0 14px;
}

/* Прогресс-бар автозакрытия */
.toast::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    width: 100%;
    background: var(--toast-accent);
    transform-origin: left center;
    transform: scaleX(1);
    transition: transform 5000ms linear;
    opacity: 0.7;
}

.toast--visible {
    transform: translateX(0) scale(1);
    opacity: 1;
}

.toast--visible::after {
    transform: scaleX(0);
}

/* ───── Иконка ───── */
.toast__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--toast-accent-soft);
    color: var(--toast-accent);
    flex-shrink: 0;
    margin-top: 1px;
}

.toast__icon svg {
    width: 20px;
    height: 20px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ───── Текст ───── */
.toast__body {
    min-width: 0;
    padding-top: 2px;
}

.toast__title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    color: #0F172A;
    letter-spacing: -0.005em;
}

.toast__text {
    margin: 4px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: #64748B;
    word-break: break-word;
}

/* ───── Закрыть ───── */
.toast__close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94A3B8;
    flex-shrink: 0;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.toast__close:hover {
    background: rgba(15, 23, 42, 0.06);
    color: #0F172A;
    transform: rotate(90deg);
}

.toast__close svg {
    width: 14px;
    height: 14px;
    stroke-linecap: round;
}

/* ───── Варианты ───── */
.toast--success {
    --toast-accent: #16A34A;
    --toast-accent-soft: rgba(22, 163, 74, 0.12);
}

.toast--error {
    --toast-accent: #E11E28;
    --toast-accent-soft: rgba(225, 30, 40, 0.12);
}

.toast--info {
    --toast-accent: #2563EB;
    --toast-accent-soft: rgba(37, 99, 235, 0.12);
}

.toast--warning {
    --toast-accent: #F59E0B;
    --toast-accent-soft: rgba(245, 158, 11, 0.14);
}

/* ───── Hover — пауза прогресса (визуально замедляем) ───── */
.toast:hover {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.7) inset,
        0 18px 40px rgba(15, 23, 42, 0.16),
        0 6px 14px rgba(15, 23, 42, 0.08);
}

/* ───── Mobile ───── */
@media (max-width: 640px) {
    #toastContainer {
        top: auto;
        bottom: 16px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
    }

    .toast {
        transform: translateY(140%) scale(0.96);
    }

    .toast--visible {
        transform: translateY(0) scale(1);
    }
}

/* ───── Reduced motion ───── */
@media (prefers-reduced-motion: reduce) {
    .toast {
        transition: opacity 200ms ease;
        transform: none;
    }
    .toast--visible {
        transform: none;
    }
    .toast::after {
        display: none;
    }
}

/* ───── Cart bump animation (счётчик в хедере) ───── */
@keyframes zamok-bump {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.35); }
    70%  { transform: scale(0.92); }
    100% { transform: scale(1); }
}

[data-cart-count].is-bump,
[data-fav-count].is-bump,
[data-cmp-count].is-bump {
    animation: zamok-bump 480ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Пульс самой кнопки "В корзину" */
@keyframes zamok-pulse {
    0%   { transform: scale(1); }
    40%  { transform: scale(0.96); }
    100% { transform: scale(1); }
}

.is-pulsed {
    animation: zamok-pulse 320ms ease;
}

