/**
 * Стили для системы уведомлений
 * Соответствуют дизайн-системе сайта
 */

/* Контейнер для уведомлений NotificationSystem (низ экрана) */
.notification-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 350px;
    width: auto;
}

/* Базовые стили уведомления */
.notification {
    background: var(--color-white-text);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-left: 4px solid var(--red-background);
    overflow: hidden;
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    position: relative;
    min-height: 60px;
    max-width: 100%;
    margin: 0 20px;
}

/* Анимация появления */
.notification-show {
    transform: translateY(0);
    opacity: 1;
}

/* Анимация скрытия */
.notification-hide {
    transform: translateY(100%);
    opacity: 0;
    margin-bottom: -70px;
}

/* Содержимое уведомления */
.notification-content {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 12px;
    position: relative;
}

/* Иконка уведомления */
.notification-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'GilroyS';
    font-size: var(--font-size-l);
    font-weight: 600;
    color: var(--color-white-text);
    background: var(--red-background);
    flex-shrink: 0;
}

/* Текст сообщения */
.notification-message {
    flex: 1;
    font-family: 'GilroyR';
    font-size: var(--font-size-m);
    line-height: 1.4;
    color: var(--background-black);
    word-wrap: break-word;
}

/* Заголовок уведомления */
.notification-text-block {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.notification-title {
    font-family: 'GilroyM';
    font-size: var(--font-size-m);
    line-height: 1.3;
    color: var(--background-black);
    margin-bottom: 2px;
}

/* Кнопка закрытия */
.notification-close {
    background: none;
    border: none;
    font-size: 18px;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.notification-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--background-black);
}

/* Прогресс-бар */
.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--red-background);
    width: 100%;
    transform-origin: left;
    animation: notification-progress linear forwards;
}

@keyframes notification-progress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

/* Типы уведомлений */
.notification-success {
    border-left-color: var(--red-background);
}

.notification-success .notification-icon {
    background: var(--red-background);
    color: var(--color-white-text);
}

.notification-success .notification-progress {
    background: var(--red-background);
}

.notification-error {
    border-left-color: var(--red-background);
}

.notification-error .notification-icon {
    background: var(--red-background);
    color: var(--color-white-text);
}

.notification-error .notification-progress {
    background: var(--red-background);
}

.notification-warning {
    border-left-color: var(--red-background);
}

.notification-warning .notification-icon {
    background: var(--red-background);
    color: var(--color-white-text);
}

.notification-warning .notification-progress {
    background: var(--red-background);
}

.notification-info {
    border-left-color: var(--red-background);
}

.notification-info .notification-icon {
    background: var(--red-background);
    color: var(--color-white-text);
}

.notification-info .notification-progress {
    background: var(--red-background);
}

/* Уведомление с подтверждением */
.notification-confirm {
    border-left-color: var(--red-background);
}

.notification-confirm .notification-icon {
    background: var(--red-background);
}

.notification-confirm .notification-content {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
}

.notification-confirm .notification-message {
    text-align: center;
    font-family: 'GilroyM';
}

/* Кнопки действий */
.notification-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.notification-btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius);
    font-family: 'GilroyM';
    font-size: var(--font-size-s);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 60px;
}

.notification-btn-confirm {
    background: var(--red-background);
    color: var(--color-white-text);
}

.notification-btn-confirm:hover {
    background: #d21e28;
}

.notification-btn-cancel {
    background: rgba(0, 0, 0, 0.1);
    color: var(--background-black);
}

.notification-btn-cancel:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Адаптивность */
@media (max-width: 768px) {
    .notification-container {
        bottom: 10px !important;
        right: 10px !important;
        max-width: calc(100% - 20px);
        width: auto;
    }
    
    .notification {
        margin: 0 10px;
    }
    
    .notification-content {
        padding: 12px;
    }
    
    .notification-message {
        font-size: var(--font-size-s);
    }
}

@media (max-width: 480px) {
    .notification-container {
        bottom: 10px !important;
        right: 10px !important;
        max-width: calc(100% - 10px);
        width: auto;
    }
    
    .notification {
        margin: 0 5px;
    }
    
    .notification-content {
        padding: 10px;
        gap: 8px;
    }
    
    .notification-icon {
        width: 20px;
        height: 20px;
        font-size: var(--font-size-m);
    }
    
    .notification-close {
        width: 20px;
        height: 20px;
        font-size: 16px;
    }
}

