/**
 * Athena Form Validation - Enhanced form validation indicators
 * Shows required fields and validation states
 */

/* Required Field Indicators */
.form-group.required .form-label::after,
.col-md-4.required .form-label::after,
.col-md-6.required .form-label::after,
.mb-3.required .form-label::after {
    content: " *";
    color: var(--bs-danger);
    font-weight: 600;
    margin-left: 2px;
}

/* Required field highlighting */
.form-control.required,
.form-select.required {
    border-left: 3px solid var(--bs-warning);
    background-image: linear-gradient(45deg, transparent 40%, rgba(255, 171, 0, 0.1) 50%, transparent 60%);
    background-size: 20px 20px;
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* Validation States - Override Bootstrap valid styles */
.form-control.is-valid,
.form-select.is-valid {
    border-color: var(--bs-border-color) !important;
    border-left: 1px solid var(--bs-border-color) !important;
    background-image: none !important;
    box-shadow: none !important;
}

.form-control.is-valid:focus,
.form-select.is-valid:focus {
    border-color: var(--bs-primary) !important;
    box-shadow: 0 0 0 0.15rem rgba(17, 19, 24, 0.15) !important;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-left: 3px solid var(--bs-danger);
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23ff3e1d' d='M7.364 6l3.536-3.536L9.536 1 6 4.536 2.464 1 1 2.464 4.536 6 1 9.536 2.464 11 6 7.464 9.536 11 11 9.536z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

/* Valid feedback */
.valid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--bs-success);
    font-weight: 500;
}

.valid-feedback i {
    margin-right: 4px;
}

/* Invalid feedback */
.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--bs-danger);
    font-weight: 500;
}

.invalid-feedback i {
    margin-right: 4px;
}

/* Field status icons */
.field-status-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 5;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.field-status-icon.show {
    opacity: 1;
}

.field-status-icon.valid {
    color: var(--bs-success);
}

.field-status-icon.invalid {
    color: var(--bs-danger);
}

.field-status-icon.required {
    color: var(--bs-warning);
}

/* Form group positioning */
.form-group {
    position: relative;
}

.col-md-4,
.col-md-6,
.mb-3 {
    position: relative;
}

/* Floating labels enhancement */
.form-floating.required .form-label::after {
    content: " *";
    color: var(--bs-danger);
    font-weight: 600;
}

/* Focus states */
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.15rem rgba(17, 19, 24, 0.15);
    border-color: var(--bs-primary);
}

.form-control.required:focus {
    box-shadow: 0 0 0 0.15rem rgba(255, 171, 0, 0.25);
    border-left-color: var(--bs-warning);
}

/* No special styling for valid inputs */

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 0.15rem rgba(255, 62, 29, 0.25);
    border-color: var(--bs-danger);
}

/* Form validation summary */
.form-validation-summary {
    background: linear-gradient(135deg, rgba(255, 171, 0, 0.1) 0%, rgba(255, 171, 0, 0.05) 100%);
    border: 1px solid var(--bs-warning);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    display: none;
}

.form-validation-summary.show {
    display: block;
}

.form-validation-summary-title {
    color: var(--bs-warning);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-validation-summary-list {
    margin: 0;
    padding-left: 20px;
    color: var(--bs-body-color);
    font-size: 13px;
}

.form-validation-summary-list li {
    margin-bottom: 4px;
}

/* Field groups */
.field-group {
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.5);
}

.field-group-title {
    font-weight: 600;
    color: var(--bs-heading-color);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--bs-border-color);
    font-size: 14px;
}

/* Progress indicator for form completion */
.form-progress {
    background: var(--bs-light);
    height: 4px;
    border-radius: 2px;
    margin-bottom: 20px;
    overflow: hidden;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.form-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--bs-warning) 0%, var(--bs-success) 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .form-control.required,
    .form-select.required {
        background-size: 16px 16px;
        background-position: right 8px center;
    }

    .field-status-icon {
        right: 8px;
        font-size: 14px;
    }

    .form-validation-summary {
        padding: 12px;
    }

    .field-group {
        padding: 12px;
    }
}

/* Checkbox and radio validation */
.form-check-input.is-invalid {
    border-color: var(--bs-danger);
}

/* No special styling for valid checkboxes */

/* Date inputs special styling */
input[type="date"].required {
    position: relative;
}

input[type="date"].required:not(:valid) {
    color: var(--bs-secondary-color);
}

/* Switch styling for validation */
.form-check-switch .form-check-input:focus {
    box-shadow: 0 0 0 0.15rem rgba(17, 19, 24, 0.15);
}

/* Animated placeholder text */
.form-control::placeholder {
    color: var(--bs-secondary-color);
    transition: color 0.3s ease;
}

.form-control:focus::placeholder {
    color: transparent;
}

/* Loading state for form submission */
.form-submitting .form-control,
.form-submitting .form-select {
    opacity: 0.7;
    pointer-events: none;
}

.form-submitting .btn {
    opacity: 0.7;
}

/* Form field animations */
.form-control,
.form-select {
    transition: all 0.3s ease;
}

.form-control:hover:not(:focus),
.form-select:hover:not(:focus) {
    border-color: var(--bs-primary);
}

/* Success state enhancements - removed animation */

.form-control.is-invalid,
.form-select.is-invalid {
    animation: invalidShake 0.6s ease-out;
}


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

/* Loading state for submit buttons */
.btn.athena-btn-loading {
    opacity: 0.85;
    cursor: not-allowed;
}