/* Messages flash (templates/_flash.html) : petite fiche papier, bande de couleur selon le type */
.flash-pile {
    position: fixed;
    top: 68px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}

.flash {
    --bande: #6b5344;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 10px 14px 12px;
    background: #fffde7;
    color: #2a2a20;
    border: 2px solid #b5a46a;
    border-left: 6px solid var(--bande);
    border-radius: 2px;
    box-shadow: 0 6px 18px rgba(42, 42, 32, 0.25), 0 2px 0 #a89960;
    font-family: Arial, sans-serif;
    overflow: hidden;
    pointer-events: auto;
    animation: flash-entree 0.28s ease-out;
}

.flash-success { --bande: #4f7a34; }
.flash-danger  { --bande: #8b3a3a; }
.flash-warning { --bande: #b8862b; }
.flash-info    { --bande: #6b5344; }

.flash-icone {
    flex: none;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin-top: 1px;
    background: var(--bande);
    color: #fffde7;
    font-weight: bold;
    font-size: 0.85rem;
    line-height: 1;
    border-radius: 2px;
}

.flash-texte {
    flex: 1;
    min-width: 0;
    margin: 2px 0 0;
    font-size: 0.92rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.flash-fermer {
    flex: none;
    width: 26px;
    height: 26px;
    margin: -2px -2px 0 0;
    padding: 0;
    background: none;
    border: none;
    border-radius: 2px;
    color: #5a5a4a;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}
.flash-fermer:hover,
.flash-fermer:focus-visible { background: rgba(107, 83, 68, 0.12); color: #2a2a20; }

/* Temps restant avant la fermeture automatique */
.flash-temps {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: var(--bande);
    opacity: 0.55;
    transform-origin: left;
    animation: flash-temps var(--duree, 5000ms) linear forwards;
    animation-play-state: var(--etat, running);
}

.flash-sortie { animation: flash-sortie 0.25s ease-in forwards; }

@keyframes flash-entree { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes flash-sortie { to { transform: translateX(24px); opacity: 0; } }
@keyframes flash-temps { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Forum caché : version sombre, façon archives M.E.G. */
.flash-archives .flash {
    background: #1d1b16;
    color: #d9c992;
    border-color: #3a3020;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    font-family: 'Courier Prime', 'Courier New', monospace;
}
.flash-archives .flash-success { --bande: #6a8f4a; }
.flash-archives .flash-danger  { --bande: #a04848; }
.flash-archives .flash-icone { color: #1d1b16; }
.flash-archives .flash-fermer { color: #8f7d55; }
.flash-archives .flash-fermer:hover { background: rgba(217, 201, 146, 0.1); color: #d9c992; }

@media (max-width: 576px) {
    .flash-pile { top: 62px; right: 16px; left: 16px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
    .flash, .flash-sortie { animation: none; }
    .flash-temps { display: none; }
}
