:root {
    /* Modern Color Palette */
    --ef-primary: #005baa;
    --ef-primary-dark: #004481;
    --ef-accent: #00bfff; /* Brighter accent */
    --ef-gold: #d4a84b;
    --ef-dark: #121212;
    --ef-light: #f8f9fa;
    --ef-gray: #6c757d;
    --ef-success: #28a745;
    --ef-danger: #dc3545;
    
    /* Spacing & Layout */
    --card-radius: 1.5rem;
    --input-radius: 0.75rem;
    --btn-radius: 0.75rem;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 20px 40px rgba(0, 91, 170, 0.15);
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f0f4f8; /* Soft background */
    color: var(--ef-dark);
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* --- Improved Hero Section --- */
.landing-hero {
    background: linear-gradient(135deg, var(--ef-primary) 0%, var(--ef-primary-dark) 100%);
    padding: 6rem 1.5rem 8rem; /* Increased padding */
    color: #fff;
    text-align: center;
    position: relative;
    clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%); /* Modern diagonal cut */
}

/* Subtle pattern overlay */
.landing-hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(circle at 20% 50%, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 25%),
                      radial-gradient(circle at 80% 20%, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 25%);
    pointer-events: none;
}

.landing-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    color: #fff;
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.landing-hero h1 {
    font-family: 'Arvo', Georgia, serif;
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin: 0 0 1rem;
    line-height: 1.2;
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.landing-hero p {
    font-size: 1.25rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
    font-weight: 300;
}

/* --- Container & Card --- */
.landing-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
    position: relative;
    z-index: 10;
    margin-top: -6rem; /* Pull card up */
}

.landing-card {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15); /* Deep shadow */
    padding: 3rem;
    position: relative;
    border: 1px solid rgba(0,0,0,0.02);
}

.landing-card h2 {
    font-family: 'Arvo', Georgia, serif;
    color: var(--ef-primary);
    font-size: 1.75rem;
    margin: 0 0 2rem;
    text-align: center;
    position: relative;
    padding-bottom: 1rem;
}

/* Underline decoration for H2 */
.landing-card h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--ef-accent);
    margin: 0.5rem auto 0;
    border-radius: 2px;
}

/* --- Form Styles --- */
.landing-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.landing-form .form-row.full {
    grid-template-columns: 1fr;
}

@media (max-width: 600px) {
    .landing-form .form-row {
        grid-template-columns: 1fr;
    }
    .landing-card {
        padding: 2rem 1.5rem;
    }
}

.landing-form label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.landing-form input[type="text"],
.landing-form input[type="email"],
.landing-form input[type="tel"],
.landing-form select {
    width: 100%;
    padding: 0.85rem 1.25rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--input-radius);
    font-size: 1rem;
    font-family: inherit;
    background-color: #f8fafc;
    transition: all 0.2s ease;
    color: #2d3748;
}

.landing-form input:focus,
.landing-form select:focus {
    outline: none;
    border-color: var(--ef-primary);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(0, 91, 170, 0.1);
}

.landing-form select:disabled {
    background-color: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
    border-color: #e2e8f0;
}

/* --- Consensi block (checkbox group) --- */
.form-consensi {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--input-radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.form-consensi-title {
    margin: 0 0 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ef-primary);
}

.form-consensi .form-check {
    margin-bottom: 1rem;
}

.form-consensi .form-check:last-of-type {
    margin-bottom: 0;
}

/* --- Checkbox & Label Alignment Fix --- */
.form-check {
    display: flex;
    align-items: center; /* Allinea checkbox al centro della riga di testo */
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
}

.form-check:hover {
    background-color: #f8fafc;
}

.form-check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1.35rem;
    height: 1.35rem;
    border: 2px solid #cbd5e0;
    border-radius: 4px;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    background-color: #fff;
    transition: all 0.2s ease;
}

.form-check input[type="checkbox"]:checked {
    background-color: var(--ef-primary);
    border-color: var(--ef-primary);
}

.form-check input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.35rem;
    height: 0.7rem;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -60%) rotate(45deg);
}

