/* ==========================================================================
   STRUTTURA PRINCIPALE E CONTRASTO DARK MODE (DESKTOP / BASE)
   ========================================================================== */
.custom-cf7-form {
    box-sizing: border-box;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 2.5rem;
    border-radius: 16px;
    background-color: #0d0d0d !important; 
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Layout a griglia flessibile */
.custom-cf7-form .cf7-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Le colonne di base occupano metà spazio ciascuna se affiancate */
.custom-cf7-form .cf7-col {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
}

.custom-cf7-form .cf7-col.full-width {
    flex: 0 0 100%;
}

/* Etichette dei campi */
.custom-cf7-form .cf7-label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: #ffffff !important;
    opacity: 0.9;
}

/* ==========================================================================
   ESTETICA FISICA DEI CAMPI (INPUT, SELECT, TEXTAREA)
   ========================================================================== */
.custom-cf7-form input[type="text"],
.custom-cf7-form input[type="email"],
.custom-cf7-form select,
.custom-cf7-form textarea {
    width: 100% !important;
    padding: 0.85rem 1.2rem !important;
    font-size: 1rem;
    line-height: 1.5;
    color: #ffffff !important;
    background-color: #1a1a1a !important;
    border: 2px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 8px !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.25s ease-in-out !important;
    outline: none !important;
}

.custom-cf7-form ::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
}

/* Menu a tendina customizzatò per Dark Mode */
.custom-cf7-form select {
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,") !important;
    background-repeat: no-repeat !important;
    background-position: right 1.2rem center !important;
    padding-right: 2.5rem !important;
}
.custom-cf7-form select option {
    background-color: #1a1a1a !important;
    color: #ffffff !important;
}

/* Focus */
.custom-cf7-form input[type="text"]:focus,
.custom-cf7-form input[type="email"]:focus,
.custom-cf7-form select:focus,
.custom-cf7-form textarea:focus {
    border-color: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.07) !important;
}

.custom-cf7-form textarea {
    resize: vertical;
    min-height: 120px;
}

/* ==========================================================================
   PULSANTE DI INVIO
   ========================================================================== */
.custom-cf7-form .cf7-submit-wrap {
    text-align: right;
    margin-top: 2rem;
}

.custom-cf7-form input[type="submit"] {
    padding: 0.9rem 2.5rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px;
    color: #ffffff !important;
    border-radius: 8px !important;
    border: none !important;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease !important;
}

.custom-cf7-form input[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    opacity: 0.9;
}

.custom-cf7-form input[type="submit"]:active {
    transform: translateY(0);
}

/* ==========================================================================
   MESSAGGI DI STATO ED ERRORI
   ========================================================================== */
.wpcf7-response-output {
    margin: 2rem 0 0 0 !important;
    padding: 1rem 1.5rem !important;
    border-radius: 8px !important;
    font-size: 0.95rem;
    font-weight: 500;
    border: 2px solid !important;
    text-align: center;
}

.wpcf7 .sent .wpcf7-response-output {
    border-color: #2ec4b6 !important;
    background-color: rgba(46, 196, 182, 0.1) !important;
    color: #2ec4b6 !important;
}

.wpcf7 .failed .wpcf7-response-output,
.wpcf7 .aborted .wpcf7-response-output,
.wpcf7 .validation-failed .wpcf7-response-output {
    border-color: #e63946 !important;
    background-color: rgba(230, 57, 70, 0.1) !important;
    color: #e63946 !important;
}

.wpcf7-not-valid-tip {
    font-size: 0.8rem !important;
    font-weight: 600;
    color: #e63946 !important;
    margin-top: 0.4rem;
    display: block;
}

.wpcf7-spinner {
    margin: 0 0 0 10px !important;
    vertical-align: middle;
    background-color: #fff !important;
}

/* ==========================================================================
   MEDIA QUERIES (RESPONSIVE CHIPS)
   ========================================================================== */

/* Tablet e schermi intermedi (sotto i 768px) */
@media screen and (max-width: 768px) {
    .custom-cf7-form {
        padding: 1.75rem; /* Riduciamo i margini interni del form */
    }
    
    .custom-cf7-form .cf7-row {
        gap: 1.25rem; /* Stringiamo lo spazio tra i campi */
        margin-bottom: 1.25rem;
    }
}

/* Smartphone (sotto i 480px) */
@media screen and (max-width: 480px) {
    .custom-cf7-form {
        padding: 1.25rem; /* Ottimizzazione massima dello spazio */
        border-radius: 12px; /* Arrotondamento leggermente minore per schermi piccoli */
    }

    .custom-cf7-form .cf7-col {
        flex: 0 0 100%; /* Forza tutti i campi (inclusi Nome ed Email) ad andare a capo su riga singola */
    }

    .custom-cf7-form .cf7-row {
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .custom-cf7-form .cf7-submit-wrap {
        text-align: center; /* Il pulsante invia si centra sul display dello smartphone */
        margin-top: 1.5rem;
    }

    .custom-cf7-form input[type="submit"] {
        width: 100% !important; /* Il pulsante diventa a larghezza intera per essere cliccato facilmente col pollice */
    }
}