/* ANTI-FOUC: Regole ad alta priorità per nascondere il banner durante il caricamento */
#prestipay-banner.hidden,
#prestipay-banner.prestipay-banner-modal.hidden,
div#prestipay-banner.prestipay-banner-modal.hidden {
    display: none;
}

/* Nasconde anche tutti i figli */
#prestipay-banner.hidden *,
#prestipay-banner.prestipay-banner-modal.hidden *,
div#prestipay-banner.prestipay-banner-modal.hidden * {
    display: none;
}

/* PRESTIPAY BANNER MODAL */
#prestipay-banner.prestipay-banner-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Banner con classe hidden completamente nascosto */
#prestipay-banner.prestipay-banner-modal.hidden {
    display: none;
}

/* Tutti gli elementi figli nascosti quando il banner ha classe hidden */
#prestipay-banner.prestipay-banner-modal.hidden * {
    visibility: hidden;
    opacity: 0;
}

/* Banner visibile quando non ha la classe hidden */
#prestipay-banner.prestipay-banner-modal:not(.hidden) {
    display: flex;
    align-items: center;
    justify-content: center;
}

#prestipay-banner.prestipay-banner-modal.hidden {
    display: none;
}

.prestipay-banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.prestipay-banner-content {
    position: relative;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    max-height: 12dvh;
    width: 90%;
    margin: 20px;
    animation: bannerSlideIn 0.3s ease-out;
    display: flex;
    min-height: 400px;
}

.prestipay-banner-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 18px;
    font-weight: bold;
    color: #ffba3a;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    line-height: 1;
}

.prestipay-banner-close .icon-close {
    color: #ffba3a;
    line-height: 1;
    transition: color 0.3s ease;
}

/* Nessun cambio di colore al hover per mantenere coerenza con il sito */

.prestipay-banner-close:active {
    transform: scale(0.95);
}

/* LAYOUT A DUE COLONNE */
.prestipay-banner-image-section {
    flex: 2;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-radius: 10px 0 0 10px;
}

.prestipay-banner-image-section img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.prestipay-banner-image-fallback {
    width: 100%;
    height: 100%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 24px;
    text-align: center;
}

.prestipay-banner-content-section {
    flex: 1;
    padding: 40px 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: left;
    position: relative;
}

.prestipay-banner-title {
    margin: 0 0 5px 0;
    font-size: 24px;
    font-weight: bold;
    color: #333;
    line-height: 1.3;
    word-break: break-all;
}

.prestipay-banner-text {
    margin: 0 0 20px 0;
    font-size: 16px;
    line-height: 1.5;
    color: #666;
    flex-grow: 1;
}

.prestipay-banner-text p {
    margin: 0 0 15px 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 8;
    line-clamp: 8;
}

.prestipay-banner-text p:last-child {
    margin-bottom: 0;
}

.prestipay-banner-cta {
    margin-top: auto;
    display: flex;
    justify-content: center;
}

/* Il bottone usa le classi esistenti del sito: .btn.blue */

/* ANIMATIONS */
@keyframes bannerFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bannerSlideIn {
    from { 
        transform: scale(0.9) translateY(-20px);
        opacity: 0;
    }
    to { 
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* RESPONSIVE */
@media screen and (max-width: 768px) {
    .prestipay-banner-content {
        width: 95%;
        margin: 10px;
        max-height: 80dvh;
        height: -webkit-fill-available;
        flex-direction: column;
        min-height: auto;
    }
    
    .prestipay-banner-image-section {
        flex: none;
        height: 60%;
        border-radius: 10px 10px 0 0;
    }
    
    .prestipay-banner-content-section {
        flex: none;
        padding: 20px;
        height: 40%;
    }
    
    .prestipay-banner-title {
        font-size: 20px;
    }
    
    .prestipay-banner-text {
        font-size: 14px;
        overflow: hidden;
        line-height: 1.4;
        word-wrap: break-word;
    }
    .prestipay-banner-text p {
        margin: 0 0 15px 0;
        overflow: hidden;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 7;
        line-clamp: 7;
    }
}

@media screen and (max-width: 540px) {
    .prestipay-banner-text p {
        margin: 0 0 15px 0;
        overflow: hidden;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }
}

@media screen and (max-width: 430px) {
    .prestipay-banner-text p {
        margin: 0 0 15px 0;
        overflow: hidden;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 5;
        line-clamp: 5;
    }
}
@media screen and (max-width: 380px) {
    .prestipay-banner-text p {
        margin: 0 0 15px 0;
        overflow: hidden;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }
}
@media screen and (max-width: 345px) {
    .prestipay-banner-text p {
        margin: 0 0 15px 0;
        overflow: hidden;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 5;
        line-clamp: 5;
    }
}
/* ACCESSIBILITÀ */
.prestipay-banner-modal:focus-within {
    outline: none;
}

.prestipay-banner-close:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}