/**
 * Popup Notification System - Versione 1.1
 * Sostituisce gli alert standard con popup animati
 */

/* Overlay per il popup */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    animation: fadeIn 0.3s ease-in-out forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

/* Container del popup */
.popup-container {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.8);
    animation: popIn 0.3s ease-out forwards;
}

@keyframes popIn {
    to {
        transform: scale(1);
    }
}

.popup-container.popup-closing {
    animation: popOut 0.2s ease-in forwards;
}

@keyframes popOut {
    to {
        transform: scale(0.8);
    }
}

/* Icona di successo/errore */
.popup-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.popup-icon.success {
    background: #10b981;
}

.popup-icon.error {
    background: #ef4444;
}

/* Animazione spunta verde */
.popup-icon.success::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 45px;
    border: solid white;
    border-width: 0 4px 4px 0;
    transform: rotate(45deg) scale(0);
    animation: checkmark 0.5s ease-in-out 0.2s forwards;
}

@keyframes checkmark {
    0% {
        transform: rotate(45deg) scale(0);
    }
    50% {
        transform: rotate(45deg) scale(1.1);
    }
    100% {
        transform: rotate(45deg) scale(1);
    }
}

/* Animazione X rossa */
.popup-icon.error::before,
.popup-icon.error::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 50px;
    background: white;
    transform: scale(0);
    animation: xmark 0.5s ease-in-out 0.2s forwards;
}

.popup-icon.error::before {
    transform: rotate(45deg) scale(0);
}

.popup-icon.error::after {
    transform: rotate(-45deg) scale(0);
}

@keyframes xmark {
    0% {
        transform: rotate(45deg) scale(0);
    }
    50% {
        transform: rotate(45deg) scale(1.1);
    }
    100% {
        transform: rotate(45deg) scale(1);
    }
}

.popup-icon.error::after {
    animation-name: xmark-opposite;
}

@keyframes xmark-opposite {
    0% {
        transform: rotate(-45deg) scale(0);
    }
    50% {
        transform: rotate(-45deg) scale(1.1);
    }
    100% {
        transform: rotate(-45deg) scale(1);
    }
}

/* Titolo e messaggio */
.popup-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: center;
    color: #1f2937;
}

.popup-message {
    font-size: 16px;
    color: #6b7280;
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Pulsante OK */
.popup-button {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.popup-button.success {
    background: #10b981;
    color: white;
}

.popup-button.success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.popup-button.error {
    background: #ef4444;
    color: white;
}

.popup-button.error:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Responsive */
@media (max-width: 640px) {
    .popup-container {
        padding: 24px;
    }

    .popup-icon {
        width: 60px;
        height: 60px;
    }

    .popup-icon.success::after {
        width: 20px;
        height: 35px;
    }

    .popup-icon.error::before,
    .popup-icon.error::after {
        height: 40px;
    }

    .popup-title {
        font-size: 20px;
    }

    .popup-message {
        font-size: 14px;
    }
}