.form-check input[type="checkbox"]:focus {
    box-shadow: 0 0 0 3px rgba(0, 91, 170, 0.2);
    border-color: var(--ef-primary);
}

.form-check-label-wrap {
    cursor: pointer;
}

.form-check-text {
    margin-bottom: 0;
    font-weight: 400;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #4a5568;
    text-transform: none;
    letter-spacing: normal;
}

.form-check-text a {
    color: var(--ef-primary);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dotted var(--ef-primary);
}

.form-check-text a:hover {
    color: var(--ef-primary-dark);
    border-bottom-style: solid;
}

/* --- Buttons --- */
.btn-landing {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, var(--ef-primary) 0%, #003366 100%);
    color: #fff;
    border: none;
    padding: 1rem 2rem;
    font-weight: 700;
    border-radius: var(--btn-radius);
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    margin-top: 1rem;
    box-shadow: 0 4px 6px rgba(0, 51, 102, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-landing:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 51, 102, 0.3);
    background: linear-gradient(135deg, #004a91 0%, #002244 100%);
}

.btn-landing:active {
    transform: translateY(0);
}

.btn-dettaglio {
    background: transparent;
    color: var(--ef-primary);
    border: 2px solid var(--ef-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--btn-radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 1.5rem;
    display: none; /* Controlled by JS */
    transition: all 0.2s;
}

.btn-dettaglio:hover {
    background: var(--ef-primary);
    color: #fff;
}

/* --- Alerts --- */
.alert-landing {
    padding: 1rem 1.25rem;
    border-radius: var(--input-radius);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
}

.alert-landing.success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

/* Messaggio di invio riuscito con animazione */
.alert-success-sent {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem 1.5rem;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: none;
    border-radius: var(--card-radius);
    box-shadow: 0 8px 24px rgba(40, 167, 69, 0.15);
    animation: successSentIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes successSentIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.success-sent-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background: var(--ef-success);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    animation: successCheckPop 0.6s 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transform: scale(0);
    opacity: 0;
}

@keyframes successCheckPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    60% {
        transform: scale(1.15);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-sent-check {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.success-sent-text {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #155724;
    line-height: 1.5;
}

.btn-landing--sent {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    cursor: default;
    opacity: 0.9;
}

.btn-landing--sent:hover {
    transform: none;
    box-shadow: 0 4px 6px rgba(0, 51, 102, 0.2);
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
}

.alert-landing.danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

/* Messaggio quando manca referente in URL – molto evidente */
.alert-no-ref {
    background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
    border: 2px solid #f9a825;
    border-radius: var(--input-radius);
    color: #5d4e37;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: 1.5rem 1.75rem;
    box-shadow: 0 4px 20px rgba(249, 168, 37, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
}

.alert-no-ref::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: linear-gradient(180deg, #f9a825 0%, #f57f17 100%);
}

.alert-no-ref-title {
    margin: 0 0 0.75rem;
    font-weight: 800;
    font-size: 1.2rem;
    color: #e65100;
    letter-spacing: 0.02em;
}

.alert-no-ref-text {
    margin: 0;
    font-size: 1rem;
    line-height: 1.6;
    color: #5d4e37;
}

.alert-no-ref a {
    color: var(--ef-primary);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 2px solid var(--ef-primary);
    padding-bottom: 1px;
}

.alert-no-ref a:hover {
    border-bottom-color: var(--ef-primary-dark);
}

/* --- Footer --- */
.footer-landing {
    text-align: center;
    padding: 3rem 1rem;
    color: #718096;
    font-size: 0.9rem;
    margin-top: 2rem;
}

.footer-landing p {
    margin: 0 0 0.5rem;
}

.footer-landing p:last-child {
    margin-bottom: 0;
}

.footer-landing-address {
    font-weight: 600;
    color: #4a5568;
}

.footer-landing-links {
    margin-bottom: 0.75rem;
}

.footer-landing-sep {
    margin: 0 0.25rem;
    color: #718096;
}

.footer-landing a {
    color: var(--ef-primary);
    text-decoration: none;
    font-weight: 600;
}

.footer-landing a:hover {
    text-decoration: underline;
}

/* --- Modal (stile allineato alla landing-card) --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.is-open {
    display: flex;
    opacity: 1;
}

.modal-box {
    background: #fff;
    border-radius: var(--card-radius);
    max-width: 550px;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.06);
    transform: scale(0.96);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.modal-overlay.is-open .modal-box {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-family: 'Arvo', Georgia, serif;
    font-weight: 700;
    color: var(--ef-primary);
    position: relative;
    padding-bottom: 0.5rem;
}

.modal-header h3::after {
    content: '';
    display: block;
    width: 50px;
    height: 4px;
    background: var(--ef-accent);
    margin-top: 0.5rem;
    border-radius: 2px;
}

.modal-close {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: var(--input-radius);
    font-size: 1.5rem;
    cursor: pointer;
    color: #4a5568;
    line-height: 1;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.modal-close:hover {
    color: var(--ef-primary);
    border-color: var(--ef-primary);
    background: rgba(0, 91, 170, 0.06);
}

.modal-body {
    padding: 1.75rem 1.75rem;
    line-height: 1.7;
    color: #4a5568;
    font-size: 1rem;
    background: #f8fafc;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-body p {
    margin: 0 0 1rem;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

/* Modal Dettaglio corso – più grande e curato */
.modal-box--dettaglio {
    max-width: min(1140px, 96vw);
    width: 100%;
    max-height: 90vh;
    box-shadow: 0 32px 64px -12px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 91, 170, 0.06);
    border: 1px solid rgba(0, 91, 170, 0.12);
}

.modal-header--dettaglio {
    background: linear-gradient(135deg, var(--ef-primary) 0%, var(--ef-primary-dark) 100%);
    border-bottom: none;
    padding: 1.5rem 2rem;
}

.modal-header--dettaglio h3 {
    color: #fff;
    font-size: 1.5rem;
}

.modal-header--dettaglio h3::after {
    background: var(--ef-accent);
    opacity: 0.95;
}

.modal-header--dettaglio .modal-close {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

.modal-header--dettaglio .modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
}

.modal-body--dettaglio {
    padding: 2rem 2.25rem;
    font-size: 1.05rem;
    line-height: 1.75;
    background: #fff;
    color: #2d3748;
    max-height: calc(90vh - 80px);
}

.modal-body--dettaglio h1,
.modal-body--dettaglio h2,
.modal-body--dettaglio h3,
.modal-body--dettaglio h4 {
    font-family: 'Arvo', Georgia, serif;
    color: var(--ef-primary);
    margin: 1.25rem 0 0.75rem;
    line-height: 1.3;
}

.modal-body--dettaglio h1 { font-size: 1.5rem; }
.modal-body--dettaglio h2 { font-size: 1.35rem; }
.modal-body--dettaglio h3 { font-size: 1.2rem; }
.modal-body--dettaglio h4 { font-size: 1.1rem; }

.modal-body--dettaglio p {
    margin: 0 0 1rem;
}

.modal-body--dettaglio ul,
.modal-body--dettaglio ol {
    margin: 0 0 1rem;
    padding-left: 1.5rem;
}

.modal-body--dettaglio li {
    margin-bottom: 0.35rem;
}

.modal-body--dettaglio a {
    color: var(--ef-primary);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 91, 170, 0.3);
}

.modal-body--dettaglio a:hover {
    border-bottom-color: var(--ef-primary);
}

.modal-body--dettaglio strong {
    font-weight: 700;
    color: #1a202c;
}

.modal-body--dettaglio img {
    max-width: 100%;
    height: auto;
    border-radius: var(--input-radius);
    margin: 0.75rem 0;
}

/* Modal con iframe (privacy) */
.modal-box--iframe {
    max-width: min(960px, 96vw);
    max-height: 90vh;
}

.modal-box--iframe .modal-body--iframe {
    flex: 1;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    background: #f8fafc;
}

.modal-body--iframe iframe {
    display: block;
    width: 100%;
    height: 60vh;
    min-height: 400px;
    border: 0;
    background: #fff;
}

