/**
 * Toast Notifications CSS
 * Sistema moderno de notificaciones toast
 * Compatible con Tailwind CSS y modo oscuro
 */

/* Contenedor base para toasts */
#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

/* Estilos base del toast */
.toast {
    min-width: 300px;
    max-width: 400px;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.1), 
        0 4px 10px rgba(0, 0, 0, 0.05),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

/* Estados del toast */
.toast.show {
    transform: translateX(0);
    opacity: 1;
}

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

/* Variantes de color */
.toast.toast-success {
    background: linear-gradient(135deg, 
        rgba(34, 197, 94, 0.95) 0%, 
        rgba(22, 163, 74, 0.95) 100%);
    border-left: 4px solid rgba(34, 197, 94, 1);
}

.toast.toast-error {
    background: linear-gradient(135deg, 
        rgba(239, 68, 68, 0.95) 0%, 
        rgba(220, 38, 38, 0.95) 100%);
    border-left: 4px solid rgba(239, 68, 68, 1);
}

.toast.toast-warning {
    background: linear-gradient(135deg, 
        rgba(245, 158, 11, 0.95) 0%, 
        rgba(217, 119, 6, 0.95) 100%);
    border-left: 4px solid rgba(245, 158, 11, 1);
}

.toast.toast-info {
    background: linear-gradient(135deg, 
        rgba(59, 130, 246, 0.95) 0%, 
        rgba(37, 99, 235, 0.95) 100%);
    border-left: 4px solid rgba(59, 130, 246, 1);
}

/* Barra de progreso */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0 0 12px 12px;
    animation: toast-progress 5s linear forwards;
}

@keyframes toast-progress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Efectos hover */
.toast:hover .toast-progress {
    animation-play-state: paused;
}

.toast:hover {
    transform: translateX(-8px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15), 
        0 8px 16px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Botón de cerrar */
.toast button {
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 2px;
}

.toast button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.toast button:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Animaciones de entrada personalizadas */
@keyframes toast-slide-in {
    from {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes toast-slide-out {
    from {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }
}

/* Responsividad móvil */
@media (max-width: 640px) {
    #toast-container {
        right: 0;
        left: 0;
        top: 1rem;
        padding: 0 1rem;
        align-items: center;
    }
    
    .toast {
        min-width: 280px;
        max-width: calc(100vw - 2rem);
        transform: translateY(-100%);
    }
    
    .toast.show {
        transform: translateY(0);
    }
    
    .toast.hide {
        transform: translateY(-100%);
    }
    
    .toast:hover {
        transform: translateY(-4px) scale(1.02);
    }
}

/* Modo oscuro */
@media (prefers-color-scheme: dark) {
    .toast {
        box-shadow: 
            0 10px 25px rgba(0, 0, 0, 0.3), 
            0 4px 10px rgba(0, 0, 0, 0.2),
            0 0 0 1px rgba(255, 255, 255, 0.1);
    }
    
    .toast:hover {
        box-shadow: 
            0 20px 40px rgba(0, 0, 0, 0.4), 
            0 8px 16px rgba(0, 0, 0, 0.3),
            0 0 0 1px rgba(255, 255, 255, 0.15);
    }
}

/* Variantes especiales */
.toast.toast-compact {
    min-width: 200px;
    padding: 12px 16px;
}

.toast.toast-large {
    min-width: 400px;
    max-width: 500px;
    padding: 20px 24px;
}

/* Animación de pulsación para toasts importantes */
.toast.toast-pulse {
    animation: toast-pulse 2s infinite;
}

@keyframes toast-pulse {
    0%, 100% {
        box-shadow: 
            0 10px 25px rgba(0, 0, 0, 0.1), 
            0 4px 10px rgba(0, 0, 0, 0.05),
            0 0 0 1px rgba(255, 255, 255, 0.05);
    }
    50% {
        box-shadow: 
            0 15px 35px rgba(0, 0, 0, 0.15), 
            0 6px 15px rgba(0, 0, 0, 0.1),
            0 0 0 1px rgba(255, 255, 255, 0.1);
    }
}

/* Accesibilidad */
.toast:focus-within {
    outline: 2px solid rgba(59, 130, 246, 0.5);
    outline-offset: 2px;
}

/* Reducir animaciones para usuarios que prefieren menos movimiento */
@media (prefers-reduced-motion: reduce) {
    .toast {
        transition: opacity 0.2s ease;
    }
    
    .toast-progress {
        animation: none;
    }
    
    .toast:hover {
        transform: none;
    }
    
    .toast.toast-pulse {
        animation: none;
    }
}

/* Utilidades adicionales */
.toast-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.toast-icon {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
}

.toast-message {
    flex: 1;
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: white;
}

.toast-close {
    flex-shrink: 0;
    color: white;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.toast-close:hover {
    opacity: 1;
}