/**
 * Stili CSS per il plugin RZ Contact Form
 *
 * Definisce lo stile del modulo di contatto e dei suoi elementi,
 * inclusi gli stati di successo ed errore e gli elementi interattivi.
 *
 * @since 1.0.0
 */

:root {
    /* Colori principali */
    --rz-primary-bg: #ffffff80;
    --rz-text-color: #000000;
    --rz-accent-color: linear-gradient(121deg, rgba(0, 0, 0, 1) 0%, rgba(0, 62, 116, 1) 35%, rgba(223, 0, 98, 1) 100%);
    --rz-white: #ffffff;
    --rz-black: #000000;
    
    /* Dimensioni e spaziature */
    --rz-border-radius-large: 40px;
    --rz-border-radius-medium: 20px;
    --rz-border-radius-small: 3px;
    --rz-border-radius-circle: 100px;
    --rz-padding-large: 30px 55px;
    --rz-padding-medium: 15px;
    --rz-padding-small: 5px;
    --rz-margin-large: 0px auto 0px auto;
    --rz-margin-medium: 15px;
    --rz-margin-small: 10px;
    --rz-gap-large: 35px;
    --rz-gap-small: 10px;
    
    /* Tipografia */
    --rz-font-family: 'Montserrat' !important;
    --rz-font-size-xlarge: 40px;
    --rz-font-size-large: 30px;
    --rz-font-size-medium: 20px;
    --rz-font-size-normal: 16px;
    --rz-font-size-small: 14px;
    --rz-font-weight-black: 800;
    --rz-font-weight-bold: 600;
    
    /* Notifiche */
    --rz-success-bg: #008a2c;
    --rz-success-color: #ffffff;
    --rz-error-bg: #d3004e;
    --rz-error-color: #ffffff;
}

/* Stile del container principale del form */
.rz-contact-form-container {
    min-width: 470px;
    max-width: 1000px;
    margin: var(--rz-margin-large);
    padding: var(--rz-padding-large);
    border: 0px solid #ddd;
    border-radius: var(--rz-border-radius-large);
    background: var(--rz-primary-bg);
    font-family: var(--rz-font-family) !important;
    overflow: hidden;
    transition: all 0.5s ease;
    position: relative;
    max-height: 115px;
}

.rz-contact-form-title {
    min-height: 60px;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: space-around;
    justify-content: center;
    align-items: center;
    position: relative;
}

.rz-contact-form-title-text {
    display: flex;
    font-size: var(--rz-font-size-xlarge);
    font-weight: var(--rz-font-weight-black);
    color: var(--rz-white);
    text-transform: uppercase;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: center;
    justify-content: space-between;
    align-items: center;
    flex-grow: 1;
    opacity: 0;
    order: 0;
    transition: all 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
}

.rz-contact-form-title-text.active {
    opacity: 1 !important;
    order: 1 !important;
    z-index: 1 !important;
}

.icon-container {
    background-color: var(--rz-white);
    padding: var(--rz-padding-small);
    border-radius: var(--rz-border-radius-circle);
    font-size: var(--rz-font-size-large);
    min-width: 50px;
    min-height: 50px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: center;
    justify-content: flex-end;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.icon-container:hover {
    min-width: 130px;
}

.icon-container i {
    color: var(--rz-white);
    background: var(--rz-accent-color);
    width: 40px;
    border-radius: var(--rz-border-radius-circle);
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
    align-items: center;
}

.form-input-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: center;
    justify-content: space-between;
    gap: var(--rz-gap-large);
}

.active {
    display: flex !important;
}

/* Stile dei gruppi di form (etichetta + campo) */
.my-custom-form {
    margin-top: 25px;
    transform: translateY(150%);
    transition: all 0.5s ease;
}

.my-custom-form.form-active {
    display: block !important;
    transform: translateY(0%);
}

.form-group {
    margin-bottom: 25px;
    flex-grow: 1;
}

