/* ===== УНИВЕРСАЛЬНАЯ СИСТЕМА УВЕДОМЛЕНИЙ ===== */

/* Основные переменные для уведомлений */
:root {
    --toast-success: #28a745;
    --toast-success-light: #20c997;
    --toast-error: #dc3545;
    --toast-error-light: #c82333;
    --toast-warning: #ffc107;
    --toast-warning-light: #e0a800;
    --toast-info: #17a2b8;
    --toast-info-light: #138496;
    
    --toast-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 8px 20px rgba(0, 0, 0, 0.1);
    --toast-border-radius: 1rem;
    --toast-transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Контейнер для всех уведомлений */
.toasts-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 1rem;
    pointer-events: none;
}

/* Основной контейнер уведомления */
.universal-toast {
    position: relative;
    border-radius: var(--toast-border-radius);
    box-shadow: var(--toast-shadow);
    transform: translateX(100%);
    opacity: 0;
    transition: var(--toast-transition);
    max-width: 450px;
    min-width: 320px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    overflow: hidden;
    pointer-events: all;
}

.universal-toast.show {
    transform: translateX(0);
    opacity: 1;
}

/* Контент уведомления */
.universal-toast-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    position: relative;
}

/* Иконка уведомления */
.universal-toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
}

/* Текст уведомления */
.universal-toast-text {
    flex: 1;
    font-weight: 500;
    font-size: 0.9375rem;
    line-height: 1.5;
    word-wrap: break-word;
    word-break: break-word;
    margin-right: 0.5rem;
}

/* Кнопка закрытия */
.universal-toast-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.8;
}

.universal-toast-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* ===== ТИПЫ УВЕДОМЛЕНИЙ ===== */

/* Успех */
.universal-toast.success {
    background: linear-gradient(135deg, var(--toast-success) 0%, var(--toast-success-light) 100%);
    color: white;
}

.universal-toast.success .universal-toast-icon {
    background: rgba(255, 255, 255, 0.2);
}

/* Ошибка */
.universal-toast.error {
    background: linear-gradient(135deg, var(--toast-error) 0%, var(--toast-error-light) 100%);
    color: white;
}

.universal-toast.error .universal-toast-icon {
    background: rgba(255, 255, 255, 0.2);
}

/* Предупреждение */
.universal-toast.warning {
    background: linear-gradient(135deg, var(--toast-warning) 0%, var(--toast-warning-light) 100%);
    color: #212529;
}

.universal-toast.warning .universal-toast-icon {
    background: rgba(33, 37, 41, 0.15);
}

.universal-toast.warning .universal-toast-close {
    background: rgba(33, 37, 41, 0.1);
}

.universal-toast.warning .universal-toast-close:hover {
    background: rgba(33, 37, 41, 0.2);
}

/* Информация */
.universal-toast.info {
    background: linear-gradient(135deg, var(--toast-info) 0%, var(--toast-info-light) 100%);
    color: white;
}

.universal-toast.info .universal-toast-icon {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    .toasts-container {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        gap: 0.75rem;
    }
    
    .universal-toast {
        max-width: none;
        min-width: auto;
        transform: translateY(-100%);
        border-radius: 0.75rem;
    }
    
    .universal-toast.show {
        transform: translateY(0);
    }
    
    .universal-toast-content {
        padding: 1rem 1.25rem;
        gap: 0.875rem;
    }
    
    .universal-toast-icon {
        width: 2rem;
        height: 2rem;
        font-size: 1.25rem;
    }
    
    .universal-toast-text {
        font-size: 0.875rem;
        margin-right: 0.25rem;
    }
    
    .universal-toast-close {
        width: 1.75rem;
        height: 1.75rem;
        padding: 0.375rem;
        font-size: 0.75rem;
    }
}

/* ===== АНИМАЦИЯ ИСЧЕЗНОВЕНИЯ ===== */
.universal-toast.fade-out {
    opacity: 0;
    transform: translateX(100%);
}

@media (max-width: 768px) {
    .universal-toast.fade-out {
        transform: translateY(-100%);
    }
}

/* ===== BOOTSTRAP АЛЕРТЫ ===== */
.toasts-container .alert {
    border: none !important;
    border-radius: 12px !important;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    font-weight: 500;
    padding: 16px 20px;
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
    animation: slideInRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: 'Inter', sans-serif;
    border-left: 4px solid transparent !important;
    pointer-events: all;
}

.toasts-container .alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #00d4ff, #0066ff);
    animation: progressBar var(--toast-duration, 5s) linear;
}

.toasts-container .alert-success {
    background: linear-gradient(135deg, 
        rgba(34, 197, 94, 0.95), 
        rgba(21, 128, 61, 0.95)) !important;
    color: #fff !important;
    border-left-color: #22c55e !important;
}

.toasts-container .alert-success::before {
    background: linear-gradient(90deg, #10b981, #22c55e);
}

.toasts-container .alert-danger {
    background: linear-gradient(135deg, 
        rgba(239, 68, 68, 0.95), 
        rgba(185, 28, 28, 0.95)) !important;
    color: #fff !important;
    border-left-color: #ef4444 !important;
}

.toasts-container .alert-danger::before {
    background: linear-gradient(90deg, #f87171, #ef4444);
}

.toasts-container .alert-info {
    background: linear-gradient(135deg, 
        rgba(59, 130, 246, 0.95), 
        rgba(29, 78, 216, 0.95)) !important;
    color: #fff !important;
    border-left-color: #3b82f6 !important;
}

.toasts-container .alert-info::before {
    background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

.toasts-container .alert-warning {
    background: linear-gradient(135deg, 
        rgba(245, 158, 11, 0.95), 
        rgba(217, 119, 6, 0.95)) !important;
    color: #000 !important;
    border-left-color: #f59e0b !important;
}

.toasts-container .alert-warning::before {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.toasts-container .alert .d-flex {
    align-items: center;
    gap: 10px;
}

.toasts-container .alert i {
    font-size: 1.25em;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    flex-shrink: 0;
}

.toasts-container .alert span {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.4;
}

.toasts-container .alert .btn-close {
    background: none !important;
    color: inherit !important;
    opacity: 0.8 !important;
    font-size: 1.1em !important;
    padding: 4px !important;
    margin: 0 !important;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.toasts-container .alert .btn-close:hover {
    opacity: 1 !important;
    transform: scale(1.1);
}

.toasts-container .alert .btn-close:focus {
    box-shadow: none !important;
}

/* Анимации для Bootstrap алертов */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

.toasts-container .alert.fade-out {
    animation: toastFadeOut 0.3s ease-out forwards;
}

/* Адаптивность Bootstrap алертов для мобильных */
@media (max-width: 768px) {
    .toasts-container .alert {
        min-width: 280px !important;
        max-width: calc(100vw - 20px) !important;
        font-size: 0.9rem;
        padding: 14px 16px;
    }
    
    .toasts-container .alert span {
        font-size: 0.9rem;
    }
    
    .toasts-container .alert i {
        font-size: 1.1em;
    }
}