/* Form Components - Enhanced validation (Bootstrap handles basic validation) */

/* Enhanced feedback styling */
.invalid-feedback.d-block {
    display: block !important;
}

/* Enhanced error styling */
.invalid-feedback {
    font-weight: 500;
}

.invalid-feedback:before {
    content: "⚠ ";
}

/* Form validation states for different field types */
.form-floating .form-control.is-invalid,
.form-floating .form-select.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.form-floating .form-control.is-valid,
.form-floating .form-select.is-valid {
    border-color: #198754;
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
}

/* Input group validation styling */
.input-group .form-control.is-invalid,
.input-group .form-select.is-invalid {
    border-color: #dc3545;
    box-shadow: none;
}

.input-group .form-control.is-valid,
.input-group .form-select.is-valid {
    border-color: #198754;
    box-shadow: none;
}

.input-group .form-control.is-invalid:focus,
.input-group .form-select.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.input-group .form-control.is-valid:focus,
.input-group .form-select.is-valid:focus {
    border-color: #198754;
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
}

/* Form floating labels */
.form-floating {
    position: relative;
}

.form-floating > .form-control,
.form-floating > .form-select {
    height: calc(3.5rem + 2px);
    line-height: 1.25;
    padding: 1rem 0.75rem;
}

.form-floating > label {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    padding: 1rem 0.75rem;
    pointer-events: none;
    border: 1px solid transparent;
    transform-origin: 0 0;
    transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
}

.form-floating > .form-control::placeholder {
    color: transparent;
}

.form-floating > .form-control:focus,
.form-floating > .form-control:not(:placeholder-shown) {
    padding-top: 1.625rem;
    padding-bottom: 0.625rem;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    opacity: 0.65;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

/* Custom form styling */
.auth-card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.auth-card .card-header {
    border-radius: 0.5rem 0.5rem 0 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

.auth-card .card-footer {
    border-radius: 0 0 0.5rem 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.125);
    background-color: rgba(0, 0, 0, 0.03);
}

/* Form group spacing */
.form-group {
    margin-bottom: 1rem;
}

/* Input group styling */
.input-group > .form-control,
.input-group > .form-select {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}

.input-group > .form-control:focus,
.input-group > .form-select:focus {
    z-index: 3;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    text-align: center;
    white-space: nowrap;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
}

/* Password strength indicator */
.password-strength {
    margin-top: 0.5rem;
}

.strength-bar {
    height: 4px;
    background-color: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
}

.strength-bar-fill {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 2px;
}

.strength-weak { background-color: #dc3545; }
.strength-fair { background-color: #ffc107; }
.strength-good { background-color: #20c997; }
.strength-strong { background-color: #198754; }

/* Password match indicator */
.match-indicator {
    font-size: 0.875rem;
    font-weight: 500;
}

.match-indicator.match {
    color: #198754;
}

.match-indicator.no-match {
    color: #dc3545;
}

.match-indicator:before {
    margin-right: 0.25rem;
}

.match-indicator.match:before {
    content: "✓";
}

.match-indicator.no-match:before {
    content: "✗";
}

/* Form validation animations */
.form-control.is-invalid,
.form-select.is-invalid,
.form-check-input.is-invalid {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* Focus states for validation */
.form-control.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.form-control.is-valid:focus {
    border-color: #198754;
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
}

.form-select.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.form-select.is-valid:focus {
    border-color: #198754;
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
}

/* Checkbox and radio validation styling */
.form-check-input.is-invalid:checked {
    background-color: #dc3545;
    border-color: #dc3545;
}

.form-check-input.is-valid:checked {
    background-color: #198754;
    border-color: #198754;
}

/* Required field indicator */
.form-label.required:after,
label.required:after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

/* Form validation summary */
.validation-summary {
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #dc3545;
    border-radius: 0.375rem;
    background-color: #f8d7da;
    color: #721c24;
}

.validation-summary h6 {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.validation-summary ul {
    margin-bottom: 0;
    padding-left: 1.25rem;
}

.validation-summary li {
    margin-bottom: 0.25rem;
}

/* Responsive form adjustments */
@media (max-width: 576px) {
    .form-floating > .form-control,
    .form-floating > .form-select {
        height: calc(3rem + 2px);
        padding: 0.75rem;
    }
    
    .form-floating > label {
        padding: 0.75rem;
    }
    
    .form-floating > .form-control:focus,
    .form-floating > .form-control:not(:placeholder-shown) {
        padding-top: 1.25rem;
        padding-bottom: 0.5rem;
    }
    
    .invalid-feedback {
        font-size: 0.8125rem;
    }
    
    .validation-summary {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
}