/* ============================================================
   JangaMarket — Toasts modernes (glassmorphism + progress bar)
   Autonome : aucune dépendance. Thème clair/sombre. Responsive.
   ============================================================ */
.jm-toast-wrap {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.jm-toast {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px 16px;
    border-radius: 16px;
    overflow: hidden;
    color: #0f172a;
    background: rgba(255, 255, 255, 0.72);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    backdrop-filter: blur(14px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.18);
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.42s ease;
}
.jm-toast.show { transform: translateX(0); opacity: 1; }
.jm-toast.hide { transform: translateX(120%); opacity: 0; }

.jm-toast-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
}
.jm-toast-body { flex: 1; min-width: 0; padding-top: 1px; }
.jm-toast-title { font-weight: 800; font-size: 0.92rem; line-height: 1.2; margin-bottom: 2px; }
.jm-toast-msg { font-size: 0.85rem; line-height: 1.4; color: #334155; word-break: break-word; }

.jm-toast-close {
    flex-shrink: 0;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    color: #475569;
    width: 26px; height: 26px;
    border-radius: 8px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
    transition: background 0.15s;
}
.jm-toast-close:hover { background: rgba(0, 0, 0, 0.12); }

/* Barre de progression (se vide pendant la durée) */
.jm-toast-progress {
    position: absolute;
    left: 0; bottom: 0;
    height: 4px;
    width: 100%;
    transform-origin: left;
    animation: jmToastShrink linear forwards;
}
.jm-toast.paused .jm-toast-progress { animation-play-state: paused; }
@keyframes jmToastShrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Accents par type */
.jm-toast.success .jm-toast-icon { background: linear-gradient(135deg, #16a34a, #15803d); }
.jm-toast.success .jm-toast-progress { background: linear-gradient(90deg, #16a34a, #22c55e); }
.jm-toast.info .jm-toast-icon { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.jm-toast.info .jm-toast-progress { background: linear-gradient(90deg, #0ea5e9, #38bdf8); }
.jm-toast.warning .jm-toast-icon { background: linear-gradient(135deg, #f59e0b, #d97706); }
.jm-toast.warning .jm-toast-progress { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.jm-toast.error .jm-toast-icon { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.jm-toast.error .jm-toast-progress { background: linear-gradient(90deg, #ef4444, #f87171); }

/* Thème sombre */
@media (prefers-color-scheme: dark) {
    .jm-toast {
        color: #e2e8f0;
        background: rgba(30, 41, 59, 0.72);
        border-color: rgba(255, 255, 255, 0.08);
        box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
    }
    .jm-toast-msg { color: #cbd5e1; }
    .jm-toast-close { background: rgba(255, 255, 255, 0.08); color: #cbd5e1; }
    .jm-toast-close:hover { background: rgba(255, 255, 255, 0.16); }
}
:root[data-theme="dark"] .jm-toast {
    color: #e2e8f0; background: rgba(30, 41, 59, 0.72);
    border-color: rgba(255, 255, 255, 0.08); box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
}
:root[data-theme="dark"] .jm-toast-msg { color: #cbd5e1; }

@media (max-width: 560px) {
    .jm-toast-wrap { top: 10px; right: 10px; left: 10px; max-width: none; }
}
