/* Form control valid/invalid state styling */
.form-control.is-valid {
    border-color: #198754;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    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");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Ensure feedback messages display properly */
.valid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #198754;
}

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

/* Updated selectors to ensure feedback messages show up */
.was-validated .form-control:valid ~ .valid-feedback,
.was-validated .form-select:valid ~ .valid-feedback,
.form-control.is-valid ~ .valid-feedback,
.form-select.is-valid ~ .valid-feedback,
.was-validated .form-control:invalid ~ .invalid-feedback,
.was-validated .form-select:invalid ~ .invalid-feedback,
.form-control.is-invalid ~ .invalid-feedback,
.form-select.is-invalid ~ .invalid-feedback {
    display: block;
}

/* Explicit selectors for our form structure */
.form-group:has(.form-control.is-valid) .valid-feedback {
    display: block;
}

.form-group:has(.form-control.is-invalid) .invalid-feedback {
    display: block;
}

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

.strength-meter-bar {
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    display: flex;
}

.meter-segment {
    height: 100%;
    width: 25%;
    border-radius: 4px;
    margin-right: 2px;
}

.meter-segment:last-child {
    margin-right: 0;
}

.strength-meter-bar[data-strength="1"] .segment-1 {
    background-color: #dc3545; /* Very Weak - Red */
}

.strength-meter-bar[data-strength="2"] .segment-1,
.strength-meter-bar[data-strength="2"] .segment-2 {
    background-color: #ffc107; /* Weak - Yellow */
}

.strength-meter-bar[data-strength="3"] .segment-1,
.strength-meter-bar[data-strength="3"] .segment-2,
.strength-meter-bar[data-strength="3"] .segment-3 {
    background-color: #6c757d; /* Medium - Gray */
}

.strength-meter-bar[data-strength="4"] .segment-1,
.strength-meter-bar[data-strength="4"] .segment-2,
.strength-meter-bar[data-strength="4"] .segment-3,
.strength-meter-bar[data-strength="4"] .segment-4 {
    background-color: #198754; /* Strong - Green */
}

.strength-text {
    font-size: 0.8rem;
    color: #6c757d;
}

.strength-value {
    font-weight: 600;
}

.strength-meter-bar[data-strength="1"] ~ .strength-text .strength-value {
    color: #dc3545;
}

.strength-meter-bar[data-strength="2"] ~ .strength-text .strength-value {
    color: #ffc107;
}

.strength-meter-bar[data-strength="3"] ~ .strength-text .strength-value {
    color: #6c757d;
}

.strength-meter-bar[data-strength="4"] ~ .strength-text .strength-value {
    color: #198754;
}

/* Password requirements list */
.password-requirements {
    margin-top: 1rem;
    border-radius: 5px;
    font-size: 0.85rem;
}

.requirements-list {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

.requirement {
    margin-bottom: 0.3rem;
    color: #6c757d;
    transition: color 0.3s ease;
}

.requirement i {
    margin-right: 0.5rem;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.requirement i.bi-x-circle {
    color: #dc3545;
}

.requirement i.bi-check-circle-fill {
    color: #198754;
}

.requirement.valid {
    color: #198754;
}

/* Submit button styles */
#submit-button {
    transition: all 0.3s ease;
    min-width: 180px;
}

#submit-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Animation for validation feedback */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.invalid-feedback,
.valid-feedback {
    animation: fadeIn 0.3s ease-out;
}

/* Error shake animation */
@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.form-control.is-invalid.shake {
    animation: shakeError 0.5s ease-in-out;
}
.border-required {
    border-left: 3px solid #dc3545 !important;
}

.border-required:focus {
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.border-required.is-valid {
    border-left: 3px solid #198754 !important;
}

/* Validation status messages */
.validation-status {
    transition: all 0.3s ease;
}

.invalid-form-message,
.valid-form-message {
    animation: fadeIn 0.3s ease;
    border-left: 5px solid;
}

.invalid-form-message {
    border-left-color: #dc3545;
}

.valid-form-message {
    border-left-color: #198754;
}

/* Validation icon highlight */
label .text-danger {
    font-size: 0.9em;
    animation: pulse 2s infinite;
}

/* Required field label styling */
label.font-weight-bold {
    position: relative;
}

/* Animation for field attention */
@keyframes fieldAttention {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
    50% { box-shadow: 0 0 0 5px rgba(220, 53, 69, 0.25); }
}

.field-attention {
    animation: fieldAttention 1s ease;
}

/* Pulse animation for required indicators */
@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* Better appearance for the disabled submit button */
button[type="submit"].btn-secondary {
    cursor: pointer !important;
    opacity: 0.9;
    position: relative;
    overflow: hidden;
}

button[type="submit"].btn-secondary:after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shine 2s infinite;
}

@keyframes shine {
    100% {
        left: 100%;
    }
}

/* Help text styling */
.form-text.text-muted {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.form-text.text-muted:hover {
    opacity: 1;
}

/* Styles for tooltips */
.tooltip {
    font-size: 0.9rem;
}

.tooltip-inner {
    max-width: 300px;
    padding: 0.5rem 0.75rem;
    background-color: #3D3D3D;
    border-radius: 0.25rem;
}

/* Improved error feedback placement */
.invalid-feedback {
    font-weight: 500;
    margin-top: 0.35rem;
}

/* Extra help for form instructions */
.alert-info {
    background-color: #f8f9fa;
    border-color: #e3f2fd;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.alert-info i {
    color: #17a2b8;
}