
/**
 * Profile Builder Material Design Integration
 * CSS specifico per trasformare i form di Profile Builder in Material Design
 */

/* ========================================
   PROFILE BUILDER FIELD WRAPPER
   ======================================== */
.wppb-form-field {
    position: relative;
    margin-bottom: 32px !important;
}

/* Nasconde asterisco di default */
.wppb-form-field .wppb-required {
    display: none;
}

/* Aggiungi asterisco custom alla label */
.wppb-form-field.wppb-required-field > label::after {
    content: ' *';
    color: #dc3545;
    font-weight: normal;
}

/* ========================================
   INPUT FIELDS RESET
   ======================================== */
.wppb-form-field input[type="text"],
.wppb-form-field input[type="password"],
.wppb-form-field input[type="email"],
.wppb-form-field input[type="tel"],
.wppb-form-field input[type="url"],
.wppb-form-field input[type="number"],
.wppb-form-field select,
.wppb-form-field textarea {
    width: 100% !important;
    padding: 20px 0 8px 0 !important;
    border: none !important;
    border-bottom: 2px solid #ddd !important;
    border-radius: 0 !important;
    background: transparent !important;
    font-size: 16px !important;
    color: #2c2c2c !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-family: 'Poppins', sans-serif !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Placeholder invisibile per :placeholder-shown */
.wppb-form-field input::-webkit-input-placeholder,
.wppb-form-field textarea::-webkit-input-placeholder {
    color: transparent;
}

.wppb-form-field input::-moz-placeholder,
.wppb-form-field textarea::-moz-placeholder {
    color: transparent;
}

.wppb-form-field input:-ms-input-placeholder,
.wppb-form-field textarea:-ms-input-placeholder {
    color: transparent;
}

.wppb-form-field input::placeholder,
.wppb-form-field textarea::placeholder {
    color: transparent;
}

/* ========================================
   FLOATING LABELS
   ======================================== */
.wppb-form-field > label {
    position: absolute !important;
    top: 20px !important;
    left: 0 !important;
    font-size: 16px !important;
    color: #6c757d !important;
    pointer-events: none !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-weight: 400 !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    z-index: 1 !important;
    transform-origin: left top !important;
}

/* Label quando input ha focus o valore */
.wppb-form-field input:focus ~ label,
.wppb-form-field input:not(:placeholder-shown) ~ label,
.wppb-form-field select:focus ~ label,
.wppb-form-field select:valid ~ label,
.wppb-form-field textarea:focus ~ label,
.wppb-form-field textarea:not(:placeholder-shown) ~ label,
.wppb-form-field.has-value > label,
.wppb-form-field.focused > label {
    top: 0 !important;
    font-size: 12px !important;
    color: #AD1736 !important;
    transform: translateY(0) !important;
}

/* Focus state per input */
.wppb-form-field input:focus,
.wppb-form-field select:focus,
.wppb-form-field textarea:focus {
    border-bottom-color: #AD1736 !important;
}

/* ========================================
   SELECT DROPDOWN
   ======================================== */
.wppb-form-field select {
    cursor: pointer;
    padding-right: 30px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 5px center !important;
    background-size: 12px !important;
}

/* ========================================
   CHECKBOX & RADIO
   ======================================== */
.wppb-form-field input[type="checkbox"],
.wppb-form-field input[type="radio"] {
    width: auto !important;
    margin-right: 8px !important;
    position: relative !important;
    top: 2px !important;
}

/* Label per checkbox/radio non floating */
.wppb-form-field input[type="checkbox"] ~ label,
.wppb-form-field input[type="radio"] ~ label {
    position: static !important;
    font-size: 14px !important;
    color: #2c2c2c !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    top: auto !important;
}

/* Remember me styling */
#wppb-form-element-remember-me {
    margin-top: 20px;
    margin-bottom: 20px;
}

#wppb-form-element-remember-me label {
    position: static !important;
    display: inline-block !important;
    margin-left: 8px !important;
    font-size: 14px !important;
    color: #6c757d !important;
    cursor: pointer !important;
}

