/*
 * Session notifications - assets/MyJs/SessionNotifier.js.
 *
 *   .sn-toasts   top-right toast stack          success green, info blue, warning orange, error red
 *   .sn-banner   inactivity countdown           orange, pinned to the top of the window
 *   .sn-overlay  blocking popup                 red: session expired / branch or year missing
 *
 * Colours come from the theme's own Bootstrap variables so they follow light and dark mode.
 * Info is a true blue rather than the theme's cyan "info", as the notification spec asks.
 *
 * Stacking: above the navbar, Bootstrap modals (1055), DevExpress popups and loading panels,
 * and the template customizer (999999), so nothing can hide a session message.
 */

:root {
    --sn-success-rgb: var(--bs-success-rgb, 40, 199, 111);
    --sn-info-rgb: 46, 123, 246;
    --sn-warning-rgb: var(--bs-warning-rgb, 255, 159, 67);
    --sn-danger-rgb: var(--bs-danger-rgb, 255, 76, 81);
    --sn-z-banner: 1000100;
    --sn-z-overlay: 1000200;
    --sn-z-toasts: 1000300;
}

/* ---- Toasts ------------------------------------------------------------------ */

.sn-toasts {
    position: fixed;
    top: 76px;
    right: 16px;
    z-index: var(--sn-z-toasts);
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.sn-toast {
    --sn-rgb: var(--sn-info-rgb);
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 14px 16px;
    border: 1px solid rgba(var(--sn-rgb), .35);
    border-left: 5px solid rgb(var(--sn-rgb));
    border-radius: 0 8px 8px 0;
    background: var(--bs-paper-bg, #fff);
    color: var(--bs-body-color);
    box-shadow: var(--bs-box-shadow-lg, 0 .625rem 1.25rem rgba(0, 0, 0, .15));
    overflow: hidden;
    pointer-events: auto;
    animation: sn-slide-in .25s ease-out;
}

.sn-toast.is-leaving { animation: sn-slide-out .2s ease-in forwards; }

.sn-toast--success { --sn-rgb: var(--sn-success-rgb); }
.sn-toast--info { --sn-rgb: var(--sn-info-rgb); }
.sn-toast--warning { --sn-rgb: var(--sn-warning-rgb); }
.sn-toast--error { --sn-rgb: var(--sn-danger-rgb); }

.sn-toast__icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: rgb(var(--sn-rgb));
    background: rgba(var(--sn-rgb), .16);
}

.sn-toast__body { min-width: 0; flex: 1; }

.sn-toast__title {
    margin: 0;
    font-size: .9375rem;
    font-weight: 600;
    line-height: 1.35;
    color: rgb(var(--sn-rgb));
}

.sn-toast__message {
    margin: 2px 0 0;
    font-size: .875rem;
    line-height: 1.45;
    color: var(--bs-body-color);
    word-break: break-word;
}

.sn-toast__action {
    margin-top: 8px;
    padding: 0;
    border: 0;
    background: none;
    font-size: .8125rem;
    font-weight: 600;
    color: rgb(var(--sn-rgb));
    cursor: pointer;
}

.sn-toast__action:hover { text-decoration: underline; }

.sn-toast__close {
    flex-shrink: 0;
    margin: -4px -4px 0 0;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--bs-secondary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sn-toast__close:hover { background: rgba(var(--bs-body-color-rgb, 0, 0, 0), .08); }

.sn-toast__progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: rgba(var(--sn-rgb), .7);
    transform-origin: left center;
}

/* ---- Inactivity banner ------------------------------------------------------- */

.sn-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--sn-z-banner);
    background: var(--bs-paper-bg, #fff);
    border-bottom: 1px solid rgba(var(--sn-warning-rgb), .6);
    box-shadow: var(--bs-box-shadow-lg, 0 .625rem 1.25rem rgba(0, 0, 0, .15));
    animation: sn-drop-in .25s ease-out;
}

.sn-banner__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    padding: 14px 20px;
    background: rgba(var(--sn-warning-rgb), .14);
}

.sn-banner__icon {
    flex-shrink: 0;
    font-size: 28px;
    color: rgb(var(--sn-warning-rgb));
}

.sn-banner__text { flex: 1; min-width: 220px; }

.sn-banner__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--bs-heading-color);
}

.sn-banner__time {
    display: inline-block;
    min-width: 3.2em;
    color: rgb(var(--sn-warning-rgb));
    font-variant-numeric: tabular-nums;
}

.sn-banner__message {
    margin: 2px 0 0;
    font-size: .875rem;
    color: var(--bs-body-color);
}

.sn-banner__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.sn-banner__track { height: 5px; background: rgba(var(--sn-warning-rgb), .2); }