.privacy-checkbox {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--rz-gap-small);
    align-content: center;
    justify-content: flex-start;
    align-items: center;
}

/* Stile delle etichette dei campi */
.form-group label {
    display: flex;
    margin: 0px 0px 10px 20px;
    font-weight: var(--rz-font-weight-bold);
    font-family: var(--rz-font-family) !important;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: center;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
}

/* Stile dei campi di input e textarea */
.form-group input, 
.form-group textarea {
    width: 100%;
    padding: var(--rz-padding-medium);
    border: 0px solid #ddd;
    border-radius: var(--rz-border-radius-medium);
    font-family: var(--rz-font-family) !important;
    resize: vertical;
}

/* Personalizzazione checkbox per farlo apparire come radio */
.privacy-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--rz-black);
    border-radius: 50%;
    outline: none;
    cursor: pointer;
    position: relative;
    padding: 2px;
    background-color: var(--rz-white);
    aspect-ratio: 1 / 1;
}

.privacy-checkbox input[type="checkbox"]:checked {
    border-color: var(--rz-black);
}

.privacy-checkbox input[type="checkbox"]:checked::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--rz-black);
}

.privacy-checkbox label {
    margin: 0px;
    font-family: var(--rz-font-family) !important;
}

/* Stile del contenitore per i messaggi di feedback */
.form-feedback {
    border-radius: var(--rz-border-radius-small);
    display: none;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
    flex-direction: column;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 70px 25px;
    align-items: center;
    align-content: center;
    transform: scale(0);
    transition-duration: 0.5s;
    transition-delay: 1s;
}

/* Stile del messaggio di successo */
.close-message {
    position: absolute;
    top: 20px;
    right: 20px;
    cursor: pointer;
    color: var(--rz-white);
    background: var(--rz-accent-color);
    width: 40px;
    border-radius: var(--rz-border-radius-circle);
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
    align-items: center;
    font-size: var(--rz-font-size-large);
}

.form-feedback.success {
    display: flex !important;
    background-color: #ffffff00;
    transform: scale(1);
    transition-delay: 1s;
}

.success-message {
    font-size: 65px;
    font-weight: var(--rz-font-weight-black);
    text-transform: uppercase;
    text-align: center;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
    align-items: center;
}

.success-message.submessage {
    font-size: 20px;    
    font-weight: var(--rz-font-weight-bold);
    color: var(--rz-white);
}

.success-message.welcome-message {
    font-size: 55px;
    color: #D2004F;
    margin-top: 50px;
}

/* Stile del messaggio di errore */
.form-feedback.error:not(:empty) {
    display: block !important;
    height: auto;
    transform: scale(1);
    padding: 5px;
    margin-bottom: 0px;
    margin-top: 0px;
    border-radius: 5px;
    background-color: #d3004e;
    color: #ffffff;
    font-weight: var(--rz-font-weight-bold);
    font-size: var(--rz-font-size-normal);
    text-align: left;
    animation: errorPulse 1.5s ease;
    top: calc(100% - 45px);
    margin-left: 55px;
    text-transform: uppercase;
    width: auto;
}

/* Stile dell'indicatore di caricamento */
.loader {
    text-align: center;
    color: #666;
    margin: var(--rz-margin-small) 0;
}

/* Stile del pulsante di invio */
.submit-btn {
    background-color: var(--rz-white);
    color: var(--rz-black);
    padding: 5px 5px 5px 30px;
    border: none;
    border-radius: var(--rz-border-radius-circle);
    cursor: pointer;
    margin-left: auto;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: center;
    justify-content: space-between;
    align-items: center;
    font-size: var(--rz-font-size-medium);
    text-transform: uppercase;
    font-weight: var(--rz-font-weight-black);
    gap: 22px;
}

.submit-btn i {
    color: var(--rz-white);
    background: var(--rz-accent-color);
    width: 40px;
    border-radius: var(--rz-border-radius-circle);
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
    align-items: center;
    font-size: var(--rz-font-size-large);
    transition: all 0.3s ease;
}

