/* Flash messages — inline, at the top of <main>, auto-dismissing.
   The same classes are applied by flashMessages.js to legacy .alert / .uq-flash
   elements, so the icon + close layout looks identical everywhere. */

.flash-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 24px 0;
}

.flash-msg,
.flash-enhanced {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: var(--radius-sm, 8px);
    color: var(--fg);
    font-family: var(--font-body);
    font-size: .9rem;
    font-weight: 500;
    line-height: 1.5;
    box-shadow: var(--shadow-sm);
    overflow: hidden;

    /* Two-step exit: opacity first, then the box collapses. The script sets an
       explicit max-height before adding .is-collapsing so the height transition runs. */
    transition: opacity .25s ease,
                max-height .25s ease,
                margin .25s ease,
                padding .25s ease,
                border-width .25s ease;
}

.flash-success { border-left-color: var(--green); }
.flash-error   { border-left-color: var(--red); }

.flash-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    margin-top: 1px;
}

.flash-success .flash-icon { color: var(--green); background: var(--green-light); }
.flash-error   .flash-icon { color: var(--red);   background: var(--red-light); }

.flash-body {
    flex: 1 1 auto;
    min-width: 0;
    padding-top: 2px;
}

.flash-body ul { margin: 0; padding-left: 18px; }

.flash-close {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    margin: -3px -4px -3px 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--fg-muted);
    font: inherit;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.flash-close:hover {
    background: var(--bg-subtle);
    color: var(--fg);
}

.flash-msg.is-fading,
.flash-enhanced.is-fading { opacity: 0; }

.flash-msg.is-collapsing,
.flash-enhanced.is-collapsing {
    max-height: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-top-width: 0 !important;
    border-bottom-width: 0 !important;
}

/* Legacy elements keep their own colours; only the layout is normalised. */
.flash-enhanced.alert-success,
.flash-enhanced.uq-flash-ok   { border-left-color: var(--green); }
.flash-enhanced.alert-danger,
.flash-enhanced.alert-error,
.flash-enhanced.uq-flash-err,
.flash-enhanced.validation-summary-errors { border-left-color: var(--red); }

@media (max-width: 720px) {
    .flash-stack { margin: 12px 16px 0; }
}
