/* Modern CakePHP flash notifications */
.app-flash-stack {
    position: fixed;
    top: 86px;
    right: 24px;
    z-index: 12000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(440px, calc(100vw - 32px));
    pointer-events: none;
}

.kt-login .app-flash-stack {
    top: 24px;
}

.app-flash {
    --app-flash-accent: #2563eb;
    --app-flash-soft: #eff6ff;
    --app-flash-border: rgba(37, 99, 235, 0.22);
    position: relative;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 32px;
    align-items: start;
    gap: 13px;
    overflow: hidden;
    padding: 15px 14px 15px 16px;
    color: #252a3a;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--app-flash-border);
    border-left: 4px solid var(--app-flash-accent);
    border-radius: 14px;
    box-shadow: 0 18px 44px rgba(38, 48, 74, 0.16), 0 3px 10px rgba(38, 48, 74, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    pointer-events: auto;
    animation: appFlashEnter 280ms cubic-bezier(.2, .8, .2, 1) both;
}

.app-flash--success {
    --app-flash-accent: #1f9d68;
    --app-flash-soft: #eaf8f1;
    --app-flash-border: rgba(31, 157, 104, 0.22);
}

.app-flash--error {
    --app-flash-accent: #e5484d;
    --app-flash-soft: #fff0f0;
    --app-flash-border: rgba(229, 72, 77, 0.23);
}

.app-flash--warning {
    --app-flash-accent: #d97706;
    --app-flash-soft: #fff7e6;
    --app-flash-border: rgba(217, 119, 6, 0.24);
}

.app-flash--info {
    --app-flash-accent: #2563eb;
    --app-flash-soft: #eff6ff;
    --app-flash-border: rgba(37, 99, 235, 0.22);
}

.app-flash__icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: var(--app-flash-accent);
    background: var(--app-flash-soft);
    border-radius: 12px;
}

.app-flash__icon svg {
    width: 23px;
    height: 23px;
}

.app-flash__content {
    min-width: 0;
    padding-top: 1px;
}

.app-flash__title {
    margin: 0 0 3px;
    color: #1f2433;
    font-size: 0.96rem;
    font-weight: 700;
    line-height: 1.35;
}

.app-flash__message,
.app-flash__messages {
    margin: 0;
    color: #60677b;
    font-size: 0.88rem;
    font-weight: 400;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.app-flash__messages {
    padding-left: 18px;
}

.app-flash__messages li + li {
    margin-top: 3px;
}

.app-flash__close {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    margin: -2px -3px 0 0;
    padding: 0;
    color: #9096a6;
    background: transparent;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    transition: color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.app-flash__close:hover,
.app-flash__close:focus-visible {
    color: #343949;
    background: #f1f3f7;
    outline: none;
    transform: scale(1.04);
}

.app-flash__close svg {
    width: 18px;
    height: 18px;
}

.app-flash__progress {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--app-flash-accent);
    opacity: 0.78;
    transform-origin: left center;
    animation: appFlashProgress var(--app-flash-timeout) linear forwards;
}

.app-flash.is-leaving {
    animation: appFlashLeave 220ms ease forwards;
}

@keyframes appFlashEnter {
    from {
        opacity: 0;
        transform: translate3d(24px, -8px, 0) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes appFlashLeave {
    to {
        opacity: 0;
        transform: translate3d(28px, 0, 0) scale(0.98);
    }
}

@keyframes appFlashProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

@media (max-width: 640px) {
    .app-flash-stack,
    .kt-login .app-flash-stack {
        top: 14px;
        right: 16px;
        left: 16px;
        width: auto;
    }

    .app-flash {
        grid-template-columns: 40px minmax(0, 1fr) 30px;
        gap: 11px;
        padding: 13px 12px 13px 13px;
        border-radius: 12px;
    }

    .app-flash__icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }

    .app-flash__title {
        font-size: 0.92rem;
    }

    .app-flash__message,
    .app-flash__messages {
        font-size: 0.84rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-flash,
    .app-flash__progress,
    .app-flash.is-leaving {
        animation: none !important;
    }
}
