/* ══ Окно сообщений ═════════════════════════════════════════════════════
   Все плашки «успешно / ошибка», непрочитанные уведомления, подсказка гостю,
   «незавершённый заказ» и сообщения скриптов показываются стопкой карточек
   в правом верхнем углу, под шапкой. Раньше они стояли в потоке страницы
   и в профиле уезжали под шапку — в самый низ.

   Стопка не мешает пользоваться сайтом: затемнения нет, прокрутка не
   блокируется, нажатия мимо карточек доходят до страницы (pointer-events).
   Карточка уходит по своему крестику; вся стопка — по нажатию в любое место
   страницы вне карточек (само нажатие при этом срабатывает) или по Esc.
   Разметку и поведение даёт wwwroot/js/bl-notes.js.

   Цвета взяты у окон профиля (.bl-win в bl-profile.css): подложка
   #281C45 → #302056, красный крестик, фиолетовый акцент. Размеры —
   в макетных пикселях: body масштабируется zoom'ом (bl.css), стопка
   лежит внутри body. */
.bl-notes {
    position: fixed;
    inset: 0;
    /* Выше окон профиля (1080) и модалок Bootstrap (1055): сообщение может
       прийти из-под открытой модалки — например, ошибка в форме данных Steam. */
    z-index: 1090;
    display: none;
    align-items: flex-start;
    justify-content: flex-end;
    padding: calc(var(--bl-header-h, 80px) + 16px) 24px 24px;
    /* Слой на весь экран только раскладывает стопку: сам он прозрачен для мыши
       и пальца, ловят нажатия только карточки. */
    pointer-events: none;
    font-family: var(--bl-font);
}
.bl-notes.is-open {
    display: flex;
    animation: bl-notes-fade .18s ease-out;
}

.bl-notes__stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 400px;
    max-width: 100%;
    /* Длинная стопка прокручивается сама, а не уезжает за низ экрана. */
    max-height: calc(100vh - var(--bl-header-h, 80px) - 40px);
    max-height: calc(100dvh - var(--bl-header-h, 80px) - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    pointer-events: auto;
}

/* ── Карточка ────────────────────────────────────────────────────────────
   Тип задаёт цвет полосы слева, значка и обводки: успех — зелёный,
   ошибка — красный, предупреждение — янтарный, уведомление — фирменный
   фиолетовый. Цвета те же, что у пилюль окна «История заказов». */
