/**
 * WebAG reCAPTCHA v3 Styling
 * 
 * @package WebAG
 * @version 1.0.0
 */

/* Messaggi di successo e errore */
.webag-message {
    padding: 15px;
    margin: 10px 0;
    border-radius: 4px;
    font-weight: 500;
    position: relative;
    animation: slideDown 0.3s ease-out;
}

.webag-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.webag-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.webag-error ul {
    margin: 0;
    padding-left: 20px;
}

.webag-error li {
    margin: 5px 0;
}

/* Animazione per i messaggi */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stile per il pulsante di invio in loading */
.webag-form input[type="submit"].loading,
.webag-form button[type="submit"].loading {
    position: relative;
    opacity: 0.7;
    cursor: not-allowed;
}

.webag-form input[type="submit"].loading .spinner,
.webag-form button[type="submit"].loading .spinner {
    display: inline-block;
    margin-left: 8px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Stile per form disabilitato */
.webag-form.disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* Stile per campi con errore */
.webag-form .field-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Stile per il campo reCAPTCHA nascosto */
.webag-form input[name="recaptcha_token"] {
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .webag-message {
        padding: 12px;
        font-size: 14px;
    }
    
    .webag-error ul {
        padding-left: 15px;
    }
}

/* Stile per debug (solo se abilitato) */
.webag-debug {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
    font-family: monospace;
    font-size: 12px;
    color: #6c757d;
}

.webag-debug pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Stile per il widget reCAPTCHA (se visibile) */
.g-recaptcha {
    margin: 10px 0;
}

/* Stile per i form WebAG */
form[data-webag-form="true"] {
    position: relative;
}

/* Miglioramenti per l'accessibilità */
.webag-message:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Stile per i messaggi di errore specifici */
.webag-form .recaptcha-error {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
    display: block;
}

/* Stile per il loading overlay (opzionale) */
.webag-form.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 1000;
    pointer-events: none;
}

/* Stile per i pulsanti di invio */
.webag-form input[type="submit"],
.webag-form button[type="submit"] {
    transition: all 0.3s ease;
}

.webag-form input[type="submit"]:hover:not(.loading),
.webag-form button[type="submit"]:hover:not(.loading) {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Stile per i campi del form */
.webag-form input,
.webag-form textarea,
.webag-form select {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.webag-form input:focus,
.webag-form textarea:focus,
.webag-form select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 0.2rem rgba(0, 124, 186, 0.25);
}
