﻿
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 340px;
}

.notification {
    width: 340px; /* фиксированная ширина для всех уведомлений */
    max-width: 100%; /* адаптив для мобильных */
    background: var(--card-background);
    color: var(--main-font);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--color-border);
    border-right: 3px solid var(--shadow-neon);
    box-shadow: 0 10px 30px var(--shadow), 0 0 12px var(--shadow-neon);
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    animation: slideIn .35s ease-out, fadeOut .35s ease-in forwards;
    animation-delay: 0s, calc(var(--duration) - 350ms);
    transition: transform 0.35s ease, opacity 0.35s ease;
    opacity: 1;
    transform: translateX(0);
}

    .notification.closing {
        opacity: 0;
        transform: translateX(40px);
    }

    .notification .progress-bar {
        position: absolute;
        bottom: 0;
        left: 0;
        height: 3px;
        background: currentColor;
        transition: width 0.1s linear;
    }


    /* Count bubble */
    .notification .count {
        background: var(--secondary);
        border-radius: 50%;
        padding: 2px 8px;
        margin-left: 6px;
        font-size: 0.8rem;
        display: inline-block;
        text-align: center;
        min-width: 24px; /* фиксированная ширина пузыря */
    }

.notification-content {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* текст слева, count справа через margin */
    gap: 8px; /* расстояние между иконкой, текстом и count */
    flex: 1; /* занимает доступное место */
    min-width: 0; /* нужно для text-overflow */
    
}

    .notification-content .text {
        flex: 1; /* текст занимает всё доступное пространство */
        white-space: pre-wrap; /* разрешаем перенос строк */
        word-break: break-word; /* перенос длинных слов */
        overflow-wrap: anywhere;
        line-height: 1.4;
        max-height: 4.2em; /* ~3 строки */
        overflow-y: auto;
        font-weight: 600;
    }


.notification .icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
}

    .notification .icon svg {
        width: 22px;
        height: 22px;
        fill: currentColor;
    }

/* TYPES */

.notification.success {
    color: var(--true);
}

.notification.warning {
    color: var(--warning);
}

.notification.error {
    color: var(--false);
}

.notification.success {
    box-shadow: 0 10px 30px var(--shadow), 0 0 12px var(--glow-primary);
    border-right: 4px solid var(--primary);
}

.notification.warning {
    box-shadow: 0 10px 30px var(--shadow), 0 0 12px rgba(229,161,0,0.25);
    border-right: 4px solid var(--primary);
}

.notification.error {
    box-shadow: 0 10px 30px var(--shadow), 0 0 12px rgba(224,82,82,0.25);
    border-right: 4px solid var(--primary);
}

/* INFO / STICKY */

.notification.info {
    color: var(--primary);
    border-right: 4px solid var(--primary);
    box-shadow: 0 10px 30px var(--shadow), 0 0 12px var(--glow-secondary);
    background: var(--card-background);
}

    /* Дополнительно для sticky — маленький значок "pin" */
    .notification.info .icon::after {
        content: "📌"; /* или используйте SVG иконку */
        display: inline-block;
        margin-left: 4px;
        font-size: 14px;
    }

.notification.info {
    animation: pulseGlow 2s infinite;
}



/* BUTTON */

.close-btn {
    background: none;
    border: none;
    color: var(--sec-font);
    font-size: 18px;
    cursor: pointer;
    transition: color .2s ease;
}

    .close-btn:hover {
        color: var(--main-font);
    }



/* PROGRESS_BAR */
.progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: linear-gradient( 90deg, currentColor, currentColor );
    box-shadow: 0 0 6px currentColor;
    transform-origin: left;
    animation: progress linear forwards;
    animation-duration: var(--duration);
}

/* ANIMATIONS */

@keyframes pulseGlow {
    0% {
        box-shadow: 0 10px 30px var(--shadow), 0 0 12px var(--glow-secondary);
    }

    50% {
        box-shadow: 0 10px 30px var(--shadow), 0 0 18px var(--glow-secondary);
    }

    100% {
        box-shadow: 0 10px 30px var(--shadow), 0 0 12px var(--glow-secondary);
    }
}

@keyframes progress {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(40px);
    }
}


/* Adaptive */
@media (max-width: 600px) {
    .notification-container {
        width: 90%;
        left: 5%;
        right: 5%;
    }

    .notification {
        touch-action: pan-y; /* Позволяет вертикальный скролл, блокирует горизонтальный жест */
        -ms-touch-action: pan-y; /* для IE/Edge */
        touch-action: none;
    }
}