/**
 * Единые стили Toast уведомлений для всего проекта
 * Этап 5: Toast Notifications
 * 
 * Замена alert() на красивые toast уведомления
 * Типы: success, warning, error, info
 */

/* ==================== КОНТЕЙНЕР ДЛЯ TOAST ==================== */

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    pointer-events: none;
}

/* ==================== БАЗОВЫЙ СТИЛЬ TOAST ==================== */

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 300px;
    max-width: 400px;
    pointer-events: none;
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

/* ==================== АНИМАЦИИ ==================== */

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.slide-out {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== ТИПЫ TOAST ==================== */

.toast-success {
    background: linear-gradient(135deg, 
        rgba(16, 185, 129, 0.95) 0%, 
        rgba(5, 150, 105, 0.95) 100%
    );
    color: white;
}

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

.toast-error {
    background: linear-gradient(135deg, 
        rgba(239, 68, 68, 0.95) 0%, 
        rgba(220, 38, 38, 0.95) 100%
    );
    color: white;
}

.toast-error::before {
    background: #ef4444;
}

.toast-warning {
    background: linear-gradient(135deg, 
        rgba(245, 158, 11, 0.95) 0%, 
        rgba(217, 119, 6, 0.95) 100%
    );
    color: white;
}

.toast-warning::before {
    background: #f59e0b;
}

.toast-info {
    background: linear-gradient(135deg, 
        rgba(59, 130, 246, 0.95) 0%, 
        rgba(37, 99, 235, 0.95) 100%
    );
    color: white;
}

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

/* ==================== ИКОНКИ ==================== */

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.toast-success .toast-icon {
    color: white;
}

.toast-error .toast-icon {
    color: white;
}

.toast-warning .toast-icon {
    color: white;
}

.toast-info .toast-icon {
    color: white;
}

/* ==================== СОДЕРЖИМОЕ ==================== */

.toast-content {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.5;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.toast-message {
    opacity: 0.95;
}

/* ==================== КНОПКА ЗАКРЫТИЯ ==================== */

.toast-close {
    pointer-events: auto;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.toast-close:active {
    transform: scale(0.9);
}

/* ==================== ПРОГРЕСС БАР (ОПЦИОНАЛЬНО) ==================== */

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    animation: toastProgress linear;
}

@keyframes toastProgress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* ==================== АДАПТИВНОСТЬ ==================== */

@media (max-width: 768px) {
    #toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
        width: 100%;
    }
}
