/* ========================================
   🔔 SISTEMA DE NOTIFICACIONES TOAST v4.0
   Feedback visual moderno para el usuario
   ======================================== */

/* === CONTENEDOR DE TOASTS === */
.toast-container {
    position: fixed;
    z-index: var(--z-tooltip, 1070);
    pointer-events: none;
}

/* Posiciones */
.toast-container.top-right {
    top: var(--spacing-lg, 1.5rem);
    right: var(--spacing-lg, 1.5rem);
}

.toast-container.top-left {
    top: var(--spacing-lg, 1.5rem);
    left: var(--spacing-lg, 1.5rem);
}

.toast-container.bottom-right {
    bottom: var(--spacing-lg, 1.5rem);
    right: var(--spacing-lg, 1.5rem);
}

.toast-container.bottom-left {
    bottom: var(--spacing-lg, 1.5rem);
    left: var(--spacing-lg, 1.5rem);
}

.toast-container.top-center {
    top: var(--spacing-lg, 1.5rem);
    left: 50%;
    transform: translateX(-50%);
}

.toast-container.bottom-center {
    bottom: var(--spacing-lg, 1.5rem);
    left: 50%;
    transform: translateX(-50%);
}

/* === TOAST INDIVIDUAL === */
.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm, 0.5rem);
    min-width: 300px;
    max-width: 400px;
    padding: var(--spacing-md, 1rem) var(--spacing-lg, 1.5rem);
    margin-bottom: var(--spacing-sm, 0.5rem);
    background-color: var(--surface-secondary, #2a2a2a);
    border: 1px solid var(--border-primary, #333333);
    border-left: 4px solid var(--accent-primary, #00d4ff);
    border-radius: var(--radius-md, 0.5rem);
    box-shadow: var(--shadow-lg, 0 8px 16px rgba(0, 0, 0, 0.5));
    backdrop-filter: blur(10px);
    animation: toast-slide-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: all var(--transition-base, 250ms);
}

.toast:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl, 0 16px 32px rgba(0, 0, 0, 0.6));
}

/* === ICONOS === */
.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

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

.toast-title {
    font-size: var(--font-size-base, 1rem);
    font-weight: var(--font-weight-semibold, 600);
    color: var(--text-primary, #ffffff);
    margin-bottom: var(--spacing-xs, 0.25rem);
    line-height: 1.3;
}

.toast-message {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-secondary, #b0b0b0);
    line-height: 1.4;
}

/* === BOTÓN DE CERRAR === */
.toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-tertiary, #808080);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0;
    transition: color var(--transition-fast, 150ms);
}

.toast-close:hover {
    color: var(--text-primary, #ffffff);
}

/* === BARRA DE PROGRESO === */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background-color: currentColor;
    border-radius: 0 0 var(--radius-md, 0.5rem) var(--radius-md, 0.5rem);
    animation: toast-progress-animation linear;
}

/* === VARIANTES DE TOAST === */

/* Success */
.toast.toast-success {
    border-left-color: var(--accent-success, #00ff88);
}

.toast.toast-success .toast-icon {
    color: var(--accent-success, #00ff88);
}

.toast.toast-success .toast-progress {
    color: var(--accent-success, #00ff88);
}

/* Error */
.toast.toast-error {
    border-left-color: var(--accent-error, #ff3b30);
}

.toast.toast-error .toast-icon {
    color: var(--accent-error, #ff3b30);
}

.toast.toast-error .toast-progress {
    color: var(--accent-error, #ff3b30);
}

/* Warning */
.toast.toast-warning {
    border-left-color: var(--accent-warning, #ff8c00);
}

.toast.toast-warning .toast-icon {
    color: var(--accent-warning, #ff8c00);
}

.toast.toast-warning .toast-progress {
    color: var(--accent-warning, #ff8c00);
}

/* Info */
.toast.toast-info {
    border-left-color: var(--accent-primary, #00d4ff);
}

.toast.toast-info .toast-icon {
    color: var(--accent-primary, #00d4ff);
}

.toast.toast-info .toast-progress {
    color: var(--accent-primary, #00d4ff);
}

/* === ANIMACIONES === */

/* Slide in desde la derecha */
@keyframes toast-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide out hacia la derecha */
@keyframes toast-slide-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Fade in */
@keyframes toast-fade-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Fade out */
@keyframes toast-fade-out {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* Barra de progreso */
@keyframes toast-progress-animation {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Clase para remover toast */
.toast.removing {
    animation: toast-slide-out 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .toast-container {
        top: var(--spacing-sm, 0.5rem);
        right: var(--spacing-sm, 0.5rem);
        left: var(--spacing-sm, 0.5rem);
        bottom: auto;
    }
    
    .toast-container.top-center,
    .toast-container.bottom-center {
        transform: none;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
        width: 100%;
    }
    
    /* En móvil, las toasts entran desde arriba */
    @keyframes toast-slide-in {
        from {
            transform: translateY(-100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    @keyframes toast-slide-out {
        from {
            transform: translateY(0);
            opacity: 1;
        }
        to {
            transform: translateY(-100%);
            opacity: 0;
        }
    }
}

/* === ACCESIBILIDAD === */
.toast[role="alert"] {
    /* Asegurar que los lectores de pantalla anuncien las notificaciones */
    position: relative;
}

/* Reducir movimiento para usuarios con preferencias de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    .toast {
        animation: toast-fade-in 0.3s ease;
    }
    
    .toast.removing {
        animation: toast-fade-out 0.3s ease forwards;
    }
    
    .toast:hover {
        transform: none;
    }
}