/* ==========================================================
   toast.css — Système de toast autonome (fonctionne sans Bootstrap)
   ========================================================== */

/* ── Container ─────────────────────────────────────────── */
#app-toasts {
    position: fixed;
    top: var(--app-header-height); /* sous le header fixe, pas derrière */
    right: 0;
    padding: var(--app-spacer);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--app-spacer-sm);
    max-width: 380px;
    width: 100%;
    pointer-events: none;
}

/* Décalage supplémentaire quand des bannières d'en-tête sont visibles */
.has-banners-1 #app-toasts,
.has-banners-2 #app-toasts,
.has-banners-3 #app-toasts {
    top: calc(var(--app-header-height) + var(--app-banners-height));
}

/* ── Toast card ────────────────────────────────────────── */
#app-toasts .toast {
    pointer-events: auto;
    background: var(--app-white);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-lg);
    overflow: hidden;
    animation: app-toast-slide-in 0.35s ease forwards;
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-family: var(--app-font-family);
    font-size: var(--app-font-size-sm);
    color: var(--app-dark);
}

/* ── Header ────────────────────────────────────────────── */
#app-toasts .toast-header {
    display: flex;
    align-items: center;
    padding: var(--app-spacer-sm) var(--app-spacer);
    border-bottom: 1px solid var(--app-gray-100);
    background: var(--app-light);
}

#app-toasts .toast-header i {
    margin-right: var(--app-spacer-sm);
    font-size: var(--app-font-size-md);
}

#app-toasts .toast-header strong {
    flex: 1 1 auto;
    font-weight: 600;
}

/* ── Close button ──────────────────────────────────────── */
#app-toasts .toast-header .btn-close {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background: transparent;
    cursor: pointer;
    margin-left: var(--app-spacer-sm);
    padding: 4px;
    opacity: 0.5;
    font-size: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--app-radius-sm);
    transition: opacity 0.15s ease, background 0.15s ease;
}

#app-toasts .toast-header .btn-close::before {
    content: '\eb99'; /* ri-close-line */
    font-family: 'remixicon';
    font-size: var(--app-font-size-base);
    color: var(--app-gray-500);
}

#app-toasts .toast-header .btn-close:hover {
    opacity: 1;
    background: var(--app-gray-100);
}

/* ── Body ──────────────────────────────────────────────── */
#app-toasts .toast-body {
    padding: var(--app-spacer-sm) var(--app-spacer);
    line-height: var(--app-line-height);
}

/* Lien d'action rapide (ex: "Voir la carte" après restauration corbeille) */
#app-toasts .toast-body a {
    color: var(--app-primary);
    font-weight: 600;
    text-decoration: underline;
    margin-left: 0.25rem;
}
#app-toasts .toast-body a:hover {
    color: var(--app-primary-dark, var(--app-primary));
}

/* Hash inline dans le message */
#app-toasts .toast-body code {
    background: var(--app-gray-100);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: var(--app-font-family-mono, monospace);
}

/* ── Couleurs d'icônes ─────────────────────────────────── */
#app-toasts .toast-header i.ri-check-line        { color: var(--app-success); }
#app-toasts .toast-header i.ri-close-circle-line  { color: var(--app-danger); }
#app-toasts .toast-header i.ri-alert-line         { color: var(--app-warning); }
#app-toasts .toast-header i.ri-information-line   { color: var(--app-info); }

/* ── Animations ────────────────────────────────────────── */
@keyframes app-toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── Responsive ────────────────────────────────────────── */

/* Sur mobile le header passe en sticky (pas fixed) → top: 0 pour le toast */
@media (max-width: 768px) {
    #app-toasts {
        top: 0;
    }
    .has-banners-1 #app-toasts,
    .has-banners-2 #app-toasts,
    .has-banners-3 #app-toasts {
        top: 0;
    }
}

@media (max-width: 480px) {
    #app-toasts {
        max-width: 100%;
        padding: var(--app-spacer-sm);
    }
}
