/**
 * UMK Form Validation Styles
 * Stili per validazione e messaggi errori form
 */

/* ===================================
   FORM GROUP & ERROR CONTAINER
   =================================== */
.form-group,
.input-with-error,
.checkbox-input {
    position: relative;
    margin-bottom: 0;
}

/* ===================================
   MESSAGGIO DI ERRORE
   =================================== */
.form-group .error,
.input-with-error .error,
.checkbox-input .error {
    position: absolute;
    padding: 0.5rem 1rem;
    text-align: center;
    color: #fff;
    background: #dc3545;
    font-family: 'Arial', sans-serif;
    letter-spacing: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 14px;
    font-weight: 500;
    line-height: normal;
    z-index: 100;
    width: fit-content;
    border-radius: 0;
    /* box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4); */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    bottom: -2.5rem;
    left: 0;
    white-space: nowrap;
}

/* Posizionamento alternativo per checkbox */
.checkbox-input .error {
    bottom: auto;
    top: 100%;
    left: -1rem;
    margin-top: 0.5rem;
}

/* ===================================
   ERRORE VISIBILE
   =================================== */
.form-group.show-error .error,
.input-with-error.show-error .error,
.checkbox-input.show-error .error {
    opacity: 1;
    visibility: visible;
    animation-duration: 0.5s;
    animation-fill-mode: both;
    animation-name: pulse;
    animation-timing-function: ease-in-out;
}

/* ===================================
   ICONA ERRORE SVG
   =================================== */
.form-group .error svg,
.input-with-error .error svg,
.checkbox-input .error svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* ===================================
   FRECCIA TOOLTIP ERRORE
   =================================== */
.form-group .error:before,
.input-with-error .error:before {
    content: '';
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 7px solid #dc3545;
    position: absolute;
    top: -6px;
    left: 1rem;
}

.checkbox-input .error:before {
    content: '';
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 7px solid #dc3545;
    border-top: none;
    position: absolute;
    bottom: auto;
    top: -6px;
    left: 1rem;
}

/* ===================================
   ANIMAZIONE PULSE
   =================================== */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* ===================================
   BORDO ERRORE SU INPUT
   =================================== */
.form-group.show-error input,
.form-group.show-error textarea,
.form-group.show-error select,
.input-with-error.show-error input,
.input-with-error.show-error textarea,
.input-with-error.show-error select {
    /* border-color: #dc3545 !important; */
    box-shadow: inset 0 0 0 1px #dc3545 !important;
}

/* ===================================
   CUSTOM SELECT ERRORS
   =================================== */
/* .group-fake-select,
.input-with-sel {
    position: relative;
}

.fake-input {
    cursor: pointer;
}

.card-sel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 5px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.card-sel.active {
    max-height: 300px;
    opacity: 1;
    visibility: visible;
    overflow-y: auto;
}

.item-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.item-option:last-child {
    border-bottom: none;
}

.item-option:hover {
    background-color: #f8f9fa;
} */

/* ===================================
   MESSAGE CONTAINER (SUCCESS/ERROR)
   =================================== */
.message-contact {
    position: fixed;
    bottom: 3rem;
    right: -100%;
    background: #ffffff;
    color: #000000;
    padding: 1.5rem;
    font-family: 'Archivo';
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transition: right 0.5s ease;
    min-width: 300px;
    max-width: 400px;
    clip-path: polygon(1em 0, 100% 0, 100% calc(100% - 1em), calc(100% - 1em) 100%, 0 100%, 0 1em);
}

.message-contact.error {
    background: #dc3545;
    color: #fff;
}

.message-contact.show-message {
    right: 3rem;
}



.message-contact .message-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.message-contact .message-content svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 0.1rem;
}

.message-contact .message-content span {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
}

/* ===================================
   LOADING STATE BUTTON
   =================================== */
.send-button.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.send-button.loading:after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 768px) {
    .form-group .error,
    .input-with-error .error,
    .checkbox-input .error {
        font-size: 13px;
        padding: 0.4rem 0.8rem;
        left: 0;
        right: 0;
        white-space: normal;
    }

    .message-contact {
        min-width: auto;
        max-width: calc(100% - 2rem);
        bottom:1rem;
        transform:translateY(100%);
        transition: transform 0.5s ease;
    }

    .message-contact.show-message {
        left: 1rem;
        transform:translateY(0%);
        right:inherit;
    }
    
    .message-contact.close-message {
        
       transform:translateY(150%);
        
    }

    
}

/* ===================================
   PRINT (nasconde messaggi)
   =================================== */
@media print {
    .error,
    .message-contact {
        display: none !important;
    }
}
