/**
 * TOCHKA Notifications System v18.7
 * Style: Atmos Dark (Glassmorphism + iOS Transitions)
 * Путь: css/notifications.css
 * Исправлено: Центрирование сверху, маппинг типов (info/success), z-index, индикация прогресса.
 * Совместимость: v4.8.7 JS Controller [2026-05-11]
 */

:root {
    --notif-bg: rgba(28, 28, 30, 0.85);
    --notif-border: rgba(255, 255, 255, 0.1);
    --notif-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    --accent-blue: #0a84ff;
    --accent-green: #30d158;
    --accent-red: #ff453a;
    --accent-orange: #ff9f0a;
    --text-main: #ffffff;
    --text-dim: #8e8e93;
}

/* ==========================================================================
   0. ПОДАВЛЕНИЕ СТАРЫХ УВЕДОМЛЕНИЙ (Удаление "синей полосы" и "облачка")
   ========================================================================== */
.toast-container, 
.old-notification-bar, 
.blue-notification-line, 
.jq-toast-wrap {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* ==========================================================================
   1. КОНТЕЙНЕР — ЦЕНТРИРОВАНИЕ И ПРИОРИТЕТ
   ========================================================================== */
#dt-notifications-container {
    position: fixed;
    /* Учитываем челку iPhone и добавляем отступ */
    top: calc(20px + env(safe-area-inset-top, 0px)); 
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 400px;
    /* Абсолютный приоритет над всем UI */
    z-index: 2147483647 !important; 
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

#dt-notifications-container:empty {
    display: none;
}

/* 2. БАЗОВЫЙ СТИЛЬ УВЕДОМЛЕНИЯ (Toast) */
.dt-toast {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    padding: 14px 18px;
    background: var(--notif-bg);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid var(--notif-border);
    border-radius: 24px;
    box-shadow: var(--notif-shadow);
    pointer-events: auto;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    
    /* Анимация появления iOS Style */
    animation: toast-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: transform 0.2s ease, opacity 0.2s ease;
    position: relative;
    overflow: hidden;
}

/* Эффект нажатия */
.dt-toast:active {
    transform: scale(0.94);
    background: rgba(44, 44, 46, 0.95);
}

.dt-toast.toast-out {
    animation: toast-out 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 3. ИКОНКИ И КОНТЕНТ */
.dt-toast-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    margin-right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
}

.dt-toast-content {
    flex-grow: 1;
    overflow: hidden;
    padding-right: 10px;
}

.dt-toast-title {
    display: block;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-main);
    margin-bottom: 2px;
    letter-spacing: -0.2px;
}

.dt-toast-msg {
    display: block;
    font-size: 13px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* 4. ЦВЕТОВЫЕ СХЕМЫ (СИНХРОНИЗАЦИЯ С JS) */
.dt-toast-chat { color: var(--accent-blue); }
.dt-toast-chat .dt-toast-icon { background: rgba(10, 132, 255, 0.15); }

.dt-toast-system { color: var(--accent-green); }
.dt-toast-system .dt-toast-icon { background: rgba(48, 209, 88, 0.15); }

.dt-toast-warning { color: var(--accent-red); }
.dt-toast-warning .dt-toast-icon { background: rgba(255, 69, 58, 0.15); }

.dt-toast-info, .dt-toast-center { color: var(--accent-orange); }
.dt-toast-info .dt-toast-icon, .dt-toast-center .dt-toast-icon { background: rgba(255, 159, 10, 0.15); }

/* 5. ТАЙМЕР (ПРОГРЕСС-БАР) */
.dt-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

.dt-toast-progress::after {
    content: '';
    display: block;
    height: 100%;
    width: 100%;
    background: currentColor; /* Цвет берется из color схемы типа */
    opacity: 0.6;
    animation: toast-timer 5s linear forwards;
}

/* 6. АНИМАЦИИ */
@keyframes toast-timer {
    from { width: 100%; }
    to { width: 0%; }
}

@keyframes toast-in {
    0% { 
        opacity: 0; 
        transform: translateY(-120%) scale(0.9); 
    }
    100% { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

@keyframes toast-out {
    0% { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
    100% { 
        opacity: 0; 
        transform: translateY(-40px) scale(0.9); 
    }
}

/* 7. BADGES (БАДЖИ) */
.chat-badge-count, .dt-badge-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--accent-red);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 10px;
    display: none; 
    align-items: center;
    justify-content: center;
    border: 2px solid #1c1c1e; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 5;
}

@media (prefers-contrast: high) {
    .dt-toast {
        background: rgb(28, 28, 30);
        border: 2px solid #ffffff;
    }
}