/* ========================================
   SUBMIT BUTTON
   ======================================== */
#wppb-submit,
.wppb-form-field input[type="submit"],
.form-submit input[type="submit"] {
    width: 100% !important;
    padding: 16px 32px !important;
    background: #AD1736 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 30px !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    margin-top: 24px !important;
    font-family: 'Poppins', sans-serif !important;
    position: relative !important;
    overflow: hidden !important;
    box-shadow: 0 2px 5px rgba(173, 23, 54, 0.2) !important;
}

#wppb-submit:hover,
.wppb-form-field input[type="submit"]:hover {
    background: #8a122b !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 15px rgba(173, 23, 54, 0.3) !important;
}

#wppb-submit:active,
.wppb-form-field input[type="submit"]:active {
    transform: translateY(0) !important;
}

/* ========================================
   ERROR & SUCCESS STATES
   ======================================== */
.wppb-form-field.error input,
.wppb-form-field input.error {
    border-bottom-color: #dc3545 !important;
}

.wppb-form-field.error label {
    color: #dc3545 !important;
}

.wppb-form-field.valid input,
.wppb-form-field input.valid {
    border-bottom-color: #28a745 !important;
}

/* Error messages */
.wppb-error,
.wppb-error-message,
ul.wppb-error-list {
    background: rgba(220, 53, 69, 0.1) !important;
    border: none !important;
    border-left: 4px solid #dc3545 !important;
    padding: 12px 16px !important;
    margin: 0 0 20px 0 !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    color: #dc3545 !important;
    list-style: none !important;
    animation: shake 0.5s ease !important;
}

.wppb-error li {
    margin: 0 !important;
    padding: 0 !important;
}

/* Success messages */
.wppb-success,
.wppb-success-message {
    background: rgba(40, 167, 69, 0.1) !important;
    border: none !important;
    border-left: 4px solid #28a745 !important;
    padding: 12px 16px !important;
    margin: 0 0 20px 0 !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    color: #28a745 !important;
}

/* ========================================
   PROFILE BUILDER SPECIFIC ELEMENTS
   ======================================== */
/* Descrizioni campi */
.wppb-description-delimiter {
    display: none;
}

.wppb-field-description {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
    display: block;
}

/* Upload avatar */
.wppb-avatar-wrap {
    margin-top: 20px;
}

.wppb-avatar-wrap input[type="file"] {
    border: none !important;
    padding: 10px 0 !important;
}

/* ========================================
   LOGIN FORM SPECIFIC
   ======================================== */
#wppb-login-wrap p {
    margin-top: 20px;
    text-align: center;
}

#wppb-login-wrap p a {
    color: #AD1736;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

#wppb-login-wrap p a:hover {
    text-decoration: underline;
}
 
/* ========================================
   REGISTER FORM SPECIFIC
   ======================================== */
/* Agreement checkboxes */
.wppb-form-field.wppb-agreement-checkbox {
    margin-top: 24px;
}

.wppb-form-field.wppb-agreement-checkbox label {
    position: static !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    color: #6c757d !important;
}

.wppb-form-field.wppb-agreement-checkbox a {
    color: #AD1736;
    text-decoration: underline;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */
@media (max-width: 768px) {
    .wppb-form-field {
        margin-bottom: 24px !important;
    }
    
    .wppb-form-field > label {
        font-size: 15px !important;
    }
    
    .wppb-form-field input:focus ~ label,
    .wppb-form-field.has-value > label {
        font-size: 11px !important;
    }
}

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

/* ========================================
   UTILITIES
   ======================================== */
/* Hide unwanted elements */
.wppb-form-field.wppb-send-credentials-checkbox {
    display: none; /* Nascondi se non necessario */
}

/* Fix per label che non devono essere floating */
.wppb-form-field.wppb-recaptcha-element label,
.wppb-form-field.wppb-html label {
    position: static !important;
}

/* Loader personalizzato */
.wppb-loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(173, 23, 54, 0.2);
    border-radius: 50%;
    border-top-color: #AD1736;
    animation: spin 1s ease-in-out infinite;
}

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