/**
 * Современная система Toast-уведомлений
 * Стили для новой реализации
 */

/* ============================================
   Контейнер
   ============================================ */

.toast-container {
    /* Фиксированное позиционирование */
    position: fixed !important;
    top: 100px !important;
    right: 20px !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 999999 !important;
    
    /* Flexbox для вертикального расположения */
    display: flex;
    flex-direction: column;
    gap: 12px;
    
    /* Размеры */
    width: 400px;
    max-width: calc(100vw - 40px);
    
    /* Важно: не влияет на layout */
    pointer-events: none;
    
    /* Ограничение по высоте */
    max-height: calc(100vh - 120px);
    overflow: visible;
    
    /* Убираем любые трансформации и сдвиги */
    transform: none !important;
    margin: 0 !important;
    padding: 0 !important;
    
    /* Фиксируем позицию относительно viewport */
    box-sizing: border-box;
}

/* ============================================
   Уведомление
   ============================================ */

.toast {
    /* Layout */
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    
    /* Стили */
    background: rgba(15, 20, 30, 0.96);
    border: 1px solid rgba(73, 86, 123, 0.3);
    border-radius: 12px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    
    /* Backdrop blur */
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    
    /* Интерактивность */
    pointer-events: all;
    cursor: pointer;
    
    /* Фиксация размеров */
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    
    /* Анимация */
    opacity: 0;
    transform: translateX(100%) scale(0.9);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Состояние: видимое */
.toast--visible {
    opacity: 1;
    transform: translateX(0) scale(1);
}

/* Состояние: скрывается */
.toast--hiding {
    opacity: 0;
    transform: translateX(100%) scale(0.9);
    transition: all 0.3s cubic-bezier(0.4, 0, 1, 1);
}

/* ============================================
   Иконка
   ============================================ */

.toast__icon {
    /* Размеры */
    width: 36px;
    height: 36px;
    min-width: 36px;
    
    /* Центрирование */
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Стили */
    border-radius: 50%;
    
    /* Анимация */
    position: relative;
}

.toast__icon svg {
    width: 20px;
    height: 20px;
    color: currentColor;
}

/* Пульсация иконки */
.toast__icon::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0;
    animation: toast-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes toast-pulse {
    0%, 100% {
        opacity: 0;
        transform: scale(1);
    }
    50% {
        opacity: 0.15;
        transform: scale(1.3);
    }
}

/* Спиннер для loading */
.toast__spinner {
    animation: toast-spin 1s linear infinite;
}

@keyframes toast-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Контент
   ============================================ */

.toast__content {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.toast__title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--color-text-primary, #e8eaf0);
    margin-bottom: 4px;
}

.toast__message {
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text-secondary, #a0a8b8);
    word-wrap: break-word;
}

/* ============================================
   Кнопка закрытия
   ============================================ */

.toast__close {
    /* Размеры */
    width: 28px;
    height: 28px;
    min-width: 28px;
    padding: 0;
    
    /* Стили */
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 6px;
    
    /* Текст */
    font-size: 20px;
    line-height: 1;
    color: var(--color-text-secondary, #a0a8b8);
    
    /* Центрирование */
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Интерактивность */
    cursor: pointer;
    transition: all 0.2s ease;
}

.toast__close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text-primary, #e8eaf0);
    transform: scale(1.1);
}

.toast__close:active {
    transform: scale(0.95);
}

/* ============================================
   Прогресс-бар
   ============================================ */

.toast__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}

.toast__progress-bar {
    height: 100%;
    background: currentColor;
    transform-origin: left;
    transform: scaleX(1);
    transition: transform linear;
}

/* ============================================
   Типы уведомлений
   ============================================ */

/* Success */
.toast--success {
    border-color: rgba(16, 185, 129, 0.3);
}

.toast--success .toast__icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.toast--success .toast__progress-bar {
    background: #10b981;
}

/* Error */
.toast--error {
    border-color: rgba(239, 68, 68, 0.3);
}

.toast--error .toast__icon {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

.toast--error .toast__progress-bar {
    background: #ef4444;
}

/* Warning */
.toast--warning {
    border-color: rgba(245, 158, 11, 0.3);
}

.toast--warning .toast__icon {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

.toast--warning .toast__progress-bar {
    background: #f59e0b;
}

/* Info */
.toast--info {
    border-color: rgba(59, 130, 246, 0.3);
}

.toast--info .toast__icon {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}

.toast--info .toast__progress-bar {
    background: #3b82f6;
}

/* Loading */
.toast--loading {
    border-color: rgba(139, 92, 246, 0.3);
}

.toast--loading .toast__icon {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

/* ============================================
   Адаптивность
   ============================================ */

@media (max-width: 768px) {
    .toast-container {
        top: 80px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto;
        max-width: none;
        transform: none !important;
    }
    
    .toast {
        padding: 14px 16px;
        gap: 10px;
    }
    
    .toast__icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }
    
    .toast__icon svg {
        width: 18px;
        height: 18px;
    }
    
    .toast__title {
        font-size: 14px;
    }
    
    .toast__message {
        font-size: 13px;
    }
    
    .toast__close {
        width: 24px;
        height: 24px;
        min-width: 24px;
        font-size: 18px;
    }
}

/* ============================================
   Светлая тема (опционально)
   ============================================ */

@media (prefers-color-scheme: light) {
    .toast {
        background: rgba(255, 255, 255, 0.96);
        border-color: rgba(0, 0, 0, 0.1);
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.12),
            0 2px 8px rgba(0, 0, 0, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
    
    .toast__title {
        color: #1a1a1a;
    }
    
    .toast__message {
        color: #666666;
    }
    
    .toast__close {
        background: rgba(0, 0, 0, 0.05);
        color: #666666;
    }
    
    .toast__close:hover {
        background: rgba(0, 0, 0, 0.1);
        color: #1a1a1a;
    }
    
    .toast__progress {
        background: rgba(0, 0, 0, 0.05);
    }
}

/* ============================================
   Accessibility
   ============================================ */

/* Уменьшение движения для пользователей с настройками accessibility */
@media (prefers-reduced-motion: reduce) {
    .toast {
        transition: opacity 0.2s ease;
        transform: none !important;
    }
    
    .toast__icon::before {
        animation: none;
    }
    
    .toast__spinner {
        animation: none;
    }
}

/* Фокус для клавиатурной навигации */
.toast:focus-visible {
    outline: 2px solid var(--color-primary, #21f0a2);
    outline-offset: 2px;
}

.toast__close:focus-visible {
    outline: 2px solid var(--color-primary, #21f0a2);
    outline-offset: 2px;
}

