﻿/* ========== УВЕДОМЛЕНИЯ ========== */
.notification-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}

.notification-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background-color: var(--color-submit-btn-bg, #0d6efd);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

    .notification-toggle:hover {
        transform: scale(1.05);
    }

.notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: #dc3545;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 50px;
    min-width: 20px;
    text-align: center;
    display: none;
}

.notification-dropdown {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 360px;
    max-height: 420px;
    display: none;
    background: var(--color-card-bg, #fff);
    border: 1px solid var(--color-card-border, #e0e0e0);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    overflow: hidden;
}

.notification-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-card-border, #e0e0e0);
    font-weight: 600;
    color: var(--color-header, #333);
}

.mark-all-read-btn {
    background: transparent;
    border: 1px solid var(--color-card-border, #ddd);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    color: var(--color-link, #666);
    cursor: pointer;
}

    .mark-all-read-btn:hover {
        background: var(--color-background, #f0f0f0);
    }

.notification-dropdown-body {
    max-height: 320px;
    overflow-y: auto;
}

.notification-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

    .notification-list li {
        padding: 12px 16px;
        border-bottom: 1px solid var(--color-card-border, #f0f0f0);
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 8px;
    }

        .notification-list li:last-child {
            border-bottom: none;
        }

    .notification-list .no-notifications {
        text-align: center;
        color: var(--color-link, #999);
        padding: 20px;
        justify-content: center;
    }

    .notification-list .notification-content {
        flex: 1;
    }

    .notification-list .notification-title {
        font-weight: 600;
        color: var(--color-header, #333);
    }

    .notification-list .notification-message {
        font-size: 13px;
        color: var(--color-link, #555);
    }

    .notification-list .notification-date {
        font-size: 11px;
        color: var(--color-link, #999);
    }

    .notification-list .mark-read-btn {
        background: transparent;
        border: 1px solid var(--color-submit-btn-bg, #0d6efd);
        border-radius: 20px;
        padding: 2px 12px;
        font-size: 12px;
        color: var(--color-submit-btn-bg, #0d6efd);
        cursor: pointer;
        white-space: nowrap;
    }

        .notification-list .mark-read-btn:hover {
            background: var(--color-submit-btn-bg, #0d6efd);
            color: #fff;
        }

.toast-notification {
    position: fixed;
    bottom: 90px;
    right: 24px;
    background: var(--color-card-bg, #fff);
    border-left: 4px solid var(--color-submit-btn-bg, #0d6efd);
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    max-width: 340px;
    z-index: 10000;
    animation: slideIn 0.3s ease;
    transition: opacity 0.3s, transform 0.3s;
}

    .toast-notification h6 {
        margin: 0 0 4px 0;
        font-weight: 600;
        color: var(--color-header, #333);
    }

    .toast-notification p {
        margin: 0;
        font-size: 14px;
        color: var(--color-link, #555);
    }

/* ===== ВАШИ ОРИГИНАЛЬНЫЕ АНИМАЦИИ И РИПЛЫ (Полностью сохранены) ===== */
@keyframes bellRingPulse {
    0% {
        transform: rotate(0deg) scale(1);
    }

    10% {
        transform: rotate(15deg) scale(1.1);
    }

    20% {
        transform: rotate(-15deg) scale(1.15);
    }

    30% {
        transform: rotate(10deg) scale(1.1);
    }

    40% {
        transform: rotate(-10deg) scale(1.15);
    }

    50% {
        transform: rotate(5deg) scale(1.1);
    }

    60% {
        transform: rotate(-5deg) scale(1.15);
    }

    70% {
        transform: rotate(2deg) scale(1.1);
    }

    80% {
        transform: rotate(-2deg) scale(1.05);
    }

    90% {
        transform: rotate(1deg) scale(1);
    }

    100% {
        transform: rotate(0deg) scale(1);
    }
}

@keyframes rippleAnim {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }

    100% {
        transform: scale(2.8);
        opacity: 0;
    }
}

.notification-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 56px;
    height: 56px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: -1;
}

    .notification-ripple span {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 50%;
        border: 3px solid var(--alarm-badge-border, #ff4d4f); /* Цвет теперь адаптивен */
        opacity: 0;
        box-sizing: border-box;
    }

/* ===== ЛОГИКА ТЕМ И ИНТЕРВАЛЬНОЙ ПУЛЬСАЦИИ (Новое дополнение) ===== */

/* 1. Настройка адаптивных переменных */
:root {
    --alarm-badge-bg: #e53e3e; /* Спокойный красный для светлой темы */
    --alarm-badge-text: #ffffff; /* Белый текст цифр */
    --alarm-badge-border: #ff4d4f; /* Оригинальный цвет ваших кругов */
    --alarm-glow: rgba(229, 62, 62, 0.45);
}

@media (prefers-color-scheme: dark) {
    :root {
        --alarm-badge-bg: #fc8181; /* Мягкий пастельный красный для темной темы */
        --alarm-badge-text: #1a202c; /* Темный текст для читаемости */
        --alarm-badge-border: #fc8181;
        --alarm-glow: rgba(252, 129, 129, 0.45);
    }
}

/* Если темная тема на сайте управляется классами на body */
body.dark-theme, body.dark, [data-theme="dark"], [data-bs-theme="dark"] {
    --alarm-badge-bg: #fc8181;
    --alarm-badge-text: #1a202c;
    --alarm-badge-border: #fc8181;
    --alarm-glow: rgba(252, 129, 129, 0.45);
}

/* 2. Активация эффектов СТРОГО во время звонка (первые 10 секунд периода в 30 секунд) */

/* Запускаем анимацию покачивания иконки внутри кнопки (цвет иконки НЕ меняется!) */
.notification-toggle.pulse-active i {
    animation: bellRingPulse 1.5s ease-in-out infinite !important;
    display: inline-block;
}

/* Запускаем ваши расходящиеся круги (риплы) только в этот интервал */
.notification-toggle.pulse-active ~ .notification-ripple span {
    animation: rippleAnim 2.5s ease-out infinite !important;
}

    .notification-toggle.pulse-active ~ .notification-ripple span:nth-child(2) {
        animation-delay: 0.8s !important;
    }

    .notification-toggle.pulse-active ~ .notification-ripple span:nth-child(3) {
        animation-delay: 1.6s !important;
    }

/* Плавно красим и подсвечиваем бейдж (счетчик) */
.notification-toggle.pulse-active .notification-badge {
    background-color: var(--alarm-badge-bg) !important;
    color: var(--alarm-badge-text) !important;
    transition: background-color 0.4s ease, color 0.4s ease;
    animation: badge-glow 1.5s ease-in-out infinite alternate;
}

/* 3. Состояние «ПАУЗЫ» будильника (оставшиеся 20 секунд периода, когда звук затих) */
.notification-toggle.bell-alarm:not(.pulse-active) .notification-badge {
    transition: background-color 0.6s ease, color 0.6s ease, box-shadow 0.6s ease;
    background-color: #dc3545 !important; /* Стандартный статический красный */
    color: #fff !important;
    box-shadow: none;
}

/* Полностью глушим анимацию иконки и кругов, когда 10 секунд активности прошли */
.notification-toggle.bell-alarm:not(.pulse-active) i,
.notification-toggle.bell-alarm:not(.pulse-active) ~ .notification-ripple span {
    animation: none !important;
}

/* Обычное дефолтное состояние, когда на кнопке остался просто класс bell-ring, но будильник молчит */
.notification-toggle.bell-ring:not(.bell-alarm) i {
    animation: none; /* Отключаем постоянное вращение, так как теперь управляем им интервально */
}

/* Мягкая пульсация свечения счетчика */
@keyframes badge-glow {
    0% {
        box-shadow: 0 0 0 0 var(--alarm-glow);
    }

    100% {
        box-shadow: 0 0 10px 4px var(--alarm-glow);
    }
}
