﻿/* ============================================================
   ANIMAZIONI DESKTOP
   ============================================================ */
@media (min-width: 767px) {

    @keyframes alertInDesktop {
        from {
            opacity: 0;
            transform: translateX(120%) translateY(-10px);
        }

        to {
            opacity: 1;
            transform: translateX(50%) translateY(0);
        }
    }

    @keyframes alertOutDesktop {
        from {
            opacity: 1;
            transform: translateX(50%) translateY(0);
        }

        to {
            opacity: 0;
            transform: translateX(-20%) translateY(0);
        }
    }
}

/* ============================================================
   CONTENITORE BASE (DESKTOP)
   ============================================================ */
.custom-alert {
    position: fixed;
    top: 2.5rem;
    right: 50%;
    min-width: 400px;
    max-width: 800px;
    width: auto;
    padding: 1rem 1rem;
    border-radius: 8px;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 1rem;
    z-index: 999999;
    animation: alertInDesktop 0.45s ease-out forwards;
}

    /* Icona */
    .custom-alert i {
        grid-row: 1 / span 2;
        margin-left: 1rem;
        font-size: 42px;
    }

    /* Testo */
    .custom-alert .alert-text {
        grid-column: 2;
        margin: 0.5rem 0;
        word-break: break-word;
    }

    /* Bottoni */
    .custom-alert .btn-group {
        grid-column: 2;
        display: flex;
        justify-content: flex-end;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }

        .custom-alert .btn-group button {
            padding: 0.4rem 1rem;
            border-radius: 4px;
            border: 1px solid #6c6c6c;
            background: #e6e6e6;
            box-shadow: 0 0 4px rgba(80,80,80,0.4);
            cursor: pointer;
            white-space: nowrap;
            margin-right: 0.5rem;
        }

            .custom-alert .btn-group button:hover {
                background: #dcdcdc;
            }

    /* ============================================================
   COLORI DELICATI PER TIPO DI MESSAGGIO
   ============================================================ */
    .custom-alert.info,
    .custom-alert.message {
        background: #e8f4ff;
        border: 1px solid #bcdcff;
        color: #1b3c59;
    }

    .custom-alert.warning {
        background: #fff7d6;
        border: 1px solid #f0d98c;
        color: #5a4a00;
    }

    .custom-alert.warningok {
        background: #e6ffe6;
        border: 1px solid #b3e6b3;
        color: #1f4d1f;
    }
    .custom-alert.success,
    .custom-alert.successok {
        background: #2cb52c;
        border: 1px solid #b3e6b3;
        font-weight: 500;
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        color: yellow;
    }

    .custom-alert.alert,
    .custom-alert.error {
        background: #ffe6e6;
        border: 1px solid #e6b3b3;
        color: #5a1f1f;
    }

    .custom-alert.confirm {
        background: white;
        border: 1px solid black;
        border-radius: 5px;
        color: #333;
    }

    .custom-alert.confirmsecure {
        background: #FF0000;
        border-radius: 5px;
        padding: 12px;
        color: white;
        font-weight: 400;
        border: 1px solid black;
    }

    .custom-alert.messageok {
        background: palegreen;
        border: 1px solid #d0d0d0;
        color: navy;
    }

    /* ============================================================
   STATO DI USCITA (DESKTOP)
   ============================================================ */
    .custom-alert.hide {
        animation: alertOutDesktop 0.4s ease-in forwards;
    }

/* ============================================================
   MOBILE: VERSIONE COMPATTA + ANIMAZIONI DEDICATE
   ============================================================ */
@media (max-width: 767px) {

    @keyframes alertInMobile {
        from {
            opacity: 0;
            transform: translateY(-20px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes alertOutMobile {
        from {
            opacity: 1;
            transform: translateY(0);
        }

        to {
            opacity: 0;
            transform: translateY(-20px);
        }
    }

    .custom-alert {
        top: 4px;
        right: 4px;
        left: 4px;
        min-width: 300px;
        max-width: calc(100% - 8px);
        width: auto;
        padding: 0.5rem 0.75rem;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        animation: alertInMobile 0.35s ease-out forwards;
    }

        /* Icona */
        .custom-alert i {
            margin-left: 1rem;
            font-size: 30px;
            flex-shrink: 0;
        }

        /* Testo */
        .custom-alert .alert-text {
            flex: 1;
            min-width: 0;
            margin: 0 0.25rem;
            font-size: 0.9rem;
            word-break: break-word;
        }

        /* Bottoni */
        .custom-alert .btn-group {
            display: flex;
            flex-direction: row;
            gap: 0.4rem;
            margin-right: 0.5rem;
            flex-shrink: 0;
        }

            .custom-alert .btn-group button {
                padding: 0.3rem 0.6rem;
                font-size: 0.85rem;
                white-space: nowrap;
            }

        .custom-alert.hide {
            animation: alertOutMobile 0.3s ease-in forwards;
        }
}

.custom-alert.alert {
    margin: 0 !important;
    padding: 1rem !important;
    border: 1px solid #e6b3b3 !important;
    position: fixed !important;
}


/* ================================
   NOTIFY: elegante, semplice
   ================================ */

@keyframes notifyIn {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes notifyOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(40px);
    }
}

.notify {
    position: fixed;
    bottom: 20px;
    right: 20px;
    min-width: 260px;
    max-width: 380px;
    background: linear-gradient(135deg, #ffffff 0%, #f7f7f7 100%);
    border: 1px solid #dcdcdc;
    border-radius: 10px;
    padding: 1rem 1.2rem;
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 999999;
    animation: notifyIn 0.75s ease-out forwards;
}

    /* Icona */
    .notify i {
        font-size: 28px;
        color: #4a4a4a;
        flex-shrink: 0;
    }

    /* Testo */
    .notify .notify-text {
        font-size: 0.95rem;
        color: #333;
        line-height: 1.3;
        word-break: break-word;
    }

    /* Stato di uscita */
    .notify.hide {
        animation: notifyOut 0.45s ease-in forwards;
    }
.custom-alert.alert,
.custom-alert.error,
.custom-alert.alertok,
.custom-alert.errorok {
    background: #ffe6e6;
    border: 1px solid #e6b3b3;
    color: #5a1f1f;
}

/* ============================================================
   NUOVI TIPI: HtmlAuto e HtmlAutoOK
   ============================================================ */

/* HtmlAuto → informativo elegante */
.custom-alert.htmlauto {
    background: #f5f7fa; /* grigio chiarissimo elegante */
    border: 1px solid #d0d7e1; /* bordo soft */
    color: #2f3b52; /* blu-grigio leggibile */
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* HtmlAutoOK → conferma elegante */
.custom-alert.htmlautook {
    background: #e9fbe9; /* verde chiarissimo */
    border: 1px solid #b8e6b8; /* verde soft */
    color: #1f4d1f; /* verde scuro leggibile */
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.custom-alert.confirm,
.custom-alert.confirmsecure,
.custom-alert.messageblack {
    background-color: #333;
    color: white;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 8px;
    opacity: 0.95;
}