/* My Shortcodes - Stili Comuni */

/* Smooth scrolling globale - forzato */
html, body {
    scroll-behavior: smooth !important;
}

/* Offset per contenitore Elementor con ID candida-azienda */
#candida-azienda {
    scroll-margin-top: 100px !important;
}

/* Popup Form Styles - Globali per funzionare con Elementor */
.form-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.form-popup-overlay.show {
    display: flex;
    opacity: 1;
    align-items: center;
    justify-content: center;
}

.form-popup-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.8);
    transition: transform 0.3s ease;
    margin: 0;
}

.form-popup-overlay.show .form-popup-content {
    transform: scale(1);
}

#form-popup .form-popup-header,
.form-popup-overlay .form-popup-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 20px 30px 0 30px !important;
    position: relative !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    background: rgba(0, 53, 78, 0.9) !important; /* Debug: sfondo per vedere l'header */
    border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
}

#form-popup .form-popup-header h3,
.form-popup-overlay .form-popup-header h3 {
    margin: 0 !important;
    font-size: 24px !important;
    font-weight: bold !important;
    color: white !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#form-popup .form-popup-close,
.form-popup-overlay .form-popup-close {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    font-size: 24px !important;
    color: #333 !important;
    cursor: pointer !important;
    padding: 0 !important;
    width: 35px !important;
    height: 35px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    transition: all 0.3s ease !important;
    position: absolute !important;
    top: 15px !important;
    right: 20px !important;
    z-index: 10 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#form-popup .form-popup-close:hover,
.form-popup-overlay .form-popup-close:hover {
    background-color: #e74c3c !important;
    color: white !important;
    transform: scale(1.1) !important;
    border-color: #e74c3c !important;
}

.form-popup-body {
    padding: 30px;
}

.form-popup-validation-alert {
    display: none;
    margin: 0 0 16px 0;
    padding: 12px 14px;
    border: 2px solid #e53e3e;
    border-radius: 8px;
    background: #fff5f5;
    color: #9b2c2c;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
}

.form-popup-validation-alert.is-visible {
    display: block;
}

.form-popup-body .cf7-invalid-highlight {
    border-color: #e53e3e !important;
    box-shadow: 0 0 0 2px rgba(229, 62, 62, 0.22) !important;
}

.form-popup-body .wpcf7-not-valid-tip {
    display: block;
    margin-top: 6px;
    color: #c53030;
    font-size: 13px;
    font-weight: 700;
}

/* Mantieni il bottone CF7 cliccabile anche in stato invalid */
.form-popup-body .wpcf7-form.invalid .wpcf7-submit,
.form-popup-body .wpcf7 form.invalid .wpcf7-submit {
    pointer-events: auto;
    opacity: 1;
}

/* Modal di conferma chiusura */
.form-popup-confirmation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.form-popup-confirmation.show {
    display: flex;
    opacity: 1;
}

.form-popup-confirmation-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    max-width: 450px;
    width: 90%;
    padding: 30px;
    text-align: center;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.form-popup-confirmation.show .form-popup-confirmation-content {
    transform: scale(1);
}

.form-popup-confirmation h3 {
    margin: 0 0 15px 0;
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.form-popup-confirmation p {
    margin: 0 0 25px 0;
    font-size: 16px;
    color: #666;
    line-height: 1.5;
}

.form-popup-confirmation-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.form-popup-confirmation-button {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

/* Pulsante "Rimani" - Evidenziato */
.form-popup-confirmation-stay {
    background: #E53E3E;
    color: white;
    box-shadow: 0 4px 15px rgba(229, 62, 62, 0.3);
    transform: scale(1.05);
}

.form-popup-confirmation-stay:hover {
    background: #C53030;
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(229, 62, 62, 0.4);
}

/* Pulsante "Esci" - Secondario */
.form-popup-confirmation-leave {
    background: #f8f9fa;
    color: #666;
    border: 2px solid #e9ecef;
}

.form-popup-confirmation-leave:hover {
    background: #e9ecef;
    color: #333;
}

/* Nascondi header quando popup è aperto */
.popup-open .header-v2-logos-container,
.popup-open .header-v2-countdown-container,
.popup-open .header-v3-logos-container,
.popup-open .header-v3-countdown-container {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Responsive Popup */
@media (max-width: 768px) {
    .form-popup-content {
        width: 95%;
        max-height: 90vh;
        margin: 0;
        max-width: 500px;
    }
    
    .form-popup-header {
        padding: 15px 20px;
    }
    
    .form-popup-header h3 {
        font-size: 20px;
    }
    
    .form-popup-body {
        padding: 15px;
    }
}

/* Mobile specific */
@media (max-width: 480px) {
    .form-popup-content {
        width: 98%;
        max-width: 400px;
        max-height: 95vh;
    }
    
    .form-popup-body {
        padding: 12px;
    }

    .form-popup-validation-alert {
        font-size: 14px;
    }
    
    /* Riduci dimensioni input */
    .form-popup-body input[type="text"],
    .form-popup-body input[type="email"],
    .form-popup-body input[type="tel"],
    .form-popup-body textarea {
        font-size: 14px;
        padding: 8px 12px;
        margin-bottom: 12px;
    }
    
    .form-popup-body textarea {
        min-height: 80px;
    }
    
    /* Riduci dimensioni button */
    .form-popup-body input[type="submit"],
    .form-popup-body .wpcf7-submit {
        font-size: 14px;
        padding: 10px 20px;
        margin: 15px 0;
    }
    
    /* Riduci dimensioni checkbox */
    .form-popup-body input[type="checkbox"] {
        transform: scale(0.8);
        margin-right: 6px;
    }
    
    .form-popup-body label {
        font-size: 12px;
        line-height: 1.3;
    }
    
    /* Modal di conferma responsive */
    .form-popup-confirmation-content {
        max-width: 350px;
        padding: 25px;
    }
    
    .form-popup-confirmation h3 {
        font-size: 20px;
    }
    
    .form-popup-confirmation p {
        font-size: 14px;
    }
    
    .form-popup-confirmation-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-popup-confirmation-button {
        width: 100%;
        min-width: auto;
    }
    
    .form-popup-close {
        width: 30px;
        height: 30px;
        font-size: 20px;
        top: 10px;
        right: 15px;
    }
}

/* Fallback per browser che non supportano scroll-behavior */
@media (prefers-reduced-motion: no-preference) {
    html, body {
        scroll-behavior: smooth !important;
    }
}

/* Reset e base styles */
.my-shortcodes-testimonianze,
.my-shortcodes-relatori,
.my-shortcodes-programma,
.my-shortcodes-form,
.my-shortcodes-benefit {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Grid system */
.testimonianze-grid,
.relatori-grid,
.benefits-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(var(--columns, 3), 1fr);
}

/* Responsive */
@media (max-width: 768px) {
    .testimonianze-grid,
    .relatori-grid,
    .benefits-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .testimonianze-grid,
    .relatori-grid,
    .benefits-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Animazioni */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* Utility classes */
.text-center {
    text-align: center;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}
