/* ============================================================
   Contact Form 7 — stile brand Ecoricerche (Modulo 18)
   ============================================================
   Tutti i form CF7 (Contatti, Software/Ecolwaste, Candidatura CV)
   condividono lo stesso markup .eco-form. Stile centralizzato qui.
   ============================================================ */

/* ============================================================
   Layout: form wrapper + row pair (2 col fields affiancati)
   ============================================================
   NB: CF7 applica wpautop al body — i label dentro un .eco-form-row
   vengono raggruppati in un SINGOLO <p> con <br> tra i label.
   Quindi il grid va applicato a `.eco-form-row > p`, non al row stesso.
   ============================================================ */
.eco-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-family: "Host Grotesk", sans-serif;
}

/* Wrapper .eco-form-row: container trasparente. CF7 wrappa i 2 label
   dentro UN UNICO <p> con <br> tra loro. Il grid va applicato SOLO al
   <p> figlio (non al wrapper, altrimenti doppio nesting → 25% width).  */
.eco-form-row {
    margin: 0;
    padding: 0;
}
.eco-form-row > p {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 0;
    padding: 0;
}
/* Nascondi il <br> che CF7 inserisce tra i 2 label dentro il <p> */
.eco-form-row > p > br { display: none; }
.eco-form-row > p > label { margin: 0; min-width: 0; }

@media (max-width: 640px) {
    .eco-form-row > p {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Adattamento per form CV con 3 cols (indirizzo / città / cap) */
.eco-form .eco-form-row:has(> p > label:nth-of-type(3)) > p {
    grid-template-columns: 2fr 1.5fr 1fr;
}
@media (max-width: 640px) {
    .eco-form .eco-form-row:has(> p > label:nth-of-type(3)) > p {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   Label + base
   ============================================================ */
.eco-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #032019;
    line-height: 1.4;
    letter-spacing: 0.2px;
    margin: 0;
}
.eco-form label small {
    color: #00411D;
    opacity: 0.7;
    font-weight: 400;
    font-size: 12px;
    margin-left: 6px;
}
.eco-form p {
    margin: 0;
}

/* ============================================================
   Input / textarea / select — stato base
   ============================================================ */
.eco-form input[type="text"],
.eco-form input[type="email"],
.eco-form input[type="tel"],
.eco-form input[type="url"],
.eco-form input[type="number"],
.eco-form textarea,
.eco-form select,
.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 input[type="tel"],
.wpcf7 input[type="url"],
.wpcf7 textarea,
.wpcf7 select {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-top: 6px;
    padding: 12px 14px;
    background: #FFFFFF;
    color: #032019;
    border: 1.5px solid rgba(3, 32, 25, 0.18);
    border-radius: 10px;
    font-family: "Host Grotesk", sans-serif;
    font-size: 15px;
    line-height: 1.4;
    transition: border-color 200ms ease-in-out, box-shadow 200ms ease-in-out, background 200ms ease-in-out;
    -webkit-appearance: none;
       -moz-appearance: none;
            appearance: none;
}

.eco-form textarea,
.wpcf7 textarea {
    min-height: 120px;
    resize: vertical;
}

/* Placeholder color */
.eco-form input::placeholder,
.eco-form textarea::placeholder { color: rgba(3, 32, 25, 0.4); }

/* Hover */
.eco-form input[type="text"]:hover,
.eco-form input[type="email"]:hover,
.eco-form input[type="tel"]:hover,
.eco-form textarea:hover,
.eco-form select:hover {
    border-color: rgba(3, 32, 25, 0.35);
}

/* Focus — accent brand */
.eco-form input[type="text"]:focus,
.eco-form input[type="email"]:focus,
.eco-form input[type="tel"]:focus,
.eco-form input[type="number"]:focus,
.eco-form textarea:focus,
.eco-form select:focus {
    outline: none;
    border-color: #56F09F;
    background: #FFFFFF;
    box-shadow: 0 0 0 4px rgba(86, 240, 159, 0.18);
}

/* ============================================================
   Select — caret custom (sostituisce nativo)
   ============================================================ */
.eco-form select,
.wpcf7 select {
    padding-right: 40px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23032019' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px 8px;
    cursor: pointer;
}
.eco-form select option {
    color: #032019;
    background: #FFFFFF;
}

/* ============================================================
   File upload — sostituisce stile nativo
   ============================================================ */
.eco-form input[type="file"],
.wpcf7 input[type="file"] {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 6px;
    padding: 18px 16px;
    background: #FAF2D5;
    border: 2px dashed rgba(0, 65, 29, 0.30);
    border-radius: 12px;
    cursor: pointer;
    font-family: "Host Grotesk", sans-serif;
    font-size: 14px;
    color: #032019;
    transition: all 200ms ease-in-out;
}
.eco-form input[type="file"]::file-selector-button,
.wpcf7 input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 8px 16px;
    background: #032019;
    color: #FFFFFF;
    border: 0;
    border-radius: 50px;
    font-family: "Host Grotesk", sans-serif;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 200ms ease-in-out;
}
.eco-form input[type="file"]:hover::file-selector-button,
.wpcf7 input[type="file"]:hover::file-selector-button {
    background: #56F09F;
    color: #032019;
}
.eco-form input[type="file"]:hover,
.wpcf7 input[type="file"]:hover {
    border-color: #56F09F;
    background: rgba(86, 240, 159, 0.08);
}

/* ============================================================
   Checkbox group (es. "Come hai conosciuto Ecolwaste?")
   ============================================================ */
.eco-form .wpcf7-checkbox,
.wpcf7 .wpcf7-checkbox {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px 16px;
    margin-top: 8px;
}
.eco-form .wpcf7-checkbox .wpcf7-list-item,
.wpcf7 .wpcf7-checkbox .wpcf7-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 12px;
    background: rgba(3, 32, 25, 0.03);
    border-radius: 8px;
    transition: background 200ms ease-in-out;
}
.eco-form .wpcf7-checkbox .wpcf7-list-item:hover,
.wpcf7 .wpcf7-checkbox .wpcf7-list-item:hover {
    background: rgba(86, 240, 159, 0.10);
}
.eco-form .wpcf7-checkbox input[type="checkbox"],
.wpcf7 .wpcf7-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #00411D;
    cursor: pointer;
    flex-shrink: 0;
}
.eco-form .wpcf7-checkbox .wpcf7-list-item-label,
.wpcf7 .wpcf7-checkbox .wpcf7-list-item-label {
    font-size: 14px;
    line-height: 1.4;
    color: #032019;
    cursor: pointer;
}

