/* ========================================
   SISTEMA DE VALIDACIÓN VISUAL DE FORMULARIOS
   ======================================== */

/* Estados base de los campos */
.form-control,
.form-select,
.form-check-input {
    transition: all 0.3s ease;
    border-width: 2px;
}

/* Campo vacío/pendiente - ROJO */
.form-control.empty,
.form-select.empty,
.form-control:invalid,
.form-control.is-invalid {
    border-color: #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.05) !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15) !important;
}

.form-control.empty:focus,
.form-select.empty:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

/* Campo completo/válido - VERDE */
.form-control.complete,
.form-select.complete,
.form-control:valid,
.form-control.is-valid {
    border-color: #28a745 !important;
    background-color: rgba(40, 167, 69, 0.05) !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.15) !important;
}

.form-control.complete:focus,
.form-select.complete:focus {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

/* Campo con error - ROJO INTENSO */
.form-control.error,
.form-select.error {
    border-color: #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.1) !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.3) !important;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Indicadores visuales en las etiquetas */
.form-label {
    position: relative;
    transition: color 0.3s ease;
}

.form-label.empty {
    color: #dc3545 !important;
}

.form-label.complete {
    color: #28a745 !important;
}

.form-label.error {
    color: #dc3545 !important;
    font-weight: 600;
}

/* Iconos de estado */
.form-label::after {
    content: '';
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.form-label.empty::after {
    content: '⚠';
    background-color: #dc3545;
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    right: -25px;
}

.form-label.complete::after {
    content: '✓';
    background-color: #28a745;
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    right: -25px;
}

.form-label.error::after {
    content: '✗';
    background-color: #dc3545;
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    right: -25px;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.1); }
    100% { transform: translateY(-50%) scale(1); }
}

/* Mensajes de validación */
.validation-message {
    font-size: 0.875rem;
    margin-top: 0.25rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.validation-message.empty {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border-left: 4px solid #dc3545;
}

.validation-message.complete {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
    border-left: 4px solid #28a745;
}

.validation-message.error {
    background-color: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    border-left: 4px solid #dc3545;
    animation: fadeIn 0.3s ease;
}

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

/* Contador de campos - DESHABILITADO */
.form-progress {
    display: none !important;
}

.form-progress h6 {
    display: none !important;
}

.progress-bar {
    height: 8px;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-bar.bg-success {
    background-color: #28a745 !important;
}

.progress-bar.bg-warning {
    background-color: #ffc107 !important;
}

.progress-bar.bg-danger {
    background-color: #dc3545 !important;
}

/* Botones de envío */
.btn-submit {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-submit.validating {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
}

.btn-submit.validating::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Campos requeridos */
.form-label.required::before {
    content: '* ';
    color: #dc3545;
    font-weight: bold;
}

/* Responsive */
@media (max-width: 768px) {
    .form-label::after {
        right: -15px;
        width: 14px;
        height: 14px;
        font-size: 8px;
    }
    
    .form-label.empty::after,
    .form-label.complete::after,
    .form-label.error::after {
        right: -18px;
    }
}

/* Animaciones suaves */
.form-group {
    transition: all 0.3s ease;
}

.form-group.highlight {
    background-color: rgba(63, 169, 245, 0.05);
    padding: 0.5rem;
    border-radius: 0.375rem;
    border-left: 3px solid #3fa9f5;
}

/* Estados especiales para campos de solo lectura */
.form-control[readonly] {
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

.form-control[readonly].complete {
    background-color: rgba(40, 167, 69, 0.1);
    border-color: #28a745;
}

/* Mejoras para campos de fecha y tiempo */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    position: relative;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

input[type="date"]:focus::-webkit-calendar-picker-indicator,
input[type="time"]:focus::-webkit-calendar-picker-indicator,
input[type="datetime-local"]:focus::-webkit-calendar-picker-indicator {
    opacity: 1;
}
