

/* ========== MEMBER ID VALIDATION STYLES ========== */

/* Form group container */
.form-group {
  position: relative;
  margin-bottom: 1.5rem;
}

/* Member ID input field */
#member_id {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: 2px solid #ddd;
  border-radius: 4px;
  transition: all 0.3s ease;
  font-family: 'Courier New', monospace; /* Monospace for ID display */
  letter-spacing: 0.5px;
}

#member_id:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

/* Validation state: Valid */
#member_id.valid {
  border-color: #28a745;
  background-color: #f0fdf4;
  padding-right: 40px; /* Make room for checkmark */
}

/* Validation state: Invalid */
#member_id.invalid {
  border-color: #dc3545;
  background-color: #fef2f2;
  padding-right: 40px; /* Make room for error icon */
}

/* Optional: Add icons for valid/invalid states */
#member_id.valid {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2328a745' viewBox='0 0 16 16'%3E%3Cpath d='M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
}

#member_id.invalid {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23dc3545' viewBox='0 0 16 16'%3E%3Cpath d='M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
}

/* Validation feedback message */
#member-id-feedback {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  min-height: 20px;
  display: none;
  padding: 0.5rem;
  border-radius: 4px;
  transition: all 0.3s ease;
}

#member-id-feedback.success {
  color: #155724;
  background-color: #d4edda;
  border-left: 4px solid #28a745;
  display: block;
  animation: slideIn 0.3s ease;
}

#member-id-feedback.error {
  color: #721c24;
  background-color: #f8d7da;
  border-left: 4px solid #dc3545;
  display: block;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Help text styling */
.help-text {
  margin-top: 0.5rem;
}

.help-text small {
  color: #6c757d;
  font-size: 0.875rem;
  display: block;
  line-height: 1.4;
}

/* Loading state (optional - for API validation) */
#member_id.validating {
  border-color: #ffc107;
  background-color: #fffbf0;
}

#member_id.validating::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid #ffc107;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: translateY(-50%) rotate(360deg); }
}

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

@media (max-width: 768px) {
  #member_id {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 14px;
  }
  
  #member-id-feedback {
    font-size: 0.8125rem;
  }
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
  #member_id.valid {
    border-width: 3px;
  }
  
  #member_id.invalid {
    border-width: 3px;
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  #member_id,
  #member-id-feedback {
    transition: none;
  }
  
  @keyframes slideIn {
    from, to {
      opacity: 1;
      transform: none;
    }
  }
}
