/* ===================================================================
   FILE: css/messaggi_sistema.css - VERSIONE CORRETTA
   =================================================================== */

.message-overlay {
    position: fixed;
    top: 80px; /* ✅ CORRETTO: Sotto la top bar */
    right: 20px;
    z-index: 9999;
    pointer-events: none;
    max-width: 400px;
}

.alert {
    pointer-events: auto;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    min-width: 300px;
    max-width: 100%;
    word-wrap: break-word;
    
    /* Animazione entrata */
    animation: slideInRight 0.4s ease-out;
    transform: translateX(0);
    opacity: 1;
    
    /* ✅ AGGIUNTO: Cursore pointer per indicare che è cliccabile */
    cursor: pointer;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ✅ AGGIUNTO: Fallback per icone se Font Awesome non carica */
.alert .alert-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.alert .alert-icon.fallback {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.alert-success .alert-icon.fallback {
    background: #155724;
    color: #d4edda;
}

.alert-error .alert-icon.fallback {
    background: #721c24;
    color: #f8d7da;
}

.alert-warning .alert-icon.fallback {
    background: #856404;
    color: #fff3cd;
}

.alert-info .alert-icon.fallback {
    background: #0c5460;
    color: #d1ecf1;
}

/* Animazioni */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

.alert.removing {
    animation: slideOutRight 0.3s ease-in forwards;
}

/* Loading state per bottoni */
.btn-loading {
    opacity: 0.7;
    pointer-events: none;
}

.btn-loading .fa-spin, .btn-loading .spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ✅ MIGLIORATO: Responsive - meglio gestito */
@media (max-width: 768px) {
    .message-overlay {
        top: 70px; /* Top bar più piccola su mobile */
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .alert {
        min-width: auto;
        max-width: none;
        font-size: 14px;
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .message-overlay {
        top: 60px;
        right: 5px;
        left: 5px;
    }
    
    .alert {
        font-size: 13px;
        padding: 10px 14px;
    }
}