/* Темная тема (если потребуется) */
@media (prefers-color-scheme: dark) {
    /* Фиксированный белый фон для уведомлений, без различий по устройствам */
    .notification {
        background: var(--color-white-text);
        color: var(--background-black);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    .notification-message {
        color: var(--background-black);
    }
    
    .notification-close {
        color: rgba(0, 0, 0, 0.5);
    }
    
    .notification-close:hover {
        background: rgba(0, 0, 0, 0.1);
        color: var(--background-black);
    }
    
    .notification-btn-cancel {
        background: rgba(0, 0, 0, 0.1);
        color: var(--background-black);
    }
    
    .notification-btn-cancel:hover {
        background: rgba(0, 0, 0, 0.2);
    }
}

@keyframes notificationSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Основные стили индикаторов */
.notification-indicator {
    position: absolute;
    width: 12px;
    height: 12px;
    background: linear-gradient(135deg, #ff4444, #cc0000);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 1000;
    animation: notificationPulse 2s infinite;
    transition: all 0.3s ease;
}

.notification-indicator:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Большой индикатор для важных уведомлений */
.notification-indicator.large {
    width: 16px;
    height: 16px;
    top: -8px;
    right: -8px;
}

/* Индикатор с числом */
.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: white;
    border-radius: 9px;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    animation: notificationPulse 2s infinite;
}

/* Контейнер для уведомлений NotificationManager (верх экрана) */
#top-notification-container,
.toast-notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    max-width: 350px;
    pointer-events: none;
}

/* Отдельное уведомление */
.notification-item {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
    overflow: hidden;
    animation: notificationSlideIn 0.3s ease-out;
    pointer-events: auto;
    border-left: 4px solid #007bff;
}

.notification-item.telegram {
    border-left-color: #0088cc;
}

.notification-item.system {
    border-left-color: #28a745;
}

.notification-item.warning {
    border-left-color: #ffc107;
}

.notification-item.error {
    border-left-color: #dc3545;
}

/* Содержимое уведомления */
.notification-content {
    padding: 12px 16px;
    position: relative;
}

.notification-message {
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    margin-bottom: 4px;
    padding-right: 20px;
}

.notification-time {
    font-size: 11px;
    color: #666;
    opacity: 0.8;
}

/* Кнопка закрытия */
.notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    font-size: 16px;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.notification-close:hover {
    background: #f0f0f0;
    color: #333;
}

/* Статус соединения */
#connection-status {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    z-index: 10001;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Адаптивность для мобильных устройств - только для верхних уведомлений */
@media (max-width: 768px) {
    #top-notification-container,
    .toast-notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .notification-item {
        margin-bottom: 8px;
    }
    
    .notification-content {
        padding: 10px 12px;
    }
    
    .notification-message {
        font-size: 13px;
    }
    
    #connection-status {
        bottom: 10px;
        left: 10px;
        font-size: 11px;
        padding: 6px 10px;
    }
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
    /* Фиксированный белый фон для элементов списка уведомлений */
    .notification-item {
        background: var(--color-white-text);
        color: var(--background-black);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    .notification-item .notification-message {
        color: var(--background-black);
    }
    
    .notification-time {
        color: #666;
    }
    
    .notification-close {
        color: rgba(0, 0, 0, 0.5);
    }
    
    .notification-close:hover {
        background: rgba(0, 0, 0, 0.1);
        color: var(--background-black);
    }
}

/* Специальные стили для интеграции с существующими элементами */
.header .notification-indicator,
.navbar .notification-indicator {
    top: -6px;
    right: -6px;
}

.chat-icon {
    position: relative;
}

.profile-icon {
    position: relative;
}

/* Стили для кнопки уведомлений в хедере */
.notification-button {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.notification-button:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.notification-button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Выпадающий список уведомлений */
.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    max-height: 400px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
    overflow: hidden;
    z-index: 10002;
    display: none;
}

.notification-dropdown.show {
    display: block;
    animation: notificationFadeIn 0.2s ease-out;
}

.notification-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-dropdown-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-dropdown-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.notification-dropdown-item:hover {
    background-color: #f8f9fa;
}

.notification-dropdown-item:last-child {
    border-bottom: none;
}

.notification-dropdown-item.unread {
    background-color: #f0f8ff;
    border-left: 3px solid #007bff;
}

.notification-dropdown-empty {
    padding: 24px 16px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* Кнопка "Отметить все как прочитанные" */
.mark-all-read {
    background: none;
    border: none;
    color: #007bff;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
}

.mark-all-read:hover {
    color: #0056b3;
}

/* Кнопка перехода к боту в уведомлениях */
.notification-bot-btn {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.notification-bot-btn:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.notification-bot-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}
