/* =========================================================
   Flash / Toast Notifications
   – Fixed bottom-right stack
   – Auto-dismiss after 10 s with animated progress bar
   – Progress bar pauses on hover
   ========================================================= */

/* Container that stacks toasts from the bottom */
#flash-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1090;
    display: flex;
    flex-direction: column-reverse;   /* newest toast appears at bottom */
    gap: 0.75rem;
    width: 340px;
    max-width: calc(100vw - 3rem);
    pointer-events: none;             /* let clicks fall through empty space */
}

/* Individual toast card */
.flash-toast {
    pointer-events: all;
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
    background: var(--color-charcoal, #2b2b2b);
    color: var(--color-cream, #f5f0e8);
    padding: 0.9rem 1rem 0.65rem 1rem;
    opacity: 0;
    transform: translateX(120%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Slide-in state added by JS */
.flash-toast.show {
    opacity: 1;
    transform: translateX(0);
}

/* Slide-out state added by JS before removal */
.flash-toast.hide {
    opacity: 0;
    transform: translateX(120%);
}

/* Top row: icon + message + close button */
.flash-toast__body {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.flash-toast__icon {
    flex-shrink: 0;
    font-size: 1.15rem;
    line-height: 1.4;
}

.flash-toast__message {
    flex: 1;
    font-size: 0.875rem;
    line-height: 1.5;
    word-break: break-word;
}

.flash-toast__close {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: inherit;
    opacity: 0.55;
    font-size: 1rem;
    line-height: 1;
    transition: opacity 0.15s;
}

.flash-toast__close:hover {
    opacity: 1;
}

/* ── Progress bar track ─────────────────────────────────── */
.flash-toast__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.12);
}

.flash-toast__progress-bar {
    height: 100%;
    width: 100%;
    transform-origin: left center;
    animation: flash-shrink 10s linear forwards;
}

/* Pause the animation while the user hovers */
.flash-toast:hover .flash-toast__progress-bar {
    animation-play-state: paused;
}

@keyframes flash-shrink {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* ── Category colour variants ───────────────────────────── */

/* success */
.flash-toast--success {
    border-left: 4px solid var(--color-success, #4caf50);
}
.flash-toast--success .flash-toast__progress-bar {
    background: var(--color-success, #4caf50);
}
.flash-toast--success .flash-toast__icon {
    color: var(--color-success, #4caf50);
}

/* danger / error */
.flash-toast--danger {
    border-left: 4px solid var(--color-rust, #c0392b);
}
.flash-toast--danger .flash-toast__progress-bar {
    background: var(--color-rust, #c0392b);
}
.flash-toast--danger .flash-toast__icon {
    color: var(--color-rust, #c0392b);
}

/* warning */
.flash-toast--warning {
    border-left: 4px solid #e0a800;
}
.flash-toast--warning .flash-toast__progress-bar {
    background: #e0a800;
}
.flash-toast--warning .flash-toast__icon {
    color: #e0a800;
}

/* info */
.flash-toast--info {
    border-left: 4px solid #3498db;
}
.flash-toast--info .flash-toast__progress-bar {
    background: #3498db;
}
.flash-toast--info .flash-toast__icon {
    color: #3498db;
}