/* Stile del pulsante al passaggio del mouse */
.submit-btn:hover i {
    transform: rotate(30deg);
}

/* Animazione shake per il pulsante quando ci sono errori */
.submit-btn.shake {
    animation: shakeButton 0.5s ease-in-out;
}

@keyframes shakeButton {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Stile del pulsante disabilitato */
.submit-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* Stili di retrocompatibilità per le notifiche */
.notice {
    padding: var(--rz-padding-small);
    margin-bottom: var(--rz-margin-medium);
    border-radius: var(--rz-border-radius-medium);
}

/* Stile di successo retrocompatibile */
.notice.success {
    background-color: var(--rz-success-bg);
    color: var(--rz-success-color);
}

/* Stile di errore retrocompatibile */
.notice.error {
    background-color: var(--rz-error-bg);
    color: var(--rz-error-color);
}

.form-group input.error,
.form-group textarea.error {
    border: 3px solid #ffffff;
    background-color: rgb(202 200 255 / 53%);
    box-shadow: 0 0 10px var(--rz-error-color);
}

.privacy-checkbox input[type="checkbox"].error {
    border: 3px solid var(--rz-error-color);
    box-shadow: 0 0 8px var(--rz-error-color);
    background-color: rgba(255, 200, 200, 0.5);
}

.form-group .error-message {
    color: var(--rz-error-color);
    font-size: var(--rz-font-size-small);
    font-weight: var(--rz-font-weight-bold);
    display: none;
}

.form-group .error-message.visible {
    display: block;
    animation: errorShake 0.5s ease-in-out;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

@keyframes errorPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Responsive Tablet Portrait */
@media (max-width: 991px) {
    .rz-contact-form-container {
        min-width: 600px;
        max-width: 100%;
    }

    .rz-contact-form-title-text {
        font-size: 25px;
    }

    .submit-btn {
        width: auto;
    }
}

/* Responsive Smartphone Landscape */
@media (max-width: 767px) {
    .rz-contact-form-container {
        min-width: 300px;
        max-width: 100%;
        padding: 15px;
        border-radius: 25px;
    }

    .my-custom-form {
        margin-top: 0px;
    }

    .rz-contact-form-title {
        min-height: 85px;
    }

    .rz-contact-form-title-text {
        font-size: 18px;
        filter: drop-shadow(1px 1px 0px black);
    }

    .icon-container {
        min-width: 0px;
        min-height: 0px;
        font-size: 20px;
        padding: 3px;
    }

    .icon-container:hover {
        min-width: 0px;
    }

    .icon-container i {
        width: 30px;
    }

    .form-input-row {
        flex-wrap: nowrap;
        gap: 10px;
    }

    .form-group {
        margin-bottom: 10px;
    }

    /* Stile delle etichette dei campi */
    .form-group label {
        margin: 0px 0px 10px 0px;
    }

    .form-group input::placeholder {
        font-size: 0px;
    }

    .privacy-checkbox {
        flex-wrap: nowrap;
    }

    .privacy-checkbox label {
        margin: 0px 0px 0px 0px;
    }

    .submit-btn {
        width: 100%;
    }

    /* Stile dei campi di input e textarea */
    .form-group input,
    .form-group textarea {
        padding: 10px;
        border-radius: 15px;
    }

    /* Stile del contenitore per i messaggi di feedback */
    .form-feedback {
        flex-wrap: nowrap;
        justify-content: center;
    }

    .success-message {
        font-size: 35px;
    }

    .success-message.submessage {
        font-size: 18px;
    }

    .success-message.welcome-message {
        font-size: 30px;
    }

    /* Stile del messaggio di errore */
    .form-feedback.error:not(:empty) {
        top: calc(0% + 0px);
        margin-left: 0px;
        border-radius: 0px;
        width: 100%;
        font-size: 13px;
        text-align: center;
    }
}