.alert {
    padding: 12px 20px;
    margin-bottom: 10px;
    border-radius: 5px;
    display: inline-flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    opacity: 1;
    transition: all 0.3s ease-in-out;
    overflow: hidden;
    max-width: 100%;
    min-width: 300px;
    width: auto;
    box-sizing: border-box;
}

.alert-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    z-index: 1000;
}

.alert.success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert.error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.alert.warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.close-message {
    cursor: pointer;
    color: inherit;
    font-size: 20px;
    font-weight: bold;
    margin-left: 15px;
    transition: color 0.3s;
    flex-shrink: 0;
}

.close-message:hover {
    color: #000;
}

.alert.fade {
    animation: fadeOut 0.5s forwards;
}

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

.alert-container .progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.alert-container .progress {
    height: 100%;
    width: 100%;
    transform: scaleX(1);
    transform-origin: left;
    transition: transform 4s linear;
}

.alert.success .progress { background-color: #28a745; }
.alert.error .progress { background-color: #dc3545; }
.alert.warning .progress { background-color: #ffc107; }
.alert.info .progress { background-color: #17a2b8; }

.alert.fade-out {
    opacity: 0;
    height: 0;
    margin-bottom: 0;
    padding: 0;
    overflow: hidden;
}

@media (max-width: 768px) {
    .alert {
        min-width: 250px;
        max-width: 95%;
    }
    
    .alert-container {
        left: 50%;
        transform: translateX(-50%);
        align-items: center;
    }
}