/* ============================================================
   Acceptance (privacy checkbox singolo) — diverso dal checkbox group
   ============================================================ */
.eco-form .eco-form-privacy,
.eco-form .wpcf7-acceptance,
.wpcf7 .wpcf7-acceptance {
    margin: 8px 0;
}
.eco-form .eco-form-privacy {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(3, 32, 25, 0.04);
    border-left: 3px solid #56F09F;
    border-radius: 0 8px 8px 0;
    font-size: 13px;
    line-height: 1.5;
    color: #032019;
}
.eco-form .eco-form-privacy .wpcf7-list-item,
.wpcf7 .wpcf7-acceptance .wpcf7-list-item {
    margin: 0;
    display: inline;
}
.eco-form .eco-form-privacy input[type="checkbox"],
.wpcf7 .wpcf7-acceptance input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #00411D;
    cursor: pointer;
    margin-top: 1px;
    flex-shrink: 0;
}
.eco-form .eco-form-privacy a,
.wpcf7 .wpcf7-acceptance a {
    color: #00411D;
    font-weight: 700;
    text-decoration: underline;
}
.eco-form .eco-form-privacy a:hover,
.wpcf7 .wpcf7-acceptance a:hover {
    color: #56F09F;
}

/* ============================================================
   Submit button — brand
   ============================================================ */
.eco-form input[type="submit"],
.eco-form button[type="submit"],
.wpcf7 input[type="submit"],
.wpcf7-submit {
    display: inline-block;
    margin-top: 12px;
    padding: 14px 36px;
    background: #032019;
    color: #FFFFFF;
    border: 1.5px solid #032019;
    border-radius: 50px;
    font-family: "Host Grotesk", sans-serif;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 220ms ease-in-out;
    -webkit-appearance: none;
       -moz-appearance: none;
            appearance: none;
    box-shadow: 0 4px 12px rgba(3, 32, 25, 0.15);
}
.eco-form input[type="submit"]:hover,
.eco-form button[type="submit"]:hover,
.wpcf7 input[type="submit"]:hover,
.wpcf7-submit:hover {
    background: #56F09F;
    color: #032019;
    border-color: #56F09F;
    box-shadow: 0 6px 18px rgba(86, 240, 159, 0.35);
    transform: translateY(-1px);
}
.eco-form input[type="submit"]:active,
.wpcf7-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(3, 32, 25, 0.15);
}
.eco-form input[type="submit"]:focus-visible,
.wpcf7-submit:focus-visible {
    outline: 3px solid rgba(86, 240, 159, 0.45);
    outline-offset: 3px;
}

/* Loading spinner CF7 — colora brand */
.wpcf7-spinner {
    background-color: #56F09F !important;
}

/* ============================================================
   Validation states (errori / successo)
   ============================================================ */
.wpcf7-not-valid-tip {
    display: block;
    margin-top: 6px;
    color: #C62828;
    font-size: 12px;
    font-weight: 600;
}
.eco-form .wpcf7-not-valid,
.wpcf7 .wpcf7-not-valid {
    border-color: #C62828 !important;
    background: rgba(198, 40, 40, 0.04);
}

.wpcf7-response-output {
    margin: 16px 0 0 !important;
    padding: 14px 18px !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    font-family: "Host Grotesk", sans-serif !important;
    border: 0 !important;
}
.wpcf7 form.sent .wpcf7-response-output {
    background: rgba(46, 125, 50, 0.10) !important;
    color: #1B5E20 !important;
    border-left: 4px solid #2E7D32 !important;
}
.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.failed .wpcf7-response-output {
    background: rgba(198, 40, 40, 0.08) !important;
    color: #B71C1C !important;
    border-left: 4px solid #C62828 !important;
}
.wpcf7 form.spam .wpcf7-response-output {
    background: rgba(237, 108, 2, 0.10) !important;
    color: #BF360C !important;
    border-left: 4px solid #ED6C02 !important;
}
