/*
 * External App Form Validation Styles
 * Estilos globais para validação de formulários na app externa
 */

/* ===========================
   FORM GROUP ERROR STATES
   =========================== */

.form-group.has-error {
    margin-bottom: 15px;
}

/* Input, Select, Textarea - Error State */
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
    border: 2px solid #dc3545 !important;
    background-color: #fff5f5 !important;
    color: #721c24;
}

.form-group.has-error input::placeholder,
.form-group.has-error textarea::placeholder {
    color: #dc3545;
    opacity: 0.7;
}

/* Focus State for Error Fields */
.form-group.has-error input:focus,
.form-group.has-error select:focus,
.form-group.has-error textarea:focus {
    border-color: #c82333 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
    outline: none;
}

/* Label Color for Error */
.form-group.has-error label.control-label {
    color: #dc3545;
    font-weight: 500;
}

.form-group.has-error label.required {
    color: #dc3545;
}

/* Help Text for Errors */
.form-group.has-error .help-block {
    color: #dc3545;
    font-weight: 500;
    margin-top: 5px;
    font-size: 0.875rem;
    display: block;
}

.form-group.has-error .help-block i {
    margin-right: 5px;
}

/* Success State (optional - can be added later) */
.form-group.has-success input,
.form-group.has-success select,
.form-group.has-success textarea {
    border: 2px solid #28a745 !important;
}

.form-group.has-success input:focus,
.form-group.has-success select:focus,
.form-group.has-success textarea:focus {
    border-color: #1e7e34 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

/* ===========================
   FORM FIELD HIGHLIGHTING
   =========================== */

/* Add left border to error fields */
.form-group.has-error {
    border-left: 4px solid #dc3545;
    padding-left: 10px;
}

/* ===========================
   RESPONSIVE ADJUSTMENTS
   =========================== */

@media (max-width: 768px) {
    .form-group.has-error input,
    .form-group.has-error select,
    .form-group.has-error textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .form-group.has-error .help-block {
        font-size: 0.8rem;
    }
}

/* ===========================
   ACCESSIBILITY
   =========================== */

/* Better visibility for screen readers */
.form-group.has-error input[aria-invalid="true"],
.form-group.has-error select[aria-invalid="true"],
.form-group.has-error textarea[aria-invalid="true"] {
    border-color: #dc3545 !important;
}

/* Support for Bootstrap classes */
.form-group.has-error .form-control {
    border-color: #dc3545 !important;
}

.form-group.has-error .form-control:focus {
    border-color: #c82333 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

/* ===========================
   INLINE ERRORS
   =========================== */

.errorlist {
    list-style: none;
    padding: 0;
    margin: 5px 0;
}

.errorlist li {
    color: #dc3545;
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 3px;
}

.errorlist li:before {
    content: "✗ ";
    margin-right: 5px;
}

/* ===========================
   NON-FIELD ERRORS
   =========================== */

.non-field-errors,
.non_field_errors {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.non-field-errors h4,
.non_field_errors h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #721c24;
}

/* ===========================
   FORM VALIDATION ANIMATIONS
   =========================== */

.form-group.has-error {
    animation: pulse-error 0.3s ease-in-out;
}

@keyframes pulse-error {
    0% {
        background-color: rgba(220, 53, 69, 0.05);
    }
    50% {
        background-color: rgba(220, 53, 69, 0.1);
    }
    100% {
        background-color: transparent;
    }
}