.sn-banner__bar {
    height: 100%;
    width: 100%;
    background: rgb(var(--sn-warning-rgb));
    transition: width 1s linear;
}

/* ---- Blocking popup ---------------------------------------------------------- */

.sn-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--sn-z-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 20, 34, .62);
    animation: sn-fade-in .2s ease-out;
}

.sn-dialog {
    width: 100%;
    max-width: 440px;
    max-height: calc(100vh - 32px);
    overflow: auto;
    border-radius: 12px;
    background: var(--bs-paper-bg, #fff);
    color: var(--bs-body-color);
    box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, .35);
    text-align: center;
    animation: sn-pop-in .22s ease-out;
}

.sn-dialog__stripe { height: 6px; background: rgb(var(--sn-danger-rgb)); }

.sn-dialog__body { padding: 28px 28px 8px; }

.sn-dialog__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    color: rgb(var(--sn-danger-rgb));
    background: rgba(var(--sn-danger-rgb), .14);
}

.sn-dialog__title {
    margin: 0 0 8px;
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--bs-heading-color);
}

.sn-dialog__message {
    margin: 0;
    font-size: .9375rem;
    line-height: 1.6;
    color: var(--bs-body-color);
}

.sn-dialog__checks {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.sn-dialog__check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: .8125rem;
    font-weight: 500;
}

.sn-dialog__check.is-missing { color: rgb(var(--sn-danger-rgb)); background: rgba(var(--sn-danger-rgb), .14); }
.sn-dialog__check.is-ok { color: rgb(var(--sn-success-rgb)); background: rgba(var(--sn-success-rgb), .14); }

.sn-dialog__hint {
    margin: 14px 0 0;
    font-size: .8125rem;
    color: var(--bs-secondary-color);
}

.sn-dialog__footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 20px 28px 28px;
}

.sn-dialog__footer .btn { min-width: 140px; }

/* Nothing behind a blocking popup may scroll or be clicked. */
body.sn-blocked { overflow: hidden; }

/* ---- Login page reason ------------------------------------------------------- */

.sn-login-reason {
    --sn-rgb: var(--sn-danger-rgb);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0 0 20px;
    padding: 14px 16px;
    border: 1px solid rgba(var(--sn-rgb), .35);
    border-left: 5px solid rgb(var(--sn-rgb));
    border-radius: 0 8px 8px 0;
    background: rgba(var(--sn-rgb), .1);
    text-align: left;
}

.sn-login-reason--info { --sn-rgb: var(--sn-info-rgb); }

.sn-login-reason i { font-size: 22px; color: rgb(var(--sn-rgb)); margin-top: 1px; }
.sn-login-reason strong { display: block; color: rgb(var(--sn-rgb)); font-size: .9375rem; }
.sn-login-reason span { font-size: .875rem; color: var(--bs-body-color); }

/* ---- Motion ------------------------------------------------------------------ */

/* ---- Icon sizes --------------------------------------------------------------- */
/* The theme's .icon-base sizes glyphs from --bs-icon-size, not font-size. */

.sn-toast__icon .icon-base { --bs-icon-size: 20px; }
.sn-toast__close .icon-base { --bs-icon-size: 18px; }
.sn-toast__action .icon-base { --bs-icon-size: 16px; }
.sn-banner__icon .icon-base { --bs-icon-size: 30px; }
.sn-banner .btn .icon-base { --bs-icon-size: 18px; }
.sn-dialog__icon .icon-base { --bs-icon-size: 38px; }
.sn-dialog__check .icon-base { --bs-icon-size: 14px; }
.sn-dialog__footer .icon-base { --bs-icon-size: 18px; }
.sn-login-reason .icon-base { --bs-icon-size: 22px; }

@keyframes sn-slide-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes sn-slide-out { to { opacity: 0; transform: translateX(24px); } }
@keyframes sn-drop-in { from { transform: translateY(-100%); } to { transform: none; } }
@keyframes sn-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sn-pop-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    .sn-toast, .sn-toast.is-leaving, .sn-banner, .sn-overlay, .sn-dialog { animation: none; }
    .sn-banner__bar { transition: none; }
}

@media (max-width: 575.98px) {
    .sn-toasts { top: 12px; right: 12px; width: calc(100vw - 24px); }
    .sn-banner__inner { padding: 12px 14px; }
    .sn-banner__actions { width: 100%; }
    .sn-banner__actions .btn { flex: 1; }
    .sn-dialog__body { padding: 24px 20px 4px; }
    .sn-dialog__footer { padding: 16px 20px 24px; }
    .sn-dialog__footer .btn { flex: 1; }
}
