/*!
 * WN Toast — unified storefront notification system.
 *
 * One navy-style toast that replaces the legacy green Toastify AND the per-feature
 * navy toasts (whatsapp / rfq-basket / follow). Colours, duration and position are
 * driven from Theme Options → Toast Notification and injected as window.WNToastConfig.
 *
 * Colours fall back to the editable B2B palette (--b2b-*) so, with no explicit
 * override set, toasts already match the theme. Position anchors are PHYSICAL
 * (left/right = screen edge) so admin choices are predictable in LTR and RTL alike;
 * text direction inside the toast still follows the document dir.
 */

.wn-toasts {
    position: fixed;
    z-index: 100600;
    display: flex;
    gap: 10px;
    width: max-content;
    max-width: min(92vw, 380px);
    pointer-events: none;
    margin: 0;
    padding: 0;
}

/* horizontal anchor (physical) */
.wn-toasts--left { left: var(--wn-toast-x, 20px); }
.wn-toasts--right { right: var(--wn-toast-x, 20px); }
.wn-toasts--center { left: 50%; transform: translateX(-50%); }

/* vertical anchor + stack direction so the newest toast is nearest the edge */
.wn-toasts--top { top: var(--wn-toast-y, 20px); flex-direction: column-reverse; }
.wn-toasts--bottom { bottom: var(--wn-toast-y, 20px); flex-direction: column; }

.wn-toast {
    --wn-accent: transparent;
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--wn-toast-bg, var(--b2b-primary, #0f172a));
    color: var(--wn-toast-fg, #f8fafc);
    box-shadow: 0 12px 30px rgba(15, 23, 42, .28);
    font-size: 14px;
    line-height: 1.45;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .22s ease, transform .22s ease;
}

/* slide from the anchored edge */
.wn-toasts--top .wn-toast { transform: translateY(-12px); }

.wn-toast.is-visible { opacity: 1; transform: none; }

/* type accents — leading bar + icon tint; neutral toasts stay plain navy */
.wn-toast--success { --wn-accent: var(--wn-toast-success, var(--b2b-success, #16a34a)); }
.wn-toast--error { --wn-accent: var(--wn-toast-error, var(--b2b-error, #ef4444)); }
.wn-toast--warning { --wn-accent: var(--wn-toast-warning, var(--b2b-warning, #f59e0b)); }
.wn-toast--info { --wn-accent: var(--wn-toast-info, var(--b2b-info, #38bdf8)); }

.wn-toast--success,
.wn-toast--error,
.wn-toast--warning,
.wn-toast--info {
    border-inline-start: 3px solid var(--wn-accent);
    padding-inline-start: 12px;
}

.wn-toast__icon {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    color: var(--wn-accent);
}
.wn-toast__icon svg { display: block; width: 20px; height: 20px; }

.wn-toast__msg {
    flex: 1 1 auto;
    min-width: 0;
    white-space: pre-line;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.wn-toast__msg a,
.wn-toast__action {
    color: var(--wn-toast-link, #93c5fd);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.wn-toast__action {
    display: inline-block;
    margin-inline-start: 8px;
    white-space: nowrap;
    font-weight: 600;
}
.wn-toast__msg a:hover,
.wn-toast__action:hover { text-decoration: none; }

/* alternative-action row (whatsapp fallbacks) */
.wn-toast__msg .wa-toast__alts,
.wn-toast__msg .wn-toast-alts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 6px;
}

.wn-toast__close {
    flex: 0 0 auto;
    align-self: flex-start;
    margin-inline-start: 4px;
    padding: 0 2px;
    background: transparent;
    border: 0;
    color: inherit;
    opacity: .55;
    font-size: 18px;
    line-height: 1.2;
    cursor: pointer;
    transition: opacity .15s ease;
}
.wn-toast__close:hover { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
    .wn-toast {
        transition: opacity .12s ease;
        transform: none;
    }
    .wn-toasts--top .wn-toast { transform: none; }
}
