.grad-form-field-wrapper.has-error input,
.grad-form-field-wrapper.has-error textarea {
    border-color: #dc3545;
    outline: none;
}

.grad-form-field-wrapper {
    position: relative;
}

.contact-form {
    position: relative;
}

.grad-api-error {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
}

.grad-form-error {
    width: 100%;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -100%);
    background-color: #dc3545;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    line-height: 1.3;
    z-index: 1000;
    margin-top: -8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Flèche du tooltip */
.grad-form-error::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #dc3545;
}

.grad-form-field-wrapper.has-error input:focus ~ .grad-form-error,
.grad-form-field-wrapper.has-error textarea:focus ~ .grad-form-error {
    opacity: 1;
    visibility: visible;
}

.grad-form-field-wrapper.radio-field.has-error .grad-form-error {
    opacity: 1;
    visibility: visible;
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin-top: 8px;
    margin-bottom: 0;
}

.grad-form-field-wrapper.radio-field .grad-form-error::after {
    display: none;
}

.grad-form-field-wrapper.has-error label {
    color: #dc3545;
}

.grad-form-field-wrapper.has-error input[type="checkbox"] {
    border-color: #dc3545;
    outline: 2px solid #dc3545;
    outline-offset: 1px;
}

.grad-form-field-wrapper.has-error .grad-form-error {
    opacity: 1;
    visibility: visible;
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin-top: 8px;
    margin-bottom: 0;
}

.grad-form-field-wrapper.has-error .grad-form-error::after {
    display: none;
}

/* Messages de formulaire */
.grad-form-message {
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 4px;
    font-weight: 500;
}

.grad-form-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.grad-form-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Gestion du débordement des tooltips */
@media (max-width: 768px) {
    .grad-form-error {
        white-space: normal;
        max-width: 90vw;
        text-align: center;
    }
}

.grad-submit-button {
    display: flex;
    align-items: center;
}

.grad-submit-button.loading {
    opacity: 0.75;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.grad-submit-button.loading::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-top-color: transparent;
    margin-right: 10px;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); } 
}