.bl-note {
    --note-accent: #8A5CF5;
    --note-grad: var(--bl-grad-primary);
    --note-line: rgba(138, 92, 245, .38);
    --note-glow: rgba(131, 87, 233, .38);
    position: relative;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 14px;
    padding: 16px 44px 16px 16px;
    border: 1px solid var(--note-line);
    border-left: 4px solid var(--note-accent);
    border-radius: 20px;
    background: linear-gradient(90deg, #281C45 0%, #302056 100%);
    /* Затемнения под стопкой больше нет — отделяет карточку от страницы тень. */
    box-shadow: 0 18px 48px rgba(0, 0, 0, .6), 0 0 0 1px rgba(0, 0, 0, .25);
    color: #fff;
    flex: 0 0 auto;
    animation: bl-note-in .28s cubic-bezier(.2, .9, .3, 1.1) both;
}
.bl-note:nth-child(2) { animation-delay: .05s; }
.bl-note:nth-child(3) { animation-delay: .1s; }
.bl-note:nth-child(n+4) { animation-delay: .15s; }

.bl-note--success {
    --note-accent: #40CE1A;
    --note-grad: linear-gradient(135deg, #2E9A12 0%, #40CE1A 100%);
    --note-line: rgba(64, 206, 26, .34);
    --note-glow: rgba(64, 206, 26, .3);
}
.bl-note--error {
    --note-accent: #E51A2E;
    --note-grad: linear-gradient(135deg, #B02A2A 0%, #E51A2E 100%);
    --note-line: rgba(229, 26, 46, .4);
    --note-glow: rgba(229, 26, 46, .32);
}
.bl-note--warn {
    --note-accent: #D8A33C;
    --note-grad: linear-gradient(135deg, #B8862A 0%, #D8A33C 100%);
    --note-line: rgba(216, 163, 60, .4);
    --note-glow: rgba(216, 163, 60, .3);
}

.bl-note__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--note-grad);
    box-shadow: 0 6px 18px var(--note-glow);
    color: #fff;
}
.bl-note__icon svg { width: 17px; height: 17px; }

.bl-note__close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #FF0004;
    color: #fff;
    cursor: pointer;
    transition: filter .15s ease;
}
.bl-note__close:hover { filter: brightness(1.12); }
.bl-note__close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.bl-note__close svg { width: 6.5px; height: 6.5px; }

.bl-note__body { min-width: 0; }
.bl-note__title {
    margin: 0;
    padding-top: 1px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    color: #fff;
    word-break: break-word;
}
.bl-note__text {
    margin-top: 5px;
    font-size: 12.5px;
    line-height: 1.5;
    color: rgba(255, 255, 255, .78);
    word-break: break-word;
}
.bl-note__title:empty { display: none; }
.bl-note__title:empty + .bl-note__text { margin-top: 0; padding-top: 8px; }
.bl-note__text b,
.bl-note__text strong { color: #fff; font-weight: 700; }

.bl-note__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.bl-note__btn {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 16px;
    border: 0;
    border-radius: var(--bl-radius-pill, 999px);
    background: var(--bl-grad-primary);
    color: #fff;
    font-family: var(--bl-font);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: filter .18s ease, box-shadow .18s ease;
}
.bl-note__btn:hover { color: #fff; filter: brightness(1.12); box-shadow: 0 6px 20px rgba(131, 87, 233, .38); }
.bl-note__btn:focus-visible { outline: 2px solid var(--bl-violet); outline-offset: 3px; }
.bl-note__btn--ghost {
    background: rgba(255, 255, 255, .06);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
}
.bl-note__btn--ghost:hover { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .4); }

/* ── Непрочитанные уведомления в карточке ────────────────────────────────
   Сам список (.pnotif__item и т. д.) описан в bl-profile.css; здесь
   снимаются рамка и фон старой карточки — рамку уже даёт .bl-note.
   Тело карточки «растворяется» в сетке: заголовок встаёт рядом со значком,
   а список — отдельной строкой во всю ширину. */
.bl-note .pnotif {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
}
.bl-note:has(.pnotif) .bl-note__body { display: contents; }
.bl-note:has(.pnotif) .bl-note__title { align-self: center; }
.bl-note .pnotif__head { margin: 0 0 8px; }
.bl-note .pnotif__item { background: rgba(13, 15, 22, .55); }
.bl-note .pnotif__more { display: inline-block; margin-top: 8px; }
/* Тексты уведомлений бывают на десяток строк («что будет дальше» после
   оплаты) — в карточке видно три, остальное раскрывается нажатием. */
.bl-note .pnotif__msg {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    cursor: pointer;
}
.bl-note .pnotif__msg.is-expanded {
    display: block;
    -webkit-line-clamp: unset;
    cursor: auto;
}

@keyframes bl-notes-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bl-note-in {
    from { opacity: 0; transform: translateX(28px); }
    to   { opacity: 1; transform: none; }
}
@keyframes bl-note-up {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .bl-notes.is-open, .bl-note { animation: none; }
}

/* На телефоне стопка внизу экрана во всю ширину и не выше половины экрана:
   сверху под шапкой страница остаётся видна и нажимается. Лишнее
   прокручивается внутри стопки. */
@media (max-width: 575.98px) {
    .bl-notes { align-items: flex-end; justify-content: center; padding: 0 10px 12px; }
    .bl-notes__stack {
        width: 100%;
        max-height: 55vh;
        max-height: 55dvh;
    }
    .bl-note { grid-template-columns: 30px minmax(0, 1fr); gap: 12px; padding: 14px 40px 14px 14px; border-radius: 16px; animation-name: bl-note-up; }
    .bl-note__icon { width: 30px; height: 30px; }
    .bl-note__icon svg { width: 14px; height: 14px; }
    .bl-note__close { top: 10px; right: 10px; }
}
