/**
 * Exit Intent Modal Styles
 * CSS per il modale di intercettazione navigazione
 * Include animazioni smooth, responsive design e accessibilità
 */

/* Overlay del modale */
.exit-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    padding: 20px;
    box-sizing: border-box;
}

.exit-modal-overlay.show {
    opacity: 1;
}

/* Container principale del modale */
.exit-modal-container {
    position: relative;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transform: scale(0.8) translateY(50px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.exit-modal-overlay.show .exit-modal-container {
    transform: scale(1) translateY(0);
}

/* Contenuto del modale */
.exit-modal-content {
    position: relative;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Pulsante di chiusura */
.exit-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
    color: #333;
}

.exit-modal-close:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.exit-modal-close:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Container del video */
.exit-modal-video-container {
    position: relative;
    width: 100%;
    height: 250px;
    background: #000;
    overflow: hidden;
}

.exit-modal-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Pulsante play per video */
.video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    z-index: 5;
}

.video-play-button:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translate(-50%, -50%) scale(1.05);
}

.video-play-button:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Sezione testo */
.exit-modal-text {
    padding: 30px;
    text-align: center;
}

.exit-modal-text h3 {
    margin: 0 0 15px 0;
    font-size: 24px;
    font-weight: 700;
    color: #333;
    line-height: 1.3;
}

.exit-modal-text p {
    margin: 0;
    font-size: 16px;
    color: #666;
    line-height: 1.5;
    max-width: 400px;
    margin: 0 auto;
}

/* Azioni del modale */
.exit-modal-actions {
    padding: 0 30px 30px 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

/* Pulsante CTA principale */
.exit-modal-cta {
    background: linear-gradient(135deg, #0051FF 0%, #0051FF 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 100px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 420px;
    position: relative;
    overflow: hidden;
    animation: fadeIn 3s 
ease, pulse-cta 2s infinite;
}

.exit-modal-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.exit-modal-cta:hover::before {
    left: 100%;
}

.exit-modal-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 124, 186, 0.3);
}

.exit-modal-cta:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.exit-modal-cta:active {
    transform: translateY(0);
}

/* Pulsante skip */
.exit-modal-skip {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
    padding: 12px 30px;
    border-radius: 100px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 420px;
}

.exit-modal-skip:hover {
    background: #f5f5f5;
    color: #333;
    border-color: #ccc;
}

.exit-modal-skip:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .exit-modal-overlay {
        padding: 15px;
    }
    
    .exit-modal-container {
        max-width: 100%;
        border-radius: 12px;
    }
    
    .exit-modal-video-container {
        height: 200px;
    }
    
    .exit-modal-text {
        padding: 25px 20px;
    }
    
    .exit-modal-text h3 {
        font-size: 20px;
    }
    
    .exit-modal-text p {
        font-size: 14px;
    }
    
    .exit-modal-actions {
        padding: 0 20px 25px 20px;
    }
    
    .exit-modal-cta {
        padding: 12px 30px;
        font-size: 15px;
    }
    
    .exit-modal-skip {
        padding: 10px 25px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .exit-modal-overlay {
        padding: 10px;
    }
    
    .exit-modal-container {
        border-radius: 8px;
    }
    
    .exit-modal-video-container {
        height: 180px;
    }
    
    .exit-modal-text {
        padding: 20px 15px;
    }
    
    .exit-modal-text h3 {
        font-size: 18px;
    }
    
    .exit-modal-actions {
        padding: 0 15px 20px 15px;
        gap: 12px;
    }
}

/* Animazioni per dispositivi che supportano le animazioni */
@media (prefers-reduced-motion: no-preference) {
    .exit-modal-container {
        animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    
    .exit-modal-text h3 {
        animation: fadeInUp 0.6s ease 0.2s both;
    }
    
    .exit-modal-text p {
        animation: fadeInUp 0.6s ease 0.3s both;
    }
    

    
    .exit-modal-skip {
        animation: fadeInUp 0.6s ease 0.5s both;
    }
}

/* Keyframes per animazioni */
@keyframes modalSlideIn {
    from {
        transform: scale(0.8) translateY(50px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Accessibilità - High Contrast Mode */
@media (prefers-contrast: high) {
    .exit-modal-overlay {
        background: rgba(0, 0, 0, 0.9);
    }
    
    .exit-modal-container {
        border: 2px solid #000;
    }
    
    .exit-modal-close {
        border: 2px solid #000;
    }
    
    .exit-modal-cta {
        border: 2px solid #000;
    }
    
    .exit-modal-skip {
        border: 2px solid #000;
    }
}

/* Focus visibile per navigazione da tastiera */
.exit-modal-overlay *:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Prevenzione scroll del body quando il modale è aperto */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Stili per il loading del video */
.exit-modal-video-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: -1;
}

.exit-modal-video[data-loaded="true"] + .exit-modal-video-container::before {
    display: none;
}

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



@keyframes pulse-cta {
    0% { box-shadow: 0 0 0 0 rgba(0, 87, 255, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(0, 87, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 87, 255, 0); }
}
