/**
 * Toast Notifications - GeneralMS
 * Design moderne, minimaliste et elegant avec animations fluides
 */

/* Container des toasts */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    pointer-events: none;
}

/* Toast de base */
.toast {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 22px;
    background: #ffffff;
    border-radius: 14px;
    border-left: 4px solid;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.21, 1.02, 0.73, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1),
                0 2px 10px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

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

.toast:hover {
    transform: translateX(-5px) scale(1.01);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.12),
                0 5px 15px rgba(0, 0, 0, 0.08);
}

.toast.hide {
    opacity: 0;
    transform: translateX(100%);
}

/* Icone du toast */
.toast-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: iconPop 0.4s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
}

@keyframes iconPop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.toast-icon svg {
    width: 18px;
    height: 18px;
}

/* Contenu */
.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.toast-message {
    font-size: 13px;
    color: #64748b;
    margin: 0;
    line-height: 1.4;
    word-wrap: break-word;
}

/* Bouton fermer */
.toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #94a3b8;
    transition: all 0.2s ease;
}

.toast-close:hover {
    background: #f1f5f9;
    color: #475569;
}

.toast-close svg {
    width: 14px;
    height: 14px;
}

/* Barre de progression */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 4px;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0 0 12px 0;
    overflow: hidden;
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    transform-origin: left;
    animation: toast-progress 5s linear forwards;
}

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

/* === VARIANTES === */

/* Success */
.toast-success {
    border-left-color: #10b981;
}

.toast-success .toast-icon {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #059669;
}

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

/* Error */
.toast-error {
    border-left-color: #ef4444;
}

.toast-error .toast-icon {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

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

/* Warning */
.toast-warning {
    border-left-color: #f59e0b;
}

.toast-warning .toast-icon {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
}

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

/* Info */
.toast-info {
    border-left-color: #3b82f6;
}

.toast-info .toast-icon {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #4f46e5;
}

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

/* Loading */
.toast-loading {
    border-left-color: #8b5cf6;
}

.toast-loading .toast-icon {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    color: #7c3aed;
}

.toast-loading .toast-icon svg {
    animation: spin 1s linear infinite;
}

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

/* === RESPONSIVE === */
@media (max-width: 480px) {
    .toast-container {
        top: auto;
        bottom: 20px;
        left: 16px;
        right: 16px;
        max-width: none;
    }
    
    .toast {
        transform: translateY(100%);
    }
    
    .toast.show {
        transform: translateY(0);
    }
    
    .toast.hide {
        transform: translateY(100%);
    }
}

/* === DARK MODE === */
[data-theme-mode="dark"] .toast {
    background: #1e293b;
}

[data-theme-mode="dark"] .toast-title {
    color: #f1f5f9;
}

[data-theme-mode="dark"] .toast-message {
    color: #94a3b8;
}

[data-theme-mode="dark"] .toast-close:hover {
    background: #334155;
    color: #e2e8f0;
}

[data-theme-mode="dark"] .toast-success .toast-icon {
    background: rgba(16, 185, 129, 0.15);
}

[data-theme-mode="dark"] .toast-error .toast-icon {
    background: rgba(239, 68, 68, 0.15);
}

[data-theme-mode="dark"] .toast-warning .toast-icon {
    background: rgba(245, 158, 11, 0.15);
}

[data-theme-mode="dark"] .toast-info .toast-icon {
    background: rgba(59, 130, 246, 0.15);
}

[data-theme-mode="dark"] .toast-loading .toast-icon {
    background: rgba(139, 92, 246, 0.15);
}
