/* Form validation styles */
.is-invalid {
    border-color: #dc3545 !important;
    padding-right: calc(1.5em + 0.75rem) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right calc(0.375em + 0.1875rem) center !important;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem) !important;
}

.invalid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
}

.is-invalid ~ .invalid-feedback {
    display: block;
}

.alert {
    position: relative;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.ajax-response {
    margin-bottom: 1rem;
}

/* Custom styles for radio buttons and checkboxes */
input[type="radio"].is-invalid + .radio-btn,
input[type="checkbox"].is-invalid + .radio-btn {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

/* Make sure error messages are visible for radio groups */
.col-xxl-12 .invalid-feedback,
.col-xxl-6 .invalid-feedback {
    margin-top: 10px;
    margin-bottom: 15px;
    font-weight: bold;
    color: #dc3545;
    padding: 10px 15px;
    background-color: rgba(220, 53, 69, 0.2);
    border-left: 5px solid #dc3545;
    border-radius: 0 4px 4px 0;
    display: none; /* Hide by default, will be shown via JS */
}

/* Add a red border around the radio group container when invalid */
.col-xxl-12:has(input[type="radio"].is-invalid),
.col-xxl-6:has(input[type="radio"].is-invalid) {
    padding-bottom: 15px;
    border: 2px dashed #dc3545;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    background-color: rgba(220, 53, 69, 0.08);
}

/* Add a green indicator when a radio option is selected */
input[type="radio"]:checked + .radio-btn {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

/* Add a green indicator when a checkbox is checked */
input[type="checkbox"]:checked + .radio-btn {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

/* Highlight error animation */
.highlight-error {
    animation: pulse-error 1.5s ease-in-out;
}

@keyframes pulse-error {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}