/**
 * Estilos para la validación en tiempo real del formulario de registro
 */

/* Estilos para campos con error */
.field._error {
    position: relative;
}

.field._error .control input,
.field._error .control select,
.field._error .control textarea {
    border-color: #e02b27;
    background-color: #fff1f0;
    box-shadow: 0 0 3px rgba(224, 43, 39, 0.3);
}

.field._error .control input:focus,
.field._error .control select:focus,
.field._error .control textarea:focus {
    border-color: #e02b27;
    box-shadow: 0 0 5px rgba(224, 43, 39, 0.5);
    outline: none;
}

/* Estilos para campos válidos */
.field._success .control input,
.field._success .control select,
.field._success .control textarea {
    border-color: #32a843;
    background-color: #f0fff4;
}

.field._success .control input:focus,
.field._success .control select:focus,
.field._success .control textarea:focus {
    border-color: #32a843;
    box-shadow: 0 0 3px rgba(50, 168, 67, 0.3);
}

/* Mensajes de error */
.field-error {
    display: block;
    font-size: 12px;
    line-height: 1.36;
    margin-top: 2px;
    color: #e02b27;
    font-weight: 400;
    animation: fadeIn 0.3s ease-in;
}

.field-error.mage-error {
    color: #e02b27;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

/* Asegurar posición relativa para el control */
.field .control {
    position: relative;
}

/* Mensajes generales del formulario */
.custom-message {
    margin-bottom: 20px;
    animation: slideDown 0.5s ease-out;
}

.custom-message .message-error {
    background-color: #fcf8e3;
    border: 1px solid #fbeed5;
    border-left-color: #e02b27;
    border-left-width: 5px;
    padding: 10px 15px;
    color: #c09853;
}

.custom-message .message-success {
    background-color: #dff0d8;
    border: 1px solid #d6e9c6;
    border-left-color: #32a843;
    border-left-width: 5px;
    padding: 10px 15px;
    color: #468847;
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estilos específicos para el indicador de fuerza de contraseña */
.field.password .control {
    margin-bottom: 5px;
}

.password-strength-meter {
    margin-top: 5px;
    font-size: 12px;
}

/* Mejoras para campos específicos */
.field.confirmation._error .control input {
    border-color: #e02b27;
    background-color: #fff1f0;
}

.field.email._error .control input {
    border-color: #e02b27;
    background-color: #fff1f0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .field-error {
        font-size: 11px;
    }
}

/* Transiciones suaves */
.field .control input,
.field .control select,
.field .control textarea {
    transition: border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Estados de hover */
.field:hover .control input:not(:focus),
.field:hover .control select:not(:focus),
.field:hover .control textarea:not(:focus) {
    border-color: #ccc;
}

.field._error:hover .control input:not(:focus) {
    border-color: #e02b27;
}

.field._success:hover .control input:not(:focus) {
    border-color: #32a843;
}

/* Estilos para botón de envío cuando hay errores */
form.has-errors .actions-toolbar .primary button {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Loading state para el botón */
form.validating .actions-toolbar .primary button {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

form.validating .actions-toolbar .primary button::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

form.validating .actions-toolbar .primary button span {
    opacity: 0.5;
}

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