/**
 * Toast Notifications - AMAIDI Groupe
 * Design moderne, minimaliste et élégant
 */

/* 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: 12px;
    padding: 16px 20px;
    background: #ffffff;
    border-radius: 12px;
    border-left: 4px solid;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.hide {
    opacity: 0;
    transform: translateX(100%);
}

/* Icône du toast */
.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-icon svg {
    width: 14px;
    height: 14px;
}

/* 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: #ecfdf5;
    color: #10b981;
}

.toast-success .toast-progress-bar {
    background: #10b981;
}

/* Error */
.toast-error {
    border-left-color: #ef4444;
}

.toast-error .toast-icon {
    background: #fef2f2;
    color: #ef4444;
}

.toast-error .toast-progress-bar {
    background: #ef4444;
}

/* Warning */
.toast-warning {
    border-left-color: #f59e0b;
}

.toast-warning .toast-icon {
    background: #fffbeb;
    color: #f59e0b;
}

.toast-warning .toast-progress-bar {
    background: #f59e0b;
}

/* Info */
.toast-info {
    border-left-color: #3b82f6;
}

.toast-info .toast-icon {
    background: #eff6ff;
    color: #3b82f6;
}

.toast-info .toast-progress-bar {
    background: #3b82f6;
}

/* Loading */
.toast-loading {
    border-left-color: #8b5cf6;
}

.toast-loading .toast-icon {
    background: #f5f3ff;
    color: #8b5cf6;
}

.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);
}
