/* ================================================================
   BLACKLINE — Steam-style Notification System
   Подключать ПОСЛЕ style.css:  <link rel="stylesheet" href="/css/notifications.css">
   ================================================================ */

/* ---- Контейнер для всех toast-уведомлений ---- */
#bl-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column-reverse;   /* новые снизу, старые уходят вверх */
    gap: 10px;
    z-index: 99999;
    pointer-events: none;
}

/* ---- Одно уведомление ---- */
.bl-toast {
    pointer-events: auto;
    width: 320px;
    background: #1c1c1c;
    border: 1px solid rgba(138, 43, 226, 0.45);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.65), 0 0 0 1px rgba(138,43,226,0.15);
    cursor: pointer;
    position: relative;
    overflow: hidden;

    /* Въезд снизу */
    transform: translateX(110%);
    opacity: 0;
    transition:
        transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
        opacity   0.38s ease;
}

/* Состояние «виден» */
.bl-toast.visible {
    transform: translateX(0);
    opacity: 1;
}

/* Обратная анимация — уезжает вправо вниз (как в Steam) */
.bl-toast.hiding {
    transform: translateX(110%);
    opacity: 0;
}

/* Подсветка при наведении — говорит пользователю «можно кликнуть» */
.bl-toast:hover {
    border-color: rgba(138, 43, 226, 0.7);
    background: #232323;
}

/* Прогресс-бар исчезновения */
.bl-toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 100%;
    background: var(--accent-gradient, linear-gradient(135deg,#8A2BE2,#C71585));
    transform-origin: left center;
    animation: bl-toast-bar linear forwards;
}

@keyframes bl-toast-bar {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* Иконка / аватар слева */
.bl-toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: rgba(138,43,226,0.18);
    overflow: hidden;
    border: 1px solid rgba(138,43,226,0.3);
}

.bl-toast-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bl-toast-icon .bl-toast-initial {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
}

/* Правая часть — текст */
.bl-toast-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.bl-toast-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-color, #8A2BE2);
    font-weight: 600;
    margin-bottom: 1px;
}

.bl-toast-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bl-toast-text {
    font-size: 0.82rem;
    color: #aaa;
    line-height: 1.35;
    /* Ограничиваем текст по словам */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Кнопка закрыть */
.bl-toast-close {
    position: absolute;
    top: 8px;
    right: 9px;
    width: 18px;
    height: 18px;
    background: transparent;
    border: none;
    color: #666;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    padding: 0;
    transition: color 0.2s, background 0.2s;
}
.bl-toast-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

/* ---- Цвет прогресс-бара по типу ---- */
.bl-toast[data-type="message"]     ::after,
.bl-toast[data-type="message"]     .bl-toast-label { /* уже задан accent */ }

.bl-toast[data-type="friend"] {
    border-color: rgba(74, 222, 128, 0.4);
}
.bl-toast[data-type="friend"]::after {
    background: linear-gradient(90deg, #4ade80, #22c55e);
}
.bl-toast[data-type="friend"] .bl-toast-label {
    color: #4ade80;
}
.bl-toast[data-type="friend"] .bl-toast-icon {
    background: rgba(74,222,128,0.15);
    border-color: rgba(74,222,128,0.3);
}

.bl-toast[data-type="achievement"] {
    border-color: rgba(250, 204, 21, 0.4);
}
.bl-toast[data-type="achievement"]::after {
    background: linear-gradient(90deg, #facc15, #f59e0b);
}
.bl-toast[data-type="achievement"] .bl-toast-label {
    color: #facc15;
}
.bl-toast[data-type="achievement"] .bl-toast-icon {
    background: rgba(250,204,21,0.15);
    border-color: rgba(250,204,21,0.3);
}

/* ================================================================
   Бейдж уведомлений на аватарке (красный кружок)
   ================================================================ */
/* Обёртка кнопки профиля — нужна для позиционирования бейджа */
.auth-btn-wrapper {
    position: relative;
    display: inline-flex;
}

#bl-notif-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    background: #e53e3e;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 0 6px rgba(229,62,62,0.7);
    pointer-events: none;
    line-height: 1;
    border: 2px solid #0a0a0a;
    z-index: 10001;
    transform: scale(0);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#bl-notif-badge.visible {
    transform: scale(1);
}

/* ================================================================
   Бейдж на кнопке "Friends" в выпадающем меню аккаунта
   ================================================================ */
.dropdown-btn {
    position: relative;
}

.bl-dropdown-badge {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 8px;
    background: #e53e3e;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    border-radius: 9px;
    box-shadow: 0 0 6px rgba(229,62,62,0.6);
    vertical-align: middle;
}

/* ================================================================
   Бейдж рядом с конкретным другом в списке (кто именно написал)
   ================================================================ */
.friend-card {
    position: relative;
}

.friend-card-info {
    position: relative;
}

.bl-friend-card-badge {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-top: 4px;
    background: #e53e3e;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    border-radius: 9px;
    box-shadow: 0 0 6px rgba(229,62,62,0.6);
}

/* ================================================================
   Старый .toast-notification — перекрываем, чтобы не конфликтовал
   (оригинальная функция showToast теперь перехвачена)
   ================================================================ */
.toast-notification {
    display: none !important;
}